public static boolean decompress(Attributes dataset, String tsuid) { return new Decompressor(dataset, tsuid).decompress(); }
public void writeTo(OutputStream out) throws IOException { ImageInputStream iis = createImageInputStream(); try { for (int i = 0; i < frames; ++i) writeFrameTo(iis, i, out); if ((length & 1) != 0) out.write(0); } finally { try { iis.close(); } catch (IOException ignore) {} decompressor.dispose(); } }
public void writeFrameTo(ImageInputStream iis, int frameIndex, OutputStream out) throws IOException { writeTo(decompressFrame(iis, frameIndex).getRaster(), out); }
iuid = parsedDicomFile.getString(Tag.SOPInstanceUID); if (!ts.equals(filets)) { Decompressor.decompress(parsedDicomFile, filets); iuid = data.getString(Tag.SOPInstanceUID); if (!ts.equals(filets)) { Decompressor.decompress(data, filets);
private static void writeTo(SampleModel sm, byte[][] bankData, OutputStream out) throws IOException { int h = sm.getHeight(); int w = sm.getWidth(); ComponentSampleModel csm = (ComponentSampleModel) sm; int len = w * csm.getPixelStride(); int stride = csm.getScanlineStride(); if (csm.getBandOffsets()[0] != 0) bgr2rgb(bankData[0]); for (byte[] b : bankData) for (int y = 0, off = 0; y < h; ++y, off += stride) out.write(b, off, len); }
protected BufferedImage createBufferedImage(int bitsStored, boolean banded, boolean signed) { int dataType = bitsAllocated > 8 ? (signed ? DataBuffer.TYPE_SHORT : DataBuffer.TYPE_USHORT) : DataBuffer.TYPE_BYTE; ComponentColorModel cm = samples == 1 ? new ComponentColorModel( ColorSpace.getInstance(ColorSpace.CS_GRAY), new int[] { bitsStored }, false, // hasAlpha false, // isAlphaPremultiplied, Transparency.OPAQUE, dataType) : new ComponentColorModel( ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[] { bitsStored, bitsStored, bitsStored }, false, // hasAlpha false, // isAlphaPremultiplied, Transparency.OPAQUE, dataType); SampleModel sm = banded ? new BandedSampleModel(dataType, cols, rows, samples) : new PixelInterleavedSampleModel(dataType, cols, rows, samples, cols * samples, bandOffsets()); WritableRaster raster = Raster.createWritableRaster(sm, null); return new BufferedImage(cm, raster, false, null); }
bi = createBufferedImage(bitsStored, true, signed);
iuid = parsedDicomFile.getString(Tag.SOPInstanceUID); if (!ts.equals(filets)) { Decompressor.decompress(parsedDicomFile, filets); iuid = data.getString(Tag.SOPInstanceUID); if (!ts.equals(filets)) { Decompressor.decompress(data, filets);
compressor.compress(tsuid, params.toArray(new Property[0])); } else if (pixeldata instanceof Fragments) Decompressor.decompress(dataset, dis.getTransferSyntax());
compressor.compress(tsuid, params.toArray(new Property[0])); } else if (pixeldata instanceof Fragments) Decompressor.decompress(dataset, dis.getTransferSyntax());