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

SmoothingRecursiveGaussianImageFilter with sharp discontinuity to background produces negative values in output #1425

Open
gdevenyi opened this issue Nov 18, 2019 · 2 comments
Labels

Comments

@gdevenyi
Copy link
Contributor

@gdevenyi gdevenyi commented Nov 18, 2019

Description

SmoothingRecursiveGaussianImageFilter, as for example, implemented in ANTs' SmoothImage https://github.com/ANTsX/ANTs/blob/master/Examples/SmoothImage.cxx produces negative values for images with an object in the foreground surrounded by "0" or some very small value produces negative values after smoothing.

Steps to Reproduce

  1. Grab http://www.bic.mni.mcgill.ca/~vfonov/icbm/2009/mni_icbm152_nlin_asym_09c_nifti.zip
  2. ImageMath 3 extracted.nii.gz m mni_icbm152_t1_tal_nlin_sym_09c_mask.nii mni_icbm152_t1_tal_nlin_sym_09c.nii
  3. SmoothImage 3 extracted.nii.gz 5 smooth.nii.gz 1 0
  4. Observe negative values:
    register smooth.nii.gz (set values under zero to be magenta)
    image

Expected behavior

No negative values

Actual behavior

Negative values

Reproducibility

100%

Versions

ANTs HEAD

Environment

Linux Ubuntu 14.04

@gdevenyi gdevenyi added the type:Bug label Nov 18, 2019
@blowekamp

This comment has been minimized.

Copy link
Member

@blowekamp blowekamp commented Nov 18, 2019

This may be expected for this implementation of the Gaussian. Here is the referenced paper:
Details of the implementation are described in the technical report: R. Deriche, "Recursively Implementing The Gaussian and Its Derivatives", INRIA, 1993, ftp://ftp.inria.fr/INRIA/tech-reports/RR/RR-1893.ps.gz

@gdevenyi

This comment has been minimized.

Copy link
Contributor Author

@gdevenyi gdevenyi commented Nov 18, 2019

Thanks, I suspected the implementation details might be the cause.

Unfortunately, I think this may cause some issues with registration, since RecursiveGaussian was set as the default for optimizers as of 569a470 it can create features which aren't actually present.

At least a documentation update is warranted, beyond that I'm not sure what to do about it in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.