ThresholdAdjuster

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ThresholdAdjuster

Piet=?ISO-8859-1?Q?=C3?= Schofield
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
Reply | Threaded
Open this post in threaded view
|

Re: ThresholdAdjuster

Michael Schmid
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
Alx
Reply | Threaded
Open this post in threaded view
|

Re: ThresholdAdjuster

Alx
Hello everybody, I need help in this ThresholdAdjuster. I need that the user choose the threshold color in order to analyse some images. The thing is I'm a newer with ImageJ's classes so i need a detail explanation with that PLEASE if is not much to ask. al03max@hotmail.com