CoBrALab / optimized_antsMultivariateTemplateConstruction

A re-implementation of antsMultivariateTemplateConstruction2.sh using optimized image pyramid scale-space and qbatch support
Other
22 stars 8 forks source link

Improve robustness with transformation averaging before shape update #7

Closed gdevenyi closed 1 year ago

gdevenyi commented 3 years ago

Two possible failure modes here

gdevenyi commented 3 years ago

For affine averaging

  1. convert affines to text-file format
  2. use a trimmed mean method with awk http://onetipperday.sterding.com/2014/04/trimmed-mean-and-median-in-awk.html

Confirm there's no special sauce in https://github.com/ANTsX/ANTs/blob/master/Utilities/itkAverageAffineTransformNoRigidFunction.hxx https://github.com/ANTsX/ANTs/blob/master/Utilities/itkAverageAffineTransformFunction.hxx

Extract matrix:

$ ConvertTransformFile 3 transform.mat test.txt --hm
$ cat test.txt
1.08344 0.0619986 0.144924 0.986581
-0.0181042 0.934848 -0.236614 1.2783
-0.205546 0.319618 1.00676 0.826693
0 0 0 1

Once we do this, we can also scale the transform with the gradient step like we do the deformation field.

gdevenyi commented 3 years ago

For the deformation averaging we'll need to implement some code with SimpleITK. I think I have an implementation written somewhere...

This should handle 3D and 4D data so we can use it for #8 as well.

gdevenyi commented 3 years ago

An implementation for interpolating transformations: https://discourse.itk.org/t/scaling-multiplying-by-a-scalar-value-an-affine-transformation/4310/8

gdevenyi commented 1 year ago

Still want to implement robust averaging of warp fields.