use of javax.media.jai.PlanarImage 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.PlanarImage in project vcell by virtualcell.
the class ROIMultiPaintManager method padXYByte.
public static byte[] padXYByte(byte[] byteArr, int numX, int numY, int left, int right, int top, int bottom) {
BufferedImage bufferedImage = new BufferedImage(numX, numY, BufferedImage.TYPE_BYTE_GRAY);
byte[] byteData = ((DataBufferByte) bufferedImage.getRaster().getDataBuffer()).getData();
System.arraycopy(byteArr, 0, byteData, 0, byteArr.length);
PlanarImage planarImage = BorderDescriptor.create(bufferedImage, left, right, top, bottom, null, null).getRendering();
return ((DataBufferByte) planarImage.getData().getDataBuffer()).getData();
}
use of javax.media.jai.PlanarImage in project vcell by virtualcell.
the class OverlayImageDisplayJAI method refreshImage.
public void refreshImage() {
PlanarImage sourceOverlay = null;
RenderedImage contrastEnhancedUnderlyingImage = createContrastEnhancedUnderlyingImage();
if (underlyingImage != null && (highlightImage != null || allROICompositeImage != null)) {
sourceOverlay = PlanarImage.wrapRenderedImage(computeComposite(contrastEnhancedUnderlyingImage));
} else if (underlyingImage != null) {
sourceOverlay = PlanarImage.wrapRenderedImage(contrastEnhancedUnderlyingImage);
} else if (highlightImage != null && allROICompositeImage == null) {
sourceOverlay = PlanarImage.wrapRenderedImage(highlightImage);
} else if (allROICompositeImage != null && highlightImage == null) {
sourceOverlay = PlanarImage.wrapRenderedImage(allROICompositeImage);
} else if (allROICompositeImage != null && highlightImage != null) {
sourceOverlay = CompositeDescriptor.create(highlightImage, allROICompositeImage, makeAlpha(allROICompositeImage.getWidth(), allROICompositeImage.getHeight(), (float) (100 - blendPercent) / (float) 10), makeAlpha(highlightImage.getWidth(), highlightImage.getHeight(), (float) (100 - blendPercent) / (float) 10), false, CompositeDescriptor.NO_DESTINATION_ALPHA, null);
} else {
sourceOverlay = PlanarImage.wrapRenderedImage(new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB));
}
if (sourceOverlay != null) {
sourceOverlay = ScaleDescriptor.create(sourceOverlay, (float) zoom, (float) zoom, 0f, 0f, Interpolation.getInstance(Interpolation.INTERP_NEAREST), null);
}
set(sourceOverlay, 0, 0);
}
use of javax.media.jai.PlanarImage in project vcell by virtualcell.
the class ROIMultiPaintManager method padXYUShort.
public static short[] padXYUShort(short[] shortArr, int numX, int numY, int left, int right, int top, int bottom) {
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 = BorderDescriptor.create(bufferedImage, left, right, top, bottom, null, null).getRendering();
return ((DataBufferUShort) planarImage.getData().getDataBuffer()).getData();
}
use of javax.media.jai.PlanarImage 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