SPM counts its indices in the same way as MATLAB, starting at 1 (like an
elevator does), whereas the actual encoding in NIfTI is in the C convention,
starting and 0 (as you see in a British lift). Unless I have made a mistake
somewhere, this should be the same throughout SPM.
Apart from the imported images and flow fields generated by the DARTEL
toolbox, SPM only uses one of the matrices. When images are created by SPM,
both the sform and qform are set to encode the same transform (although some
qform transforms can not be exactly represented, and a warning message will
be generated). Images are written with their qform_code and sform_code both
set to 2.
When orientations are read, the sform is used in preference to the qform. If
the sform is not specified, then the qform is used. If qform is not
specified, then SPM assumes that images are stored axially and their
left-right is determined by spm_flip_analyze_images.
On Friday 13 March 2009 01:19, Bryce Wilkins wrote:
> Hi everyone,
> I have been evaluating SPM 5/8's compatibility with the NIfTI standard and
> am curious to know the extent that the different transformations qForm and
> sForm embedded in the NIfTI header (either .hdr or .nii file) are
> accommodated in SPM.
> When I display a NIfTI file that includes a header with only the *sForm*
> transformation, SPMs "Display" utility seems to display it correctly, and
> the origin reported is as expected, say at [128 104 30]. However, when I
> load the same image data with a header that includes only the *qForm*
> transformation, I find the origin (and thus voxel space/world space) is
> incorrect; e.g. the origin is now reported as [128 154 30]. It seems only
> the second co-ordinate is wrong.
> If I display my test data sets with MRIcroN or a NIfTI MATLAB toolbox, the
> origin is reported identical as expected in all cases.
> So, my question is, does SPM 5/8 only support one type of transformation,
> either sForm or qForm. Which one should be used?
> Is the above inconsistency a bug that needs to be fixed?
> Thank-you for any comments to help me understand and resolve this problem!