Low/High brightness or complete black or white image is created in dicom using dcmtk

1,060 views
Skip to first unread message

Kamlesh Bhure

unread,
Mar 31, 2014, 11:03:47 AM3/31/14
to
Hi All,

I am fetching tag and images separately from erad PACS server. I am creating dicom file using these two files using dcmtk.

Tag has information of window values. As per dicom standard below values are correct for CT- Abdomen.
WindowCenter "0028,1050" is 50/300
WindowWidth "0028,1051" is 350/2000

After dcm is created it has image which has low/high brightness or complete black or white image is visible in dicom viewer i.e. Oviyam 0.9.2

When I remove WW/WL values from dicom tag, I can see dicom image correctly in dicom viewer i.e. Oviyam 0.9.2. But then user apply windowing on oviyam image get starting WW = 0 and WL = 0. Which make image to look darker first then after appropriate values image is visible. for attached jpg, image is visible at WL  = -904, WW= 214. 

Is there any other way to solve this issue?

How I can solve this issue using dcm3che-toolkit? But I don't know how to create dicom file using dcm4che-toolkit?
image.jpg
tag_info.xml
sample_with_problem.dcm

nicolas...@gmail.com

unread,
Mar 28, 2014, 8:24:24 AM3/28/14
to dcm...@googlegroups.com


On Friday, March 28, 2014 11:10:27 AM UTC+1, Kamlesh Bhure wrote:
Hi All,

I am fetching tag and images separately from erad PACS server. I am creating dicom file using these two files using dcmtk.

Tag has information of window values. As per dicom standard below values are correct for CT- Abdomen.
WindowCenter "0028,1050" is 50/300
WindowWidth "0028,1051" is 350/2000
 
Those values are invalid. The syntax for several values is "50\300".

Kamlesh Bhure

unread,
Mar 28, 2014, 10:33:54 AM3/28/14
to dcm...@googlegroups.com

Nicolas, Thats my mistake while writing post. Its correct in tag file.

--
You received this message because you are subscribed to a topic in the Google Groups "dcm4che" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dcm4che/3wluM3-lJso/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dcm4che+u...@googlegroups.com.
To post to this group, send email to dcm...@googlegroups.com.
Visit this group at http://groups.google.com/group/dcm4che.
For more options, visit https://groups.google.com/d/optout.

nicolas...@gmail.com

unread,
Mar 28, 2014, 2:43:01 PM3/28/14
to dcm...@googlegroups.com
No, you need to change the values. In dcm4che an error is thrown when reading those attributes

Here is the weasis log:
28.03.2014 19:38:09.836 *ERROR* [pool-1-thread-1] org.weasis.dicom.codec.utils.DicomMediaUtils Cannot parse float[] of (0028,1051): For input string: "350/2000" 
28.03.2014 19:38:09.837 *ERROR* [pool-1-thread-1] org.weasis.dicom.codec.utils.DicomMediaUtils Cannot parse float[] of (0028,1050): For input string: "50/300" 

Kamlesh Bhure

unread,
Mar 31, 2014, 3:04:00 AM3/31/14
to dcm...@googlegroups.com

Sorry Nicolas, for confusion I have attached corrected tag_info.xml.

I am facing same issue. dcm files shows only black colored image by default but if windowing values changed its become visible.

Thanks,
Kamlesh

nicolas...@gmail.com

unread,
Mar 31, 2014, 12:55:11 PM3/31/14
to dcm...@googlegroups.com
I don't know how do you create tag_info.xml, but I can tell you that in the sample_with_problem.dcm file, WindowCenter and WindowWidth have invalid values according to the DICOM standard (the value separator is '/' instead of '\').

Kamlesh Bhure

unread,
Mar 31, 2014, 1:57:14 PM3/31/14
to
Nicolas I corrected it too.. But still same issue


To unsubscribe from this group and all its topics, send an email to dcm4che+unsubscribe@googlegroups.com.

To post to this group, send email to dcm...@googlegroups.com.
Visit this group at http://groups.google.com/group/dcm4che.
For more options, visit https://groups.google.com/d/optout.



--
Thanks and regards,
Kamlesh V. Bhure
Sr. Software Engineer
Mb. No. 9870593611

nicolas...@gmail.com

unread,
Mar 31, 2014, 4:54:50 PM3/31/14
to dcm...@googlegroups.com
Ok, I don't see any issue with this image now. The image is displayed in gray with the preset. However I don't understand the link with the jpeg image because in the dicom file, the value of all the pixels is 0.


On Monday, March 31, 2014 7:55:22 PM UTC+2, Kamlesh Bhure wrote:
Nicolas I corrected it too.. But still same issue
On Mon, Mar 31, 2014 at 10:25 PM, <nicolas...@gmail.com> wrote:

Kamlesh Bhure

unread,
Apr 1, 2014, 3:18:20 AM4/1/14
to dcm...@googlegroups.com
Hi Nicolas,

Issue is not with image. Attached dcm file is of CT - Abdomen. If we open this dcm file with default wl=50 and ww=350 or preset values of CT-Abdomen (wl=60, ww=400), then image is visible with black in color. After changing wl/ww it becomes visible.

Is it normal working? or image has to be visible with preset values of CT - Abdomen i.e. wl=60, ww=400.

I don't want user to see image black at first look then he need to change windowing in oviyam.

Hope you are getting what issue I want to point.

Prakash Jayaraman

unread,
Apr 1, 2014, 6:14:01 AM4/1/14
to dcm...@googlegroups.com
What you get when you try this DICOM file in any other DICOM Viewers?


--
You received this message because you are subscribed to the Google Groups "dcm4che" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dcm4che+u...@googlegroups.com.

Prakash Jayaraman

unread,
Apr 1, 2014, 6:16:49 AM4/1/14
to dcm...@googlegroups.com
Ok. Ok. I tried this in Micro DICOM Viewer. Yes it was a black image initially as you said.

Kamlesh Bhure

unread,
Apr 1, 2014, 6:26:03 AM4/1/14
to dcm...@googlegroups.com
Hi Prakash,

Yes exactly thats issue. Is there any solution for this?

I was thinking if I can calculate full dynamic ww/wl using below formula mentioned in page here. (want to understand it fully to implement)
But then to create each dicom file it will be sluggish process. Can you suggest better method?

nicolas...@gmail.com

unread,
Apr 1, 2014, 3:31:03 PM4/1/14
to dcm...@googlegroups.com
Sorry, I just realize there is a real image inside. I don't what you want to achieve, but the DICOM attributes are inconsistent. I guess you have convert 16-bit image into a 8-bit image and keep all the other attributes without modifications. 

First, if you do this kind of transformation you cannot keep "CT" as modality, you must change into "SC" or "OT". And then you need to adapt all MLut and VOILut attributes. In your sample, the range of the 8-bit data is from 0 to 255 and when applying the modality LUT parameters the values will be out the range: (0 -1024)*1 = -1024.

  • (0028,1050) [DS] WindowCenter: 50/300
  • (0028,1051) [DS] WindowWidth: 350/2000
  • (0028,1052) [DS] RescaleIntercept: -1024
  • (0028,1053) [DS] RescaleSlope: 1 

Kamlesh Bhure

unread,
Apr 4, 2014, 6:23:58 AM4/4/14
to
Hi Nicolas,

Thanks for reply
But I am not doing any transformation from 16 bit to 8 bit on image. I get tag file and image file separately from erad pacs API. 

What could be solution for to resolve this?

I tried to find WW and WL value from image as mentioned in here. But still getting image black colored image using these techniques. Do I need to modify formula given in that post?

I am getting below values using both approaches.

vmin= 0
vmax=720

Approach 1
Window Width 1= (720 - 0) = 720
Window Level 1=  (0 + 720/2) = 360

Approach 2
Window Width 2= pow(2,12) - 1 = 4095
Window Level 2= pow(2,(12 - 1)) = 2048


To unsubscribe from this group and all its topics, send an email to dcm4che+unsubscribe@googlegroups.com.

To post to this group, send email to dcm...@googlegroups.com.
Visit this group at http://groups.google.com/group/dcm4che.
For more options, visit https://groups.google.com/d/optout.

nicolas...@gmail.com

unread,
Apr 4, 2014, 7:14:36 AM4/4/14
to dcm...@googlegroups.com
I could not believe that a CT modality produce such a file.

I'm try to tell you that it doesn't make sense to make any w/l transformation because the CT image is 8-bit data with a pixel range from 0 to 255. The auto-windowing is WW = 255; WC =127 and the transformation with the WindowCenter, WindowWidth, RescaleIntercept and RescaleSlope values are not consistent.

Once the image has been transformed into 8-bit image, you cannot get back to 12 or 16-bit image.


On Friday, April 4, 2014 12:13:11 PM UTC+2, Kamlesh Bhure wrote:
Hi Nicolas,

Thanks for reply
But I am not doing any transformation from 16 bit to 8 bit on image. I get tag file and image file separately from erad pacs API. 

What could be solution for to resolve this?

I tried to find WW and WL value from image as mentioned in here. But still getting image black colored image using these techniques. Do I need to modify formula given in that post?

I am getting below values using both approaches.

vmin= 0
vmax=720

Approach 1
Window Width 1= (720 - 0) = 720
Window Level 1=  (0 + 720/2) = 360

Approach 2
Window Width 2= pow(2,12) - 1 = 4095
Window Level 2= pow(2,(12 - 1)) = 2048
On Wed, Apr 2, 2014 at 1:01 AM, <nicolas...@gmail.com> wrote:

Kamlesh Bhure

unread,
Apr 7, 2014, 9:56:26 AM4/7/14
to dcm...@googlegroups.com
Hi Nicolas,

I checked same dicom file on RadiAnt Dicom Viewer. Initially it shows black image, but then after selecting adjusting window > Full Dynamic from menu, It shows up image as expected. After selecting to Full dynamic, it actually change windowing values as per its calculation based on image.

So It seems there is some formula to calculate this Window width and Window Center/Level.
I asked this question on RadiAnt dicussion forum here. They gave me same formula.

am I doing mistake while finding minimum and maximum values from pixel data?
 

nicolas...@gmail.com

unread,
Apr 7, 2014, 12:20:29 PM4/7/14
to
As I told you before, the problem with your image is not about how to calculate the auto-level values. This image is like a screenshot and should not be CT as modality but rather Secondary Capture. An the following attributes should be removed as they are inconsistent with pixel data:
  • (0028,1050) [DS] WindowCenter: 50/300
  • (0028,1051) [DS] WindowWidth: 350/2000
  • (0028,1052) [DS] RescaleIntercept: -1024
  • (0028,1053) [DS] RescaleSlope: 1 
Removing those attributes will probably allow to display your image correctly in the viewers.

In DICOM ,there are several levels (Modality, VOI and PR) for computing the final pixel values (P-values). In this case, Modality and VOI LUTs have values that are not consistent with the pixel data (8-bit).

If you say that you get separately the pixel data and the metadata. So, those two pieces cannot go together!

Hemant Garg

unread,
Apr 23, 2014, 6:29:14 AM4/23/14
to dcm...@googlegroups.com
Hi Nicolas

I tried after removing these attributes and it worked well. Now I am able to see my Image in Viewer.

Here is another issue, As I am able to see WL/WW values at viewer, But when I look for all my DICOM tags attached to Image, I dont see WL/WW values in that.
It looks like viewer automatically generated/created these values for viewing purpose.

Is there any way/option to get/generate these values automatically when doing img2dcm?

I gone through img2dcm input/output options, but didnt understand, which option to pick for same.
Please help.

Thanks
Hemant Garg


On Monday, 7 April 2014 21:48:29 UTC+5:30, nicolas...@gmail.com wrote:
As I told you before, the problem with your image is not about how to calculate the auto-level values. This image is like a screenshot and should not be CT as modality but rather Secondary Capture. An the following attributes should be removed as they are inconsistent with pixel data:
  • (0028,1050) [DS] WindowCenter: 50/300
  • (0028,1051) [DS] WindowWidth: 350/2000
  • (0028,1052) [DS] RescaleIntercept: -1024
  • (0028,1053) [DS] RescaleSlope: 1 
Removing those attributes will probably allow to display your image correctly in the viewers.

In DICOM ,there are several levels (Modality, VOI and PR) for computing the final pixel values (P-values). In this case, Modality and VOI LUTs have values that are not consistent with the pixel data (8-bit).

If you say that you get separately the pixel data and the metadata. So, those two pieces cannot go together!

Reply all
Reply to author
Forward
0 new messages