]> Creatis software - gdcm.git/commitdiff
ENH: Adding a new method on TS: IsTransferSyntax. Where you pass in a string and...
authormalaterre <malaterre>
Tue, 11 Jan 2005 00:37:41 +0000 (00:37 +0000)
committermalaterre <malaterre>
Tue, 11 Jan 2005 00:37:41 +0000 (00:37 +0000)
Testing/TestTS.cxx
src/gdcmTS.cxx
src/gdcmTS.h

index 2d6b428dd257b36d0c9f536c1c6396e560619662..70a5190dbacec1fcb0e83dac357990a01bb1cfdc 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestTS.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/11/16 04:28:20 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2005/01/11 00:37:41 $
+  Version:   $Revision: 1.4 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -23,5 +23,38 @@ int TestTS(int , char *[])
    // There should be 150 entries
    ts.Print( std::cout );
 
+   // Implicit VR Little Endian
+   std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2" ) << std::endl;
+   // Implicit VR Big Endian DLX (G.E Private)
+   std::cout << ts.IsTransferSyntax( "1.2.840.113619.5.2" ) << std::endl;
+   // Explicit VR Little Endian
+   std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.1" ) << std::endl;
+   // Deflated Explicit VR Little Endian
+   std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.1.99" ) << std::endl;
+   // Explicit VR Big Endian
+   std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.2" ) << std::endl;
+   // JPEG Baseline (Process 1)
+   std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.50" ) << std::endl;
+   // JPEG Extended (Process 2 & 4)
+   std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.51" ) << std::endl;
+   // JPEG Extended (Process 3 & 5)
+   std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.52" ) << std::endl;
+   // JPEG Spectral Selection, Non-Hierarchical (Process 6 & 8)
+   std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.53" ) << std::endl;
+   // JPEG Full Progression, Non-Hierarchical (Process 10 & 12)
+   std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.55" ) << std::endl;
+   // JPEG Lossless, Non-Hierarchical (Process 14)
+   std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.57" ) << std::endl;
+   // JPEG Lossless, Hierarchical, First-Order Prediction (Process 14, [Selection Value 1])
+   std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.70" ) << std::endl;
+   // JPEG 2000 Lossless
+   std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.90" ) << std::endl;
+   // JPEG 2000
+   std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.91" ) << std::endl;
+   // RLE Lossless
+   std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.5" ) << std::endl;
+   // Unknown
+   std::cout << ts.IsTransferSyntax( "Unknown Transfer Syntax" ) << std::endl;
+
    return ts.GetValue( "" ) != gdcm::GDCM_UNFOUND;
 }
index 0c64dcb4cef624a5b795376d4ca9f457c969baad..af3bf7b0417e718bc9e41fe98bbd8ce46f14eee8 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmTS.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/07 22:03:30 $
-  Version:   $Revision: 1.33 $
+  Date:      $Date: 2005/01/11 00:37:41 $
+  Version:   $Revision: 1.34 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -106,6 +106,16 @@ TSAtr const & TS::GetValue(TSKey const &key)
    return it->second;
 }
 
+bool TS::IsTransferSyntax(TSKey const &key)
+{
+   for (TSHT::const_iterator it = TsMap.begin(); it != TsMap.end(); ++it)
+   {
+      if( it->first == key ) return true;
+   }
+
+  return false;
+}
+
 //-----------------------------------------------------------------------------
 // Protected
 
index 94336b510a4878e98d2a97d6fb5915190949cabe..a4e82fe418f561dd85a1f59c1fbe6e481c54e8f1 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmTS.h,v $
   Language:  C++
-  Date:      $Date: 2005/01/06 20:03:28 $
-  Version:   $Revision: 1.13 $
+  Date:      $Date: 2005/01/11 00:37:42 $
+  Version:   $Revision: 1.14 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -47,6 +47,7 @@ public:
 
    int Count(TSKey const &key);
    TSAtr const &GetValue(TSKey const &key);
+   bool IsTransferSyntax(TSKey const &key);
 
 private:
    TSHT TsMap;