use of com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReader in project bioformats by openmicroscopy.
the class JAIIIOServiceImpl method readRaster.
/* @see JAIIIOService#readRaster(InputStream, JPEG2000CodecOptions) */
@Override
public Raster readRaster(InputStream in, JPEG2000CodecOptions options) throws IOException, ServiceException {
J2KImageReader reader = getReader();
MemoryCacheImageInputStream mciis = new MemoryCacheImageInputStream(in);
reader.setInput(mciis, false, true);
J2KImageReadParam param = (J2KImageReadParam) reader.getDefaultReadParam();
if (options.resolution != null) {
param.setResolution(options.resolution.intValue());
}
Raster raster = reader.readRaster(0, param);
mciis.close();
reader.dispose();
return raster;
}
use of com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReader in project bioformats by openmicroscopy.
the class JAIIIOServiceImpl method readImage.
/* @see JAIIIOService#readImage(InputStream, JPEG2000CodecOptions) */
@Override
public BufferedImage readImage(InputStream in, JPEG2000CodecOptions options) throws IOException, ServiceException {
J2KImageReader reader = getReader();
MemoryCacheImageInputStream mciis = new MemoryCacheImageInputStream(in);
reader.setInput(mciis, false, true);
J2KImageReadParam param = (J2KImageReadParam) reader.getDefaultReadParam();
if (options.resolution != null) {
param.setResolution(options.resolution.intValue());
}
BufferedImage image = reader.read(0, param);
mciis.close();
reader.dispose();
return image;
}
Aggregations