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;
}
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;
}
Aggregations