Dear Stephen,
We haven't tried very hard to be consistent about this issue, as there is no really "correct" solution and if you have a method that relies on the rounding/truncating behaviour then it is likely to be quite unrobust. I would say that if you want to be very careful then you should calculate the floating-point version of the mm coordinate and then convert to the "closest" integer coordinate by your own method or, even better, interpolate the image at the non-integer coordinate value.
All the best,
Mark
On 11 Apr 2013, at 21:28, Stephen Towler <[log in to unmask]> wrote:
> Hi FSL experts,
>
> Am I experiencing a strange local bug, or is it expected that fslview
> and fslmeants may differ in how they translate mm coordinates to voxel
> coordinates?
>
> For a native-space RPI NIFTI test image (fslhd output below), fslview
> translates mm 0, 0, 0 to voxel 24, 27, 40. fslmeants disagrees,
> translating it to voxel 25, 28, 40.
>
> Digging deeper I see that the voxel output from std2imgcoord is 24.5,
> 27.6122, 40.1939. Truncating those produces the fslview coordinates,
> while rounding them produces the fslmeants coordinate.
>
> FWIW, AFNI's GUI and 3dmaskdump agree with each other, while
> disagreeing with both fslview and fslmeants (screenshot:
> http://goo.gl/oYYco ).
>
> No problems with voxel->mm for this image.
>
> Any ideas?
>
> Thank you,
> Stephen
>
>
> Neurodebian FSL 5.0.2 on 3.2.0-39-generic #62-Ubuntu SMP Thu Feb 28
> 00:28:53 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
>
> filename /tmp/run1_mosaic_pipeline1.nii.gz
>
> sizeof_hdr 348
> data_type INT16
> dim0 4
> dim1 50
> dim2 74
> dim3 74
> dim4 71
> dim5 1
> dim6 1
> dim7 1
> vox_units mm
> time_units s
> datatype 4
> nbyper 2
> bitpix 16
> pixdim0 0.0000000000
> pixdim1 3.0000000000
> pixdim2 2.9729728699
> pixdim3 2.9729728699
> pixdim4 5.8000001907
> pixdim5 0.0000000000
> pixdim6 0.0000000000
> pixdim7 0.0000000000
> vox_offset 352
> cal_max 0.0000
> cal_min 0.0000
> scl_slope 1.000000
> scl_inter 0.000000
> phase_dim 0
> freq_dim 0
> slice_dim 0
> slice_name Unknown
> slice_code 0
> slice_start 0
> slice_end 0
> slice_duration 0.000000
> time_offset 0.000000
> intent Unknown
> intent_code 0
> intent_name
> intent_p1 0.000000
> intent_p2 0.000000
> intent_p3 0.000000
> qform_name Scanner Anat
> qform_code 1
> qto_xyz:1 -3.000000 0.000000 -0.000000 73.500000
> qto_xyz:2 0.000000 2.972973 -0.000000 -82.090347
> qto_xyz:3 0.000000 0.000000 2.972973 -119.495377
> qto_xyz:4 0.000000 0.000000 0.000000 1.000000
> qform_xorient Right-to-Left
> qform_yorient Posterior-to-Anterior
> qform_zorient Inferior-to-Superior
> sform_name Scanner Anat
> sform_code 1
> sto_xyz:1 -3.000000 0.000000 0.000000 73.500000
> sto_xyz:2 0.000000 2.972973 0.000000 -82.090347
> sto_xyz:3 0.000000 0.000000 2.972973 -119.495377
> sto_xyz:4 0.000000 0.000000 0.000000 1.000000
> sform_xorient Right-to-Left
> sform_yorient Posterior-to-Anterior
> sform_zorient Inferior-to-Superior
> file_type NIFTI-1+
> file_code 1
> descrip FSL5.0
> aux_file
|