Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

# Transformation order in ANTSpy

See original GitHub issue

This might be related to the issue I raised but I am still having issue getting my head around how the transformation concatenations and orderings are handled in ANTSpy.

So, if I perform a registration in ANTS (the usual SyN), I get the following list as my forward transformations an example:

``````'/tmp/tmpdddnbjk41Warp.nii.gz', '/tmp/tmpdddnbjk40GenericAffine.mat']
``````

So the first entry is the non linear deformation field and the second one is the initial affine map.

Now, I can use apply_transforms to apply the map. However, what I know about `antsApplyTransform`, the transforms are applied in the order in which they are encountered on the command line and I think ANTSpy passes them on by simply going through the list.

My question is would this not result in the non linear warp being applied before the affine?

Also, on a related note if I combone two transformation list as:

``````final = t1 + t2
``````

and use this in `apply_transforms` would the resulting transformation be `t2(t1(x))` where x are the spatial coordinates i.e. t1 first and then t2?

### Issue Analytics

• State:
• Created 3 years ago

1reaction
stnavacommented, Mar 29, 2020

there will be discussions of this in various places here https://github.com/ANTsX/ANTs/wiki and in the papers https://github.com/ANTsX/ANTs#boilerplate-ants as well as in `ants*pdf` documentation.

the core reasons are mathematical, statistical and practical :

• mathematical: we use `Diff_0` which requires fixed boundary conditions. as such, images are mapped to the fixed space by an affine transformation. within the fixed domain, we compute the diffemorphism, member of `Diff_0`.

• statistical: we want the tail of the deformation fields to be in common (template) space to allow group comparisons

• practical: transformations are only dense under pull back not push forward

0reactions
stnavacommented, Mar 29, 2020

edit: 3rd reason

#### Top Results From Across the Web

Registration — ANTsPy master documentation
Assumes images are aligned by an inital transformation. Can be useful if you want to run an unmasked affine followed by masked deformable...
transformlist (list of strings) – list of transforms generated by ants.registration where each transform is a filename. • interpolator (string) ...
Advanced Normalization Tools (ANTS) - WordPress.com
The numbers of the transformations (here, 0 and 1 because there is only a deformation and affine mapping) relate to the order in...
Points vs pixel in ANTs - SourceForge
I use ANTsPY to find the transform between a fixed and a moving image. ... in order to find the corresponding points in...
Apply transforms to images. — antsApplyTransforms ...
Apply a transform list to map an image from one domain to another. ... The order matters strongly and the user is advised...

#### Troubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free