0001 function [outHeader] = GE_reorientHeader(inHeader, orient)
0002
0003
0004 outHeader = inHeader;
0005
0006
0007 nX = inHeader.dim(2);
0008 nY = inHeader.dim(3);
0009 nZ = inHeader.dim(4);
0010 pX = inHeader.pixDim(2);
0011 pY = inHeader.pixDim(3);
0012 pZ = inHeader.pixDim(4);
0013
0014
0015
0016
0017
0018 switch orient
0019 case 0
0020 fprintf('Orientation is undefined. Check your images!');
0021
0022 case {1, -1}
0023 outHeader.dim(2) = nZ;
0024 outHeader.dim(3) = nX;
0025 outHeader.dim(4) = nY;
0026 outHeader.pixDim(2) = pZ;
0027 outHeader.pixDim(3) = pX;
0028 outHeader.pixDim(4) = pY;
0029
0030 case {2, -12}
0031 outHeader.dim(2) = nX;
0032 outHeader.dim(3) = nY;
0033 outHeader.dim(4) = nZ;
0034 outHeader.pixDim(2) = pX;
0035 outHeader.pixDim(3) = pY;
0036 outHeader.pixDim(4) = pZ;
0037
0038 case {3, -3}
0039 outHeader.dim(2) = nX;
0040 outHeader.dim(3) = nZ;
0041 outHeader.dim(4) = nY;
0042 outHeader.pixDim(2) = pX;
0043 outHeader.pixDim(3) = pZ;
0044 outHeader.pixDim(4) = pY;
0045
0046 end
0047
0048
0049 outHeader.originator = [floor(outHeader.dim(2)/2) floor(outHeader.dim(3)/2) floor(outHeader.dim(4)/2) 0 0];
0050
0051 return