Matlab DICOM Slices

南笙酒味 提交于 2019-12-21 19:57:01

问题


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?

Like view slice x at position 100, y=0, z=0


回答1:


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, ...,:,...));

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.

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)));

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)))


来源:https://stackoverflow.com/questions/12876961/matlab-dicom-slices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!