Skip to content

ENH: Vector reorientation#1895

Merged
cookpa merged 3 commits intomasterfrom
reorient_vectors
Nov 21, 2025
Merged

ENH: Vector reorientation#1895
cookpa merged 3 commits intomasterfrom
reorient_vectors

Conversation

@cookpa
Copy link
Member

@cookpa cookpa commented Jul 1, 2025

Reorient vectors like we do for tensors.

This composes the local jacobians from the composite transform into one, then does a polar decomposition to get a rotation. Thus it should preserve vector magnitude.

It's up to the user to ensure that the vectors are sensibly interpolated. For axial data, it probably makes sense to use nearest neighbor interpolation. At the least, data should be projected into one hemisphere so that we don't interpolate x and -x.

I've also added an extra option for displacement vector data in antsApplyTransforms. Displacement fields from ITK / ANTs registration are based in physical space. Generic vectors (-e 1) are assumed to be in index space, and are rebased accordingly.

For displacement fields, the vectors are signed and should have some spatial regularity, so linear interpolation might work better.

@cookpa
Copy link
Member Author

cookpa commented Jul 1, 2025

Related to #1881

I've tested this vs DT orientation - if I pull V1 before applying the warp, I can get similar results to the tensor after PPD.

Need to test on template building. The idea is if the mean affine is not close to zero, reorienting the warps will produce better shape updates.

@cookpa
Copy link
Member Author

cookpa commented Nov 18, 2025

I tested the displacement field reorientation by doing a nonlinear registration, then rotating the fixed image, and applying the same rotation to the warp field. I can then recover the registration solution, indicating that the warp field is being reoriented correctly.

It's harder to judge a template performance difference because the average rotation converges quite quickly to zero, but it seems like the right thing to do.

@cookpa
Copy link
Member Author

cookpa commented Nov 21, 2025

Changed -e displacement field to -e physical-vector, as it's generic to any vector in ITK physical coordinates. Also updated docs to clarify this

@cookpa cookpa merged commit 952a0af into master Nov 21, 2025
1 check passed
@cookpa cookpa deleted the reorient_vectors branch November 21, 2025 20:23
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.

1 participant