From 3f244b54d3cff8a8ccbb2f8586ba992618075b41 Mon Sep 17 00:00:00 2001 From: jpr Date: Thu, 8 Jun 2006 13:37:33 +0000 Subject: [PATCH] Add some comments about pixel spacing --- src/gdcmFile.cxx | 34 ++++++++++++++++++++++++++++++++-- src/gdcmTS.cxx | 31 ++++++++++++++++++++++++++++--- src/gdcmTS.h | 17 ++++++++++++----- 3 files changed, 72 insertions(+), 10 deletions(-) diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index accb2b3f..9c55ec89 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmFile.cxx,v $ Language: C++ - Date: $Date: 2006/05/31 16:11:51 $ - Version: $Revision: 1.320 $ + Date: $Date: 2006/06/08 13:37:33 $ + Version: $Revision: 1.321 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -508,6 +508,36 @@ float File::GetXSpacing() { float xspacing = 1.0; uint32_t nbValue; + +/* +It *SHOULD* first find the IOD and then deduce which tags to read +Eg: Cross section this is in Pixel Spacing (0028,0030) +CR is in Imager Pixel Spacing (0018,1164) +US is in Pixel Ratio (0028,0034) +RT is in : +(3002,0011) Image Plane Pixel Spacing +(3002,0012) RT Image Position +and +(3004,000c) for deducing Z spacing +*/ + + +// std::string SOPClassUID = GetEntryString(0x0008,0x0016); + + /// \todo check the various SOP Class + /// to get the Pixel Spacing at the proper location + + + // Ultrasound Image Storage (Retired) +/* + if (Util::DicomStringEqual( SOPClassUID,"1.2.840.10008.5.1.4.1.1.6") + { + - check if SOPClassUID contains 2 parts (e.g. "4\3") + - guess how to deduce the spacing (FOV ?, ??) + } + else + // go on with old method ... +*/ // To follow David Clunie's advice, we first check ImagerPixelSpacing diff --git a/src/gdcmTS.cxx b/src/gdcmTS.cxx index bc2b6c2f..d10f6630 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/12/09 12:23:39 $ - Version: $Revision: 1.53 $ + Date: $Date: 2006/06/08 13:37:33 $ + Version: $Revision: 1.54 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -78,6 +78,11 @@ static const char *SpecialStrings[] = { "1.2.840.10008.1.2.5", // MPEG2 Main Profile @ Main Level "1.2.840.10008.1.2.4.100", + + // The following are *not* t.s. but SOP uid + // Ultrasound Image Storage (Retired) + "1.2.840.10008.5.1.4.1.1.6", + // Unknown "Unknown Transfer Syntax", // Pretty sure we never use this case... NULL // Compilers have no obligation to finish by NULL, do it ourself @@ -92,6 +97,7 @@ void FillDefaultTSDict(TSHT &ts); // Constructor / Destructor TS::TS() { + std::string filename = DictSet::BuildDictPath() + DICT_TS; std::ifstream from(filename.c_str()); if ( !from ) @@ -115,6 +121,7 @@ TS::TS() TsMap[key] = name; } } + from.close(); } } @@ -311,6 +318,24 @@ bool TS::IsMPEG(TSKey const &key) return r; } +/** + * \brief Determines if the SOP id corresponds to any form + * of UltrasoundImageStorage_Retired. + * @return True when Ultrasound Image Storage Retired. False otherwise. + */ +bool TS::IsUltrasoundImageStorage_Retired(TSKey const &key) +{ + bool r = false; + // First check this is an actual SOP id + if ( IsTransferSyntax(key) ) + { + if ( key == SpecialStrings[UltrasoundImageStorage_Retired] ) + { + r = true; + } + } + return r; +} /** * \brief GetSpecialTransferSyntax ?? * @param key TSKey const &key ?? @@ -333,7 +358,7 @@ TS::SpecialType TS::GetSpecialTransferSyntax(TSKey const &key) * @param t SpecialType t ?? * @return char* TS : SpecialStrings[t] ??. */ -const char* TS::GetSpecialTransferSyntax(SpecialType t) +const char *TS::GetSpecialTransferSyntax(SpecialType t) { return SpecialStrings[t]; } diff --git a/src/gdcmTS.h b/src/gdcmTS.h index e5398dd9..773a8ff6 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/11/29 17:11:52 $ - Version: $Revision: 1.27 $ + Date: $Date: 2006/06/08 13:37:33 $ + Version: $Revision: 1.28 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -61,7 +61,11 @@ public: JPEG2000Lossless, JPEG2000, RLELossless, - MPEG2MainProfile, + MPEG2MainProfile, + +// The following are *not* Transfer Syntaxes, but SOP uid + UltrasoundImageStorage_Retired, + UnknownTS }; @@ -82,11 +86,14 @@ public: bool IsJPEG(TSKey const &key); bool IsJPEGLS(TSKey const &key); bool IsMPEG(TSKey const &key); - + // This should be deprecated very soon SpecialType GetSpecialTransferSyntax(TSKey const &key); const char* GetSpecialTransferSyntax(SpecialType t); - + + // The following are *not* Transfer Syntaxes. + bool IsUltrasoundImageStorage_Retired(TSKey const &key); + protected: TS(); ~TS(); -- 2.48.1