From 7a1b29f5a540bc9b70b1a2443b9802d08d67b4cf Mon Sep 17 00:00:00 2001 From: malaterre Date: Tue, 11 Jan 2005 00:37:41 +0000 Subject: [PATCH] ENH: Adding a new method on TS: IsTransferSyntax. Where you pass in a string and it return if this is a valid Transfer Syntax. So far gdcm is broken since 1.2.840.113619.5.2 is not handled --- Testing/TestTS.cxx | 37 +++++++++++++++++++++++++++++++++++-- src/gdcmTS.cxx | 14 ++++++++++++-- src/gdcmTS.h | 5 +++-- 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/Testing/TestTS.cxx b/Testing/TestTS.cxx index 2d6b428d..70a5190d 100644 --- a/Testing/TestTS.cxx +++ b/Testing/TestTS.cxx @@ -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; } diff --git a/src/gdcmTS.cxx b/src/gdcmTS.cxx index 0c64dcb4..af3bf7b0 100644 --- a/src/gdcmTS.cxx +++ b/src/gdcmTS.cxx @@ -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 diff --git a/src/gdcmTS.h b/src/gdcmTS.h index 94336b51..a4e82fe4 100644 --- a/src/gdcmTS.h +++ b/src/gdcmTS.h @@ -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; -- 2.48.1