I have an image A which is
A = dicomread ('HYP-P-040.MR.ALL_PHYSICS_JAMESO.0004.0001.2019.12.11.14.31.46.328125.178069209.IMA'); %T2Axial image
and image B which is
B= dicomread('metab1_dyn=0001_slice=0001.IMA'); %metabolite 1
How can i overlay image B on A with transparency.
Both Image is attached for reference.
Please provide support.

 採用された回答

Image Analyst
Image Analyst 2020 年 11 月 4 日

1 投票

Try this:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 18;
fprintf('Beginning to run %s.m ...\n', mfilename);
A = dicomread ('HYP-P-040.MR.ALL_PHYSICS_JAMESO.0004.0002.2019.12.11.14.31.46.328125.178068929.IMA'); %T2Axial image
subplot(2, 2, 1);
imshow(A, [], 'Colormap', gray(256))
B = dicomread('metab1_dyn=0001_slice=0001.IMA'); %metabolite 1
subplot(2, 2, 2);
imshow(B, [], 'Colormap', gray(256))
[rowsa, colsa, numberOfColorChannelsa] = size(A)
[rowsb, colsb, numberOfColorChannelsb] = size(B)
if rowsa ~= rowsb || colsa ~= colb
B = imresize(B, [rowsa, colsa], 'nearest');
end
subplot(2, 2, 3);
% Get RGB image
cmap = jet(256);
rgbImage = ind2rgb(uint8(255 * mat2gray(B)), cmap);
imshow(rgbImage, []);
% Put both images into subplot
subplot(2, 2, 4);
ha = imshow(A, [], 'Colormap', gray(256))
hold on;
hb = imshow(rgbImage)
% Set opacity/transparency to something less than 1 (alpha).
% 1 is the default and it means the last image is opaque and the image below can't be seen.
hb.AlphaData = 0.4;

2 件のコメント

Medical Imaging
Medical Imaging 2020 年 11 月 5 日
Thank you so much. Yes it is working, I just wonder why I am getting a bit wierd result.
Medical Imaging
Medical Imaging 2020 年 11 月 5 日
I got it now. This is working perfectly fine. Thank you.

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2020 年 11 月 3 日

0 投票

5 件のコメント

Medical Imaging
Medical Imaging 2020 年 11 月 3 日
I did not get the clear picture of doing this using the mentioned links.
Image Analyst
Image Analyst 2020 年 11 月 3 日
I'm not able to use your code to open your images. Are you sure you attached the right files and right code to read them in?
Medical Imaging
Medical Imaging 2020 年 11 月 3 日
Ahh sorry. mentioned different image.
Image A is:
A = dicomread ('HYP-P-040.MR.ALL_PHYSICS_JAMESO.0004.0002.2019.12.11.14.31.46.328125.178068929.IMA'); %T2Axial image
and image B is
B= dicomread('metab1_dyn=0001_slice=0001.IMA'); %metabolite 1
Image Analyst
Image Analyst 2020 年 11 月 3 日
They aren't even the same size, so how do you want to overlay them? Resize B to match A?
A = dicomread ('HYP-P-040.MR.ALL_PHYSICS_JAMESO.0004.0002.2019.12.11.14.31.46.328125.178068929.IMA'); %T2Axial image
subplot(2, 2, 1);
imshow(A, [])
B = dicomread('metab1_dyn=0001_slice=0001.IMA'); %metabolite 1
subplot(2, 2, 2);
imshow(B, [])
Medical Imaging
Medical Imaging 2020 年 11 月 4 日
yes be resizing the image and overlay with some color map.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File 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