3
votes

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
I'm not familiar with DICOM, but you just defined a point in 3D (x=100,y=0,z=0), what do you mean by a slice? If you try in matlab to 'size(image)' what do you get?bla

1 Answers

4
votes

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