Login  Register

Re: Threshold Adjuster

Posted by Leon Espinosa on Oct 14, 2005; 10:39am
URL: http://imagej.273.s1.nabble.com/Frequency-and-area-analysis-tp3704675p3704677.html

Dear Kiran
This the same plugin but it waits for the "Apply" button (same procedure:
save as Threshold_3.java, compile it and use in your macro with

run("Threshold 2");

//-----------------------------------------------

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_3 implements PlugIn {

         public void run(String arg)     {
             CustomThresholdAdjuster3 seuil = new CustomThresholdAdjuster3();
         }

}

class CustomThresholdAdjuster3 extends ThresholdAdjuster {

         boolean fin = false;

         public void actionPerformed(ActionEvent e) {
         super.actionPerformed(e);
         String action = e.getActionCommand();

         if (action=="Apply") {
                 fin = true;
                 this.close();
                 IJ.showMessage(" la suite...");
                 }


         }
}

//-------------- end -----------------------




A 11:27 13/10/2005 -0700, vous avez é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