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

Mask preprocessing in registration #452

Closed
cookpa opened this issue Apr 17, 2023 · 1 comment · Fixed by #456
Closed

Mask preprocessing in registration #452

cookpa opened this issue Apr 17, 2023 · 1 comment · Fixed by #456

Comments

@cookpa
Copy link
Member

cookpa commented Apr 17, 2023

While reviewing #450, I saw this

if mask is not None:
mask_scale = mask - mask.min()
mask_scale = mask_scale / mask_scale.max() * 255.0
charmask = mask_scale.clone("unsigned char")
maskopt = "[%s,NA]" % (utils.get_pointer_string(charmask))

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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants