I am using gdcm 2.0 and it seem that gdcm doesn't support the signed pixel representation (i,e (0028, 0103) set to 1)
When I try to read an image with the pixel representation element set to 1, gdcm gives me the following messages
samples_per_pixel 1 bits_allocated 16 bits_stored 16 high_bit 15
Warning: In /Users/jchu014/cmiss/image_libraries/libgdcm/gdcm-2-0-120808-SAB/Source/MediaStorageAndFileFormat/gdcmImageReader.cxx, line 752, function <unknow>
TODO
Warning: In /Users/jchu014/cmiss/image_libraries/libgdcm/gdcm-2-0-120808-SAB/Source/MediaStorageAndFileFormat/gdcmImageReader.cxx, line 757, function <unknow>
Pixel Padding Value (0028,0120) is not handled. Image will not be displayed properly
Does the lastest version of gdcm support this? if not do you plan to in the future?
Here is some additional information extracted from the DICOM file
a. Bits Allocated (0028, 0100) = 16
b. Bits Stored (0028, 0101) = 16
c. High Bit (0028, 0102) = 15
d. Pixel Representation (0028, 0103) = 1 (Signed)
e. Pixel Padding Value (0028, 012) = 0
f. Byte order = Little endian
Following is the part of gdcm source which is responsible for the warnings
// (0028,0120) US 32767 # 2, 1 PixelPaddingValue
bool pixelpaddingvalue = ds.FindDataElement(Tag(0x0028,0x0120));
// PS 3.3 - 2008 / C.7.5.1.1.2 Pixel Padding Value and Pixel Padding Range
Limit
if(pixelpaddingvalue)
{
// Technically if Pixel Padding Value is 0 on MONOCHROME2 image, then
appearance should be fine...
bool vizissue = true;
if( pf.GetPixelRepresentation() == 0 )
{
Element<VR::US,VM::VM1> ppv;
if( !ds.GetDataElement(Tag(0x0028,0x0120) ).IsEmpty() )
{
ppv.Set( ds.GetDataElement(Tag(0x0028,0x0120)).GetValue() );
if( pi == PhotometricInterpretation::MONOCHROME2 && ppv.GetValue() == 0
)
{
vizissue = false;
}
}
}
else if( pf.GetPixelRepresentation() == 1 )
{
gdcmWarningMacro( "TODO" ); // <<<<<<<<< first warning
}
// test if there is any viz issue:
if( vizissue )
{
gdcmWarningMacro( "Pixel Padding Value (0028,0120) is not handled. Image
will not be displayed properly" ); // <<<<<<<<<<<< second warning
}
}
So it seems the combination of the presence of the Pixel Padding Value element and Pixel Representation set to 1 (=signed) is what is causing this problem.
(The Photometric Interpretation (0028,0004) is MONOCHROME2)