Fusion of colour PET /MRI image of brain

18 次查看(过去 30 天)
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 个评论
doaa yehia
doaa yehia 2022-11-26
the image i download not GIF it is png from this link (http://www.med.harvard.edu/AANLIB/cases/caseNN1/dg1/015.png)
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!

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 个评论
Walter Roberson
Walter Roberson 2022-10-28
If you image() or imagesc() a grayscale image then matlab will assume that it is pseudocolor and will display it using the current colormap, which is typically a color one. imshow() is a convenience function that uses image() to display the image but also automatically activates colormap gray() when passed 2d arrays.
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)

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by