| import
ij.plugin.filter.PlugInFilter; |
| import
ij.ImagePlus; |
| import
ij.process.ImageProcessor; |
| import
org.python.util.PythonInterpreter; |
| public
class Invert_Filter
implements PlugInFilter { |
|
public int setup(String arg, ImagePlus imp) { |
| //
inform ImageJ that this plugin filter only handles 8 bit grayscale
images |
|
return DOES_8G; |
|
} |
|
public void run(ImageProcessor ip) { |
| //
create a Python interpreter |
|
PythonInterpreter py = new PythonInterpreter(); |
| //
pass the image processor of the current image to the Python interpreter
|
|
py.set("ip", ip); |
| //
execute the Python file containing the source code for this ImageJ
plugin filter |
|
py.execfile("C:\\ImageJ\\plugins\\Invert_Filter.py"); |
|
} |
| } |