Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible affine matrix for normalized images #55

Open
nbeliy opened this issue Nov 4, 2022 · 4 comments
Open

Incompatible affine matrix for normalized images #55

nbeliy opened this issue Nov 4, 2022 · 4 comments
Assignees

Comments

@nbeliy
Copy link

nbeliy commented Nov 4, 2022

Dear developpers,
I remarked that all normalized images produced by hMRI toolbox has the affine matrix:

1 0 0 -78
0 1 0 -112
0 0 1 -70
0 0 0 1

while the MNI152 template (including the one shipped with hMRI toolbox) has:

-1 0 0 90
0 1 0 -126
0 0 1 -72
0 0 0 1

It happens in normalized masks after cegmentation (wc* and mwc*) and maps after dartell->normalisation.

If this mismatch is important and should I worry?
It made FSLeyes produce a warning, which lead to discovery of this issue.

@lukeje
Copy link
Member

lukeje commented Nov 6, 2022

Hi Nikita,

Do you have a minimal example that reproduces this problem?
Also, is this the sform or the qform transform (and are they different)?

As far as I know we just use SPM functions under the hood, so perhaps it's worth checking whether the same thing happens when you use SPM12 directly.

@ChristophePhillips ChristophePhillips self-assigned this Nov 8, 2022
@ChristophePhillips
Copy link
Contributor

Hi both,

Here is my take on this:

  • the sign difference in the 1st row (1 0 0 -78 vs -1 0 0 90) is due to the way the voxels are ordered. With the former, increasing the voxel index i is moving towards the right side, i.e. increasing the x coordinates; for the latter, voxels are order in the opposite direction with index i=1 sitting on the rightest part of the image.
  • the different translation values in the 4th column are likely due to a different image "bounding box", i.e. different number of voxel along the 3 axis. So the centre of the brain at [0 0 0]mm ends up being at a different voxel index [i j k].

All in all, it should not matter as the brain anatomy in the image should be inline with that of the MNI (or whatever specific template/TPM used) space. It would be interesting to figure out why FSLeyes is complaining though...

@nbeliy
Copy link
Author

nbeliy commented Nov 10, 2022

The scripts.zip
are in attachement (it's esssentually a standard US matlabbatch)
To be placed and run from osf mpm-ds.

As requested the screen of normalised images and template.
Screenshot from 2022-11-10 16-13-19

I checked, the translation matrix in normalized image is same as bounding box parameter in config:

proc_us.many_sdatas.bb = [-78 -112 -70 78 76 85];

So it confirms what Christophe said.

Just for conclusion, is it safe to ignore these matrixes incompatibilities?

@lukeje
Copy link
Member

lukeje commented Nov 10, 2022

In the FSLeyes documentation it seems that this warning appears when the two images have not been resliced to the same space.

In another part of the documentation it states that MNI152 space differs from proper nifti conventions by going L to R rather than R to L.

Combined, I think these two bits of documentation explain the problem, but I don't know what the correct thing to do about it would be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants