Fusion of colour PET /MRI image of brain

조회 수: 18(최근 30일)
doaa yehia
doaa yehia 2022년 10월 28일
편집: DGM 2022년 11월 26일
I have download PET image from this site ( http://www.med.harvard.edu/AANLIB/home.html ) it seems to be color image but in matlab it is gray image so I use this command in matlab to display it :
imshow('C:\myfolder\image.png')
then it appeared colored. my question : after making fusion of PET with MRI image how to display the color fused image

채택된 답변

DGM
DGM 2022년 10월 28일
편집: DGM 2022년 10월 29일
If you call imshow() and directly give it the path to an indexed-color image, it's smart enough to use the colormap from the file instead of gray() or the default axes colormap.
Considering that many of these images I'm seeing on this page are GIF files, that will be what's happening. These are indexed-color images. In order to combine them, you'll convert them to RGB images. Once that's done, there are multiple ways they can be combined.
Let's consider the two images:
You could combine them with imfuse(), but as mentioned, you'll need to convert to RGB first. That said, the only thing it can do is a non-adjustable 50% opacity blend. Its other modes are likely unsuitable for the task of combining color images like these.
% use imfuse()
[mrpict mrmap] = imread('mr-007.gif');
[tcpict tcmap] = imread('tc-007.gif');
% convert images to RGB
mrpict = ind2rgb(mrpict,mrmap);
tcpict = ind2rgb(tcpict,tcmap);
% fuse the images using imfuse()
% this is just the arithmetic mean (50% opacity) and is not adjustable
outpict = imfuse(mrpict,tcpict,'blend');
imshow(outpict)
If alpha compositing suffices, but you just want a different opacity parameter (other than 50%), then you can just do that. Bear in mind that since this is still just a weighted average and the images are largely black, the contributions from the two images will appear darkened.
% do basic adjustable alpha compositing
[mrpict mrmap] = imread('mr-007.gif');
[tcpict tcmap] = imread('tc-007.gif');
% convert images to RGB
mrpict = ind2rgb(mrpict,mrmap);
tcpict = ind2rgb(tcpict,tcmap);
% do simple scalar alpha blending
alpha = 0.6;
outpict = alpha*tcpict + (1-alpha)*mrpict;
imshow(outpict)
More likely, the task is some form of image blending. Consider the following examples.
% do basic image blending
[mrpict mrmap] = imread('mr-007.gif');
[tcpict tcmap] = imread('tc-007.gif');
% convert images to RGB
mrpict = ind2rgb(mrpict,mrmap);
tcpict = ind2rgb(tcpict,tcmap);
% linear dodge blend
% this is basic addition
op1 = tcpict + mrpict;
% screen blend
% this is the complement of multiplication
op2 = 1-(1-tcpict).*(1-mrpict);
% lighten blend
% this a simple relational
op3 = max(tcpict,mrpict);
% maleki dodge blend
% similar to linear dodge, but more emphasis for dark FG regions
op4 = sqrt(tcpict) + (1-tcpict).*mrpict;
% combine images for easy viewing
outpict = [op1 op2; op3 op4];
imshow(outpict)
Take note that the math in the above examples is simplified by the fact that the two RGB arrays are unit-scale floating point. If they were integer-class or if the class could not be known beforehand, those calculations would become more complicated.
  댓글 수: 4
DGM
DGM 2022년 11월 26일
편집: DGM 2022년 11월 26일
Yeah. That's also an indexed color image. While GIF only supports indexed color, PNG supports a lot of things. It just so happens that PNG also supports indexed color.
If you run into PNGs which are truecolor RGB instead of indexed, you might have to handle them differently. If that's a possibility, you can check to see if the incoming colormap is empty. If that's the case, you can conditionally skip the ind2rgb() conversion and instead prepare the RGB image using im2double().

댓글을 달려면 로그인하십시오.

추가 답변(2개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2022년 10월 28일
편집: KALYAN ACHARJYA 2022년 10월 28일
Important Note: Color is just an perception (Human Eye), color may vary person to person (minor changes in color contrast) There are naturally infinite (much more) colors. Simply load the images, if the image contains a single plane, it is considered a gray image (regardless of any color shades).
data=imread('image_file_name')
% file name with extension if the image in same current working directory
% Otherwise put the complete path, example
# Example- Gray Image
>> data=imread('1.jpg');
>> whos data
Name Size Bytes Class Attributes
data1 720x1280 921600 uint8
On the other hand, in color images, you can see multiple planes (RGB cases - 3 planes), and there can be more high dimensional images.
>> data=imread('1.jpg');
>> whos data
Name Size Bytes Class Attributes
data 720x1280x3 2764800 uint8
Hence dont go by eye perception, just see the mathamatical background, maths never lies. On the other hand teh image fusion is different issue, you can fuse two images in multiple ways, please see imfuse function.
https://in.mathworks.com/help/images/ref/imfuse.html
Hope I understand the question. Expert members please confirm!
  댓글 수: 1
doaa yehia
doaa yehia 2022년 11월 26일
Thank you very much. I found the answer very helpful

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2022년 10월 28일
Which image from http://www.med.harvard.edu/AANLIB/home.html did youi download? If it's gray scale in MATLAB, then it should not display as colored unless you applied a colormap to it with the colormap() function or with the 'Colormap' option of imshow().
  댓글 수: 2
doaa yehia
doaa yehia 2022년 11월 26일
i download this image MRI (http://www.med.harvard.edu/AANLIB/cases/caseNN1/mr1/015.png) ,and this PET image (http://www.med.harvard.edu/AANLIB/cases/caseNN1/dg1/015.png)

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by