From: regrain Date: Thu, 18 Sep 2003 09:32:15 +0000 (+0000) Subject: * "gdcm::Unfound" string changed to a constant variable (GDCM_UNFOUND) X-Git-Tag: Version0.3.1~165 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=d44cb38c3275dc302d9b523c17d346810f0e6644;hp=0a6fbcbd58d5e186b183316d8d10d1f07ac0f6cb;p=gdcm.git * "gdcm::Unfound" string changed to a constant variable (GDCM_UNFOUND) located in the gdcmCommon.h file. All use of reference of tha has been changed to now use the variable GDCM_UNFOUND. -- BeNours --- diff --git a/ChangeLog b/ChangeLog index a6cc55a3..e96dc4a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,14 @@ +2003-09-16 Benoit Regrain + * "gdcm::Unfound" string changed to a constant variable (GDCM_UNFOUND) + located in the gdcmCommon.h file. All use of reference of tha has been + changed to now use the variable GDCM_UNFOUND. + 2003-09-16 Eric Boix with JPR * Cosmetic changes: - gdcmPython/testSuite.py adapted to the JPR updated Dicts/dicomV3.dic Dicom dictionary. The test suite can now be run again. Note: I'm note very happy with the " (RET)" changes. I believe this - RETAINED comment should be dropped when parsing the dictionary. + RETAINED comment should be dropped when parsing the dictionary. - PACKAGER corrected - DEVELOPPER added. - AUTHORS updated and now in alphabetical order diff --git a/src/gdcmCommon.h b/src/gdcmCommon.h index 131fceba..b3300d90 100644 --- a/src/gdcmCommon.h +++ b/src/gdcmCommon.h @@ -27,6 +27,8 @@ typedef int gint32; #include +const std::string GDCM_UNFOUND = "gdcm::Unfound"; + typedef std::string TagKey; typedef std::string TagName; diff --git a/src/gdcmElValSet.cxx b/src/gdcmElValSet.cxx index 38310a46..ae4de17b 100644 --- a/src/gdcmElValSet.cxx +++ b/src/gdcmElValSet.cxx @@ -152,7 +152,7 @@ gdcmElValue* gdcmElValSet::GetElementByName(string TagName) { string gdcmElValSet::GetElValueByNumber(guint16 group, guint16 element) { TagKey key = gdcmDictEntry::TranslateToKey(group, element); if ( ! tagHt.count(key)) - return "gdcm::Unfound"; + return GDCM_UNFOUND; return tagHt.find(key)->second->GetValue(); } @@ -163,7 +163,7 @@ string gdcmElValSet::GetElValueByNumber(guint16 group, guint16 element) { */ string gdcmElValSet::GetElValueByName(string TagName) { if ( ! NameHt.count(TagName)) - return "gdcm::Unfound"; + return GDCM_UNFOUND; return NameHt.find(TagName)->second->GetValue(); } diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index 58da7385..50eeeba7 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -64,7 +64,7 @@ void gdcmFile::SetPixelDataSizeFromHeader(void) { string str_nb; str_nb=gdcmHeader::GetPubElValByNumber(0x0028,0x0100); - if (str_nb == "gdcm::Unfound" ) { + if (str_nb == GDCM_UNFOUND ) { nb = 16; } else { nb = atoi(str_nb.c_str() ); @@ -127,7 +127,7 @@ bool gdcmFile::ParsePixelData(void) { int nb; string str_nb=gdcmHeader::GetPubElValByNumber(0x0028,0x0100); - if (str_nb == "gdcm::Unfound" ) { + if (str_nb == GDCM_UNFOUND ) { nb = 16; } else { nb = atoi(str_nb.c_str() ); @@ -252,7 +252,7 @@ bool gdcmFile::ReadPixelData(void* destination) { int nb; string str_nb=gdcmHeader::GetPubElValByNumber(0x0028,0x0100); - if (str_nb == "gdcm::Unfound" ) { + if (str_nb == GDCM_UNFOUND ) { nb = 16; } else { nb = atoi(str_nb.c_str() ); @@ -472,7 +472,7 @@ size_t gdcmFile::GetImageDataIntoVector (void* destination, size_t MaxSize) { // Nombre de Bits Alloues pour le stockage d'un Pixel str_nb = GetPubElValByNumber(0x0028,0x0100); - if (str_nb == "gdcm::Unfound" ) { + if (str_nb == GDCM_UNFOUND ) { nb = 16; } else { nb = atoi(str_nb.c_str() ); @@ -480,7 +480,7 @@ size_t gdcmFile::GetImageDataIntoVector (void* destination, size_t MaxSize) { // Nombre de Bits Utilises str_nbu=GetPubElValByNumber(0x0028,0x0101); - if (str_nbu == "gdcm::Unfound" ) { + if (str_nbu == GDCM_UNFOUND ) { nbu = nb; } else { nbu = atoi(str_nbu.c_str() ); @@ -488,7 +488,7 @@ size_t gdcmFile::GetImageDataIntoVector (void* destination, size_t MaxSize) { // Position du Bit de Poids Fort str_highBit=GetPubElValByNumber(0x0028,0x0102); - if (str_highBit == "gdcm::Unfound" ) { + if (str_highBit == GDCM_UNFOUND ) { highBit = nb - 1; } else { highBit = atoi(str_highBit.c_str() ); @@ -496,7 +496,7 @@ size_t gdcmFile::GetImageDataIntoVector (void* destination, size_t MaxSize) { // Signe des Pixels str_signe=GetPubElValByNumber(0x0028,0x0103); - if (str_signe == "gdcm::Unfound" ) { + if (str_signe == GDCM_UNFOUND ) { signe = 1; } else { signe = atoi(str_signe.c_str() ); diff --git a/src/gdcmHeader.cxx b/src/gdcmHeader.cxx index 30806b67..50d4800e 100644 --- a/src/gdcmHeader.cxx +++ b/src/gdcmHeader.cxx @@ -1,4 +1,4 @@ -// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.cxx,v 1.83 2003/09/11 11:12:59 jpr Exp $ +// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.cxx,v 1.84 2003/09/18 09:32:15 regrain Exp $ //This is needed when compiling in debug mode #ifdef _MSC_VER @@ -112,11 +112,11 @@ bool gdcmHeader::CloseFile(void) { * \brief Canonical destructor. */ gdcmHeader::~gdcmHeader (void) { - dicom_vr = (gdcmVR*)0; - Dicts = (gdcmDictSet*)0; - RefPubDict = (gdcmDict*)0; - RefShaDict = (gdcmDict*)0; - return; + dicom_vr = (gdcmVR*)0; + Dicts = (gdcmDictSet*)0; + RefPubDict = (gdcmDict*)0; + RefShaDict = (gdcmDict*)0; + return; } // Fourth semantics: @@ -1260,7 +1260,7 @@ size_t gdcmHeader::GetPixelOffset(void) { guint16 grPixel; guint16 numPixel; string ImageLocation = GetPubElValByName("Image Location"); - if ( ImageLocation == "gdcm::Unfound" ) { + if ( ImageLocation == GDCM_UNFOUND ) { grPixel = 0x7fe0; } else { grPixel = (guint16) atoi( ImageLocation.c_str() ); @@ -1343,7 +1343,7 @@ gdcmDictEntry * gdcmHeader::GetDictEntryByName(string Name) { * @param group Group of the researched tag. * @param element Element of the researched tag. * @return Corresponding element value when it exists, and the string - * "gdcm::Unfound" otherwise. + * GDCM_UNFOUND ("gdcm::Unfound") otherwise. */ string gdcmHeader::GetPubElValByNumber(guint16 group, guint16 element) { return PubElValSet.GetElValueByNumber(group, element); @@ -1361,12 +1361,12 @@ string gdcmHeader::GetPubElValByNumber(guint16 group, guint16 element) { * @param group Group of the researched tag. * @param element Element of the researched tag. * @return Corresponding element value representation when it exists, - * and the string "gdcm::Unfound" otherwise. + * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise. */ string gdcmHeader::GetPubElValRepByNumber(guint16 group, guint16 element) { gdcmElValue* elem = PubElValSet.GetElementByNumber(group, element); if ( !elem ) - return "gdcm::Unfound"; + return GDCM_UNFOUND; return elem->GetVR(); } @@ -1376,7 +1376,7 @@ string gdcmHeader::GetPubElValRepByNumber(guint16 group, guint16 element) { * a given tag. * @param TagName name of the researched element. * @return Corresponding element value when it exists, and the string - * "gdcm::Unfound" otherwise. + * GDCM_UNFOUND ("gdcm::Unfound") otherwise. */ string gdcmHeader::GetPubElValByName(string TagName) { return PubElValSet.GetElValueByName(TagName); @@ -1393,12 +1393,12 @@ string gdcmHeader::GetPubElValByName(string TagName) { * of semantics than just the native C++ type. * @param TagName name of the researched element. * @return Corresponding element value representation when it exists, - * and the string "gdcm::Unfound" otherwise. + * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise. */ string gdcmHeader::GetPubElValRepByName(string TagName) { gdcmElValue* elem = PubElValSet.GetElementByName(TagName); if ( !elem ) - return "gdcm::Unfound"; + return GDCM_UNFOUND; return elem->GetVR(); } @@ -1409,7 +1409,7 @@ string gdcmHeader::GetPubElValRepByName(string TagName) { * @param group Group of the researched tag. * @param element Element of the researched tag. * @return Corresponding element value representation when it exists, - * and the string "gdcm::Unfound" otherwise. + * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise. */ string gdcmHeader::GetShaElValByNumber(guint16 group, guint16 element) { return ShaElValSet.GetElValueByNumber(group, element); @@ -1427,12 +1427,12 @@ string gdcmHeader::GetShaElValByNumber(guint16 group, guint16 element) { * @param group Group of the researched tag. * @param element Element of the researched tag. * @return Corresponding element value representation when it exists, - * and the string "gdcm::Unfound" otherwise. + * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise. */ string gdcmHeader::GetShaElValRepByNumber(guint16 group, guint16 element) { gdcmElValue* elem = ShaElValSet.GetElementByNumber(group, element); if ( !elem ) - return "gdcm::Unfound"; + return GDCM_UNFOUND; return elem->GetVR(); } @@ -1442,7 +1442,7 @@ string gdcmHeader::GetShaElValRepByNumber(guint16 group, guint16 element) { * for an element value of given tag. * @param TagName name of the researched element. * @return Corresponding element value when it exists, and the string - * "gdcm::Unfound" otherwise. + * GDCM_UNFOUND ("gdcm::Unfound") otherwise. */ string gdcmHeader::GetShaElValByName(string TagName) { return ShaElValSet.GetElValueByName(TagName); @@ -1459,12 +1459,12 @@ string gdcmHeader::GetShaElValByName(string TagName) { * of semantics than just the native C++ type. * @param TagName name of the researched element. * @return Corresponding element value representation when it exists, - * and the string "gdcm::Unfound" otherwise. + * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise. */ string gdcmHeader::GetShaElValRepByName(string TagName) { gdcmElValue* elem = ShaElValSet.GetElementByName(TagName); if ( !elem ) - return "gdcm::Unfound"; + return GDCM_UNFOUND; return elem->GetVR(); } @@ -1476,7 +1476,7 @@ string gdcmHeader::GetShaElValRepByName(string TagName) { * @param group Group of the researched tag. * @param element Element of the researched tag. * @return Corresponding element value representation when it exists, - * and the string "gdcm::Unfound" otherwise. + * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise. */ string gdcmHeader::GetElValByNumber(guint16 group, guint16 element) { string pub = GetPubElValByNumber(group, element); @@ -1498,7 +1498,7 @@ string gdcmHeader::GetElValByNumber(guint16 group, guint16 element) { * @param group Group of the researched tag. * @param element Element of the researched tag. * @return Corresponding element value representation when it exists, - * and the string "gdcm::Unfound" otherwise. + * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise. */ string gdcmHeader::GetElValRepByNumber(guint16 group, guint16 element) { string pub = GetPubElValRepByNumber(group, element); @@ -1514,7 +1514,7 @@ string gdcmHeader::GetElValRepByNumber(guint16 group, guint16 element) { * for the element value of a given tag. * @param TagName name of the researched element. * @return Corresponding element value when it exists, - * and the string "gdcm::Unfound" otherwise. + * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise. */ string gdcmHeader::GetElValByName(string TagName) { string pub = GetPubElValByName(TagName); @@ -1535,7 +1535,7 @@ string gdcmHeader::GetElValByName(string TagName) { * of semantics than just the native C++ type. * @param TagName name of the researched element. * @return Corresponding element value representation when it exists, - * and the string "gdcm::Unfound" otherwise. + * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise. */ string gdcmHeader::GetElValRepByName(string TagName) { string pub = GetPubElValRepByName(TagName); @@ -1642,17 +1642,17 @@ void gdcmHeader::ParseHeader(bool exception_on_error) throw(gdcmFormatError) { * false otherwise. */ bool gdcmHeader::IsReadable(void) { - if ( GetElValByName("Image Dimensions") != "gdcm::Unfound" + if ( GetElValByName("Image Dimensions") != GDCM_UNFOUND && atoi(GetElValByName("Image Dimensions").c_str()) > 4 ) { return false; } - if ( GetElValByName("Bits Allocated") == "gdcm::Unfound" ) + if ( GetElValByName("Bits Allocated") == GDCM_UNFOUND ) return false; - if ( GetElValByName("Bits Stored") == "gdcm::Unfound" ) + if ( GetElValByName("Bits Stored") == GDCM_UNFOUND ) return false; - if ( GetElValByName("High Bit") == "gdcm::Unfound" ) + if ( GetElValByName("High Bit") == GDCM_UNFOUND ) return false; - if ( GetElValByName("Pixel Representation") == "gdcm::Unfound" ) + if ( GetElValByName("Pixel Representation") == GDCM_UNFOUND ) return false; return true; } @@ -1847,7 +1847,7 @@ int gdcmHeader::GetXSize(void) { // We cannot check for "Columns" because the "Columns" tag is present // both in IMG (0028,0011) and OLY (6000,0011) sections of the dictionary. string StrSize = GetPubElValByNumber(0x0028,0x0011); - if (StrSize == "gdcm::Unfound") + if (StrSize == GDCM_UNFOUND) return 0; return atoi(StrSize.c_str()); } @@ -1862,7 +1862,7 @@ int gdcmHeader::GetYSize(void) { // We cannot check for "Rows" because the "Rows" tag is present // both in IMG (0028,0010) and OLY (6000,0010) sections of the dictionary. string StrSize = GetPubElValByNumber(0x0028,0x0010); - if (StrSize != "gdcm::Unfound") + if (StrSize != GDCM_UNFOUND) return atoi(StrSize.c_str()); if ( IsDicomV3() ) return 0; @@ -1885,14 +1885,14 @@ int gdcmHeader::GetZSize(void) { // Both in DicomV3 and ACR/Nema the consider the "Number of Frames" // as the third dimension. string StrSize = GetPubElValByNumber(0x0028,0x0008); - if (StrSize != "gdcm::Unfound") + if (StrSize != GDCM_UNFOUND) return atoi(StrSize.c_str()); // We then consider the "Planes" entry as the third dimension [we // cannot retrieve by name since "Planes tag is present both in // IMG (0028,0012) and OLY (6000,0012) sections of the dictionary]. StrSize = GetPubElValByNumber(0x0028,0x0012); - if (StrSize != "gdcm::Unfound") + if (StrSize != GDCM_UNFOUND) return atoi(StrSize.c_str()); return 1; } @@ -1906,7 +1906,7 @@ int gdcmHeader::GetZSize(void) { */ int gdcmHeader::GetBitsStored(void) { string StrSize = GetPubElValByNumber(0x0028,0x0101); - if (StrSize == "gdcm::Unfound") + if (StrSize == GDCM_UNFOUND) return 1; return atoi(StrSize.c_str()); } @@ -1921,7 +1921,7 @@ int gdcmHeader::GetBitsStored(void) { */ int gdcmHeader::GetSamplesPerPixel(void) { string StrSize = GetPubElValByNumber(0x0028,0x0002); - if (StrSize == "gdcm::Unfound") + if (StrSize == GDCM_UNFOUND) return 1; // Well, it's supposed to be mandatory ... return atoi(StrSize.c_str()); } @@ -1935,7 +1935,7 @@ int gdcmHeader::GetSamplesPerPixel(void) { */ int gdcmHeader::GetPlanarConfiguration(void) { string StrSize = GetPubElValByNumber(0x0028,0x0006); - if (StrSize == "gdcm::Unfound") + if (StrSize == GDCM_UNFOUND) return 0; return atoi(StrSize.c_str()); } @@ -1974,7 +1974,7 @@ int gdcmHeader::GetPixelSize(void) { string gdcmHeader::GetPixelType(void) { string BitsAlloc; BitsAlloc = GetElValByName("Bits Allocated"); - if (BitsAlloc == "gdcm::Unfound") { + if (BitsAlloc == GDCM_UNFOUND) { dbg.Verbose(0, "gdcmHeader::GetPixelType: unfound Bits Allocated"); BitsAlloc = string("16"); } @@ -1983,7 +1983,7 @@ string gdcmHeader::GetPixelType(void) { string Signed; Signed = GetElValByName("Pixel Representation"); - if (Signed == "gdcm::Unfound") { + if (Signed == GDCM_UNFOUND) { dbg.Verbose(0, "gdcmHeader::GetPixelType: unfound Pixel Representation"); BitsAlloc = string("0"); } @@ -2003,7 +2003,7 @@ string gdcmHeader::GetPixelType(void) { */ string gdcmHeader::GetTransferSyntaxName(void) { string TransfertSyntax = GetPubElValByNumber(0x0002,0x0010); - if (TransfertSyntax == "gdcm::Unfound") { + if (TransfertSyntax == GDCM_UNFOUND) { dbg.Verbose(0, "gdcmHeader::GetTransferSyntaxName: unfound Transfert Syntax (0002,0010)"); return "Uncompressed ACR-NEMA"; } @@ -2031,13 +2031,13 @@ int gdcmHeader::GetLUTLength(void) { //int LutNbits; // Just hope Lookup Table Desc-Red = Lookup Table Desc-Red = Lookup Table Desc-Blue string LutDescriptionR = GetPubElValByNumber(0x0028,0x1101); - if (LutDescriptionR == "gdcm::Unfound") + if (LutDescriptionR == GDCM_UNFOUND) return 0; string LutDescriptionG = GetPubElValByNumber(0x0028,0x1102); - if (LutDescriptionG == "gdcm::Unfound") + if (LutDescriptionG == GDCM_UNFOUND) return 0; string LutDescriptionB = GetPubElValByNumber(0x0028,0x1103); - if (LutDescriptionB == "gdcm::Unfound") + if (LutDescriptionB == GDCM_UNFOUND) return 0; if( (LutDescriptionR != LutDescriptionG) || (LutDescriptionR != LutDescriptionB) ) { dbg.Verbose(0, "gdcmHeader::GetLUTLength: The CLUT R,G,B are not equal"); @@ -2069,7 +2069,7 @@ int gdcmHeader::GetLUTNbits(void) { // Just hope Lookup Table Desc-Red = Lookup Table Desc-Red = Lookup Table Desc-Blue // Consistency already checked in GetLUTLength string LutDescription = GetPubElValByNumber(0x0028,0x1101); - if (LutDescription == "gdcm::Unfound") + if (LutDescription == GDCM_UNFOUND) return 0; tokens.erase(tokens.begin(),tokens.end()); // clean any previous value Tokenize (LutDescription, tokens, "\\"); @@ -2127,7 +2127,7 @@ void * gdcmHeader::GetLUTRGB(void) { // http://www.barre.nom.fr/medical/dicom2/limitations.html#Color%20Lookup%20Tables // and OT-PAL-8-face.dcm - if (GetPubElValByNumber(0x0028,0x0004) == "gdcm::Unfound") { + if (GetPubElValByNumber(0x0028,0x0004) == GDCM_UNFOUND) { dbg.Verbose(0, "gdcmHeader::GetLUTRGB: unfound Photometric Interpretation"); return NULL; } diff --git a/src/gdcmHeader.h b/src/gdcmHeader.h index 0f37b1aa..a5a21fb0 100644 --- a/src/gdcmHeader.h +++ b/src/gdcmHeader.h @@ -1,4 +1,4 @@ -// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.h,v 1.37 2003/09/10 16:31:24 malaterre Exp $ +// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.h,v 1.38 2003/09/18 09:32:15 regrain Exp $ #ifndef GDCMHEADER_H #define GDCMHEADER_H @@ -40,12 +40,12 @@ private: /// the VR of the DICOM version3 public dictionary. gdcmVR *dicom_vr; // Not a class member for thread-safety reasons /// Pointer to global dictionary container - gdcmDictSet* Dicts; // Not a class member for thread-safety reasons + gdcmDictSet *Dicts; // Not a class member for thread-safety reasons /// Public dictionary used to parse this header - gdcmDict* RefPubDict; + gdcmDict *RefPubDict; /// Optional "shadow dictionary" (private elements) used to parse this /// header - gdcmDict* RefShaDict; + gdcmDict *RefShaDict; /// Pointer to the Transfert Syntax Hash Table which contains all /// the TS of the DICOM version3 public dictionary. gdcmTS *dicom_ts; // Not a class member for thread-safety reasons diff --git a/src/gdcmHeaderHelper.cxx b/src/gdcmHeaderHelper.cxx index 3b1547e6..05ade1c5 100644 --- a/src/gdcmHeaderHelper.cxx +++ b/src/gdcmHeaderHelper.cxx @@ -1,4 +1,4 @@ -// $Header: /cvs/public/gdcm/src/Attic/gdcmHeaderHelper.cxx,v 1.4 2003/09/17 17:46:35 malaterre Exp $ +// $Header: /cvs/public/gdcm/src/Attic/gdcmHeaderHelper.cxx,v 1.5 2003/09/18 09:32:15 regrain Exp $ //This is needed when compiling in debug mode #ifdef _MSC_VER @@ -117,7 +117,7 @@ int gdcmHeaderHelper::GetPixelSize() { string gdcmHeaderHelper::GetPixelType() { string BitsAlloc; BitsAlloc = GetElValByName("Bits Allocated"); - if (BitsAlloc == "gdcm::Unfound") { + if (BitsAlloc == GDCM_UNFOUND) { dbg.Verbose(0, "gdcmHeader::GetPixelType: unfound Bits Allocated"); BitsAlloc = string("16"); } @@ -126,7 +126,7 @@ string gdcmHeaderHelper::GetPixelType() { string Signed; Signed = GetElValByName("Pixel Representation"); - if (Signed == "gdcm::Unfound") { + if (Signed == GDCM_UNFOUND) { dbg.Verbose(0, "gdcmHeader::GetPixelType: unfound Pixel Representation"); BitsAlloc = string("0"); } @@ -148,7 +148,7 @@ float gdcmHeaderHelper::GetXSpacing() { float xspacing, yspacing; string StrSpacing = GetPubElValByNumber(0x0028,0x0030); - if (StrSpacing == "gdcm::Unfound") { + if (StrSpacing == GDCM_UNFOUND) { dbg.Verbose(0, "gdcmHeader::GetXSpacing: unfound Pixel Spacing (0028,0030)"); return 1.; } @@ -168,7 +168,7 @@ float gdcmHeaderHelper::GetYSpacing() { float xspacing, yspacing; string StrSpacing = GetPubElValByNumber(0x0028,0x0030); - if (StrSpacing == "gdcm::Unfound") { + if (StrSpacing == GDCM_UNFOUND) { dbg.Verbose(0, "gdcmHeader::GetYSpacing: unfound Pixel Spacing (0028,0030)"); return 1.; } @@ -204,10 +204,10 @@ float gdcmHeaderHelper::GetZSpacing() { string StrSpacingBSlices = GetPubElValByNumber(0x0018,0x0088); - if (StrSpacingBSlices == "gdcm::Unfound") { + if (StrSpacingBSlices == GDCM_UNFOUND) { dbg.Verbose(0, "gdcmHeader::GetZSpacing: unfound StrSpacingBSlices"); string StrSliceThickness = GetPubElValByNumber(0x0018,0x0050); - if (StrSliceThickness == "gdcm::Unfound") + if (StrSliceThickness == GDCM_UNFOUND) return 1.; else // if no 'Spacing Between Slices' is found, @@ -243,10 +243,10 @@ float gdcmHeaderHelper::GetXOrigin() { float xImPos, yImPos, zImPos; string StrImPos = GetPubElValByNumber(0x0020,0x0032); - if (StrImPos == "gdcm::Unfound") { + if (StrImPos == GDCM_UNFOUND) { dbg.Verbose(0, "gdcmHeader::GetXImagePosition: unfound Image Position Patient (0020,0032)"); StrImPos = GetPubElValByNumber(0x0020,0x0030); // For ACR-NEMA images - if (StrImPos == "gdcm::Unfound") { + if (StrImPos == GDCM_UNFOUND) { dbg.Verbose(0, "gdcmHeader::GetXImagePosition: unfound Image Position (RET) (0020,0030)"); // How to tell the caller nothing was found ? return 0.; @@ -268,10 +268,10 @@ float gdcmHeaderHelper::GetYOrigin() { float xImPos, yImPos, zImPos; string StrImPos = GetPubElValByNumber(0x0020,0x0032); - if (StrImPos == "gdcm::Unfound") { + if (StrImPos == GDCM_UNFOUND) { dbg.Verbose(0, "gdcmHeader::GetYImagePosition: unfound Image Position Patient (0020,0032)"); StrImPos = GetPubElValByNumber(0x0020,0x0030); // For ACR-NEMA images - if (StrImPos == "gdcm::Unfound") { + if (StrImPos == GDCM_UNFOUND) { dbg.Verbose(0, "gdcmHeader::GetYImagePosition: unfound Image Position (RET) (0020,0030)"); // How to tell the caller nothing was found ? return 0.; @@ -294,7 +294,7 @@ float gdcmHeaderHelper::GetYOrigin() { float gdcmHeaderHelper::GetZOrigin() { float xImPos, yImPos, zImPos; string StrImPos = GetPubElValByNumber(0x0020,0x0032); - if (StrImPos != "gdcm::Unfound") { + if (StrImPos != GDCM_UNFOUND) { if( sscanf( StrImPos.c_str(), "%f\\%f\\%f", &xImPos, &yImPos, &zImPos) != 3) { dbg.Verbose(0, "gdcmHeader::GetZImagePosition: wrong Image Position Patient (0020,0032)"); return 0.; // bug in the element 0x0020,0x0032 @@ -303,7 +303,7 @@ float gdcmHeaderHelper::GetZOrigin() { } } StrImPos = GetPubElValByNumber(0x0020,0x0030); // For ACR-NEMA images - if (StrImPos != "gdcm::Unfound") { + if (StrImPos != GDCM_UNFOUND) { if( sscanf( StrImPos.c_str(), "%f\\%f\\%f", &xImPos, &yImPos, &zImPos) != 3) { dbg.Verbose(0, "gdcmHeader::GetZImagePosition: wrong Image Position (RET) (0020,0030)"); return 0.; // bug in the element 0x0020,0x0032 @@ -312,7 +312,7 @@ float gdcmHeaderHelper::GetZOrigin() { } } string StrSliceLocation = GetPubElValByNumber(0x0020,0x1041);// for *very* old ACR-NEMA images - if (StrSliceLocation != "gdcm::Unfound") { + if (StrSliceLocation != GDCM_UNFOUND) { if( sscanf( StrSliceLocation.c_str(), "%f", &zImPos) !=1) { dbg.Verbose(0, "gdcmHeader::GetZImagePosition: wrong Slice Location (0020,1041)"); return 0.; // bug in the element 0x0020,0x1041 @@ -322,7 +322,7 @@ float gdcmHeaderHelper::GetZOrigin() { } dbg.Verbose(0, "gdcmHeader::GetZImagePosition: unfound Slice Location (0020,1041)"); string StrLocation = GetPubElValByNumber(0x0020,0x0050); - if (StrLocation != "gdcm::Unfound") { + if (StrLocation != GDCM_UNFOUND) { if( sscanf( StrLocation.c_str(), "%f", &zImPos) !=1) { dbg.Verbose(0, "gdcmHeader::GetZImagePosition: wrong Location (0020,0050)"); return 0.; // bug in the element 0x0020,0x0050 @@ -347,7 +347,7 @@ int gdcmHeaderHelper::GetImageNumber() { // simpler and faster function. sscanf() can do all possible conversions whereas atoi() can //only do single decimal integer conversions. string StrImNumber = GetPubElValByNumber(0x0020,0x0013); //0020 0013 IS REL Image Number - if (StrImNumber != "gdcm::Unfound") { + if (StrImNumber != GDCM_UNFOUND) { return atoi( StrImNumber.c_str() ); } return 0; //Hopeless @@ -360,7 +360,7 @@ int gdcmHeaderHelper::GetImageNumber() { */ ModalityType gdcmHeaderHelper::GetModality(void) { string StrModality = GetPubElValByNumber(0x0008,0x0060); //0008 0060 CS ID Modality - if (StrModality != "gdcm::Unfound") { + if (StrModality != GDCM_UNFOUND) { if ( StrModality.find("AU") < StrModality.length()) return AU; else if ( StrModality.find("AS") < StrModality.length()) return AS; else if ( StrModality.find("BI") < StrModality.length()) return BI; @@ -463,7 +463,7 @@ void gdcmHeaderHelper::GetImageOrientationPatient( float* iop ) { iop[0] = iop[1] = iop[2] = iop[3] = iop[4] = iop[5] = 0; string StrImOriPat = GetPubElValByNumber(0x0020,0x0037); // 0020 0037 DS REL Image Orientation (Patient) - if (StrImOriPat != "gdcm::Unfound") { + if (StrImOriPat != GDCM_UNFOUND) { if( sscanf( StrImOriPat.c_str(), "%f\\%f\\%f\\%f\\%f\\%f", &iop[0], &iop[1], &iop[2], &iop[3], &iop[4], &iop[5]) != 6) { dbg.Verbose(0, "gdcmHeader::GetImageOrientationPatient: wrong Image Orientation Patient (0020,0037)"); @@ -475,7 +475,7 @@ void gdcmHeaderHelper::GetImageOrientationPatient( float* iop ) { //For ACR-NEMA StrImOriPat = GetPubElValByNumber(0x0020,0x0035); //0020 0035 DS REL Image Orientation (RET) - if (StrImOriPat != "gdcm::Unfound") { + if (StrImOriPat != GDCM_UNFOUND) { if( sscanf( StrImOriPat.c_str(), "%f\\%f\\%f\\%f\\%f\\%f", &iop[0], &iop[1], &iop[2], &iop[3], &iop[4], &iop[5]) != 6) { dbg.Verbose(0, "gdcmHeader::GetImageOrientationPatient: wrong Image Orientation Patient (0020,0035)"); diff --git a/src/gdcmTS.cxx b/src/gdcmTS.cxx index e697e566..8ed38d0b 100644 --- a/src/gdcmTS.cxx +++ b/src/gdcmTS.cxx @@ -185,6 +185,6 @@ int gdcmTS::Count(TSKey key) { std::string gdcmTS::GetValue(TSKey key) { if (ts.count(key) == 0) - return ("gdcm::Unfound"); + return (GDCM_UNFOUND); return ts[key]; }