フィルターのクリア

imshow index issues with display

1 回表示 (過去 30 日間)
Pratik Samant
Pratik Samant 2017 年 4 月 26 日
編集済み: Stephen23 2017 年 4 月 26 日
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!

採用された回答

Stephen23
Stephen23 2017 年 4 月 26 日
編集済み: Stephen23 2017 年 4 月 26 日
"is there a way to convert from a 453x1x501 variable to a 453x501 variable"
squeeze(...)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by