ANTsX / ANTs

Advanced Normalization Tools (ANTs)
Apache License 2.0
1.18k stars 380 forks source link

Feature Idea: Smoothing only within mask when provided #584

Open gdevenyi opened 6 years ago

gdevenyi commented 6 years ago

When registering with a mask, it appears (though I'm not sure exactly where to look...) that the smoothing happens over the whole image.

It should be possible to compensate for masking using this equality:

s(X with mask) = s(Mask*X)/s(Mask)
spinicist commented 6 years ago

It would be great to have this more generally. Currently I use 3dBlurInMask, but that’s the only part of AFNI I ever touch so to have it natively in ANTs would be helpful.

gdevenyi commented 6 years ago

@spinicist good point, it would be nice to also have in SmoothImage

cookpa commented 6 years ago

I haven't got time to implement this right now, but I took a look at the code. SmoothImage calls the ITK DiscreteGaussianImageFilter which uses a NeighborhoodOperatorImageFilter. There is a subclass of this that takes a mask:

https://itk.org/Doxygen/html/classitk_1_1MaskNeighborhoodOperatorImageFilter.html

gdevenyi commented 6 years ago

@cookpa oh nice. Definitely doable then!