Search in sources :

Example 1 with InterpolationNearest

use of javax.media.jai.InterpolationNearest in project vcell by virtualcell.

the class ROIMultiPaintManager method resizeXYUShort.

public static PlanarImage resizeXYUShort(short[] shortArr, int numX, int numY, Float scaleX, Float scaleY) {
    BufferedImage bufferedImage = new BufferedImage(numX, numY, BufferedImage.TYPE_USHORT_GRAY);
    short[] shortData = ((DataBufferUShort) bufferedImage.getRaster().getDataBuffer()).getData();
    System.arraycopy(shortArr, 0, shortData, 0, shortArr.length);
    PlanarImage planarImage = ScaleDescriptor.create(bufferedImage, scaleX, scaleY, 0f, 0f, new InterpolationNearest(), null);
    return planarImage;
// PaddedInfo paddedInfo = new PaddedInfo();
// paddedInfo.paddedArray = ((DataBufferUShort)planarImage.getData().getDataBuffer()).getData();
// paddedInfo.paddedISize = new ISize(planarImage.getWidth(), planarImage.getHeight(), 1);
// return paddedInfo;
}
Also used : InterpolationNearest(javax.media.jai.InterpolationNearest) DataBufferUShort(java.awt.image.DataBufferUShort) BufferedImage(java.awt.image.BufferedImage) PlanarImage(javax.media.jai.PlanarImage)

Example 2 with InterpolationNearest

use of javax.media.jai.InterpolationNearest in project vcell by virtualcell.

the class ROIMultiPaintManager method resizeXYByte.

public static PlanarImage resizeXYByte(byte[] byteArr, int numX, int numY, Float scaleX, Float scaleY) {
    BufferedImage bufferedImage = new BufferedImage(numX, numY, BufferedImage.TYPE_BYTE_INDEXED, getContrastIndexColorModel());
    byte[] byteData = ((DataBufferByte) bufferedImage.getRaster().getDataBuffer()).getData();
    System.arraycopy(byteArr, 0, byteData, 0, byteArr.length);
    PlanarImage planarImage = ScaleDescriptor.create(bufferedImage, scaleX, scaleY, 0f, 0f, new InterpolationNearest(), null);
    return planarImage;
// PaddedInfo paddedInfo = new PaddedInfo();
// paddedInfo.paddedArray = ((DataBufferByte)planarImage.getData().getDataBuffer()).getData();
// paddedInfo.paddedISize = new ISize(planarImage.getWidth(), planarImage.getHeight(), 1);
// return paddedInfo;
}
Also used : InterpolationNearest(javax.media.jai.InterpolationNearest) DataBufferByte(java.awt.image.DataBufferByte) BufferedImage(java.awt.image.BufferedImage) PlanarImage(javax.media.jai.PlanarImage)

Aggregations

BufferedImage (java.awt.image.BufferedImage)2 InterpolationNearest (javax.media.jai.InterpolationNearest)2 PlanarImage (javax.media.jai.PlanarImage)2 DataBufferByte (java.awt.image.DataBufferByte)1 DataBufferUShort (java.awt.image.DataBufferUShort)1