Azzera filtri
Azzera filtri

imshow index issues with display

1 visualizzazione (ultimi 30 giorni)
Pratik Samant
Pratik Samant il 26 Apr 2017
Modificato: Stephen23 il 26 Apr 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!

Risposta accettata

Stephen23
Stephen23 il 26 Apr 2017
Modificato: Stephen23 il 26 Apr 2017
"is there a way to convert from a 453x1x501 variable to a 453x501 variable"
squeeze(...)

Più risposte (0)

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by