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

Write composite transforms from antsApplyTransforms #1839

Merged
merged 4 commits into from
Feb 4, 2025
Merged

Conversation

cookpa
Copy link
Member

@cookpa cookpa commented Feb 3, 2025

antsApplyTransforms only allowed users to collapse linear transforms into a single .mat file, or composite transforms into a single displacement field.

Now allow users to write the full composite transform. This enables users familiar with antsApplyTransforms to write out composite transforms by specifying the components in the order they are applied when warping images. That is, one can call antsApplyTransforms -o warpedImage and then antsApplyTransforms -o CompositeTransform[composite.h5] without changing the -t options.

The motivation is to make it easier to write composite transforms, since CompositeTransformUtil requires users to use the internal "reverse queue order" of itkCompositeTransform.

The changes are backwards compatible, but I have noted in the usage that we prefer

-o DisplacementField[ field.ext ]

to

-o [ field.ext, 1 ]

Thus the output options are

-o warped.ext # apply transforms to input image
-o Linear[ collapsed.mat invert=0] # Write collapsed linear transform
-o DisplacementField[ collapsed.ext ] # Write collapsed displacement field
-o [ collapsed.ext, 1 ] # same as above, for backwards compatiblity
-o CompositeTransform[ composite.h5 ] # write composite transform

Previously, we only allowed writing a composite displacement field or affine, ie all transforms had to be collapsed into one output transform.

See new output options for antsApplyTransforms. We preserve the option -o [compositeDisplacement.nii.gz, 1] for backwards compatibility.

DOC: Change log message for imageio checks - this confused some antspy users.

DOC: Document new functionality in CompositeTransformUtil
To avoid confusion, use Composite in output to mean composite transforms.

Use "collapsed" to mean things composed into a single transform. Composite means
a reversible process (ie, you can separate the components again).
@cookpa
Copy link
Member Author

cookpa commented Feb 3, 2025

@cookpa cookpa merged commit 2a91bc8 into master Feb 4, 2025
1 check passed
@cookpa cookpa deleted the aat_composite branch February 4, 2025 15:13
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