@Override public int getIndex(int z, int c, int t) { return reader.getIndex(z, c, t); }
@Override public int getIndex(int z, int c, int t, int moduloZ, int moduloC, int moduloT) { return reader.getIndex(z, c, t, moduloZ, moduloC, moduloT); }
@Override public int getIndex(int z, int c, int t) { return reader.getIndex(z, c, t); }
@Override public int getIndex(int z, int c, int t, int moduloZ, int moduloC, int moduloT) { return reader.getIndex(z, c, t, moduloZ, moduloC, moduloT); }
public byte[] getTile(int z, int c, int t, int x, int y, int w, int h, byte[] buffer) throws FormatException, IOException { return reader.openBytes(reader.getIndex(z, c, t), buffer, x, y, w, h); }
@Override public int getIndex(int z, int c, int t, int moduloZ, int moduloC, int moduloT) { return getReader().getIndex(z, c, t, moduloZ, moduloC, moduloT); }
@Override public int getIndex(int z, int c, int t) { return getReader().getIndex(z, c, t); }
@Override public int getIndex(int z, int c, int t, int moduloZ, int moduloC, int moduloT) { return getReader().getIndex(z, c, t, moduloZ, moduloC, moduloT); }
@Override public int getIndex(int z, int c, int t) { return getReader().getIndex(z, c, t); }
/** * Returns the image number in the original dataset that corresponds to the * given image number. * * @param no is an image number greater than or equal to 0 and less than * getImageCount() * @return the corresponding image number in the original (unmerged) data. */ public int getOriginalIndex(int no) throws FormatException, IOException { int imageCount = getImageCount(); int originalCount = reader.getImageCount(); if (imageCount == originalCount) return no; int[] coords = getZCTCoords(no); return reader.getIndex(coords[0], coords[1], coords[2]); }
/** * Returns the image number in the original dataset that corresponds to the * given image number. * * @param no is an image number greater than or equal to 0 and less than * getImageCount() * @return the corresponding image number in the original (unmerged) data. */ public int getOriginalIndex(int no) throws FormatException, IOException { int imageCount = getImageCount(); int originalCount = reader.getImageCount(); if (imageCount == originalCount) return no; int[] coords = getZCTCoords(no); return reader.getIndex(coords[0], coords[1], coords[2]); }
int ndx = in == null ? -1 : in.getIndex(getZ(), getC(), getT()); if (ndx >= 0) { nSlider.removeChangeListener(this);
/** * Returns the image number in the original dataset that corresponds to the * given image number. For instance, if the original dataset was a single * RGB image and the given image number is 2, the return value will be 0. * * @param no is an image number greater than or equal to 0 and less than * getImageCount() * @return the corresponding image number in the original (unseparated) data. */ public int getOriginalIndex(int no) { int imageCount = getImageCount(); int originalCount = reader.getImageCount(); if (imageCount == originalCount) return no; int[] coords = getZCTCoords(no); coords[1] /= reader.getRGBChannelCount(); return reader.getIndex(coords[0], coords[1], coords[2]); }
int ndx = in == null ? -1 : in.getIndex(getZ(), getC(), getT()); if (ndx >= 0) { nSlider.removeChangeListener(this);
/** * Returns the image number in the original dataset that corresponds to the * given image number. For instance, if the original dataset was a single * RGB image and the given image number is 2, the return value will be 0. * * @param no is an image number greater than or equal to 0 and less than * getImageCount() * @return the corresponding image number in the original (unseparated) data. */ public int getOriginalIndex(int no) { int imageCount = getImageCount(); int originalCount = reader.getImageCount(); if (imageCount == originalCount) return no; int[] coords = getZCTCoords(no); coords[1] /= reader.getRGBChannelCount(); return reader.getIndex(coords[0], coords[1], coords[2]); }
@Override public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException { FormatTools.assertId(getCurrentFile(), true, 2); if (!canMerge()) return super.openBytes(no, buf, x, y, w, h); int sizeC = getSizeC(); int[] nos = getZCTCoords(no); int z = nos[0], t = nos[2]; for (int c=0; c<sizeC; c++) { byte[] b = reader.openBytes(reader.getIndex(z, c, t), x, y, w, h); System.arraycopy(b, 0, buf, c * b.length, b.length); } return buf; }
@Override public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException { FormatTools.assertId(getCurrentFile(), true, 2); if (!canMerge()) return super.openBytes(no, buf, x, y, w, h); int sizeC = getSizeC(); int[] nos = getZCTCoords(no); int z = nos[0], t = nos[2]; for (int c=0; c<sizeC; c++) { byte[] b = reader.openBytes(reader.getIndex(z, c, t), x, y, w, h); System.arraycopy(b, 0, buf, c * b.length, b.length); } return buf; }
private byte[] getWholePlane(int z, int c, int t, byte[] plane) throws IOException, FormatException { int planeNumber; if (reader.getRGBChannelCount() == 1) { planeNumber = reader.getIndex(z, c, t); reader.openBytes(planeNumber, plane); } else { int size = RomioPixelBuffer.safeLongToInteger(getPlaneSize()); byte[] fullPlane = new byte[size*reader.getRGBChannelCount()]; planeNumber = reader.getIndex(z, 0, t); reader.openBytes(planeNumber, fullPlane); if(reader.isInterleaved()) { for(int p = 0; p < size; p += getByteWidth()) { System.arraycopy(fullPlane, c*getByteWidth() + p*reader.getRGBChannelCount(), plane, p, getByteWidth()); } } else { System.arraycopy(fullPlane, c*size, plane, 0, size); } } return plane; }
public static long getMaxNonzero(IFormatReader reader) { final int siz = reader.getBitsPerPixel() / 8 * reader.getRGBChannelCount() * reader.getSizeX() * reader.getSizeY(); final byte[] buffer = new byte[siz]; final int nC = reader.getSizeC() == reader.getRGBChannelCount() ? 1 : reader.getSizeC(); final int nT = reader.getSizeT(); int z = reader.getSizeZ() - 1; for (;z>=0;z--) for (int c = 0; c < nC; c++ ) for (int t = 0; t < nT; t++) { try { reader.openBytes( reader.getIndex( z, c, t ), buffer ); } catch ( FormatException | IOException e ) { e.printStackTrace(); } if (isNonzero( buffer )) return z; } return 0l; }