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