Just popping in to try to clarify what @valosekj is referring to by the above quote.
We’re coming from the world of NIFTI1 images, nibabel
, and FSL (specifically tools like the FSLeyes image viewer and fslhd
). As far as I understand:
- For
nibabel
and FSL, affine matrices are assumed to always map the voxel array to RAS+ world space. - However, in voxel space, the array can be “reoriented” (i.e. axes transposition and inversion). For FSL, this can be done with
fslswapdim
. In order to preserve the “always maps to RAS+” assumption, if the data array is changed, then the affine will be changed in kind. - The tool
fslhd
reports the header information in NIFTI1 image files. Part of the output information is the axis ordering corresponding to the qform/sform affine matrices. For example, on a sample image I’ve picked out, the command reports:sto_xyz:1 0.000000 0.000000 1.000000 -32.219284 sto_xyz:2 -1.000000 0.000000 0.000000 31.786606 sto_xyz:3 0.000000 1.000000 0.000000 -19.321671 sto_xyz:4 0.000000 0.000000 0.000000 1.000000 sform_xorient Anterior-to-Posterior sform_yorient Inferior-to-Superior sform_zorient Left-to-Right
- Because of this information, our lab will refer to such images in shorthand as “AIL-/PSR+ images”. In other words, for this example image, the voxel-space array has an orientation associated with it (
0 = x = AP
,1 = y = IS
,2 = z = LR
), but only because of the inherent assumption that the affine will always map to RAS+ physical space.- Side note: This can be intuited via the above affine. The
-1
in the first column flips the so-called “PSR+ image” to be ASR+, and the non-diagonal matrix reorients the axes from ASR+ to RAS+. This kind of intuition is part of why we find it helpful to describe voxel space in physical terms.
- Side note: This can be intuited via the above affine. The
- ((For reference, the reason why we describe images in “voxel space terms” is because we do a lot of Python-based image processing where we operate directly on the array using tools such as
numpy
,skimage
,scipy
,dipy
, etc. Since we process the array using tools that ignore the context of the image header, it is important for us to know which array axes map to which physical axes (which then get universally transformed into RAS+ physical coordinates by the affine matrix).))
So, I suppose what @valosekj is truly asking is:
- Assuming the images have an affine that universally maps the array to RAS+ physical coordinates, does axis order matter in voxel space?
- In other words, will “reorienting” the image in voxel space (i.e. modifying the data array + header in tandem) make any difference for
pyradiomics
, given the assumption that the affine will always map the array to RAS+?
Kind regards,
Joshua