Dear DCMTKers,
I encountered a Philips PET image which contained strange rescale slope and rescale intercept.
0028,1050, Window Center=25524.0
0028,1051, Window Width=31120
0028,1052, Rescale Intercept=0.0153112
0028,1053, Rescale Slope=0.000450329
As the calculation is
Pixel Output value = Stored Pixel Data * Rescale Slope + Rescale Intercept
the window center becomes 25524*0.000450329 + 0.0153112 = 11.51
and the window width is 31120*0.000450329 = 14.01
The dynamic range is too small for integer type.
It seems DCMTK don't have float precisions for immediate formats
enum EP_Representation
{
/// unsigned 8 bit integer
EPR_Uint8, EPR_MinUnsigned = EPR_Uint8,
/// signed 8 bit integer
EPR_Sint8, EPR_MinSigned = EPR_Sint8,
/// unsigned 16 bit integer
EPR_Uint16,
/// signed 16 bit integer
EPR_Sint16,
/// unsigned 32 bit integer
EPR_Uint32, EPR_MaxUnsigned = EPR_Uint32,
/// signed 32 bit integer
EPR_Sint32, EPR_MaxSigned = EPR_Sint32
};
I wonder whether the only lossless method is to manual rescale the bits before the ModalityTransformation.
Could somebody help me display such images using DCMTK?
Questions about rescale slope and rescale intercept with DCMTK
Moderator: Moderator Team
-
- DCMTK Developer
- Posts: 2506
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
No, because IMHO the described use case is not what the Pixel Data is/was meant for - I would even call this an "abuse" of the Pixel Data element.It seems DCMTK don't have float precisions for immediate formats
Nevertheless, you could modify the Rescale Slope/Intercept values (if needed) before the Modality LUT transformation is applied, e.g. by multiplying them with a value of 1,000 or the like.
Btw, the Real World Value Mapping SOP Class might be interesting in this context.
Thanks for your reply. The following code seems to work now.J. Riesmeier wrote:No, because IMHO the described use case is not what the Pixel Data is/was meant for - I would even call this an "abuse" of the Pixel Data element.It seems DCMTK don't have float precisions for immediate formats
Nevertheless, you could modify the Rescale Slope/Intercept values (if needed) before the Modality LUT transformation is applied, e.g. by multiplying them with a value of 1,000 or the like.
Btw, the Real World Value Mapping SOP Class might be interesting in this context.
Code: Select all
OFString key;
float rescaleSlope, rescaleIntercept;
if(dcmFileFormat.getDataset()->findAndGetOFString(DCM_RescaleSlope, key).good())
{
rescaleSlope = atof(key.c_str());
if(dcmFileFormat.getDataset()->findAndGetOFString(DCM_RescaleIntercept, key).good())
{
rescaleIntercept = atof(key.c_str());
if(rescaleSlope < 0.1)
{
float amp = 1.0/rescaleSlope;
rescaleSlope *= amp;
rescaleIntercept *= amp;
dcmFileFormat.getDataset()->remove( DCM_RescaleSlope);
dcmFileFormat.getDataset()->remove( DCM_RescaleIntercept);
dcmFileFormat.getDataset()->putAndInsertFloat32( DCM_RescaleSlope, rescaleSlope);
dcmFileFormat.getDataset()->putAndInsertFloat32( DCM_RescaleIntercept, rescaleIntercept);
}
}
}
dicomImage = new DicomImage(dcmFileFormat.getDataset(),EXS_Unknown);
// read pixel values
// ......
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest