How to display specified slice as an image?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Oah Joan
le 18 Nov 2018
Modifié(e) : John Kelly
le 15 Jan 2021
Matlab has some data from an MRI scan built-in.
I can load it in 3 lines:
load mri; %load the sample data from Mathworks
D = double(squeeze(D));
D=D/max(D(:)); %Normalize to 0-1 range
So what I find that D has size 128 128 27
How can I write a function showslice(MRIdata, slice) that displays the specified slice as an image?
2 commentaires
Stephen23
le 20 Nov 2020
Modifié(e) : John Kelly
le 15 Jan 2021
Original question on 18 Nov 2018:
How to display specified slice as an image?
Matlab has some data from an MRI scan built-in.
I can load it in 3 lines:
load mri; %load the sample data from Mathworks
D = double(squeeze(D));
D=D/max(D(:)); %Normalize to 0-1 range
So what I find that D has size 128 128 27
How can I write a function showslice(MRIdata, slice) that displays the specified slice as an image?
Réponse acceptée
Image Analyst
le 18 Nov 2018
Modifié(e) : Image Analyst
le 18 Nov 2018
Try this
fontSize = 16;
load mri; %load the sample data from Mathworks
D = double(squeeze(D));
D=D/max(D(:)); %Normalize to 0-1 range
maxValue = max(D(:))
for k = 1 : size(D, 3)
thisSlice = D(:, :, k);
subplot(5, 6, k);
imshow(thisSlice, [0, maxValue]);
caption = sprintf('Slice #%d', k);
title(caption, 'FontSize', fontSize);
drawnow;
end
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195605/image.png)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur MRI dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!