I have a MATLAB program that reads a 256x256x190 NIFTI image, processes it to get 4D image data, and writes the resulting 4D data out as a binary file of floating point vales. I’m then trying to use an AFNI program to convert the binary file to a NIFTI image with the same geometry and orientation as the original 3D NIFTI image, with the exception of being 4D rather then 3D. This seems like it should be a simple thing to do, and to3d almost works, but it’s not setting the orientation properly. I’ve looked through the AFNI command line documentation, and I haven’t found any solution, so any help would be appreciated. The ‘to3d’ command I’m trying to use and the input and resulting image formats are shown below. Thanks in advance!
Cheers,
Steve
$ to3d -prefix newImg.nii -datum float -time:zt 190 3 4000 seqplus -geomparent parentIm.nii 3Df:0:0:256:256:570:temp.bin
$ 3dinfo parentIm.nii
…
Geometry String: “MATRIX(0.997633,-0.002181,-0.069076,-125.4405,0.01053,-0.982863,0.184971,64.55254,0.067951,0.184325,0.985491,-101.1443):256,256,190”
Data Axes Tilt: Oblique (11.330 deg. from plumb)
Data Axes Approximate Orientation:
first (x) = Right-to-Left
second (y) = Posterior-to-Anterior
third (z) = Inferior-to-Superior [-orient RPI]
R-to-L extent: -125.440 [R] -to- 129.560 [L] -step- 1.000 mm [256 voxels]
A-to-P extent: -190.447 [A] -to- 64.553 [P] -step- 1.000 mm [256 voxels]
I-to-S extent: -101.144 [I] -to- 88.815 [S] -step- 1.005 mm [190 voxels]
Number of values stored at each pixel = 1
– At sub-brick #0 ‘?’ datum type is short
$ 3dinfo newImg.nii
…
Geometry String: “MATRIX(1,0,0,-125.4405,0,-1,0,64.55254,0,0,1.005076,-101.1443):256,256,190”
Data Axes Tilt: Plumb
Data Axes Orientation:
first (x) = Right-to-Left
second (y) = Posterior-to-Anterior
third (z) = Inferior-to-Superior [-orient RPI]
R-to-L extent: -125.440 [R] -to- 129.560 [L] -step- 1.000 mm [256 voxels]
A-to-P extent: -190.447 [A] -to- 64.553 [P] -step- 1.000 mm [256 voxels]
I-to-S extent: -101.144 [I] -to- 88.815 [S] -step- 1.005 mm [190 voxels]
Number of time steps = 3 Time step = 4.00000s Origin = 0.00000s Number time-offset slices = 190 Thickness = 1.005
– At sub-brick #0 ‘?’ datum type is float: 0 to 2268.57
– At sub-brick #1 ‘?’ datum type is float: 0 to 3830.46
– At sub-brick #2 ‘?’ datum type is float: -1 to 1.68638e-19