Matlab DICOM切片 [英] Matlab DICOM Slices
问题描述
我在matlab中将DICOM图像作为矩阵加载。我的问题是,如何在每个正交方向上显示该图像的特定切片?
I have a DICOM image loaded as a matrix in matlab. My question is, how do I show specific slices of that image in each orthogonal direction?
与位置100处的视图切片x类似,y = 0,z = 0
Like view slice x at position 100, y=0, z=0
推荐答案
如果您的矩阵是M,并且有d维(3,或者你有什么)并且你想要绘制1-D然后是其中一个维度的切片:
If your matrix is M, and has d dimensions (3, or what have you) and you want to plot a 1-D "slice" of one of the dimensions then:
plot(squeeze(M(n1,n2, ...,:,...));
其中n1,n2,...是维x的位置, y,...你要切片的地方,而操作符(:)是你要绘制的尺寸。
where n1,n2,... are the positions of dimension x,y,... where you want to slice, and the operator (:) is the dimension you want to plot.
例如,给定5维矩阵M = rand(10,10,10,10,10),让我们围绕某些点切割第4维(x = n1,y = n2等等)
for example, given a 5 dimensional matrix M=rand(10,10,10,10,10), lets slice the 4-th dimension around some points (x=n1, y=n2, etc...)
M=rand(10,10,10,10,10);
n1=4; n2=7; n3=3; n5=5;
plot(squeeze(M(n1,n2, n3, :, n5)));
如果切片是2-D然后你可以使用imshow或imagesc来显示2-D切片,例如显示2-n和4 -th dimension:
If the slice is 2-D then you can use imshow or imagesc to show the 2-D slice, for example showing the 2-nd and 4-th dimension:
imagesc(squeeze(M(n1,:,n3,:,n5)))
这篇关于Matlab DICOM切片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!