Skip to content

Histology atlas has inconsistent origin #52

@mguaypaq

Description

@mguaypaq

Following #6, #7, #8, the histology atlas now has a consistent orientation and pixdim, but 2 of the 7 images have a different origin. As a result, opening the files in fsleyes gives a warning:

Images have different orientations/fields of view - alignment/orientation labels may be incorrect!

Specifically, the affine matrix these 5 files is:

PAM50_200um_AVF.nii.gz
PAM50_200um_Eccentricity.nii.gz
PAM50_200um_EquivDiameter14.nii.gz
PAM50_200um_EquivDiameter48.nii.gz
PAM50_200um_MVF.nii.gz

array([[  -0.19907407,    0.        ,    0.        ,   10.65227222],
       [   0.        ,    0.19879518,    0.        ,  -53.37294388],
       [   0.        ,    0.        ,    0.5       , -184.49050903],
       [   0.        ,    0.        ,    0.        ,    1.        ]])

And the affine matrix for these 2 files is:

PAM50_200um_EquivDiameter.nii.gz
PAM50_200um_Naxons.nii.gz

array([[  -0.19907407,    0.        ,    0.        ,   10.70833302],
       [   0.        ,    0.19879518,    0.        ,  -53.42833328],
       [   0.        ,    0.        ,    0.5       , -184.34002686],
       [   0.        ,    0.        ,    0.        ,    1.        ]])

In terms of voxels, the shift between the two origins of these coordinate systems is approx 0.3 voxels:

>>> (10.65227222 - 10.70833302) / -0.19907407  # x dimension
0.28160774529801463
>>> (-53.37294388 - -53.42833328) / 0.19879518  # y dimension
0.2786254676798286
>>> (-184.49050903 - -184.34002686) / 0.5  # z dimension
-0.30096434000000727

Since I wrote this old comment, I now know how to use nibabel to do pretty much any resampling we want, as long as I know:

  • the desired resolution in each dimension (so, it could be exactly 0.2x0.2x0.5mm as previously discussed),
  • the origin we want to use (which one?),
  • the data array size (currently it's 108x83x205 voxels, but I could also round up to fully cover the current field of view).

Also, I should probably resample starting from the earlier, high-resolution images, rather than the current already-resampled images.

After doing this, what would be the steps to update everything downstream (for example, in SCT)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions