You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wondering what's an easy way to apply the transforms generated by greedy to images loaded in SimpleITK (Python)? I understand that one difference is that greedy (RAS) and ITK (LPS) uses a different coordinate system, so I tried two things to remedy that -- which didn't seem to work:
I negated some values of my greedy generated affine matrix so that they are now compatible to images in LPS coordinates, according to this article. I then applied that modified affine matrix to my image loaded in SimpleITK.
I transposed the image in the first two axes, applied the affine transformation, then transposed the image back.
Am I missing other differences? Or am I not, so it's probably the case that I did something wrong?
Help appreciated from anyone who has tried doing this. I'm very new to registration, so any help would be great! Thanks in advance!
Best Wishes
The text was updated successfully, but these errors were encountered:
What worked for me was to calculate how the axes changes greedy applies to the pixels (both before the transform and after) could be applied to the transform matrix to get the same result. LPS_affine = np.loadtxt('affine.mat') * np.array( [[1, 1, -1, -1], [1, 1, -1, -1], [-1, -1, 1, 1], [1, 1, 1, 1]])
Using LPS_affine in a SimpleITK.AffineTransform gave me the same results as doing a resample with greedy.
Alternately, one could probably use the c3d tool to convert the affine matrix file, but I have not tried.
Hello
I'm having a great time using greedy.
I'm wondering what's an easy way to apply the transforms generated by greedy to images loaded in SimpleITK (Python)? I understand that one difference is that greedy (RAS) and ITK (LPS) uses a different coordinate system, so I tried two things to remedy that -- which didn't seem to work:
I negated some values of my greedy generated affine matrix so that they are now compatible to images in LPS coordinates, according to this article. I then applied that modified affine matrix to my image loaded in SimpleITK.
I transposed the image in the first two axes, applied the affine transformation, then transposed the image back.
Am I missing other differences? Or am I not, so it's probably the case that I did something wrong?
Help appreciated from anyone who has tried doing this. I'm very new to registration, so any help would be great! Thanks in advance!
Best Wishes
The text was updated successfully, but these errors were encountered: