+/**
+ *\ingroup gdcmHeaderHelper
+ *\brief gets the info from 0028,1052 : Rescale Intercept
+ * @return Rescale Intercept
+ */
+float gdcmHeaderHelper::GetRescaleIntercept() {
+ float resInter = 0.;
+ std::string StrRescInter = GetEntryByNumber(0x0028,0x1052); //0028 1052 DS IMG Rescale Intercept
+ if (StrRescInter != GDCM_UNFOUND) {
+ if( sscanf( StrRescInter.c_str(), "%f", &resInter) != 1) {
+ dbg.Verbose(0, "gdcmHeader::GetRescaleIntercept: Rescale Slope is empty");
+ // bug in the element 0x0028,0x1052
+ }
+ }
+ return resInter;
+}
+
+/**
+ *\ingroup gdcmHeaderHelper
+ *\brief gets the info from 0028,1053 : Rescale Slope
+ * @return Rescale Slope
+ */
+ float gdcmHeaderHelper::GetRescaleSlope() {
+ float resSlope = 1.;
+ std::string StrRescSlope = GetEntryByNumber(0x0028,0x1053); //0028 1053 DS IMG Rescale Slope
+ if (StrRescSlope != GDCM_UNFOUND) {
+ if( sscanf( StrRescSlope.c_str(), "%f", &resSlope) != 1) {
+ dbg.Verbose(0, "gdcmHeader::GetRescaleSlope: Rescale Slope is empty");
+ // bug in the element 0x0028,0x1053
+ }
+ }
+ return resSlope;
+}
+
+/**
+ * \ingroup gdcmHeaderHelper
+ * \brief This function is intended to user who doesn't want
+ * to have to manage a LUT and expects to get an RBG Pixel image
+ * (or a monochrome one ...)
+ * \warning to be used with GetImagePixels()
+ * @return 1 if Gray level, 3 if Color (RGB, YBR or PALETTE COLOR)
+ */
+int gdcmHeaderHelper::GetNumberOfScalarComponents() {
+ if (GetSamplesPerPixel() ==3)
+ return 3;
+
+ // 0028 0100 US IMG Bits Allocated
+ // (in order no to be messed up by old RGB images)
+ if (gdcmHeader::GetEntryByNumber(0x0028,0x0100) == "24")
+ return 3;
+
+ std::string PhotometricInterpretation =
+ gdcmHeader::GetEntryByNumber(0x0028,0x0004);
+
+ if ( ( PhotometricInterpretation == "PALETTE COLOR ") ) {
+ if (HasLUT()) // PALETTE COLOR is NOT enough
+ return 3;
+ else
+ return 1;
+ }
+
+ //beware of trailing space at end of string
+ if (PhotometricInterpretation.find(GDCM_UNFOUND) <
+ PhotometricInterpretation.length() ||
+ PhotometricInterpretation.find("MONOCHROME1") <
+ PhotometricInterpretation.length() ||
+ PhotometricInterpretation.find("MONOCHROME2") <
+ PhotometricInterpretation.length() )
+ return 1;
+ else
+ // we assume that *all* kinds of YBR are dealt with
+ return 3;
+}
+
+/**
+ * \ingroup gdcmHeaderHelper
+ * \brief This function is intended to user that DOESN'T want
+ * to get RGB pixels image when it's stored as a PALETTE COLOR image
+ * - the (vtk) user is supposed to know how deal with LUTs -
+ * \warning to be used with GetImagePixelsRaw()
+ * @return 1 if Gray level, 3 if Color (RGB or YBR - NOT 'PALETTE COLOR' -)
+ */
+int gdcmHeaderHelper::GetNumberOfScalarComponentsRaw() {
+
+ // 0028 0100 US IMG Bits Allocated
+ // (in order no to be messed up by old RGB images)
+ if (gdcmHeader::GetEntryByNumber(0x0028,0x0100) == "24")
+ return 3;
+
+ // we assume that *all* kinds of YBR are dealt with
+ return GetSamplesPerPixel();
+}
+
+/**
+ *\ingroup gdcmHeaderHelper
+ *\brief gets the info from 0020,000d : Study Instance UID
+ *\todo ? : return the ACR-NEMA element value if DICOM one is not found
+ * @return Study Instance UID
+ */
+ std::string gdcmHeaderHelper::GetStudyUID(){
+ return GetEntryByNumber(0x0020,0x000d); //0020 000d UI REL Study Instance UID
+}
+
+/**
+ *\ingroup gdcmHeaderHelper
+ *\brief gets the info from 0020,000e : Series Instance UID
+ *\todo ? : return the ACR-NEMA element value if DICOM one is not found
+ * @return Series Instance UID
+ */
+ std::string gdcmHeaderHelper::GetSeriesUID(){
+ return GetEntryByNumber(0x0020,0x000e); //0020 000e UI REL Series Instance UID
+}
+
+/**
+ *\ingroup gdcmHeaderHelper
+ *\brief gets the info from 0008,0016 : SOP Class UID
+ *\todo ? : return the ACR-NEMA element value if DICOM one is not found
+ * @return SOP Class UID
+ */
+ std::string gdcmHeaderHelper::GetClassUID(){
+ return GetEntryByNumber(0x0008,0x0016); //0008 0016 UI ID SOP Class UID
+}
+
+/**
+ *\ingroup gdcmHeaderHelper
+ *\brief gets the info from 0008,0018 : SOP Instance UID
+ *\todo ? : return the ACR-NEMA element value if DICOM one is not found
+ * @return SOP Instance UID
+ */
+ std::string gdcmHeaderHelper::GetInstanceUID(){
+ return GetEntryByNumber(0x0008,0x0018); //0008 0018 UI ID SOP Instance UID
+}
+//
+// -------------- Remember ! ----------------------------------