mf mf
mf mf

Reputation: 143

Why my pixel value of DICOM is beyond 'Largest Image Pixel Value' attribute?

I'm using dcmtk to fetch image data from dicom data. Now I have following information for a sample image:

When I applied the window/center value to real pixel value of data, then many of them is white. I iterate on pixel values and then I found many pixel value (larger than 80 percent) is beyond Largest Image Pixel Value. Many of them are beyond of 5x of largest! This made my resulting image near to complete white. Strangely I don't why when I divide pixel values to 256 then the resulting image is near to the image that I expect. I can't understand why it's true.

Maybe it's good to see other unknown attribute :

Why this happend to my image?

Upvotes: 3

Views: 3353

Answers (2)

michael pan
michael pan

Reputation: 599

could you verify that you are only reading 12 bits of each pixel? ie you've applied something along these lines

int value = ((byte[0] & 0x0f) << 8) | byte[1];

and not

int value = (byte[0] << 8) | byte[1];

Upvotes: 2

Freddy Jose
Freddy Jose

Reputation: 49

I have not seen your image data but from what you say i think this is an endianness problem. Now i have not worked with gdcmtk extensively but in gdcm we have an option of setting the data endianness. Try setting the endianness to little instead of big. If you could provide me the dicom file i can try to read it using gdcm.

Upvotes: 1

Related Questions