volxelsize to nifiti header
Brought to you by:
dr_bazz
Hello,
please consider this patch for outputting the voxel size (as created by M. Raemaekers) in the nifti-header:
--- old/convert_r2a.m 2009-10-12 10:29:07.000000000 +0200
+++ new/convert_r2a.m 2014-12-05 16:31:52.000000000 +0100
@@ -548,7 +548,7 @@
%use smallest in plane resolution...
[lXmm,lYmm]=SetLarger (lXmm,lYmm);
lZmm = pars.fov_apfhrl(2)/pars.dim(3);
-
+ realvoxsize=[lXmm,lYmm,lZmm];
case '2' %sagittal
lmm= [ 0 0 -1 0;
1 0 0 0;
@@ -559,6 +559,7 @@
%use smallest in plane resolution...
[lYmm,lZmm]=SetLarger(lYmm,lZmm);
lXmm = pars.fov_apfhrl(3)/pars.dim(3);
+ realvoxsize=[lYmm,lZmm,lXmm];
case '3' %coronal
@@ -571,6 +572,7 @@
%use smallest in plane resolution...
[lXmm,lZmm]=SetLarger (lXmm,lZmm);
lYmm = pars.fov_apfhrl(1)/pars.dim(3);
+ realvoxsize=[lXmm,lZmm,lYmm];
end
@@ -578,7 +580,7 @@
0 lYmm 0 0;
0 0 lZmm 0;
0 0 0 1];
-realvoxsize=[lXmm,lYmm,lZmm]; % return argument, used to fill in pixdim nifti header info
+%realvoxsize=[lXmm,lYmm,lZmm]; % return argument, used to fill in pixdim nifti header info
patient_to_tal = diag([-1 -1 1 1]);
analyze_to_dicom = diag([1 -1 1 1]);
A_tot=patient_to_tal*R_tot*Zm*lmm*analyze_to_dicom;