MATLAB Answers

Rotate DICOM data 90 degrees through central axis

24 views (last 30 days)
Hi, I have 300 DICOM 512x512 coronal images (through the top of the head, forming a plane parallel to the ground) which I would like to rotate such that they form 512 images in the sagittal plane (images parallel to the plane bisecting the nose and perpendicular to the ground). I have attempted reading the 300 images in using dicomread() to form a 3D array, and then writing the images using dicomwrite() along one of the faces perpendicular to the face defined by the images (see code below). However, this results in incorrectly written DICOM files and a loss of data. I'd appreciate any help you can offer. If this rotation is not possible using MATLAB, could any one suggest an alternative method? Thanks! slice=zeros(512,512); I=zeros(245,512); for i=1:512 for j=245:-1:1 slice=dicomread(['vhm' int2str(j) '.dcm']); I(246-j,:)=slice(:,j); end; dicomwrite(I,['SLICE' int2str(i) '.dcm']) end;

  0 Comments

Sign in to comment.

Accepted Answer

Sean de Wolski
Sean de Wolski on 28 Feb 2011
doc permute
would be the easiest.

  2 Comments

Roman Hochuli
Roman Hochuli on 28 Feb 2011
Could you elaborate a bit please? Does the method you suggest preserve slice thickness information when using dicomwrite()?
Sean de Wolski
Sean de Wolski on 28 Feb 2011
1) Read your data in using dicomread, you'll have a 3-dimensional image volume.
2) Permute it so the sagittal plane using 'permute'. (ps. isn't the plane parallel to the ground the transverse plane?) http://en.wikipedia.org/wiki/Sagittal_plane
3) I don't know how to preserve the slice thickness after the permute but it will just be a permutation of the various thicknesses you already have. I think the tools you want to do this are on the File Exchange from Dirk Jan-Kroon. He has an extensive dicom manipulation toolbox that will allow you to write whole thing as a 3-d volume etc.
http://www.mathworks.com/matlabcentral/fileexchange/29145-dicom-tags-read-and-write
http://www.mathworks.com/matlabcentral/fileexchange/27941-dicom-toolbox

Sign in to comment.

More Answers (1)

Jeff
Jeff on 1 Mar 2011
I haven't attempted this but my initial thought is to first read all coronal slice data into a 3d matrix. Then if you want to view the data in the transverse plane simple reconstruct the image by displaying the data in each row and column. For example, read in the data as
Y - ant to post
Z - sup to inf data
X - lt to right data
The only other issue I can think of the slice thickness corrections. Perhaps you could interpolate after reading in the data so that the distance between all data points is consistent. In other words, you turn your 512x512xX, where X is the number of coronal slices into a 512x512x512 matrix.
Jeff

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!