Borrar filtros
Borrar filtros

imshow index issues with display

1 visualización (últimos 30 días)
Pratik Samant
Pratik Samant el 26 de Abr. de 2017
Editada: Stephen23 el 26 de Abr. de 2017
I currently have a 423x27x501 3D grayscale image, which I want to view slice by slice. The image is stored in a variable called Cell.
I want imshow to show me the different slices of Cell along the 'xz' plane, so in this case each image would be a 423x501 image. If I want to view slices of the xy plane, I can simply write my code as follows
for i=1:27
figure(i)
imshow(Cell(:,:,i))
end
In each iteration of the above loop, Cell(:,:,i) is stored as a 453x27 uint8 variable, which is friendly to imshow.
However, if I do something similar for the xz plane,
for i=1:27
figure(i)
imshow(Cell(:,i,:))
end
Then instead I get an error complaining about the size of the image. In the second loop, Cell(:,i,:) is stored as a 453x1x501 uint8 variable, which confuses imshow because it thinks of this as a rank 3 tensor instead of a 2D matrix, even though it is essentially a plane.
So, is there a way to get my script to display the relevant planes via use of indexing? Or alternately is there a way to convert from a 453x1x501 variable to a 453x501 variable so that imshow can accept the input?
Thanks in advance!

Respuesta aceptada

Stephen23
Stephen23 el 26 de Abr. de 2017
Editada: Stephen23 el 26 de Abr. de 2017
"is there a way to convert from a 453x1x501 variable to a 453x501 variable"
squeeze(...)

Más respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by