Equalize grayscale of two dicom images and subtract

4 views (last 30 days)
Hi,
I want to compare two dicom images, see figures below. I want to know whether there is a difference in size between the two 'circles'. To visualize this, I want to subtract the two images to see if a 'ring' remains (something like the figure below).
However the problem is that the two dicom images have a different grayscale. So therefore I first have to equalize the two grayscales. After that I can subtract the two images (I think...?).
I hope I explained clearly what I want to achieve, I am quite new to matlab. Hope someone can help. Thanks!!

Answers (1)

Priysha LNU
Priysha LNU on 24 Nov 2020
Hi,
You may use 'dicomread()' MATLAB function to read both image files into MATLAB. For detailed information of this function, you may refer to the following documentation link:
Read both images as:
Im1 = dicomread('Fig1.dcm');
Im2 = dicomread('Fig2.dcm');
Having read both the image files, you can then display the difference in images by:
imshow(Im2 - Im1);
This will show a single image with difference in pixels of the two input images.
You can also display following different types of errors in MATLAB:
(Im2 - Im1) % Errors
(Im2 - Im1).^2 % Squared Error
mean((Im2 - Im1).^2) % Mean Squared Error
RMSE = sqrt(mean((Im2 - Im1).^2)); % Root Mean Squared Error
Hope this helps!
DISCLAIMER: These are my own views and in no way depict those of MathWorks.
  2 Comments
Tain Neupane
Tain Neupane on 20 Apr 2023
Hi Priysha,
I am wondering if you have a folder with multiple dicom images (like CT/PET slices), how do you compare ? I mean how do you loop in? I need help with this! Thank you in advance!
-Tain

Sign in to comment.

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!