MATLAB: Rotate DICOM data 90 degrees through central axis

dicomreaddicomwriteimage processingImage Processing Toolbox

Hi, I have 300 DICOM 512×512 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;

Best Answer

doc permute
would be the easiest.