Mapping colored image on grayscale
显示 更早的评论
I have a gray scale image of brain and a colored tumor image. i want to map the tumor colored image on the gray scale image, can i do this???
i have used for loop for mapping but the result is http://imgur.com/UoYBK, but this is not correct i guess, how can this be corrected
8 个评论
abisha abisha
2020-5-11
how to get that colored tumor image. I want code to extract exact tumor region
Image Analyst
2020-5-11
Right click on the image below, then select "Save image as..."
abisha abisha
2020-5-11
how to retain pacreas superpixel canditates based on pancreas location. I need exact pancreas region segmentation code
Walter Roberson
2020-5-12
I need exact pancreas region segmentation code
There is no known way to get exact region segmentation based upon images. The big question is how to create algorithms that do better. In order to evaluate "better", you need to have some trial images that a medical professional has segmented already, so you can make predictions based upon your algorithm and compare the predictions to the "ground truth" to see how well you did.
"Ground truth" is never something that you can calculate. For example if you had a picture of a forest and your algorithm tried to determine species based upon branch and leaf color and shape and so on, then "ground truth" would be someone taking biological samples of the wood and the roots and doing DNA analysis to find out what the tree is really no matter what it looks like.
abisha abisha
2020-5-12
then, how to segment the pancreas image. give any idea
Image Analyst
2020-5-12
Go here to Vision Bibliography to search the Image Analysis article database for articles that discuss how to segment out various organs. There is a search link at the bottom where you can type in pancreas and get things like:
Hierarchical Framework for Automatic Pancreas Segmentation in MRI Using Continuous Max-Flow and Min-Cuts Approach,
ICIAR18(562-570).
abisha abisha
2020-5-13
编辑:Image Analyst
2020-5-13
Did you have any code related to pancreas cancer detection or diagnosis?
Image Analyst
2020-5-13
No, I've never done that.
回答(4 个)
I = imread('Brain.jpg');
Tumor = imread('Tumor.jpg');
ThresholdValue = 10; % You'll want to find the best value
mask = Tumor <= ThresholdValue;
figure,imshow(I),hold on
h = imshow(Tumor);
set(h,'AlphaData',double(~mask(:,:,1)))
Output image:

2 个评论
Sehrish
2012-7-24
Glad to help. I was playing around with it and 15 seems to be the best threshold value.
You could also use:
...
...
mask = Tumor >= ThresholdValue;
...
...
set(h,'AlphaData',double(mask(:,:,1)))
Image Analyst
2012-7-23
编辑:Image Analyst
2012-7-23
Segment the image, say, by thresholding the intensity to get a binary image of where the tumor is. Then multiply it by the original image to get an image of only the tumor. Then apply a colormap with the colormap() function. Something like (untested)
binaryImage = grayImage > thresholdValue; % You decide what thresholdValue is
maskedImage = uint8(binaryImage) .* grayImage;
imshow(maskedImage, []);
colormap(autumn(256));
With this case, binary image can be more general and sophisticated than the simple thresholding I showed here.
Or, you can simply do it with a colormap, like this:
thresholdValue = 130; % gray level where the colors start.
numberOfColorValues = 256 - thresholdValue + 1;
myColorMap = gray(256);
myColorMap(thresholdValue:end, :) = flipud(autumn(numberOfColorValues));
colormap(myColorMap);
colorbar;
Matt Kindig
2012-7-23
0 个投票
What do you want the resulting image to look like? Do you want the brain to render as gray, with the tumor shown in the flame-like colors? If so, you can follow this general approach:
1. Convert the brain image to RGB, using ind2rgb() with the original (gray) colormap.
2. Convert the tumor image to RGB, using ind2rgb() with the color (hot?) colormap.
3. Use logical indexing to identify all parts of the tumor image that are black (zeros).
4. Replace the brain image with the tumor image for those given pixels.
3 个评论
Walter Roberson
2012-7-23
I think you mean "replace the tumor image with the brain image for those given pixels"
Sehrish
2012-7-23
Image Analyst
2012-7-23
The second chunk of code in my answer will do that. But you need to say if the tumor can be simply be determined by intensity alone, or did you do something more to find it, like get rid of small regions, do hole filling, etc. If you didn't do anything fancy like that and it's simply based on intensity then my code will display it like you wanted. If you want to convert the colormapped image into a RGB image, then you can use ind2rgb(grayImage, myColorMap) to get the RGB image.
Walter Roberson
2012-7-23
0 个投票
You need scaling and alignment information, which it is not clear that you have. Is the assumption that the tumor and brain image are already scaled to the same size and are positioned at the same place in their images?
Once they are scaled and aligned, image() or imagesc() the two images into place. On the top image (the one with the tumor), set the AlphaData to 0 for each pixel where the grayscale image is to show through.
类别
在 帮助中心 和 File Exchange 中查找有关 Neuroimaging 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!