Posted by
Leon Espinosa on
Oct 14, 2005; 8:32am
URL: http://imagej.273.s1.nabble.com/Frequency-and-area-analysis-tp3704675p3704678.html
I know this...
This a plugin that add a listener (save this code as "Threshold_2.java"
compile it with "compile and run"):
import ij.*;
import ij.process.*;
import ij.gui.*;
import ij.plugin.*;
import ij.plugin.frame.*;
import ij.plugin.frame.ThresholdAdjuster.*;
import java.lang.*;
import java.lang.Object.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.WindowEvent.*;
public class Threshold_2 implements PlugIn {
int wclose = 202;
public void run(String arg) {
CustomThresholdAdjuster2 seuil = new CustomThresholdAdjuster2();
while(!(seuil.getWclose==wclose)) {}
IJ.showMessage(" la suite...");
}
}
class CustomThresholdAdjuster2 extends ThresholdAdjuster {
public int getWclose;
boolean fin = false;
public void windowClosing(WindowEvent w) {
super.windowClosing(w);
String Waction = w.paramString();
getWclose = w.WINDOW_CLOSED;
}
}
//------------------------------------------------------------ END
-------------------
Now you will have a new "Threshold_2.class" in the plugins folder, close
ImageJ and start again, now you can use it in your macros, exemple:
macro.txt:
showMessage("Set Threshold and close the window to continue");
run("Threshold 2");
getThreshold(lower, upper);
Your code here...
A 11:27 13/10/2005 -0700, KIRAN kumar a écrit :
>Hello group,
>
> I am writing a plugin for analysis of SEM image and
>using threshold adjuster for adjusting the threshold.
>I need to give indefinite time to the user to adjust
>it and after he clicks the button apply then I have to
>proceed with next operations.
>
> But I figured out that i need to use Event listeners
>but doesnt know how to get instance of button Apply of
>threshold adjuster class.
>
> I would be gratefull if anyone could help me find a
>solution.
>
>Thanks,
>
>Regards,
>Kiran
>
>
>
>__________________________________
>Yahoo! Music Unlimited
>Access over 1 million songs. Try it free.
>
http://music.yahoo.com/unlimited/Leon Espinosa
04 91 32 46 25
06 79 25 97 40
Unité des Rickettsies
Fac. de la Timone
27 Bd Jean Moulin
13005 Marseille