public Long getHypercubeSize(List<Integer> offset, List<Integer> size, List<Integer> step) throws DimensionsOutOfBoundsException { // only works for 5d at present checkCubeBounds(offset, size, step); int tStripes = (size.get(4) + step.get(4) - 1) / step.get(4); int cStripes = (size.get(3) + step.get(3) - 1) / step.get(3); int zStripes = (size.get(2) + step.get(2) - 1) / step.get(2); int yStripes = (size.get(1) + step.get(1) - 1) / step.get(1); int xStripes = (size.get(0) + step.get(0) - 1) / step.get(0); long tileRowSize = (long) getByteWidth() * xStripes; long cubeSize = tileRowSize * yStripes * zStripes * cStripes * tStripes; return cubeSize; }
public Integer getRowSize() { return getSizeX() * getByteWidth(); }
public Integer getColSize() { return getSizeY() * getByteWidth(); }
public int getByteWidth() { return reader().getByteWidth(); }
public void getByteWidth_async(AMD_RawPixelsStore_getByteWidth __cb, Current __current) throws ServerError { try { __cb.ice_response(reader.getByteWidth()); } catch (Exception e) { __cb.ice_exception(e); } }
if (getByteWidth() == 1) return bytes; int length; if (isLittleEndian) { if (getByteWidth() == 2) { // short/ushort ShortBuffer buf = buffer.asShortBuffer(); length = buffer.limit() / 2; buf.put(i, DataTools.swap(buf.get(i))); } else if (getByteWidth() == 4) { // int/uint/float IntBuffer buf = buffer.asIntBuffer(); length = buffer.limit() / 4; buf.put(i, DataTools.swap(buf.get(i))); } else if (getByteWidth() == 8) // long/double "Unsupported sample bit width: %d", getByteWidth()));
int cubeOffset = 0; 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]; if(step.get(0)==1) int byteOffset = rowOffset + offset.get(0)*getByteWidth(); for(int y = offset.get(1); y < size.get(1)+offset.get(1); y += step.get(1)) int byteOffset = offset.get(0)*getByteWidth(); for(int x = offset.get(0); x < size.get(0)+offset.get(0); x += step.get(0)) System.arraycopy(plane, rowOffset+byteOffset, cube, cubeOffset, getByteWidth()); cubeOffset += getByteWidth(); byteOffset += step.get(0)*getByteWidth();
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; }