I'm experiencing a discrepancy in the display of DICOM images between MATLAB's imshow function and the Medical Image Labeling tool.

9 views (last 30 days)
I am new on MATLAB. I am encountering a discrepancy in the display of DICOM images between two MATLAB environments: the standard MATLAB workspace using the imshow function and MATLAB's Medical Image Labeling tool. Both tools are used within the same MATLAB session to visualize the same DICOM images. However, the images appear differently in terms of contrast, brightness, and overall visibility. The preprocessing of these images includes steps like Hounsfield Unit conversion, windowing, noise reduction (Gaussian filtering), intensity normalization, and resampling. After preprocessing, the images displayed using imshow appear as intended. However, when these preprocessed images are loaded into the Medical Image Labeling tool, there is a noticeable difference in their appearance. This variation complicates the process of consistently analyzing and labeling the images, as the same image presents differently in two MATLAB-based tools. I am looking for insights or solutions to ensure uniformity in image display across both environments, which is critical for accurate image analysis and processing.
  4 Comments
Ozlem
Ozlem on 23 Jan 2024
Edited: Ozlem on 23 Jan 2024
I attached unprocessed image. I am planning study with 2D roi therefore I use single slice only. Thank you very much for your time and help.

Sign in to comment.

Accepted Answer

Cris LaPierre
Cris LaPierre on 23 Jan 2024
Have you adjusted the Window Level and Window Width in the Medical Image Viewer App to match what you set in imshow?
When I open a medical image (uint16 xray) in a new app session, it seems to default to a level of 2048 and a width of 2048. Since a uint16 has pixel values ranging from 0 to 65535, this will make the contrast and brightness of the image appear different from a figure created using imshow(I,[]). The [] causes the figure to adjust the window width to the range of data in your image.
Since you have adjusted the image contrast, your resampledImage16 is likely using the full range of data (at least based on what I can see in the images you shared). Therefore, you will want to adjust the window level and window width settings in the Medical Image Labeler App to be 32768 and 65535 respectively to mimic what you see wtih imshow.
  2 Comments
Cris LaPierre
Cris LaPierre on 23 Jan 2024
Found something interesting. I needed to halve the window width in the Medical Image Labeler App to get it to appear the same as the Image Viewer App (screenshot below). I have passed that info along internally in case that is not the correct behavior.
For the image you shared, after running your code, I used a value of 32678 for both the level and width in the Medical Image Labeler App. When comparing preprocessedImage.dcm in the app with the figure created by imshow(resampledImage16,[]) the results looked the same.
Cris LaPierre
Cris LaPierre on 24 Jan 2024
Edited: Cris LaPierre on 24 Jan 2024
Final comment. Medical Image Labeler App will try to use the window center and width values in the metadata. However, the values in the metadata are for the original int16 image. Your preprocessing has convered it to a uint16 and applied histogram equalization. That means the original values are no longer valid for the new image.
I would suggest updating them in the metadata before writing your new dicom file. This will allow it to open with the same contrast and brightness as you specified in your code. Here is what the updated code might look like.
newDicomPath = 'preprocessedImageV2.dcm';
dicomInfo.WindowWidth = range(resampledImage16(:));
dicomInfo.WindowCenter = round(dicomInfo.WindowWidth/2);
dicomwrite(resampledImage16, newDicomPath, dicomInfo, 'CreateMode', 'Copy');

Sign in to comment.

More Answers (0)

Categories

Find more on DICOM Format in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!