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! Sincerely Joachim ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
> 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 |
Hi Wayne,
thanks for the hint, I now understand the difference between IJ.run and IJ.runPlugIn! However, this seems to reveal some bug in the contrast enhancer: If you look in the sourecode of the "B&C" window, you see that the "Auto" button that I would like to use has it´s own built-in contrast enhancer which seems to work fine. HOWEVER, it records run("Enhance Contrast", "saturated=0.5"); instead! What I find with my data that there seems to be a bug in the true ContrastEnhancer, the result is NOT the same and depends strongly on the % value given, for 0.1 there is practically no effect, while 0.5 percent leads to a strongly asymmetrical clipping of much more than 0.5%! I will send you a test image (float) by personal mail, you should use B&C Auto and Enhance Contrast 0.5 on it to see the difference! Sincerely Mit freundlichen Grüßen / Best regards Joachim Wesner Wayne Rasband <[hidden email]> Gesendet von: An ImageJ Interest [hidden email] Group Kopie <[hidden email]. GOV> Thema Re: How to call "Contrast Enhancer" from Java plugin 08.09.2009 17:59 Bitte antworten an ImageJ Interest Group <[hidden email]. GOV> > 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 ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
> Hi Wayne,
> > thanks for the hint, I now understand the difference between IJ.run > and > IJ.runPlugIn! > > However, this seems to reveal some bug in the contrast enhancer: > > If you look in the sourecode of the "B&C" window, you see that the > "Auto" > button that I would like to use has it´s own built-in contrast enhan > cer > which seems to work fine. HOWEVER, it records > > run("Enhance Contrast", "saturated=0.5"); > > instead! What I find with my data that there seems to be a bug in > the true > ContrastEnhancer, the result is NOT the same and depends strongly on > the % > value given, for 0.1 there is practically no > effect, while 0.5 percent leads to a strongly asymmetrical clipping > of > much more than 0.5%! A saturation value of 0.35 seems to produce results closest to what you get when clicking on "Auto" in the "B&C" window, so I changed the value that gets recorded from 0.5 to 0.35. -wayne |
Hi Wayne,
YES, I agree, this is the best compromise. The asymmetry seems to only come up with higher % values and my special data files with few outliers. I was a bit puzzled, because I assumed that both cases of contrast enhancement actually use the very same algorithm (or even class/method initially) and that the value of 0.5% might be somehow encoded in the "Auto" code (did not yet really analyze the source). Thanks Joachim Wesner Rasband Wayne <[hidden email]> Gesendet von: An ImageJ Interest [hidden email] Group Kopie <[hidden email]. GOV> Thema Re: Antwort: Re: How to call "Contrast Enhancer" from Java 08.09.2009 22:13 plugin Bitte antworten an ImageJ Interest Group <[hidden email]. GOV> > Hi Wayne, > > thanks for the hint, I now understand the difference between IJ.run > and > IJ.runPlugIn! > > However, this seems to reveal some bug in the contrast enhancer: > > If you look in the sourecode of the "B&C" window, you see that the > "Auto" > button that I would like to use has it´s own built-in contrast enhan > cer > which seems to work fine. HOWEVER, it records > > run("Enhance Contrast", "saturated=0.5"); > > instead! What I find with my data that there seems to be a bug in > the true > ContrastEnhancer, the result is NOT the same and depends strongly on > the % > value given, for 0.1 there is practically no > effect, while 0.5 percent leads to a strongly asymmetrical clipping > of > much more than 0.5%! A saturation value of 0.35 seems to produce results closest to what you get when clicking on "Auto" in the "B&C" window, so I changed the value that gets recorded from 0.5 to 0.35. -wayne ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
Free forum by Nabble | Edit this page |