Skip to content

Conversation

cookpa
Copy link
Member

@cookpa cookpa commented May 7, 2025

Now that the PPD filter supports composite transforms, it is feasible to add it directly to antsApplyTransforms. This avoids the need to use a separate program and keep track of the transforms to use.

This simplifies things for users, and reduces potential for mistakes in transform composition.

To make this happen, I had to change the tensor type in AAT from a general itk::SymmetricSecondRankTensor to a DiffusionTensor3D. Typing this, I realize I should document this in the usage.

I think DiffusionTensor3D is the vast majority of use cases, so I'm thinking it would not be worth complicating usage by separately supporting generic tensors. Non-diffusion tensors might not also work with the log transformation that we apply automatically.

@cookpa
Copy link
Member Author

cookpa commented May 8, 2025

@ntustison @stnava will this interfere with any of your workflows? Should I make this not the default behavior? I could add a --reorient flag

@ntustison
Copy link
Member

I'm pretty sure this will be fine with anything I'm doing. Thanks @cookpa.

@cookpa
Copy link
Member Author

cookpa commented May 8, 2025

Thanks Nick!

I remembered Brian had posted some code from antsPyMM over at

ANTsX/ANTsPy#753

Looking at that, I see he is splitting the channels, warping, then reorienting. This would continue to work and would be the alternative I would recommend to use antsApplyTransforms without -e 2, if for some reason you didn't want to reorient.

@stnava
Copy link
Member

stnava commented May 8, 2025

yeah - I think this change that you are making will not impact antspymm. although I tested antspymm reorientation with a large variety of cases, am still not sure it's correct. I'd be happy to switch to something that is more well validated if possible.

@cookpa
Copy link
Member Author

cookpa commented May 8, 2025

Thanks @stnava I think the antspymm method does have some of the same problems I have been working on. It is a really tricky thing to debug because the image headers, the code, and the visualization software can all change things. Will open an issue on antspymm.

I need to evaluate more, and am getting some help from a collaborator soonish.

@cookpa
Copy link
Member Author

cookpa commented May 8, 2025

I'm going to merge later unless I think of any other issues. I think this + other recent fixes solve the coordinate basis problem, and the new ImageMath edits allow for import of tensors from FSL, taking into account the change in sign of the x-axis for direction matrices with positive determinants.

There remains the question of how best to estimate the local rotation from a displacement field. I have a couple of prototype scripts that I will try to develop further, and test on real data somehow. I think the real test is doing whole-brain tractography

@cookpa cookpa merged commit 516d241 into master May 9, 2025
1 check passed
@cookpa cookpa deleted the reorient_aat branch May 9, 2025 13:51
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

Successfully merging this pull request may close these issues.

3 participants