public final void setTransferSyntax(String uid) { this.tsuid = uid; this.tstype = TransferSyntaxType.forUID(uid); if (tstype == null) { throw new IllegalArgumentException( "Unsupported Transfer Syntax: " + tsuid); } }
TransferSyntaxType tstype = TransferSyntaxType.forUID(tsuid); if (decompressor == null || super.tstype == TransferSyntaxType.RLE) bi = createBufferedImage( Math.min(bitsStored, tstype.getMaxBitsStored()), super.tstype == TransferSyntaxType.RLE || banded, signed && tstype.canEncodeSigned()); Fragments compressedPixeldata = dataset.newFragments(Tag.PixelData, VR.OB, frames + 1); pmiAfterDecompression.compress(tsuid).toString()); dataset.setInt(Tag.PlanarConfiguration, VR.US, tstype.getPlanarConfiguration());
this.tstype = TransferSyntaxType.forUID(tsuid); Object pixeldata = dataset.getValue(Tag.PixelData); if (pixeldata == null) if (!tstype.isPixeldataEncapsulated()) throw new IllegalArgumentException("Encapusulated Pixel Data" + "with Transfer Syntax: " + tsuid);
public void transcodeWithTranscoder(File src, final File dest) throws IOException { try (Transcoder transcoder = new Transcoder(src)) { transcoder.setIncludeFileMetaInformation(!nofmi); transcoder.setRetainFileMetaInformation(retainfmi); transcoder.setEncodingOptions(encOpts); transcoder.setDestinationTransferSyntax(tsuid); if (tstype.isPixeldataEncapsulated()) transcoder.setCompressParams(params.toArray(new Property[0])); transcoder.transcode(new Transcoder.Handler(){ @Override public OutputStream newOutputStream(Transcoder transcoder, Attributes dataset) throws IOException { return new FileOutputStream(dest); } }); } }
int samples = imageDescriptor.getSamples(); int bitsAllocated = imageDescriptor.getBitsAllocated(); int bitsStored = Math.min(imageDescriptor.getBitsStored(), destTransferSyntaxType.getMaxBitsStored()); boolean signed = imageDescriptor.isSigned() && destTransferSyntaxType.canEncodeSigned(); boolean banded = imageDescriptor.isBanded() || srcTransferSyntaxType == TransferSyntaxType.RLE; int dataType = bitsAllocated > 8
private void adjustDataset() { if (imageDescriptor.getSamples() == 3) { PhotometricInterpretation pmi = imageDescriptor.getPhotometricInterpretation(); int planarConfiguration = imageDescriptor.getPlanarConfiguration(); if (decompressor != null) { pmi = decompressorParam.pmiAfterDecompression(pmi); planarConfiguration = srcTransferSyntaxType.getPlanarConfiguration(); } if (compressor != null) { pmi = pmi.compress(destTransferSyntax); planarConfiguration = destTransferSyntaxType.getPlanarConfiguration(); } dataset.setString(Tag.PhotometricInterpretation, VR.CS, pmi.toString()); dataset.setInt(Tag.PlanarConfiguration, VR.US, planarConfiguration); } }
public void transcodeWithTranscoder(File src, final File dest) throws IOException { try (Transcoder transcoder = new Transcoder(src)) { transcoder.setIncludeFileMetaInformation(!nofmi); transcoder.setRetainFileMetaInformation(retainfmi); transcoder.setEncodingOptions(encOpts); transcoder.setDestinationTransferSyntax(tsuid); if (tstype.isPixeldataEncapsulated()) transcoder.setCompressParams(params.toArray(new Property[0])); transcoder.transcode(new Transcoder.Handler(){ @Override public OutputStream newOutputStream(Transcoder transcoder, Attributes dataset) throws IOException { return new FileOutputStream(dest); } }); } }
public final void setTransferSyntax(String uid) { this.tsuid = uid; this.tstype = TransferSyntaxType.forUID(uid); if (tstype == null) { throw new IllegalArgumentException( "Unsupported Transfer Syntax: " + tsuid); } }
String tsuid = this.tsuid; if (pixeldata != null) { if (tstype.isPixeldataEncapsulated()) { tsuid = adjustTransferSyntax(tsuid, dataset.getInt(Tag.BitsStored, 8));
public void setDestinationTransferSyntax(String tsuid) { if (tsuid.equals(destTransferSyntax)) return; this.destTransferSyntaxType = TransferSyntaxType.forUID(tsuid); this.destTransferSyntax = tsuid; if (srcTransferSyntaxType != TransferSyntaxType.NATIVE) initDecompressor(); if (destTransferSyntaxType != TransferSyntaxType.NATIVE) initCompressor(tsuid); }
String tsuid = this.tsuid; if (pixeldata != null) { if (tstype.isPixeldataEncapsulated()) { tsuid = adjustTransferSyntax(tsuid, dataset.getInt(Tag.BitsStored, 8));
public Transcoder(DicomInputStream dis) throws IOException { this.dis = dis; dis.readFileMetaInformation(); dis.setDicomInputHandler(dicomInputHandler); dataset = new Attributes(dis.bigEndian(), 64); srcTransferSyntax = dis.getTransferSyntax(); srcTransferSyntaxType = TransferSyntaxType.forUID(srcTransferSyntax); destTransferSyntax = srcTransferSyntax; destTransferSyntaxType = srcTransferSyntaxType; }