using FileOpener on 16-bit grayscale in java app ?
Posted by Bill Christens-Barry on Apr 10, 2006; 10:38pm
URL: http://imagej.273.s1.nabble.com/using-FileOpener-on-16-bit-grayscale-in-java-app-tp3703115.html
I have a 16-bit grayscale TIFF that I'd like to open, display, and work
with in a Java app that imports and draws on various classes in ij.jar.
I ran into trouble when I tried to use BufferedImage's TYPE_USHORT_GRAY
to ensure that I can get at the 16-bit data.
So far I haven't been successful and wondered if I might be able to do
this using ij. A quick look at the ImageJ source and API left me a bit
confused.
I'm trying to use the FileOpener, FileInfo, ImageReader, and
ShortProcessor classes to get at the 16-bit sample values of the image
data. In my toy program to work this out, based on the source from
FileOpener, the compiler gags with these errors:
Rastic8r.java:45: cannot find symbol
symbol : method createColorModel(ij.io.FileInfo)
location: class ExtractRaster
cm = createColorModel(fi);
^
Rastic8r.java:50: cannot find symbol
symbol : method readPixels(ij.io.FileInfo)
location: class ij.io.ImageReader
pixels = ir.readPixels(fi);
^
In trying to understand the cause of these errors, I'm left wondering
whose createColorModel() and readPixels() methods are used in FileOpener
because I've imported java.awt.image.ColorModel, ij.io.FileOpener,
ij.io.ImageReader, and ij.io.FileInfo. Also, in my code I declared a new
ImageReader ir because I didn't see where Wayne had done this in the
FileOpener source. As I see it, readPixels() is a method of ImageReader,
so I thought I needed one. What am I misunderstanding here?
Can anyone help me understand this by explanation or example?
Thanks.
Bill Christens-Barry