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