How to display specified slice as an image?

19 visualizaciones (últimos 30 días)
Oah Joan
Oah Joan el 18 de Nov. de 2018
Editada: John Kelly el 15 de En. de 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 comentarios
Stephen23
Stephen23 el 20 de Nov. de 2020
Editada: John Kelly el 15 de En. de 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?
Rena Berman
Rena Berman el 15 de En. de 2021

(Answers Dev) Restored edit

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 18 de Nov. de 2018
Editada: Image Analyst el 18 de Nov. de 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

Más respuestas (0)

Categorías

Más información sobre Biomedical Imaging en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by