2
votes

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

  • (0028,0002) Samples per Pixel: 1
  • (0028,0004) Photometric Interpretation: MONOCHROME2
  • (0028,0010) Rows: 256
  • (0028,0011) Columns: 256
  • (0028,0030) Pixel Spacing: 1.5625\1.5625
  • (0028,0100) Bits Allocated: 16
  • (0028,0101) Bits Stored: 12
  • (0028,0102) High Bit: 11
  • (0028,0103) Pixel Representation: 0
  • (0028,0106) Smallest Image Pixel Value: 1
  • (0028,0107) Largest Image Pixel Value: 1060
  • (0028,1050) Window Center: 474
  • (0028,1051) Window Width: 1000
  • (0028,1055) Window Center & Width Explanation: Algo1

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 :

  • (0019,1009) Unknown: 1.0
  • (0019,100b) Unknown: 245
  • (0019,1016) Unknown: 25.53

Why this happend to my image?

2
Do you have contents on the rescale elements? I mean, rescale intercept (0028,1052) and rescale slope (0028,1053). It could be useful, too, to attach an image showing your image output. Anyway, this page can be very useful to you: dicomiseasy.blogspot.com.es/2012/08/chapter-12-pixel-data.htmljap1968
There is nothing like this in my sample's header. All things for 0028 group I've listed. Many of values(80 percent) are out of window all thing is going to white but other viewers show this image as I expect.mf mf
Are you reading the raw values as unsigned or as signed values? The value of the Data element pixel representation (0028,0103) is 0 (you must read them as unsigned integers)jap1968
I read them as unsigned.mf mf

2 Answers

2
votes

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];

1
votes

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.