private void loadPixels(float [][] i, ShortProcessor sp, int width, int height) { short [] u = (short []) sp.getPixels(); for (int y = 0; y < height; y++) { int offset = y * width; for (int x = 0; x < width; x++) i[y][x] = (float) u[offset + x]; } } private void loadPixels(float [][] i, FloatProcessor fp, int width, int height)
private void loadPixels(float [][] i, ShortProcessor sp, int width, int height) { short [] u = (short []) sp.getPixels(); for (int y = 0; y < height; y++) { int offset = y * width; for (int x = 0; x < width; x++) i[y][x] = (float) u[offset + x]; } } private void loadPixels(float [][] i, FloatProcessor fp, int width, int height)
public ShortApply( final ShortProcessor ip, final ByteProcessor src, final ByteProcessor dst, final ByteProcessor mask, final int boxXMin, final int boxYMin, final int boxXMax, final int boxYMax ) throws Exception { super( ip, src, dst, mask, boxXMin, boxYMin, boxXMax, boxYMax ); ipPixels = ( short[] )ip.getPixels(); }
public ShortApply( final ShortProcessor ip, final ByteProcessor src, final ByteProcessor dst, final ByteProcessor mask, final int boxXMin, final int boxYMin, final int boxXMax, final int boxYMax ) throws Exception { super( ip, src, dst, mask, boxXMin, boxYMin, boxXMax, boxYMax ); ipPixels = ( short[] )ip.getPixels(); }
public ShortAccessor(ShortProcessor ip) { w = ip.getWidth(); h = ip.getHeight(); pixels = (short[])ip.getPixels(); }
/** Constructs a ShortBlitter from a ShortProcessor. */ public ShortBlitter(ShortProcessor ip) { this.ip = ip; width = ip.getWidth(); height = ip.getHeight(); pixels = (short[])ip.getPixels(); }
/** Constructs a ShortBlitter from a ShortProcessor. */ public ShortBlitter(ShortProcessor ip) { this.ip = ip; width = ip.getWidth(); height = ip.getHeight(); pixels = (short[])ip.getPixels(); }
/** Returns a copy of this image as a TYPE_USHORT_GRAY BufferedImage. */ public BufferedImage get16BitBufferedImage() { BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_USHORT_GRAY); Raster raster = bi.getData(); DataBufferUShort db = (DataBufferUShort)raster.getDataBuffer(); System.arraycopy(getPixels(), 0, db.getData(), 0, db.getData().length); bi.setData(raster); return bi; }
/** Returns a copy of this image as a TYPE_USHORT_GRAY BufferedImage. */ public BufferedImage get16BitBufferedImage() { BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_USHORT_GRAY); Raster raster = bi.getData(); DataBufferUShort db = (DataBufferUShort)raster.getDataBuffer(); System.arraycopy(getPixels(), 0, db.getData(), 0, db.getData().length); bi.setData(raster); return bi; }
protected FloatProcessor convertToFloat( final ShortProcessor sp ) { final short[] pixS = (short[]) sp.getPixels(); loader.releaseToFit( pixS.length * 4 ); final float[] pixF = new float[pixS.length]; for ( int i=0; i<pixS.length; ++i) { pixF[i] = pixS[i] & 0xffff; } return new FloatProcessor( sp.getWidth(), sp.getHeight(), pixF ); }
/** A method that circumvents the findMinAndMax when creating a float processor from an existing processor. Ignores color calibrations and does no scaling at all. */ static public final FloatProcessor fastConvertToFloat(final ShortProcessor ip) { final short[] pix = (short[])ip.getPixels(); final float[] data = new float[pix.length]; for (int i=0; i<pix.length; i++) data[i] = pix[i]&0xffff; final FloatProcessor fp = new FloatProcessorT2(ip.getWidth(), ip.getHeight(), data, ip.getColorModel(), ip.getMin(), ip.getMax()); return fp; } /** A method that circumvents the findMinAndMax when creating a float processor from an existing processor. Ignores color calibrations and does no scaling at all. */
max = ip.getMax(); final long[] hist = IntegralHistogram2d.integralHistogram2d((short[])sp.getPixels(), sp.getWidth(), sp.getHeight(), nBins, min, max); final short[] median = IntegralHistogram2d.median(sp.getWidth(), sp.getHeight(), hist, nBins, min, max, this.medianRadius); final short[] p = (short[]) sp.getPixels();
static public final ShortProcessor median( final ShortProcessor sp, final int nBins, final double min, final double max, final int radius) { final long[] hist = integralHistogram2d((short[])sp.getPixels(), sp.getWidth(), sp.getHeight(), nBins, min, max); final short[] median = median(sp.getWidth(), sp.getHeight(), hist, nBins, min, max, radius); return new ShortProcessor(sp.getWidth(), sp.getHeight(), median, null); }
final ArrayImg< UnsignedShortType, ShortArray > image3 = ArrayImgs.unsignedShorts( ( short[] )imp1.getProcessor().convertToShortProcessor().getPixels(), imp1.getWidth(), imp1.getHeight() ); final ArrayImg< ARGBType, IntArray > image4 = ArrayImgs.argbs( ( int[] )imp1.getProcessor().getPixels(), imp1.getWidth(), imp1.getHeight() );