]> Creatis software - gdcm.git/blobdiff - src/gdcmHeaderHelper.cxx
* Modification to compile with the distutils.
[gdcm.git] / src / gdcmHeaderHelper.cxx
index 25d2d80c55d1e0dde855a0ebae8ff24f7e3fc5d2..0898ed5d945f05a47b33dee7bbc5ad709e57fe92 100644 (file)
@@ -1,11 +1,11 @@
-// $Header: /cvs/public/gdcm/src/Attic/gdcmHeaderHelper.cxx,v 1.15 2003/11/03 10:49:31 jpr Exp $
+// $Header: /cvs/public/gdcm/src/Attic/gdcmHeaderHelper.cxx,v 1.17 2003/11/12 14:06:35 malaterre Exp $
 
 #include "gdcmHeaderHelper.h"
 
 #include "gdcmUtil.h" //for debug
 #include <math.h>
 #include <algorithm>
-#include <string.h> //for bzero
+//#include <string.h> //for bzero
 
 //directory manipulation (os indep).
 //cygwin ???? -> _WIN32 ??
@@ -497,6 +497,32 @@ std::string gdcmHeaderHelper::GetInstanceUID()
 {
   return GetPubElValByNumber(0x0008,0x0018); //0008 0018 UI ID SOP Instance UID
 }
+//----------------------------------------------------------------------------
+float gdcmHeaderHelper::GetRescaleIntercept()
+{
+  float resInter = 0.;
+  std::string StrRescInter = GetPubElValByNumber(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;
+}
+//----------------------------------------------------------------------------
+float gdcmHeaderHelper::GetRescaleSlope()
+{
+  float resSlope = 1.;
+  std::string StrRescSlope = GetPubElValByNumber(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;
+}