@Override public void reopenFile() throws IOException { initTiffParser(); }
@Override public void reopenFile() throws IOException { initTiffParser(); }
/** * Sets the resolution level when we have JPEG 2000 compressed data. * @param ifd The active IFD that is being used in our current * <code>openBytes()</code> calling context. It will be the sub-resolution * IFD if <code>currentSeries > 0</code>. */ protected void setResolutionLevel(IFD ifd) { if (tiffParser == null) { initTiffParser(); } if (j2kCodecOptions == null) { j2kCodecOptions = new JPEG2000CodecOptions(); } j2kCodecOptions.resolution = Math.abs(getCoreIndex() - resolutionLevels); LOGGER.debug("Using JPEG 2000 resolution level {}", j2kCodecOptions.resolution); tiffParser.setCodecOptions(j2kCodecOptions); }
/** * Sets the resolution level when we have JPEG 2000 compressed data. * @param ifd The active IFD that is being used in our current * <code>openBytes()</code> calling context. It will be the sub-resolution * IFD if <code>currentSeries > 0</code>. */ protected void setResolutionLevel(IFD ifd) { if (tiffParser == null) { initTiffParser(); } if (j2kCodecOptions == null) { j2kCodecOptions = new JPEG2000CodecOptions(); } j2kCodecOptions.resolution = Math.abs(getCoreIndex() - resolutionLevels); LOGGER.debug("Using JPEG 2000 resolution level {}", j2kCodecOptions.resolution); tiffParser.setCodecOptions(j2kCodecOptions); }
super.initFile(id); in = new RandomAccessInputStream(id, 16); initTiffParser(); Boolean littleEndian = tiffParser.checkHeader(); if (littleEndian == null) {
super.initFile(id); in = new RandomAccessInputStream(id, 16); initTiffParser(); Boolean littleEndian = tiffParser.checkHeader(); if (littleEndian == null) {
@Override public byte[] openThumbBytes(int no) throws FormatException, IOException { FormatTools.assertId(currentId, true, 1); if (thumbnailIFDs == null || thumbnailIFDs.size() <= no) { return super.openThumbBytes(no); } if (tiffParser == null) { initTiffParser(); } tiffParser.fillInIFD(thumbnailIFDs.get(no)); int[] bps = null; try { bps = thumbnailIFDs.get(no).getBitsPerSample(); } catch (FormatException e) { } if (bps == null) { return super.openThumbBytes(no); } int b = bps[0]; while ((b % 8) != 0) b++; b /= 8; if (b != FormatTools.getBytesPerPixel(getPixelType()) || bps.length != getRGBChannelCount()) { return super.openThumbBytes(no); } byte[] buf = new byte[getThumbSizeX() * getThumbSizeY() * getRGBChannelCount() * FormatTools.getBytesPerPixel(getPixelType())]; return tiffParser.getSamples(thumbnailIFDs.get(no), buf); }
@Override public byte[] openThumbBytes(int no) throws FormatException, IOException { FormatTools.assertId(currentId, true, 1); if (thumbnailIFDs == null || thumbnailIFDs.size() <= no) { return super.openThumbBytes(no); } if (tiffParser == null) { initTiffParser(); } tiffParser.fillInIFD(thumbnailIFDs.get(no)); int[] bps = null; try { bps = thumbnailIFDs.get(no).getBitsPerSample(); } catch (FormatException e) { } if (bps == null) { return super.openThumbBytes(no); } int b = bps[0]; while ((b % 8) != 0) b++; b /= 8; if (b != FormatTools.getBytesPerPixel(getPixelType()) || bps.length != getRGBChannelCount()) { return super.openThumbBytes(no); } byte[] buf = new byte[getThumbSizeX() * getThumbSizeY() * getRGBChannelCount() * FormatTools.getBytesPerPixel(getPixelType())]; return tiffParser.getSamples(thumbnailIFDs.get(no), buf); }