Hi Pieta,
if you write an ExtendedPlugInFilter with preview, you can have a
GenericDialog with a slider that sets the threshold of the
ImageProcessor (ip).
Then, with "preview" checked, the run(ip) method is called each time
the slider is adjusted.
In your case, run(ip) should probably update the ImagePlus to show
the threshold.
In the run(ip) method, you could also process other images than the
ip that the plugin operates on.
I have not tried it, but to me this would seem a possible way of
doing it.
Michael
________________________________________________________________
On 12 Feb 2009, at 09:48, Pietà Schofield wrote:
> Hullo
>
> I am trying to write a plugin which uses the ThresholdAdjuster to
> permit a
> user to set a threshold for a sample image and then retreives the
> threshold
> value they have manually set to process the a set of other images.
> Naively
> I thought I could do something like:
>
> --------
> class myplugin ... implements AdjustmentListener..{
> private int th_value;
> ...
> ImagePlus im = new ImagePlus("Mask", C3.getProcessor().duplicate());
> im.show();
> ThresholdAdjuster ta= new ThresholdAdjuster();
> ta.addAdjustmentListener(this);
> ta.run();
> ...
>
>
> private void adjustmentValueChanged(){
> // code to get th_value from ThresholdAdjuster
> }
> }
>
> But this approach fails as ta.addAjustmentListerner(this) is not
> supported.
>
> My questions are, is there a way to make this approach work, or is
> there a
> better way to let the user interactively set a reference threshold
> which is
> subsequently used for processing the rest of the images.
>
> thanks
>
> Pieta