/** * @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); int file = no / getSizeT(); int plane = no % getSizeT(); lastFile = file; return readers[file].openBytes(plane, 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); int file = no / getSizeT(); int plane = no % getSizeT(); lastFile = file; return readers[file].openBytes(plane, 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); 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; }
/** * @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); int[] zct = getZCTCoords(no); int file = FormatTools.getIndex("XYZCT", getSizeZ(), getEffectiveSizeC(), getSizeT(), getImageCount(), zct[0], zct[1], zct[2]) % files.length; int plane = no / files.length; lastFile = file; return readers[file].openBytes(plane, 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); int[] zct = getZCTCoords(no); int file = FormatTools.getIndex("XYZCT", getSizeZ(), getEffectiveSizeC(), getSizeT(), getImageCount(), zct[0], zct[1], zct[2]) % files.length; int plane = no / files.length; lastFile = file; return readers[file].openBytes(plane, 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); if (getSeries() < planes.length && no < planes[getSeries()].length) { Plane p = planes[getSeries()][no]; if (p != null && p.filename != null && new Location(p.filename).exists()) { if (reader == null) { reader = new MinimalTiffReader(); } reader.setId(p.filename); reader.openBytes(0, buf, x, y, w, h); reader.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; }
/** * @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); if (getSeries() < planes.length && no < planes[getSeries()].length) { Plane p = planes[getSeries()][no]; if (p != null && p.filename != null && new Location(p.filename).exists()) { if (reader == null) { reader = new MinimalTiffReader(); } reader.setId(p.filename); reader.openBytes(0, buf, x, y, w, h); reader.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); if (getSizeC() == 1) { return super.openBytes(no, buf, x, y, w, h); } byte[] b = delegate.openBytes(no / getSizeC(), x, y, w, h); int bpp = FormatTools.getBytesPerPixel(getPixelType()); int c = getZCTCoords(no)[1]; ImageTools.splitChannels( b, buf, c, getSizeC(), bpp, false, isInterleaved(), w * h * bpp); 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 (getSizeC() == 1) { return super.openBytes(no, buf, x, y, w, h); } byte[] b = delegate.openBytes(no / getSizeC(), x, y, w, h); int bpp = FormatTools.getBytesPerPixel(getPixelType()); int c = getZCTCoords(no)[1]; ImageTools.splitChannels( b, buf, c, getSizeC(), bpp, false, isInterleaved(), w * h * bpp); 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 = getFile(no); int index = getFileIndex(no); if (isTiff) { tiff.setId(file); return tiff.openBytes(index, buf, x, y, w, h); } try (RandomAccessInputStream ras = new RandomAccessInputStream(file)) { if (6 + index * FormatTools.getPlaneSize(this) < ras.length()) { ras.seek(6 + index * FormatTools.getPlaneSize(this)); readPlane(ras, x, y, w, h, buf); } } 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 = getFile(no); int index = getFileIndex(no); if (isTiff) { tiff.setId(file); return tiff.openBytes(index, buf, x, y, w, h); } try (RandomAccessInputStream ras = new RandomAccessInputStream(file)) { if (6 + index * FormatTools.getPlaneSize(this) < ras.length()) { ras.seek(6 + index * FormatTools.getPlaneSize(this)); readPlane(ras, x, y, w, h, buf); } } return buf; }