call a pluginfilter
Posted by Thomas Boudier on Feb 16, 2009; 4:19pm
URL: http://imagej.273.s1.nabble.com/call-a-pluginfilter-tp3693703.html
Hi,
I would like to create a selection from a mask so I used the
ThresholdToSelection class but I have trouble to make it work properly,
when I use directly IJ.run("Create Selection") it works perfectly, but I
would like to hide my image. Any idea ? Thanks.
Thomas
Here a small plugin :
import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.filter.*;
public class Test_ implements PlugInFilter {
ImagePlus imp;
public int setup(String arg, ImagePlus imp) {
this.imp = imp;
return DOES_ALL;
}
public void run(ImageProcessor ip) {
imp.lock();
ThresholdToSelection tts = new ThresholdToSelection();
tts.setup("setup", imp);
tts.run(ip);
IJ.write("sel="+ip.getRoi());
IJ.write("sel="+imp.getRoi());
imp.unlock();
IJ.run("Create Selection");
IJ.write("sel="+ip.getRoi());
IJ.write("sel="+imp.getRoi());
}
}
--
/**********************************************************/
Thomas Boudier, MCU Université Pierre et Marie Curie,
IFR 83. Bat B 7ème étage, porte 709, Jussieu.
Tel : 01 44 27 20 11 Fax : 01 44 27 22 91
/*******************************************************/