use of cbit.image.ImagePaneModel in project vcell by virtualcell.
the class FormatSpecificSpecs method getImageDimension.
public static Dimension getImageDimension(int meshMode, int imageScale, CartesianMesh mesh, int normalAxis) {
ImagePaneModel imagePaneModel = new ImagePaneModel();
imagePaneModel.setMode(meshMode);
imagePaneModel.setZoom(imageScale);
Dimension dim = FormatSpecificSpecs.getMeshDimensionUnscaled(normalAxis, mesh);
dim.width = imagePaneModel.getScaledLength(dim.width);
dim.height = imagePaneModel.getScaledLength(dim.height);
return dim;
}
use of cbit.image.ImagePaneModel in project vcell by virtualcell.
the class PDEOffscreenRenderer method getScaledRGBVolume.
private BufferedImage getScaledRGBVolume(CartesianMesh mesh, int meshMode, int imageScale, boolean bBackground) {
Dimension dim = FormatSpecificSpecs.getMeshDimensionUnscaled(getNormalAxis(), getServerPDEDataContext().getCartesianMesh());
int width = (int) dim.getWidth();
int height = (int) dim.getHeight();
double[] volumeData = new double[width * height];
if (!bBackground) {
// if(bNeedsDefaultScaling){setDefaultScaling();}
double notInDomainValue = getDisplayAdapterService().getValueDomain().getMin() - 1.0;
double[] values = getServerPDEDataContext().getDataValues();
int[] dataIndices = getServerPDEDataContext().getCartesianMesh().getVolumeSliceIndices(getNormalAxis(), getSlice());
for (int i = 0; i < dataIndices.length; i++) {
double value = values[dataIndices[i]];
if (domainValid != null) {
if (domainValid.get(dataIndices[i]) || domainValid.isEmpty()) {
volumeData[i] = value;
} else {
volumeData[i] = notInDomainValue;
}
} else {
volumeData[i] = value;
}
}
}
SourceDataInfo sourceDataInfo = new SourceDataInfo(SourceDataInfo.RAW_VALUE_TYPE, volumeData, mesh.getExtent(), mesh.getOrigin(), new Range(0, 1), 0, width, 1, height, width, 1, 0);
ImagePaneModel imagePaneModel = new ImagePaneModel();
imagePaneModel.setSourceData(sourceDataInfo);
imagePaneModel.setBackgroundColor(Color.black);
imagePaneModel.setDisplayAdapterService(getDisplayAdapterService());
// getDisplayAdapterService().setActiveScaleRange(new Range(0,1));
imagePaneModel.setMode(meshMode);
imagePaneModel.setZoom(imageScale);
imagePaneModel.setViewport(new Rectangle(imagePaneModel.getScaledLength(width), imagePaneModel.getScaledLength(height)));
imagePaneModel.updateViewPortImage();
if (bBackground) {
int[] internalBuffer = ((DataBufferInt) (imagePaneModel.getViewPortImage().getRaster().getDataBuffer())).getData();
Arrays.fill(internalBuffer, getDisplayAdapterService().getSpecialColors()[DisplayAdapterService.NULL_COLOR_OFFSET]);
}
BufferedImage bufferedImage = imagePaneModel.getViewPortImage();
imagePaneModel.setDisplayAdapterService(null);
return bufferedImage;
}
use of cbit.image.ImagePaneModel in project vcell by virtualcell.
the class PDEOffscreenRenderer method getPixelDelta.
private Coordinate getPixelDelta(Extent extent, CartesianMesh mesh, int meshMode, int imageScale) {
ImagePaneModel imagePaneModel = new ImagePaneModel();
imagePaneModel.setMode(meshMode);
imagePaneModel.setZoom(imageScale);
double pixelScaleX = extent.getX() / imagePaneModel.getScaledLength(mesh.getSizeX());
double pixelScaleY = extent.getY() / imagePaneModel.getScaledLength(mesh.getSizeY());
double pixelScaleZ = extent.getZ() / imagePaneModel.getScaledLength(mesh.getSizeZ());
return new Coordinate(pixelScaleX, pixelScaleY, pixelScaleZ);
}
Aggregations