/** * Implemented as specified by {@link PixelBuffer} I/F. * @see PixelBuffer#getColDirect(Integer, Integer, Integer, Integer, byte[]) */ public byte[] getColDirect(Integer x, Integer z, Integer c, Integer t, byte[] buffer) throws IOException, DimensionsOutOfBoundsException { PixelData plane = getPlane(z, c, t); Integer sizeY = getSizeY(); Integer sizeX = getSizeX(); ByteBuffer buf = ByteBuffer.wrap(buffer); PixelData column = new PixelData(pixels.getPixelsType().getValue(), buf); int offset; double value; for (int i = 0; i < sizeY; i++) { offset = (i * sizeX) + x; value = plane.getPixelValue(offset); column.setPixelValue(i, value); } plane.dispose(); return buffer; }
/** * Returns the pixel intensity value of the pixel at a given offset within * the backing buffer. This method takes into account bytes per pixel. * * @param offset The relative offset (taking into account the number of * bytes per pixel) within the backing buffer. * @return The intensity value. */ public double getPixelValue(int offset) { return getPixelValueDirect(offset * bytesPerPixel); }
/** * Implemented as specified by {@link PixelBuffer} I/F. * @see PixelBuffer#getRegionDirect(Integer, Long, byte[]) */ public byte[] getRegionDirect(Integer size, Long offset, byte[] buffer) throws IOException { if (buffer.length != size) throw new ApiUsageException("Buffer size incorrect."); final PixelData pd = getRegion(size, offset); pd.getData().get(buffer); pd.dispose(); return buffer; }
stackValue = ctx.from.getPixelValue(currentPlaneStart + i); if (stackValue > projectedValue) ctx.to.setPixelValue(i, projectedValue); if (doMinMax)
boolean mean, boolean doMinMax) double planeMaximum = ctx.to.getMaximum(); stackValue = ctx.from.getPixelValue(currentPlaneStart + i); projectedValue += stackValue; projectedPlaneCount++; ctx.to.setPixelValue(i, projectedValue); if (doMinMax)
public PixelData getCol(Integer x, Integer z, Integer c, Integer t) throws IOException, DimensionsOutOfBoundsException { final BfPixelsWrapper reader = reader(); PixelData d; byte[] buffer = new byte[reader.getColSize()]; reader.getCol(x,z,c,t,buffer); d = new PixelData(reader.getPixelsType(), ByteBuffer.wrap(buffer)); d.setOrder(isLittleEndian()? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN); return d; }
public PixelData getPlane(Integer z, Integer c, Integer t) throws IOException, DimensionsOutOfBoundsException { ByteBuffer buf = ByteBuffer.wrap(planes[z][c][t]); return new PixelData(pixels.getPixelsType().getValue(), buf); }
public double get(PixelBuffer buf, int x, int y, int z, int c, int t) { ome.util.PixelData pd = null; try { pd = buf.getRow(y, z, c, t); return pd.getPixelValue(x); } catch (IOException e) { throw new ResourceError("IOException: " + e); } catch (DimensionsOutOfBoundsException e) { throw new ApiUsageException("DimensionsOutOfBounds: " + e); } catch (IndexOutOfBoundsException iobe) { throw new ValidationException("IndexOutOfBounds: " + iobe); } finally { if (pd != null) { pd.dispose(); } } }
max = pixelMinMax[0]; for (int i = 0; i < px.size(); i++) { min = Math.min(min, px.getPixelValue(i)); max = Math.max(max, px.getPixelValue(i));
boolean isXYPlanar = plane.isXYPlanar(); PixelData data = plane.getData(); int bytesPerPixel = data.bytesPerPixel(); discreteValue = qs.quantize( data.getPixelValueDirect(pix * bytesPerPixel)); else discreteValue =
/** * Returns the pixel intensity value of the pixel at a given offset within * the backing buffer. This method takes into account bytes per pixel. So * the number of offsets is equal to the buffer size / * <code>bytesPerPixel</code>. * * @param offset The relative offset (taking into account the number of * bytes per pixel) within the backing buffer. * @return The intensity value. */ public double getPixelValue(int offset) { return data.getPixelValue(offset); }
/** * Implemented as specified by {@link PixelBuffer} I/F. * @see PixelBuffer#getByteWidth() */ public int getByteWidth() { return PixelData.getBitDepth(pixels.getPixelsType().getValue()) / 8; }
pd.dispose(); i++;
if (isSigned()) { switch (javaType)
public byte[] calculateMessageDigest() throws IOException { MessageDigest md; try { md = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException( "Required SHA-1 message digest algorithm unavailable."); } for (int z = 0; z < getSizeZ(); z++) { for (int c = 0; c < getSizeC(); c++) { for (int t = 0; t < getSizeT(); t++) { try { ByteBuffer buffer = getPlane(z, c, t).getData(); md.update(buffer); } catch (DimensionsOutOfBoundsException e) { throw new RuntimeException(e); } } } } return md.digest(); }
bytesPerPixel = bytesPerPixel(); int type = FormatTools.pixelTypeFromString(pixelsType); long[] values = FormatTools.defaultMinMax(type);
public PixelData getRow(Integer y, Integer z, Integer c, Integer t) throws IOException, DimensionsOutOfBoundsException { final BfPixelsWrapper reader = reader(); PixelData d; byte[] buffer = new byte[reader.getRowSize()]; reader.getRow(y,z,c,t,buffer); d = new PixelData(reader.getPixelsType(), ByteBuffer.wrap(buffer)); d.setOrder(isLittleEndian()? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN); return d; }