@Override public void setId(String id) throws FormatException, IOException { log.debug("setId(" + id + ")"); super.setId(id); }
@Override public byte[][] get8BitLookupTable() throws FormatException, IOException { FormatTools.assertId(currentId, true, 1); try { int index = (int) Math.min(lastPlane, files[getSeries()].size() - 1); tiff.setId(files[getSeries()].get(index)); return tiff.get8BitLookupTable(); } catch (FormatException e) { LOGGER.debug("Failed to retrieve lookup table", e); } catch (IOException e) { LOGGER.debug("Failed to retrieve lookup table", e); } return null; }
@Override public short[][] get16BitLookupTable() throws FormatException, IOException { FormatTools.assertId(currentId, true, 1); try { int index = (int) Math.min(lastPlane, files[getSeries()].size() - 1); tiff.setId(files[getSeries()].get(index)); return tiff.get16BitLookupTable(); } catch (FormatException e) { LOGGER.debug("Failed to retrieve lookup table", e); } catch (IOException e) { LOGGER.debug("Failed to retrieve lookup table", e); } return null; }
@Override public byte[][] get8BitLookupTable() throws FormatException, IOException { FormatTools.assertId(currentId, true, 1); try { int index = (int) Math.min(lastPlane, files[getSeries()].size() - 1); tiff.setId(files[getSeries()].get(index)); return tiff.get8BitLookupTable(); } catch (FormatException e) { LOGGER.debug("Failed to retrieve lookup table", e); } catch (IOException e) { LOGGER.debug("Failed to retrieve lookup table", e); } return null; }
@Override public short[][] get16BitLookupTable() throws FormatException, IOException { FormatTools.assertId(currentId, true, 1); try { int index = (int) Math.min(lastPlane, files[getSeries()].size() - 1); tiff.setId(files[getSeries()].get(index)); return tiff.get16BitLookupTable(); } catch (FormatException e) { LOGGER.debug("Failed to retrieve lookup table", e); } catch (IOException e) { LOGGER.debug("Failed to retrieve lookup table", e); } return null; }
@Override public int getOptimalTileWidth() { FormatTools.assertId(currentId, true, 1); try { readers[0][0].setId(tiffs[0][0]); return readers[0][0].getOptimalTileWidth(); } catch (FormatException e) { LOGGER.debug("", e); } catch (IOException e) { LOGGER.debug("", e); } return super.getOptimalTileWidth(); }
@Override public int getOptimalTileHeight() { FormatTools.assertId(currentId, true, 1); try { readers[0][0].setId(tiffs[0][0]); return readers[0][0].getOptimalTileHeight(); } catch (FormatException e) { LOGGER.debug("", e); } catch (IOException e) { LOGGER.debug("", e); } return super.getOptimalTileHeight(); }
@Override public int getOptimalTileHeight() { FormatTools.assertId(currentId, true, 1); try { readers[0][0].setId(tiffs[0][0]); return readers[0][0].getOptimalTileHeight(); } catch (FormatException e) { LOGGER.debug("", e); } catch (IOException e) { LOGGER.debug("", e); } return super.getOptimalTileHeight(); }
@Override public int getOptimalTileWidth() { FormatTools.assertId(currentId, true, 1); try { readers[0][0].setId(tiffs[0][0]); return readers[0][0].getOptimalTileWidth(); } catch (FormatException e) { LOGGER.debug("", e); } catch (IOException e) { LOGGER.debug("", e); } return super.getOptimalTileWidth(); }
/** * @see loci.formats.IFormatReader#openBytes(int, byte[], int, int, int, int) */ @Override public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException { FormatTools.checkPlaneParameters(this, no, buf.length, x, y, w, h); reader.setId(tiffs[getSeries()][no]); return reader.openBytes(0, buf, x, y, w, h); }
/** * @see loci.formats.IFormatReader#openBytes(int, byte[], int, int, int, int) */ @Override public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException { FormatTools.checkPlaneParameters(this, no, buf.length, x, y, w, h); reader.setId(tiffs[getSeries()][no]); return reader.openBytes(0, buf, x, y, w, h); }
/** * @see loci.formats.IFormatReader#openBytes(int, byte[], int, int, int, int) */ @Override public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException { FormatTools.checkPlaneParameters(this, no, buf.length, x, y, w, h); Arrays.fill(buf, (byte) 0); Plane p = lookupPlane(getSeries(), no); LOGGER.trace("series = {}, no = {}, file = {}", series, no, p == null ? null : p.file); if (p != null && p.file != null) { reader.setId(p.file); return reader.openBytes(0, buf, x, y, w, h); } return buf; }
/** * @see loci.formats.IFormatReader#openBytes(int, byte[], int, int, int, int) */ @Override public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException { FormatTools.checkPlaneParameters(this, no, buf.length, x, y, w, h); Arrays.fill(buf, (byte) 0); Plane p = lookupPlane(getSeries(), no); LOGGER.trace("series = {}, no = {}, file = {}", series, no, p == null ? null : p.file); if (p != null && p.file != null) { reader.setId(p.file); return reader.openBytes(0, buf, x, y, w, h); } return buf; }
/** * @see loci.formats.IFormatReader#openBytes(int, byte[], int, int, int, int) */ @Override public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException { FormatTools.checkPlaneParameters(this, no, buf.length, x, y, w, h); if (imageFiles[no] != null && new Location(imageFiles[no]).exists()) { Plane p = planes.get(no); tiffReader.setId(p.filename); tiffReader.openBytes(0, buf, x, y, w, h); tiffReader.close(); } else { LOGGER.warn("File for image #{} ({}) is missing.", no, imageFiles[no]); } return buf; }
/** * @see loci.formats.IFormatReader#openBytes(int, byte[], int, int, int, int) */ @Override public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException { FormatTools.checkPlaneParameters(this, no, buf.length, x, y, w, h); if (imageFiles[no] != null && new Location(imageFiles[no]).exists()) { Plane p = planes.get(no); tiffReader.setId(p.filename); tiffReader.openBytes(0, buf, x, y, w, h); tiffReader.close(); } else { LOGGER.warn("File for image #{} ({}) is missing.", no, imageFiles[no]); } return buf; }
private byte[] getTile(int well, int no, int row, int col, Region intersection) throws FormatException, IOException { intersection.x %= tileWidth; intersection.y %= tileHeight; int tileIndex = (no * tileRows + row) * tileCols + col; readers[well][tileIndex].setId(tiffs[well][tileIndex]); int bpp = FormatTools.getBytesPerPixel(getPixelType()); int ch = getRGBChannelCount(); int bufferSize = intersection.width * intersection.height * ch * bpp; if (cachedTileBuffer == null || cachedTileBuffer.length != bufferSize) { cachedTileBuffer = new byte[bufferSize]; } byte[] buf = readers[well][tileIndex].openBytes(0, cachedTileBuffer, intersection.x, intersection.y, intersection.width, intersection.height); readers[well][tileIndex].close(); return buf; }
private byte[] getTile(int well, int no, int row, int col, Region intersection) throws FormatException, IOException { intersection.x %= tileWidth; intersection.y %= tileHeight; int tileIndex = (no * tileRows + row) * tileCols + col; readers[well][tileIndex].setId(tiffs[well][tileIndex]); int bpp = FormatTools.getBytesPerPixel(getPixelType()); int ch = getRGBChannelCount(); int bufferSize = intersection.width * intersection.height * ch * bpp; if (cachedTileBuffer == null || cachedTileBuffer.length != bufferSize) { cachedTileBuffer = new byte[bufferSize]; } byte[] buf = readers[well][tileIndex].openBytes(0, cachedTileBuffer, intersection.x, intersection.y, intersection.width, intersection.height); readers[well][tileIndex].close(); return buf; }
/** * @see loci.formats.IFormatReader#openBytes(int, byte[], int, int, int, int) */ @Override public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException { FormatTools.checkPlaneParameters(this, no, buf.length, x, y, w, h); String file = positions.get(getSeries()).getFile( getDimensionOrder(), getSizeZ(), getSizeC(), getSizeT(), getImageCount(), no); if (file != null && new Location(file).exists()) { tiffReader.setId(file); int index = no % tiffReader.getImageCount(); return tiffReader.openBytes(index, buf, x, y, w, h); } LOGGER.warn("File for image #{} ({}) is missing.", no, file); return buf; }
/** Initialize the TIFF reader with the first non-null file in the current series. */ private void setupReader() { try { int plane = 0; String file = positions.get(getSeries()).getFile( getDimensionOrder(), getSizeZ(), getSizeC(), getSizeT(), getImageCount(), plane++); while (file == null && plane < getImageCount()) { file = positions.get(getSeries()).getFile( getDimensionOrder(), getSizeZ(), getSizeC(), getSizeT(), getImageCount(), plane++); } tiffReader.setId(file); } catch (Exception e) { LOGGER.warn("", e); } }
/** Initialize the TIFF reader with the first non-null file in the current series. */ private void setupReader() { try { int plane = 0; String file = positions.get(getSeries()).getFile( getDimensionOrder(), getSizeZ(), getSizeC(), getSizeT(), getImageCount(), plane++); while (file == null && plane < getImageCount()) { file = positions.get(getSeries()).getFile( getDimensionOrder(), getSizeZ(), getSizeC(), getSizeT(), getImageCount(), plane++); } tiffReader.setId(file); } catch (Exception e) { LOGGER.warn("", e); } }