Start up example loader
Posted: Mon Jul 15, 2013 10:59 am
I'm trying to program a new FormatReader and am following the guide on http://www.openmicroscopy.org/site/supp ... guide.html.
I'm programming in Eclipse and got things started up. But what would be the best way to test the code? How to load the image, such the openBytes() method is called?
For example, how to implement the run method to call the dialog for selecting the image and thus load the file?
I'm programming in Eclipse and got things started up. But what would be the best way to test the code? How to load the image, such the openBytes() method is called?
For example, how to implement the run method to call the dialog for selecting the image and thus load the file?
- Code: Select all
import java.io.IOException;
import loci.formats.FormatException;
import loci.formats.FormatReader;
public class Test extends FormatReader {
public Test(String format, String suffix) {
super(format, suffix);
}
public static void main(String[] args) throws FormatException, IOException {
Test test = new Test(null, null);
test.run(args);
test.close();
}
private void run(String[] args) throws FormatException, IOException {
// TODO load an image
}
@Override
public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException {
for(int i=0; i<buf.length; i++) {
buf[i] = (byte)(Math.random()*255);
}
return buf;
}
}