changed behavior for non-uniform enhanced images, if z spacing can not be read, x and y spacing become always 1, even if they were read before, because GetSpacingValueFromSequence returns false if it can not get z-spacing
This is not ideal, but IMHO better. Not ideal is an approach to read just fisrt per-frame entry if shared group fails. For example GE PET images exist with rescale intecept/slope different for every frame (...ohh).. But it is another story... I could make a pull req., but there is already one mine pull req. for gdcmImageHelper.cxx.
Thank you
Regards,
Mihail
Your image contains does not provide a Fonctional Group with the Pixel Spacing
I need to sanitize this code section, thanks for the bug report !
Fixed in 198d8727c006da7cd19fd899e62d0f42d7b6f1b8.
This change
if (GetSpacingValueFromSequence(ds,t1, sp) ||
GetSpacingValueFromSequence(ds,t2, sp))
{
assert( sp.size() == 3 );
}
else
{
sp.resize( 3 );
+ sp[0] = 1.;
+ sp[1] = 1.;
sp[2] = 1.;
gdcmWarningMacro( "Could not find Spacing" );
}
return sp;
changed behavior for non-uniform enhanced images, if z spacing can not be read, x and y spacing become always 1, even if they were read before, because GetSpacingValueFromSequence returns false if it can not get z-spacing
ftp://medical.nema.org/medical/dicom/DataSets/WG16/Philips/EnhancedMR/Brain/DICOM/IM_0016
Such images are not seldom. My suggestion were to change GetSpacingValueFromSequence
at the end to set z=1 there and return true
current -------------------------------------
double zspacing;
bool b = ComputeZSpacingFromIPP(ds, zspacing);
if( !b ) return false;
sp.push_back( zspacing );
return true;
}
suggestion ----------------------------------------
double zspacing;
if( ComputeZSpacingFromIPP(ds, zspacing) )
{
sp.push_back( zspacing );
}
else
{
sp.push_back( 1. );
}
return true;
}
This is not ideal, but IMHO better. Not ideal is an approach to read just fisrt per-frame entry if shared group fails. For example GE PET images exist with rescale intecept/slope different for every frame (...ohh).. But it is another story... I could make a pull req., but there is already one mine pull req. for gdcmImageHelper.cxx.
Thank you
Regards,
Mihail