-
Notifications
You must be signed in to change notification settings - Fork 532
ENH: Wrapper for DenoiseImage #1291
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
Conversation
This looks like a good addition, but it needs a few changes before we can merge it.
If you have any questions, just let me know. |
This replicates the method from in N4BiasFieldCorrection used to specify more than one output file (as suggested by blakedewey). It updates the doctest and test_auto_DenoiseImage.py with new variables save_noise and noise_image. It alse removes the version, help, and short_help options since nipype is a pipelining tool and a pipeline would not need to see the output if those options are set.
@blakedewey I implemented your suggestions of removing the help/version variables and replicating the output style used in N4BiasFieldCorrection. The tests are currently running. Thank you for the tips. |
@satra What is with the codacy failure? |
'the input image can be resampled. The shrink ' | ||
'factor, specified as a single integer, describes ' | ||
'this resampling. Shrink factor = 1 is the default.')) | ||
output_image = traits.Str(argstr="-o %s", genfile=True, hash_files=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can skip genfile
(and the need to define _gen_filename
) if you use name_source
and name_template
(more info here: http://nipy.org/nipype/devel/cmd_interface_devel.html#creating-outputs-on-the-fly). This will simplify the interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing applies for noise_image
This removes the genfile and _gen_filename function. It now uses the name_source and name_template options to simplify the interface.
For output_image and noise_image I am setting keep_extension=True, but this does not seem to work. The output_image does not have an extension. Can someone please explain if there is an error with keep_extension or if I need to change something? output_image = File(argstr="-o %s", name_source=['input_image'], hash_files=False, Error with the Travis CI build is due to missing extensions in the cmdline outputs: File "/home/travis/build/nipy/nipype/nipype/interfaces/ants/segmentation.py", line 843, in nipype.interfaces.ants.segmentation.DenoiseImage File "/home/travis/build/nipy/nipype/nipype/interfaces/ants/segmentation.py", line 856, in nipype.interfaces.ants.segmentation.DenoiseImage |
* upstream/master: fix: fixes issue #1227 when install fails with pypi fix: decode bytes output when multiprocessing plugin is used with stdout/err fix: from make check
Enh/denoise
Thank you @satra for fixing the keep_extension metadata behavior. |
I am not sure what the codacy issue is or how to fix it. |
Codacy claims that this PR increased "complexity" of the code, but does not provide much details. Let's ignore this one. Thank you for your contribution! |
ENH: Wrapper for DenoiseImage
This provides a Nipype wrapper for the DenoiseImage program provided as part of ANTs.
It is a fairly simple interface seen here:
$ ./DenoiseImage
COMMAND:
DenoiseImage
Denoise an image using a spatially adaptive filter originally described in J. V.
Manjon, P. Coupe, Luis Marti-Bonmati, D. L. Collins, and M. Robles. Adaptive
Non-Local Means Denoising of MR Images With Spatially Varying Noise Levels,
Journal of Magnetic Resonance Imaging, 31:192-203, June 2010.
OPTIONS:
-d, --image-dimensionality 2/3/4
This option forces the image to be treated as a specified-dimensional image. If
not specified, the program tries to infer the dimensionality from the input
image.
-i, --input-image inputImageFilename
A scalar image is expected as input for noise correction.
-n, --noise-model Rician/(Gaussian)
Employ a Rician or Gaussian noise model.
-s, --shrink-factor (1)/2/3/...
Running noise correction on large images can be time consuming. To lessen
computation time, the input image can be resampled. The shrink factor, specified
as a single integer, describes this resampling. Shrink factor = 1 is the
default.
-o, --output correctedImage
[correctedImage,]
The output consists of the noise corrected version of the input image.
Optionally, one can also output the estimated noise image.
--version
Get Version Information.
-v, --verbose (0)/1
Verbose output.
-h
Print the help menu (short version).
--help
Print the help menu.