I needed the inverse function to nilearn.image.coord_transform
I didn’t find in nilearn, so I had to implement it.
I believe it should be there, already.
(maybe I should have opened this as an enhancement request in github)
What I’ve done is simply inverting the affine and multiply it by the needed coordinate, and then I get the indices…
Any comments about this pseudo code or a suggested pseudo code for implementing this inverse function?
(Edit: I’ve tested my implementation and it seems fine (extracted some known region and compared its mean with masker.fit_transform and asserted that coord_transform(myfunction((x,y,z))=(x,y,z) ))