Posted by
Vasilescu,Dan on
URL: http://imagej.273.s1.nabble.com/Problem-with-Brightness-Contrast-dialog-in-Plug-in-tp3700193p3700195.html
Wayne,
I appreciate your help, this is the perfect solution for my problem.
Many thanks for the speed as well, I am impressed.
Regards,
Dan
-----Original Message-----
From: ImageJ Interest Group on behalf of Rasband Wayne
Sent: Sat 3/3/2007 10:53 PM
To:
[hidden email]
Cc:
Subject: Re: Problem with Brightness / Contrast dialog in Plug-in
Starting with ImageJ 1.38l, plugins can call the ContrastAdjuster's
update() method to update the controls in the "B&C" window. Here is
an example:
IJ.run("Brightness/Contrast...");
IJ.getImage().getProcessor().setMinAndMax(min,max);
ContrastAdjuster.update();
This is what it looks like in macro code:
run("Brightness/Contrast...");
setMinAndMax(min,max);
call("ij.plugin.frame.ContrastAdjuster.update");
-wayne
> Greetings,
> I am writing a plug-in where I try to apply the user preferences
(Min and
> Max values) from a previous session to a Brightness / Contrast
dialog box.
>
>A simplified version of this would be:
> IJ.run("Brightness/Contrast...");
> IJ.getImage().getProcessor().setMinAndMax(Min,Max);
>
> The image is adjusted correctly and the dialog box gets the new
settings.
> The problem is that the controls inside the dialog box (histogram and
> scrollbars) are not adjusted to reflect the change.
>
> The real problem seems to be that ij.plugin.frame.ContrastAdjuster
> class was not designed to be used programatically, but only in the
> context of user/GUI interaction.
>
> I have a few solutions, like creating a helper class inside
ij.plugin.frame
> package, or use the java reflection API and override all access
control,
> or even generate a IJ script to mimic user interaction.
>
> However, they feel too much like a hack - and it's very likely that
> sooner or later some code modification will force me to redo the
> work all over again.
>
> I am rather new to ImageJ and there may be other solutions which
> I could not think of. Comments from the experts on this forum
> would be greatly appreciated.
>
> Thank you!
> Dan Vasilescu
> Center for Cell Analysis and Modeling, (vcell.org)
> University of Connecticut Heath Center
> 263 Farmington Ave
> Farmington, CT 06030