Search in sources :

Example 1 with SourceDataInfo

use of cbit.image.SourceDataInfo in project vcell by virtualcell.

the class ImageContainerPanel method refreshImage.

/**
 * This method was created by a SmartGuide.
 */
public void refreshImage() {
    if (getImageContainer() == null) {
        getImagePaneScroller().getImagePaneView().clear();
        return;
    }
    try {
        int nX = getImageContainer().getDisplayWidth();
        int nY = getImageContainer().getDisplayHeight();
        int nZ = 1;
        SourceDataInfo sourceData = new SourceDataInfo(SourceDataInfo.INT_RGB_TYPE, getImageContainer().getPixels(), new org.vcell.util.Extent(1, 1, 1), new org.vcell.util.Origin(0, 0, 0), getImageContainer().getDataRange(), 0, nX, 1, nY, nX, nZ, nX * nY);
        getImagePaneScroller().getImagePaneModel().setSourceData(sourceData);
    } catch (Exception e) {
        getImagePaneScroller().getImagePaneView().clear();
        e.printStackTrace(System.out);
    }
}
Also used : SourceDataInfo(cbit.image.SourceDataInfo) DataAccessException(org.vcell.util.DataAccessException)

Example 2 with SourceDataInfo

use of cbit.image.SourceDataInfo in project vcell by virtualcell.

the class GeometryViewer method refreshSourceDataInfo.

/**
 * connEtoM2:  (Geometry.this --> ImagePlaneManagerPanel1.sourceDataInfo)
 * @param value cbit.vcell.geometry.Geometry
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void refreshSourceDataInfo() {
    if (getGeometry() == null) {
        return;
    }
    GeometrySpec geometrySpec = getGeometry().getGeometrySpec();
    if (geometrySpec.getSampledImage().isDirty()) {
        return;
    }
    VCImage sampledImage = geometrySpec.getSampledImage().getCurrentValue();
    try {
        SourceDataInfo sdi = new SourceDataInfo(SourceDataInfo.INDEX_TYPE, sampledImage.getPixels(), geometrySpec.getExtent(), geometrySpec.getOrigin(), null, 0, sampledImage.getNumX(), 1, sampledImage.getNumY(), sampledImage.getNumX(), sampledImage.getNumZ(), sampledImage.getNumX() * sampledImage.getNumY());
        getImagePlaneManagerPanel1().setSourceDataInfo(sdi);
    } catch (ImageException e) {
        e.printStackTrace();
        DialogUtils.showErrorDialog(this, e.getMessage());
    } catch (Exception e) {
        e.printStackTrace();
        DialogUtils.showErrorDialog(this, e.getMessage(), e);
    }
}
Also used : GeometrySpec(cbit.vcell.geometry.GeometrySpec) ImageException(cbit.image.ImageException) VCImage(cbit.image.VCImage) SourceDataInfo(cbit.image.SourceDataInfo) ImageException(cbit.image.ImageException)

Example 3 with SourceDataInfo

use of cbit.image.SourceDataInfo in project vcell by virtualcell.

the class GeometrySummaryPanel method initGeometry.

/**
 * Comment
 */
private void initGeometry(Geometry arg1) {
    final boolean bSpatial = getGeometry() != null && getGeometry().getDimension() > 0;
    getImagePlaneManagerPanel1().setVisible(bSpatial);
    getJPanelOrigin().setVisible(bSpatial);
    getJPanelSize().setVisible(bSpatial);
    if (getGeometry() != null) {
        try {
            if (getGeometry().getGeometrySpec().getSampledImage().isDirty()) {
                return;
            }
            VCImage vcImage = getGeometry().getGeometrySpec().getSampledImage().getCurrentValue();
            byte[] pixels = vcImage.getPixels();
            DisplayAdapterService das = new DisplayAdapterService();
            das.setActiveScaleRange(new org.vcell.util.Range(0, 255));
            das.setValueDomain(new org.vcell.util.Range(0, 255));
            das.addColorModelForValues(DisplayAdapterService.createContrastColorModel(), DisplayAdapterService.createGraySpecialColors(), "Contrast");
            das.setActiveColorModelID("Contrast");
            int[] rgb = new int[pixels.length];
            for (int i = 0; i < rgb.length; i += 1) {
                rgb[i] = das.getColorFromIndex(pixels[i]);
            }
            SourceDataInfo sdi = new SourceDataInfo(SourceDataInfo.INT_RGB_TYPE, rgb, getGeometry().getExtent(), getGeometry().getOrigin(), new org.vcell.util.Range(0, 255), 0, vcImage.getNumX(), 1, vcImage.getNumY(), vcImage.getNumX(), vcImage.getNumZ(), vcImage.getNumX() * vcImage.getNumY());
            getImagePlaneManagerPanel1().setSourceDataInfo(sdi);
        } catch (Exception e) {
            PopupGenerator.showErrorDialog(GeometrySummaryPanel.this, e.getMessage(), e);
        }
    } else {
        getImagePlaneManagerPanel1().setSourceDataInfo(null);
    }
}
Also used : DisplayAdapterService(cbit.image.DisplayAdapterService) VCImage(cbit.image.VCImage) SourceDataInfo(cbit.image.SourceDataInfo) ImageException(cbit.image.ImageException)

Example 4 with SourceDataInfo

use of cbit.image.SourceDataInfo in project vcell by virtualcell.

the class PDEDataContextPanel method calculateSourceDataInfo.

/**
 * Comment
 */
private SourceDataInfo calculateSourceDataInfo(CartesianMesh mesh, double[] sdiData, VariableType sdiVarType, Range newRange) {
    SourceDataInfo sdi = null;
    // 
    if (sdiVarType.equals(VariableType.VOLUME) || sdiVarType.equals(VariableType.POSTPROCESSING)) {
        // Set data to display
        int yIncr = mesh.getSizeX();
        int zIncr = mesh.getSizeX() * mesh.getSizeY();
        sdi = new SourceDataInfo(SourceDataInfo.RAW_VALUE_TYPE, sdiData, mesh.getExtent(), mesh.getOrigin(), newRange, 0, mesh.getSizeX(), 1, mesh.getSizeY(), yIncr, mesh.getSizeZ(), zIncr);
    } else if (sdiVarType.equals(VariableType.VOLUME_REGION)) {
        // 
        double[] expandedVolumeRegionValues = new double[mesh.getSizeX() * mesh.getSizeY() * mesh.getSizeZ()];
        double[] volumeRegionDataValues = sdiData;
        for (int i = 0; i < expandedVolumeRegionValues.length; i += 1) {
            expandedVolumeRegionValues[i] = volumeRegionDataValues[mesh.getVolumeRegionIndex(i)];
        }
        // 
        int yIncr = mesh.getSizeX();
        int zIncr = mesh.getSizeX() * mesh.getSizeY();
        sdi = new SourceDataInfo(SourceDataInfo.RAW_VALUE_TYPE, expandedVolumeRegionValues, mesh.getExtent(), mesh.getOrigin(), newRange, 0, mesh.getSizeX(), 1, mesh.getSizeY(), yIncr, mesh.getSizeZ(), zIncr);
    } else {
        // Membranes
        // Create placeholder SDI with null data
        sdi = new SourceDataInfo(SourceDataInfo.RAW_VALUE_TYPE, null, mesh.getExtent(), mesh.getOrigin(), newRange, 0, mesh.getSizeX(), 0, mesh.getSizeY(), 0, mesh.getSizeZ(), 0);
    }
    if (mesh.isChomboMesh()) {
        sdi.setIsChombo(true);
    } else if (mesh instanceof CartesianMeshMovingBoundary) {
        sdi.setSolverDataType(SolverDataType.MBSData);
    }
    return sdi;
}
Also used : SourceDataInfo(cbit.image.SourceDataInfo) CartesianMeshMovingBoundary(cbit.vcell.solvers.CartesianMeshMovingBoundary) SinglePoint(cbit.vcell.geometry.SinglePoint)

Example 5 with SourceDataInfo

use of cbit.image.SourceDataInfo in project vcell by virtualcell.

the class PDEDataContextPanel method recodeDataForDomain.

public void recodeDataForDomain() {
    // 
    if (getPdeDataContext() == null) {
        return;
    }
    recodeDataForDomain0();
    VariableType vt = getPdeDataContext().getDataIdentifier().getVariableType();
    // This creates an appropriate volume data data holder for volume data types
    // or creates a dummy background for membrane data types
    SourceDataInfo recodedSourceDataInfo = calculateSourceDataInfo(getPdeDataContext().getCartesianMesh(), recodeDataForDomainInfo.getRecodedDataForDomain(), getPdeDataContext().getDataIdentifier().getVariableType(), recodeDataForDomainInfo.getRecodedDataRange());
    getImagePlaneManagerPanel().setSourceDataInfo(recodedSourceDataInfo);
}
Also used : VariableType(cbit.vcell.math.VariableType) SourceDataInfo(cbit.image.SourceDataInfo)

Aggregations

SourceDataInfo (cbit.image.SourceDataInfo)18 Range (org.vcell.util.Range)5 DisplayAdapterService (cbit.image.DisplayAdapterService)3 ImageException (cbit.image.ImageException)3 VCImage (cbit.image.VCImage)3 UShortImage (cbit.vcell.VirtualMicroscopy.UShortImage)2 VariableType (cbit.vcell.math.VariableType)2 DataOperationResults (cbit.vcell.simdata.DataOperationResults)2 CartesianMesh (cbit.vcell.solvers.CartesianMesh)2 ArrayList (java.util.ArrayList)2 ImageTimeSeries (org.vcell.vmicro.workflow.data.ImageTimeSeries)2 ImagePaneModel (cbit.image.ImagePaneModel)1 ImagePlaneManager (cbit.image.ImagePlaneManager)1 VCImageUncompressed (cbit.image.VCImageUncompressed)1 ImagePlaneManagerPanel (cbit.image.gui.ImagePlaneManagerPanel)1 Plot2D (cbit.plot.Plot2D)1 PlotData (cbit.plot.PlotData)1 PlotPane (cbit.plot.gui.PlotPane)1 ImageDataset (cbit.vcell.VirtualMicroscopy.ImageDataset)1 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)1