0

I have a Dicom image file in dcm format.In matlab by using Dicomread i got image data and by using dicominfo i got window center and window width of that dcm file. Now i want to display the image by using imshow in figure.

My code is below,

ct = dicomread('E:\IM-0001-0001.dcm'); 
info = dicominfo('E:\IM-0001-0001.dcm');
figure
imshow(ct , [info.WindowCenter, info.WindowWidth]);

but it gives a error

 Error using checkDisplayRange (line 20)
HIGH must be greater than LOW.

I knew why this error was came .it occur because of window center value is more than window width.

Now my question is

1.whether my code is right or wrong for assign the Window level and window width for dcm image?

2.How to assign the Window level and window width for dicom image when above condition occur?

Karthick Rajan
  • 394
  • 2
  • 17

2 Answers2

1

Just calculate the highest and lowest value by

low = center - width / 2
high = center + width / 2

and use this values for imshow

imshow(ct, [low, high])
JohnnyQ
  • 1,591
  • 1
  • 16
  • 25
0

If I inspect that image with ImageMagick's identify command like this, I get the following...

identify -verbose IM-0001-0001.dcm | grep -i window

dcm:WindowCenter: 2856.4189453125
dcm:WindowWidth: 2475.0

I am inclined to believe these values since ImageMagick appears to extract the image perfectly well as below:

enter image description here

I would suggest you maybe check your window values with some other software.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • I am not saying about getting windows value. I asked question about how to set window values in imshow () function in matlab – Karthick Rajan May 04 '15 at 04:33