/** Determines whether the channels in the file can be merged. */ public boolean canMerge() { int c = getSizeC(); return c > 1 && c <= 4 && !reader.isRGB(); }
/** Determines whether the channels in the file can be merged. */ public boolean canMerge() { int c = getSizeC(); return c > 1 && c <= 4 && !reader.isRGB(); }
@Override public int getImageCount() { FormatTools.assertId(getCurrentFile(), true, 2); int no = reader.getImageCount(); if (canMerge()) no /= getSizeC(); return no; }
@Override public int getImageCount() { FormatTools.assertId(getCurrentFile(), true, 2); int no = reader.getImageCount(); if (canMerge()) no /= getSizeC(); return no; }
@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; }