use of org.dcm4che3.imageio.codec.jpeg.PatchJPEGLSImageInputStream in project dcm4che by dcm4che.
the class DicomImageReader method iisOfFrame.
/**
* Generate an image input stream for the given frame, -1 for all frames (video, multi-component single frame)
* Does not necessarily support the length operation without seeking/reading to the end of the input.
*
* @param frameIndex
* @return
* @throws IOException
*/
public ImageInputStream iisOfFrame(int frameIndex) throws IOException {
ImageInputStream iisOfFrame;
if (epdiis != null) {
seekFrame(frameIndex);
iisOfFrame = epdiis;
} else if (pixelDataFragments == null) {
return null;
} else {
iisOfFrame = new SegmentedInputImageStream(iis, pixelDataFragments, frames == 1 ? -1 : frameIndex);
((SegmentedInputImageStream) iisOfFrame).setImageDescriptor(imageDescriptor);
}
return patchJpegLS != null ? new PatchJPEGLSImageInputStream(iisOfFrame, patchJpegLS) : iisOfFrame;
}
use of org.dcm4che3.imageio.codec.jpeg.PatchJPEGLSImageInputStream in project dcm4che by dcm4che.
the class Decompressor method decompressFrame.
@SuppressWarnings("resource")
protected BufferedImage decompressFrame(ImageInputStream iis, int index) throws IOException {
SegmentedInputImageStream siis = new SegmentedInputImageStream(iis, pixeldataFragments, index);
siis.setImageDescriptor(imageDescriptor);
decompressor.setInput(patchJpegLS != null ? new PatchJPEGLSImageInputStream(siis, patchJpegLS) : siis);
readParam.setDestination(bi);
long start = System.currentTimeMillis();
bi = decompressor.read(0, readParam);
long end = System.currentTimeMillis();
if (LOG.isDebugEnabled())
LOG.debug("Decompressed frame #{} 1:{} in {} ms", new Object[] { index + 1, (float) sizeOf(bi) / siis.getStreamPosition(), end - start });
return bi;
}
use of org.dcm4che3.imageio.codec.jpeg.PatchJPEGLSImageInputStream in project dcm4chee-arc-light by dcm4che.
the class DecompressSupport method decompressFrame.
protected BufferedImage decompressFrame(int frameIndex) throws IOException {
if (encapsulatedPixelData.isEndOfStream())
throw new IOException("Number of data fragments not sufficient for number of frames in requested object");
decompressor.setInput(decompressorParam.patchJPEGLS != null ? new PatchJPEGLSImageInputStream(encapsulatedPixelData, decompressorParam.patchJPEGLS) : encapsulatedPixelData);
decompressParam.setDestination(bi);
long start = System.currentTimeMillis();
bi = decompressor.read(0, decompressParam);
long end = System.currentTimeMillis();
if (LOG.isDebugEnabled())
LOG.debug("Decompressed frame #{} 1:{} in {} ms", frameIndex + 1, (float) sizeOf(bi) / encapsulatedPixelData.getStreamPosition(), end - start);
encapsulatedPixelData.seekNextFrame();
return bi;
}
Aggregations