ANTsX / ANTsPy

A fast medical imaging analysis library in Python with algorithms for registration, segmentation, and more.
https://antspyx.readthedocs.io
Apache License 2.0
625 stars 161 forks source link

Masking for the linear transformation (and for the moving image) #449

Closed azylbertal closed 1 year ago

azylbertal commented 1 year ago

In my use case and based on my experience with command line antsregistration, it is particularly useful to mask the moving image in all registration stages (rigid, affine and SyN). This is a result of a large part of the moving image being obscured (in a predictable way), while the fixed image is a 'full' atlas image.

In the current version, when a mask is provided it is only applied to the final stage (usually SyN, or Affine in the particular case of TRSAA), and only in the fixed image space. I think it would be useful to be able to provide a moving mask and also have the option to apply it for all stages.

ntustison commented 1 year ago

So this isn't something that we're inclined to implement ourselves as this could be invoked by calling ants.registration multiple times. We would entertain a pull request but it would have to maintain the simplicity of the current ANTsR/ANTsPy registration interface.

azylbertal commented 1 year ago

Thanks, I'll try to come up with a simple way to implement it. Is there a way to use a moving mask with the current implementation?

ntustison commented 1 year ago

Not perfect but, depending on your registration scenario, you can swap the fixed and moving image for the first ants.registration linear-only registration optimization. Then use that as an initial transform (but using the whichtoinvert option) for the second call.