How can I place the cancerous area on the CT image and separate it into ROI and non-ROI?
3 views (last 30 days)
Show older comments
I have dicom file (body picture) and one cancerous area image detected in that body picture. How can I merge these cancerous regions with the dicom file? My second question is how can I do this automatically to 494 images?
Note: Since the dicom file could not be uploaded to this platform, I uploaded the body image as .jpg. How can I overlap dicom and jpg files together?
2 Comments
Joe Vinciguerra
on 6 Apr 2023
What do you mean when you say "merge", and what is the final output you want? For example, do you want a single image showing the CT and highlighting the ROI?
Accepted Answer
More Answers (2)
Image Analyst
on 6 Apr 2023
Start with the FAQ: https://matlab.fandom.com/wiki/FAQ#How_can_I_process_a_sequence_of_files?
It's a generic, general purpose demo of how to threshold an image to find blobs, and then measure things about the blobs, and extract certain blobs based on their areas or diameters.
0 Comments
Joe Vinciguerra
on 10 Apr 2023
Edited: Joe Vinciguerra
on 10 Apr 2023
With the files you provided, and no special toolboxes:
CT = imread("Body-CT.jpg"); % import the CT image
ROI = imread("ROI.jpg"); % import the ROI image
CT(end+1, :) = 0; % make the CT array the same size as the ROI array
ROIN = ROI / 255; % normaize to 1
ROIN = uint8(ROIN); % convert to an integer
RGB = CT; % initialize a variable for the merged image
RGB(:,:,2) = RGB(:,:,2) - RGB(:,:,2).*ROIN; % reduce the amount of green in the ROI
RGB(:,:,3) = RGB(:,:,3) - RGB(:,:,3).*ROIN; % reduce the amount of blue in the ROI
indx = and(ROIN, RGB(:,:,1) < 64); % find areas within the ROI where red is too dim
RGB(:,:,1) = RGB(:,:,1) + 64*uint8(indx); % increase red within the ROI where it is too dim
% imshow(RGB) % display the results if you want to
imwrite(RGB, "output.png") % save the output to a file
Now put this code in a FOR loop to process a batch of images, where the file name variables change accordinly.
Some of this code (where you see uint8, 255, 64) assumes your images are 8-bit. This would need to change based on the dynamic range of the images. Additionally, I'm not familiar with dicom files, so check out this: DICOM file format in medical imaging - MATLAB & Simulink (mathworks.com)
0 Comments
See Also
Categories
Find more on DICOM Format in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!