Search in sources :

Example 6 with PlotPane

use of cbit.plot.gui.PlotPane in project vcell by virtualcell.

the class DisplayPlotOp method displayPlot.

public void displayPlot(RowColumnResultSet rowColumnResultSet, String title, WindowListener listener) throws ExpressionException {
    JFrame frame = new javax.swing.JFrame();
    PlotPane aPlotPane;
    aPlotPane = new PlotPane();
    frame.setContentPane(aPlotPane);
    frame.setSize(aPlotPane.getSize());
    if (listener != null) {
        frame.addWindowListener(listener);
    }
    frame.setTitle(title);
    frame.setVisible(true);
    java.awt.Insets insets = frame.getInsets();
    frame.setSize(frame.getWidth() + insets.left + insets.right, frame.getHeight() + insets.top + insets.bottom);
    frame.setVisible(true);
    int dataColumnCount = rowColumnResultSet.getDataColumnCount();
    PlotData[] plotDatas = new PlotData[dataColumnCount - 1];
    String[] labels = new String[dataColumnCount - 1];
    double[] time = rowColumnResultSet.extractColumn(0);
    for (int i = 0; i < dataColumnCount - 1; i++) {
        double[] yArray = rowColumnResultSet.extractColumn(i + 1);
        plotDatas[i] = new PlotData(time, yArray);
        labels[i] = rowColumnResultSet.getColumnDescriptions(i + 1).getName();
    }
    Plot2D plot2D = new Plot2D(null, null, labels, plotDatas);
    aPlotPane.setPlot2D(plot2D);
}
Also used : PlotData(cbit.plot.PlotData) JFrame(javax.swing.JFrame) PlotPane(cbit.plot.gui.PlotPane) Plot2D(cbit.plot.Plot2D)

Example 7 with PlotPane

use of cbit.plot.gui.PlotPane in project vcell by virtualcell.

the class FRAPDataPanel method showCurve.

private void showCurve(String[] varNames, double[] independent, double[][] dependents) {
    PlotPane plotter = new PlotPane();
    PlotData[] plotDatas = new PlotData[dependents.length];
    for (int i = 0; i < plotDatas.length; i++) {
        plotDatas[i] = new PlotData(independent, dependents[i]);
    }
    Plot2D plot2D = new Plot2D(null, null, varNames, plotDatas);
    plotter.setPlot2D(plot2D);
    ChildWindow plotChildWindow = ChildWindowManager.findChildWindowManager(this).addChildWindow(plotter, plotter, "ROI time course", true);
    plotChildWindow.setTitle("ROI time course");
    plotChildWindow.setIsCenteredOnParent();
    plotChildWindow.setSize(new Dimension(400, 400));
    plotChildWindow.showModal();
}
Also used : PlotData(cbit.plot.PlotData) PlotPane(cbit.plot.gui.PlotPane) Plot2D(cbit.plot.Plot2D) Dimension(java.awt.Dimension) ChildWindow(cbit.vcell.client.ChildWindowManager.ChildWindow)

Example 8 with PlotPane

use of cbit.plot.gui.PlotPane in project vcell by virtualcell.

the class ODEDataViewer method getPlotPane1.

/**
 * Return the PlotPane1 property value.
 * @return cbit.plot.PlotPane
 */
private PlotPane getPlotPane1() {
    if (ivjPlotPane1 == null) {
        try {
            ivjPlotPane1 = new PlotPane();
            ivjPlotPane1.setName("PlotPane1");
            SpecialtyTableRenderer str = new RenderDataViewerDoubleWithTooltip();
            ivjPlotPane1.setSpecialityRenderer(str);
        } catch (java.lang.Throwable ivjExc) {
            handleException(ivjExc);
        }
    }
    return ivjPlotPane1;
}
Also used : RenderDataViewerDoubleWithTooltip(org.vcell.util.gui.RenderDataViewerDoubleWithTooltip) SpecialtyTableRenderer(org.vcell.util.gui.SpecialtyTableRenderer) PlotPane(cbit.plot.gui.PlotPane)

Example 9 with PlotPane

use of cbit.plot.gui.PlotPane in project vcell by virtualcell.

the class PDEDataViewer method plotSpaceStats.

void plotSpaceStats(TSJobResultsSpaceStats tsjrss) {
    // Determine if Volume or Membrane
    DataIdentifier[] diArr = getPdeDataContext().getDataIdentifiers();
    boolean bVolume = true;
    for (int i = 0; i < diArr.length; i += 1) {
        if (diArr[i].getName().equals(tsjrss.getVariableNames()[0])) {
            if (diArr[i].getVariableType().equals(VariableType.MEMBRANE) || diArr[i].getVariableType().equals(VariableType.MEMBRANE_REGION)) {
                bVolume = false;
                break;
            }
        }
    }
    SymbolTableEntry[] symbolTableEntries = null;
    if (tsjrss.getVariableNames().length == 1) {
        // max.mean.min,sum
        symbolTableEntries = new SymbolTableEntry[3];
        if (getSimulation() != null && getSimulation().getMathDescription() != null) {
            symbolTableEntries[0] = getSimulation().getMathDescription().getEntry(tsjrss.getVariableNames()[0]);
        } else {
            symbolTableEntries[0] = new SimpleSymbolTable(tsjrss.getVariableNames()).getEntry(tsjrss.getVariableNames()[0]);
        }
        symbolTableEntries[1] = symbolTableEntries[0];
        symbolTableEntries[2] = symbolTableEntries[0];
    }
    SymbolTableEntry[] finalSymbolTableEntries = symbolTableEntries;
    boolean finalBVolume = bVolume;
    PlotPane plotPane = new cbit.plot.gui.PlotPane();
    plotPane.setPlot2D(new SingleXPlot2D(finalSymbolTableEntries, getSimulationModelInfo().getDataSymbolMetadataResolver(), "Time", new String[] { "Max", (tsjrss.getWeightedMean() != null ? "WeightedMean" : "UnweightedMean"), "Min" /*,
				(tsjrss.getWeightedSum() != null?"WeightedSum":"UnweightedSum")*/
    }, new double[][] { tsjrss.getTimes(), tsjrss.getMaximums()[0], (tsjrss.getWeightedMean() != null ? tsjrss.getWeightedMean()[0] : tsjrss.getUnweightedMean()[0]), tsjrss.getMinimums()[0] /*,
				(tsjrss.getWeightedSum() != null?tsjrss.getWeightedSum()[0]:tsjrss.getUnweightedSum()[0])*/
    }, new String[] { "Statistics Plot for " + tsjrss.getVariableNames()[0] + (tsjrss.getTotalSpace() != null ? " (ROI " + (finalBVolume ? "volume" : "area") + "=" + tsjrss.getTotalSpace()[0] + ")" : ""), ReservedVariable.TIME.getName(), "[" + tsjrss.getVariableNames()[0] + "]" }));
    String title = "Statistics: (" + tsjrss.getVariableNames()[0] + ") ";
    if (getSimulationModelInfo() != null) {
        title += getSimulationModelInfo().getContextName() + " " + getSimulationModelInfo().getSimulationName();
    }
    ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(PDEDataViewer.this);
    ChildWindow childWindow = childWindowManager.addChildWindow(plotPane, plotPane, title);
    childWindow.setIsCenteredOnParent();
    childWindow.pack();
    childWindow.show();
}
Also used : VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) LocalVCSimulationDataIdentifier(cbit.vcell.client.ClientSimManager.LocalVCSimulationDataIdentifier) ExternalDataIdentifier(org.vcell.util.document.ExternalDataIdentifier) VCDataIdentifier(org.vcell.util.document.VCDataIdentifier) DataIdentifier(cbit.vcell.simdata.DataIdentifier) ChildWindowManager(cbit.vcell.client.ChildWindowManager) ChildWindow(cbit.vcell.client.ChildWindowManager.ChildWindow) Point(java.awt.Point) SinglePoint(cbit.vcell.geometry.SinglePoint) SingleXPlot2D(cbit.plot.SingleXPlot2D) SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) SimpleSymbolTable(cbit.vcell.parser.SimpleSymbolTable) PlotPane(cbit.plot.gui.PlotPane)

Example 10 with PlotPane

use of cbit.plot.gui.PlotPane in project vcell by virtualcell.

the class PDEDataViewer method showSpatialPlot.

/**
 * Comment
 */
private void showSpatialPlot() {
    // check selections
    final SpatialSelection[] sl = getPDEDataContextPanel1().fetchSpatialSelections(false, true);
    if (sl == null) {
        PopupGenerator.showErrorDialog(this, "Nothing selected!");
        return;
    }
    for (int i = 0; i < sl.length; i++) {
        if (sl[i].isPoint()) {
            PopupGenerator.showErrorDialog(this, "One or more selections are single points - no spatial plot will be produced for those selections");
            break;
        }
    }
    final String varName = getPdeDataContext().getVariableName();
    final double timePoint = getPdeDataContext().getTimePoint();
    final SymbolTableEntry[] symbolTableEntries = new SymbolTableEntry[1];
    if (getSimulation() != null && getSimulation().getMathDescription() != null) {
        symbolTableEntries[0] = getSimulation().getMathDescription().getEntry(varName);
    }
    if (symbolTableEntries[0] == null) {
        // TODO domain
        Domain domain = null;
        symbolTableEntries[0] = new VolVariable(varName, domain);
    }
    AsynchClientTask task1 = new AsynchClientTask("Retrieving spatial series for variable '" + varName, AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            // get plots, ignoring points
            PlotData[] plotDatas = new PlotData[sl.length];
            for (int i = 0; i < sl.length; i++) {
                PlotData plotData = null;
                if (getPdeDataContext() instanceof PDEDataViewerPostProcess.PostProcessDataPDEDataContext) {
                    SpatialSelectionVolume ssVolume = (SpatialSelectionVolume) sl[i];
                    SpatialSelection.SSHelper ssvHelper = ssVolume.getIndexSamples(0.0, 1.0);
                    ssvHelper.initializeValues_VOLUME(getPdeDataContext().getDataValues());
                    double[] values = ssvHelper.getSampledValues();
                    plotData = new PlotData(ssvHelper.getWorldCoordinateLengths(), values);
                } else {
                    plotData = getPdeDataContext().getLineScan(varName, timePoint, sl[i]);
                }
                plotDatas[i] = plotData;
            }
            hashTable.put("plotDatas", plotDatas);
        }
    };
    AsynchClientTask task2 = new AsynchClientTask("Showing spatial plot for variable" + varName, AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            PlotData[] plotDatas = (PlotData[]) hashTable.get("plotDatas");
            for (PlotData plotData : plotDatas) {
                if (plotData != null) {
                    PlotPane plotPane = new PlotPane();
                    Plot2D plot2D = new Plot2D(symbolTableEntries, getSimulationModelInfo().getDataSymbolMetadataResolver(), new String[] { varName }, new PlotData[] { plotData }, new String[] { "Values along curve", "Distance (\u00b5m)", "[" + varName + "]" });
                    plotPane.setPlot2D(plot2D);
                    String title = createContextTitle(PDEDataViewer.this.isPostProcess(), "Spatial Plot:'" + varName + "' ", getPdeDataContext(), getSimulationModelInfo(), getSimulation());
                    ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(PDEDataViewer.this);
                    ChildWindow childWindow = childWindowManager.addChildWindow(plotPane, plotPane, title);
                    childWindow.setIsCenteredOnParent();
                    childWindow.pack();
                    childWindow.show();
                // System.out.println("Spatial plot requesting focus.  Result is: "+childWindow.requestFocusInWindow());
                }
            }
        }
    };
    ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 }, false);
}
Also used : PlotData(cbit.plot.PlotData) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) VolVariable(cbit.vcell.math.VolVariable) Hashtable(java.util.Hashtable) PostProcessDataPDEDataContext(cbit.vcell.client.data.PDEDataViewerPostProcess.PostProcessDataPDEDataContext) ChildWindowManager(cbit.vcell.client.ChildWindowManager) ChildWindow(cbit.vcell.client.ChildWindowManager.ChildWindow) Point(java.awt.Point) SinglePoint(cbit.vcell.geometry.SinglePoint) SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) SpatialSelection(cbit.vcell.simdata.SpatialSelection) SSHelper(cbit.vcell.simdata.SpatialSelection.SSHelper) SpatialSelectionVolume(cbit.vcell.simdata.SpatialSelectionVolume) PlotPane(cbit.plot.gui.PlotPane) SingleXPlot2D(cbit.plot.SingleXPlot2D) Plot2D(cbit.plot.Plot2D) VariableDomain(cbit.vcell.math.VariableType.VariableDomain) Domain(cbit.vcell.math.Variable.Domain)

Aggregations

PlotPane (cbit.plot.gui.PlotPane)12 Plot2D (cbit.plot.Plot2D)5 PlotData (cbit.plot.PlotData)4 SingleXPlot2D (cbit.plot.SingleXPlot2D)3 ChildWindow (cbit.vcell.client.ChildWindowManager.ChildWindow)3 SymbolTableEntry (cbit.vcell.parser.SymbolTableEntry)3 SpatialSelectionVolume (cbit.vcell.simdata.SpatialSelectionVolume)3 GridBagConstraints (java.awt.GridBagConstraints)3 GridBagLayout (java.awt.GridBagLayout)3 JPanel (javax.swing.JPanel)3 JScrollPane (javax.swing.JScrollPane)3 ChildWindowManager (cbit.vcell.client.ChildWindowManager)2 SinglePoint (cbit.vcell.geometry.SinglePoint)2 VariableType (cbit.vcell.math.VariableType)2 VolVariable (cbit.vcell.math.VolVariable)2 SimpleSymbolTable (cbit.vcell.parser.SimpleSymbolTable)2 DataIdentifier (cbit.vcell.simdata.DataIdentifier)2 Dimension (java.awt.Dimension)2 Point (java.awt.Point)2 JFrame (javax.swing.JFrame)2