How can I write a similar plugin that opens a file from a specified path?
Posted by
Avital Steinberg on
Aug 05, 2014; 11:41am
URL: http://imagej.273.s1.nabble.com/How-can-I-write-a-similar-plugin-that-opens-a-file-from-a-specified-path-tp5009034.html
Hi,
I would like to write a plugin similar to this one:
import ij.ImagePlus;
import ij.plugin.filter.PlugInFilter;
import ij.process.ImageProcessor;
public class My_Inverter implements PlugInFilter {
public int setup (String arg, ImagePlus im) {
return DOES_8G; // This plugin accepts 8-bit grayscale images
}
public void run (ImageProcessor ip) {
int w = ip.getWidth();
int h = ip.getHeight();
for (int u = 0; u < w; u++) {
for (int v = 0; v < h; v++) {
int p = ip.getPixel(u, v);
ip.putPixel(u, v, 255-p);
}
}
}
}
But I would like it to open an image from a specified path, instead of
working on an image which is already open in ImageJ. How can I change the
code to do that?
Thanks,
Avital
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html