Thanks Matthew!
On Wed, Feb 20, 2008 at 10:38:56AM +0000, Matthew Webster wrote:
> Hi,
> At the moment fslorient (slightly confusingly) will only set the
> s/qform if the codes are non-zero. For an image with zero s/q-form codes
> you have to first set them to non-zero (at which point the image will be
> assigned a "default" s-form and q-form ) and then set the s/q-form
> itself. We're considering changing the sets/q-form option so that it will
> automatically set the codes if unset ( and maybe some more messages
> explaining what operations have actually occured - setting defaults etc).
>
> Matthew
>
>> Hi,
>>
>> I had to convert a file from ANALYZE to NIFTI where the sform-analogue
>> transformation matrix came as a separate text file. I used
>> fslchfiletype
>> to convert the file into NIFTI and then thought to restore the
>> orientation information:
>>
>> Original status of conversion to NIFTI:
>>
>> hanke@feanor:/tmp$ fslhd anat.nii.gz |egrep '(to_xyz)|(form_code)'
>> qform_code 0
>> qto_xyz:1 0.898438 0.000000 0.000000 0.000000
>> qto_xyz:2 0.000000 1.000000 0.000000 0.000000
>> qto_xyz:3 0.000000 0.000000 1.421875 0.000000
>> qto_xyz:4 0.000000 0.000000 0.000000 1.000000
>> sform_code 0
>> sto_xyz:1 0.000000 0.000000 0.000000 0.000000
>> sto_xyz:2 0.000000 0.000000 0.000000 0.000000
>> sto_xyz:3 0.000000 0.000000 0.000000 0.000000
>> sto_xyz:4 0.000000 0.000000 0.000000 0.000000
>>
>> Text format matrix:
>>
>> hanke@feanor:/tmp$ cat mat.txt
>> 0.0000000e+00 0.0000000e+00 -1.4218750e+00 9.1160938e+01
>> -8.9843750e-01 0.0000000e+00 0.0000000e+00 1.3244922e+02
>> 0.0000000e+00 -1.0000000e+00 0.0000000e+00 1.2850000e+02
>> 0.0000000e+00 0.0000000e+00 0.0000000e+00 1.0000000e+00
>>
>> (Failing) Attempt to apply as sform matrix:
>>
>> hanke@feanor:/tmp$ fslorient -setsform $(cat mat.txt) anat.nii.gz
>> hanke@feanor:/tmp$ fslhd anat.nii.gz |egrep '(to_xyz)|(form_code)'
>> qform_code 0
>> qto_xyz:1 0.898438 0.000000 0.000000 0.000000
>> qto_xyz:2 0.000000 1.000000 0.000000 0.000000
>> qto_xyz:3 0.000000 0.000000 1.421875 0.000000
>> qto_xyz:4 0.000000 0.000000 0.000000 1.000000
>> sform_code 0
>> sto_xyz:1 0.000000 0.000000 0.000000 0.000000
>> sto_xyz:2 0.000000 0.000000 0.000000 0.000000
>> sto_xyz:3 0.000000 0.000000 0.000000 0.000000
>> sto_xyz:4 0.000000 0.000000 0.000000 0.000000
>>
>> Apparently an sform code != 0 is required:
>>
>> hanke@feanor:/tmp$ fslorient -setsformcode 1 anat.nii.gz
>> hanke@feanor:/tmp$ fslhd anat.nii.gz |egrep '(to_xyz)|(form_code)'
>> qform_code 1
>> qto_xyz:1 -0.898438 0.000000 -0.000000 0.000000
>> qto_xyz:2 0.000000 1.000000 -0.000000 0.000000
>> qto_xyz:3 0.000000 0.000000 1.421875 0.000000
>> qto_xyz:4 0.000000 0.000000 0.000000 1.000000
>> sform_code 1
>> sto_xyz:1 -0.898438 0.000000 0.000000 0.000000
>> sto_xyz:2 0.000000 1.000000 0.000000 0.000000
>> sto_xyz:3 0.000000 0.000000 1.421875 0.000000
>> sto_xyz:4 0.000000 0.000000 0.000000 1.000000
>>
>> However, this also changes the qform and sform matrices as well. But
>> with a proper sform code I can finally apply the matrix.
>>
>> hanke@feanor:/tmp$ fslorient -setsform $(cat mat.txt) anat.nii.gz
>> hanke@feanor:/tmp$ fslhd anat.nii.gz |egrep '(to_xyz)|(form_code)'
>> qform_code 1
>> qto_xyz:1 -0.898438 0.000000 -0.000000 0.000000
>> qto_xyz:2 0.000000 1.000000 -0.000000 0.000000
>> qto_xyz:3 0.000000 0.000000 1.421875 0.000000
>> qto_xyz:4 0.000000 0.000000 0.000000 1.000000
>> sform_code 1
>> sto_xyz:1 0.000000 0.000000 -1.421875 91.160934
>> sto_xyz:2 -0.898438 0.000000 0.000000 132.449219
>> sto_xyz:3 0.000000 -1.000000 0.000000 128.500000
>> sto_xyz:4 0.000000 0.000000 0.000000 1.000000
>>
>> This time the qform matrix remains unchanged.
>>
>>
>> I guess I still have difficulties to grasp all relations between qform
>> and sform, but it would be nice if fslorient would announce if it does
>> not/cannot do what it was told (or maybe even explain why).
>>
>>
>> Thanks,
>>
>> Michael
>>
>> --
>> GPG key: 1024D/3144BE0F Michael Hanke
>> http://apsy.gse.uni-magdeburg.de/hanke
>> ICQ: 48230050
>>
--
GPG key: 1024D/3144BE0F Michael Hanke
http://apsy.gse.uni-magdeburg.de/hanke
ICQ: 48230050
|