On Jan 16, 2013, at 12:50 AM, Chris wrote:
> I can open a jpeg file using
>
> java.net.URL url;
> url = getClass().getResource(image.jpg);
> java.awt.Image image = Toolkit.getDefaultToolkit().getImage(url);
> imp = new ImagePlus("", image);
> if (imp != null) {
> imp.show();
> }
>
> but this will not work for a tiff image. My tiff image is a stack. How can
> I open the tiff stack that is bundled in the resources folder of my jar file?
Hi Chris,
The "JAR Resources Demo" plugin at
http://rsbweb.nih.gov/ij/plugins/pcl-demo.html
opens TIFFs using
InputStream is = getClass().getResourceAsStream(path+"image.tif");
if (is!=null) {
Opener opener = new Opener();
ImagePlus imp = opener.openTiff(is, "San Francisco (TIFF)");
if (imp!=null)
imp.show();
}
which should work with ImageJ TIFF stacks.
-wayne
_______________________________________________
ImageJ-devel mailing list
[email protected]
http://imagej.net/mailman/listinfo/imagej-devel