Hi Mark,
Here is what I tried, but did not work:
The actual volume that I'd like to (apply the) warp is input.nii.gz and my reference volume is named ref.nii.gz
Based on these two volumes, I created input and reference anchor volumes, each consisting of all zeros but values of "1" at the 4 anchor points. I named these volumes as
input-4pointanchor.nii.gz and ref-4pointanchor.nii.gz, respectively.
I created text files involcoords and refvolcoords, which include x,y,z (mm) coordinates of 4 anchor points (3-by-4 matrices, 3 rows 4 columns) for the input volume and reference volume, respectively. I put the corresponding points in the two volumes in the same order (i.e. point 1 (column 1) is left-eye center, point-2 is right eye-center, and so on... i.e. same order in both matrices).
I then ran these:
1) obtain the transformation matrix:
pointflirt -i involcoords -r refvolcoords -o pointflirtoutputmatrix_4pt --vox --invol=input-4pointanchor.nii.gz \
--refvol=ref-4pointanchor.nii.gz
2)apply the transformation matrix to the volume (and resample it in the ref volume space):
/opt/fsl-4.1.6/bin/flirt \
-in input.nii.gz \
-ref ref.nii.gz \
-out input_warpedpointflirt_4pt.nii.gz \
-applyxfm -init pointflirtoutputmatrix_4pt -interp trilinear
It did not work. The warped brain is way off... Is the above usage correct? Could you please help me out? I'd appreciate.
..
Unal
|