3D array permutation
2 ビュー (過去 30 日間)
古いコメントを表示
I have a 3D volume mask_GTV (256x256x137) and I want to plot 3 different slices: XY,YZ,XZ.
Currently I use permute [1 3 2] for the XZ plane for example.
G = permute(mask_GTV,[1 3 2));
contour(G(:,:,120),[.5 .5])
The dimensions in this plot are different from what I expect. I would expect this to be a 256x137 plot, but it is 137x256.
How can I plot the correct slice?
0 件のコメント
回答 (2 件)
James Tursa
2018 年 5 月 30 日
編集済み: James Tursa
2018 年 5 月 30 日
According to the doc for contour(Z), "... The x values correspond to the column indices of Z and the y values correspond to the row indices of Z ..."
So if you want the other order, do a different permute to account for it. E.g.,
G = permute(mask_GTV,[3 1 2));
0 件のコメント
Anton Semechko
2018 年 5 月 30 日
編集済み: Anton Semechko
2018 年 5 月 30 日
Suppose you have G, which is a Y-by-X-by-Z 3D array, then
i-th xy slice:
G_yx=G(:,:,i); % Y-by-X array
i-th xz slice:
G_xz=permute(G(i,:,:),[2 3 1]); % X-by-Z array
i-th yz slice:
G_yz=permute(G(:,i,:),[1 3 2]); % Y-by-Z array
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!