public Long getStackSize() { return getSizeZ() * getPlaneSize(); }
public Long getPlaneSize() { return reader().getPlaneSize(); }
public byte[] getPlane(Integer z, Integer c, Integer t, byte[] buffer) throws IOException, DimensionsOutOfBoundsException { checkBounds(null, null, z, c, t); try { if (buffer.length != getPlaneSize()) throw new RuntimeException("Buffer size incorrect."); getWholePlane(z,c,t,buffer); } catch (FormatException e) { throw new RuntimeException(e); } return buffer; }
public void getPlaneSize_async(AMD_RawPixelsStore_getPlaneSize __cb, Current __current) throws ServerError { try { __cb.ice_response(reader.getPlaneSize()); } catch (Exception e) { __cb.ice_exception(e); } }
public Long getPlaneOffset(Integer z, Integer c, Integer t) throws DimensionsOutOfBoundsException { checkBounds(null, null, z, c, t); return (long) getStackOffset(c,t) + z * getPlaneSize(); }
int xStripes = (size.get(0) + step.get(0) - 1) / step.get(0); int tileRowSize = getByteWidth() * xStripes; int planeSize = RomioPixelBuffer.safeLongToInteger(getPlaneSize()); byte[] plane = new byte[planeSize]; for(int t = offset.get(4); t < size.get(4)+offset.get(4); t += step.get(4))
public byte[] getStack(Integer c, Integer t, byte[] buffer) throws IOException, DimensionsOutOfBoundsException { checkBounds(null, null, null, c, t); try { if (buffer.length != getStackSize()) throw new RuntimeException("Buffer size incorrect."); int size = RomioPixelBuffer.safeLongToInteger(getPlaneSize()); byte[] plane = new byte[size]; int sizeZ = getSizeZ(); for(int z = 0; z < sizeZ; z++) { getWholePlane(z,c,t,plane); System.arraycopy(plane, 0, buffer, z*size, size); } } catch (FormatException e) { throw new RuntimeException(e); } return buffer; }
public byte[] getRow(Integer y, Integer z, Integer c, Integer t, byte[] buffer) throws IOException, DimensionsOutOfBoundsException { checkBounds(null, y, z, c, t); try { if (buffer.length != getRowSize()) throw new RuntimeException("Buffer size incorrect."); int size = RomioPixelBuffer.safeLongToInteger(getPlaneSize()); byte[] plane = new byte[size]; getWholePlane(z,c,t,plane); System.arraycopy(plane, y*getRowSize(), buffer, 0, getRowSize()); } catch (FormatException e) { throw new RuntimeException(e); } return buffer; }
public PixelData getPlane(Integer z, Integer c, Integer t) throws IOException, DimensionsOutOfBoundsException { final BfPixelsWrapper reader = reader(); PixelData d; int size = RomioPixelBuffer.safeLongToInteger(reader.getPlaneSize()); byte[] buffer = new byte[size]; reader.getPlane(z,c,t,buffer); d = new PixelData(reader.getPixelsType(), ByteBuffer.wrap(buffer)); d.setOrder(isLittleEndian()? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN); return d; }
public void getPlane_async(AMD_RawPixelsStore_getPlane __cb, int z, int c, int t, Current __current) throws ServerError { try { int size = RomioPixelBuffer.safeLongToInteger( reader.getPlaneSize()); byte[] plane = new byte[size]; reader.getPlane(z,c,t,plane); reader.swapIfRequired(plane); __cb.ice_response(plane); } catch (Exception e) { __cb.ice_exception(e); } }
public byte[] getCol(Integer x, Integer z, Integer c, Integer t, byte[] buffer) throws IOException, DimensionsOutOfBoundsException { checkBounds(x, null, z, c, t); try { if (buffer.length != getColSize()) throw new RuntimeException("Buffer size incorrect."); int size = RomioPixelBuffer.safeLongToInteger(getPlaneSize()); byte[] plane = new byte[size]; getWholePlane(z,c,t,plane); for(int y = 0; y < reader.getSizeY(); y++) { System.arraycopy(plane, (y*getRowSize())+(x*getByteWidth()), buffer, y*getByteWidth(), getByteWidth()); } } catch (FormatException e) { throw new RuntimeException(e); } return buffer; }
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; }