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 = getByteWidth() * (long) xStripes; long cubeSize = tileRowSize * yStripes * zStripes * cStripes * tStripes; return cubeSize; }
/** * Implemented as specified by {@link PixelBuffer} I/F. * @see PixelBuffer#getRowSize() */ public Integer getRowSize() { if (rowSize == null) { rowSize = getSizeX() * getByteWidth(); } return rowSize; }
/** * Implemented as specified by {@link PixelBuffer} I/F. * @see PixelBuffer#getColSize() */ public Integer getColSize() { if (colSize == null) { colSize = getSizeY() * getByteWidth(); } return colSize; }
/** * Implemented as specified by {@link PixelBuffer} I/F. * @see PixelBuffer#getPlaneRegionDirect(Integer, Integer, Integer, Integer, * Integer, byte[]) */ public byte[] getPlaneRegionDirect(Integer z, Integer c, Integer t, Integer count, Integer offset, byte[] buffer) throws IOException, DimensionsOutOfBoundsException { final PixelData pd = getPlane(z, c, t); final ByteBuffer b = pd.getData(); b.position(offset * getByteWidth()); b.get(buffer, 0, count * getByteWidth()); pd.dispose(); return buffer; }
public Dimension getTileSize() { int width = getSizeX(); int height = Math.min(getSizeY(), (MAXIMUM_BUFFER_SIZE / getByteWidth()) / getSizeX()); return new Dimension(width, height); }
/** * Implemented as specified by {@link PixelBuffer} I/F. * @see PixelBuffer#getPlaneSize() */ public Long getPlaneSize() { if (planeSize == null) { planeSize = (long) getSizeX() * (long) getSizeY() * getByteWidth(); } return planeSize; }
int cubeOffset = 0; int xStripes = (size.get(0) + step.get(0) - 1) / step.get(0); int pixelSize = getByteWidth(); int tileRowSize = pixelSize * xStripes; byte[] plane = new byte[safeLongToInteger(getPlaneSize())];
public void setTile(byte[] buffer, Integer z, Integer c, Integer t, Integer x, Integer y, Integer w, Integer h) throws IOException, BufferOverflowException { if (x != 0) { throw new UnsupportedOperationException( "ROMIO pixel buffer only supports 0 offseted tile writes."); } if (w != getSizeX()) { throw new UnsupportedOperationException( "ROMIO pixel buffer only supports full row writes."); } try { long offset = getPlaneOffset(z, c, t); offset += getByteWidth() * getSizeX() * y; setRegion(buffer.length, offset, buffer); } catch (DimensionsOutOfBoundsException e) { throw new RuntimeException(e); } }
size = width*height*getByteWidth(); buf = ByteBuffer.wrap(new byte[size]); region = new PixelData(pixels.getPixelsType().getValue(), buf); size = width*height*getByteWidth()/(stride*stride); buf = ByteBuffer.wrap(new byte[size]); region = new PixelData(pixels.getPixelsType().getValue(), buf);