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

Mask preprocessing in registration #452

Closed cookpa closed 1 year ago

cookpa commented 1 year ago

While reviewing #450, I saw this

https://github.com/ANTsX/ANTsPy/blob/8f5fa941c83515154d6125cd4bcb1636e8813768/ants/registration/interface.py#L396-L400

This might make masks be interpreted differently to ANTs, if they are not binarized already. For example, if one used a FreeSurfer aparc+aseg type mask here ( subcortex labels 1-48(ish), cortex 1000-1100(ish) ), some labels will be zeroed out in this rescaling process.

How about we just binarize first and then cast to char? Happy to work on a PR for this.

ntustison commented 1 year ago

Thanks Phil. Yeah, in all my coding, I go with ITK's definition of a mask which is anything not equal to 0.