-// $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
* \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:
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() );
* @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);
* @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();
}
* 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);
* 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();
}
* @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);
* @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();
}
* 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);
* 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();
}
* @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);
* @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);
* 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);
* 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);
* 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;
}
// 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());
}
// 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;
// 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;
}
*/
int gdcmHeader::GetBitsStored(void) {
string StrSize = GetPubElValByNumber(0x0028,0x0101);
- if (StrSize == "gdcm::Unfound")
+ if (StrSize == GDCM_UNFOUND)
return 1;
return atoi(StrSize.c_str());
}
*/
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());
}
*/
int gdcmHeader::GetPlanarConfiguration(void) {
string StrSize = GetPubElValByNumber(0x0028,0x0006);
- if (StrSize == "gdcm::Unfound")
+ if (StrSize == GDCM_UNFOUND)
return 0;
return atoi(StrSize.c_str());
}
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");
}
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");
}
*/
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";
}
//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");
// 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, "\\");
// 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;
}
-// $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
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");
}
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");
}
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.;
}
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.;
}
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,
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.;
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.;
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
}
}
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
}
}
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
}
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
// 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
*/
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;
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)");
//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)");