Re: How to call "Contrast Enhancer" from Java plugin
Posted by Wayne Rasband on Sep 08, 2009; 3:59pm
URL: http://imagej.273.s1.nabble.com/How-to-call-Contrast-Enhancer-from-Java-plugin-tp3691264p3691265.html
> HI,
>
> I would like to use the "ContrastEnhancer" class/plugin
> from my own plugin.
>
> After some fiddling around I thought the correct call might be
>
> IJ.runPlugIn(imp, "ij.plugin.ContrastEnhancer", "saturated=.1");
>
> which runs the enhancer plugin up to the dialog window, but
> does not process the argument string, but wants the user to
> enter values and press OK.
>
> What is the right way to do it? Or is there a more direct way
> to call the enhancer class? THANX!
Run the Process>Enhance Contrast command with the command recorder
(Plugins>Macros>Record) running and you get this macro call:
run("Enhance Contrast", "saturated=0.1");
To convert it into a method that can be called from a plugin, change
"run" to "IJ.run" and add an argument that passes an ImagePlus object:
IJ.run(imp, "Enhance Contrast", "saturated=0.1");
-wayne