int[] getBitsStored() { int n = 0; for (int i = 8; i <= 16; i++) if (matchBitStored(i)) n++; int[] bitsStored = new int[n]; for (int i = 8, j = 0; i <= 16; i++) if (matchBitStored(i)) bitsStored[j++] = i; return bitsStored; }
FormatNameFilterIterator(Iterator<T> iter, String formatName) { this.iter = iter; this.formatName = formatName; advance(); }
public static ImageWriterFactory getDefault() { if (defaultFactory == null) defaultFactory = initDefault(); return defaultFactory; }
public boolean matches(String aeTitle, ImageDescriptor imageDescriptor) { return pmis.contains(imageDescriptor.getPhotometricInterpretation()) && matchBitStored(imageDescriptor.getBitsStored()) && matchPixelRepresentation(imageDescriptor.getPixelRepresentation()) && isEmptyOrContains(this.aeTitles, aeTitle) && isEmptyOrContains(this.sopClasses, imageDescriptor.getSopClassUID()) && isEmptyOrContains(this.bodyPartExamined, imageDescriptor.getBodyPartExamined()); }
private void decompressPixelData() throws IOException { int length = imageDescriptor.getLength(); int padding = length & 1; adjustDataset(); writeDataset(); dos.writeHeader(Tag.PixelData, VR.OW, length + padding); for (int i = 0; i < imageDescriptor.getFrames(); i++) { decompressFrame(i); writeFrame(); } if (padding != 0) dos.write(0); }
public static boolean decompress(Attributes dataset, String tsuid) { return new Decompressor(dataset, tsuid).decompress(); }
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); }
private void nullifyUnusedBits(short[] data) { int mask = (1<<imageDescriptor.getBitsStored())-1; for (int i = 0; i < data.length; i++) data[i] &= mask; }
public void add(CompressionRules rules) { for (CompressionRule rule : rules) add(rule); }
public static boolean canDecompress(String tsuid) { return getDefault().contains(tsuid); }
public static ImageReaderFactory getDefault() { if (defaultFactory == null) defaultFactory = initDefault(); return defaultFactory; }
public CompressionRule findCompressionRule(String aeTitle, ImageDescriptor imageDescriptor) { for (CompressionRule ac : list) if (ac.matchesCondition(aeTitle, imageDescriptor)) return ac; return null; }
@Override public int getEncodedLength(DicomEncodingOptions encOpts, boolean explicitVR, VR vr) { try { compress(); } catch (IOException e) { return -1; } return (streamLength + 1) & ~1; }
@Override public int compareTo(CompressionRule o) { return condition.compareTo(o.condition); }
@Override public void writeTo(DicomOutputStream out, VR vr) throws IOException { Decompressor.this.writeTo(out); }
@Override public int calcLength(DicomEncodingOptions encOpts, boolean explicitVR, VR vr) { return getEncodedLength(encOpts, explicitVR, vr); }
@Override public int calcLength(DicomEncodingOptions encOpts, boolean explicitVR, VR vr) { return getEncodedLength(encOpts, explicitVR, vr); }
@Override public void writeTo(DicomOutputStream out, VR vr) throws IOException { writeTo(out); }
public PhotometricInterpretation[] getPhotometricInterpretations() { return condition.getPhotometricInterpretations(); }
public int[] getBitsStored() { return condition.getBitsStored(); }