I am trying to read the pixel values of an image contained in a DICOM file in my simple C ++ application using the Grassroots DICOM library (GDCM). When reading file metadata, I get the following picture information:
Bits allocated: 16
Bits Stored: 16
High Bit: 15
Unsigned or signed: 1
Samples pr pixel: 1
Dimensions: 2
Dimension values: 256x256
Pixel Representation: 1
SamplesPerPixel: 1
ScalarType: INT16
PhotometricInterpretation: MONOCHROME2
Pixel buffer length: 131072
Given that the image has a resolution of 256x256 and is of type MONOCHROME2, I expected the pixel buffer length to be 256x256 = 65536 elements, but in reality it is 131072 elements.
If I use MATLAB instead of importing pixel data, I get exactly 65536 values in the range 0 - 850, where 0 is black and 850 is white.
, GDCM ++, pixelbuffer - 131072 , -128 +127, 0- 3. :
Exerpt:
PixelBuffer[120] = -35
PixelBuffer[121] = 0
PixelBuffer[122] = 51
PixelBuffer[123] = 2
PixelBuffer[124] = 71
PixelBuffer[125] = 2
PixelBuffer[126] = 9
PixelBuffer[127] = 2
PixelBuffer[128] = -80
PixelBuffer[129] = 2
PixelBuffer[130] = 87
PixelBuffer[131] = 3
PixelBuffer[132] = 121
PixelBuffer[133] = 3
PixelBuffer[134] = -27
PixelBuffer[135] = 2
PixelBuffer[136] = 27
PixelBuffer[137] = 2
PixelBuffer[138] = -111
PixelBuffer[139] = 1
PixelBuffer[140] = 75
PixelBuffer[141] = 1
PixelBuffer[142] = 103
? ? "googeling image pixel structure" , , . - , ?