+ int nbValues;
+
+ // To follow David Clunie's advice, we first check ImagerPixelSpacing
+ // (never saw any image with that field :-(
+
+ const std::string &strImagerPixelSpacing = GetEntryValue(0x0018,0x1164);
+ if( strImagerPixelSpacing != GDCM_UNFOUND )
+ {
+ if( ( nbValues = sscanf( strImagerPixelSpacing.c_str(),
+ "%f\\%f", &yspacing, &xspacing)) != 2 )
+ {
+ // if no values, xspacing is set to 1.0
+ if( nbValues == 0 )
+ xspacing = 1.0;
+ // if single value is found, xspacing is defaulted to yspacing
+ if( nbValues == 1 )
+ xspacing = yspacing;
+
+ if ( xspacing == 0.0 )
+ xspacing = 1.0;
+
+ return xspacing;
+ }
+ }
+
+