imshow index issues with display
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Pratik Samant
le 26 Avr 2017
Modifié(e) : Stephen23
le 26 Avr 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!
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Image Processing Toolbox 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!