use of cbit.vcell.simdata.SpatialSelectionMembrane in project vcell by virtualcell.
the class PDEDataViewer method roiAction.
private void roiAction() {
BeanUtils.setCursorThroughout(this, Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
final String[] ROI_COLUMN_NAMES = new String[] { "ROI source", "ROI source name", "ROI Description" };
final Vector<Object> auxInfoV = new Vector<Object>();
final DataIdentifier dataIdentifier = getPdeDataContext().getDataIdentifier();
VariableType variableType = dataIdentifier.getVariableType();
final boolean isVolume = variableType.equals(VariableType.VOLUME) || variableType.equals(VariableType.VOLUME_REGION);
DefaultTableModel tableModel = new DefaultTableModel() {
public boolean isCellEditable(int row, int column) {
return false;
}
};
for (int i = 0; i < ROI_COLUMN_NAMES.length; i++) {
tableModel.addColumn(ROI_COLUMN_NAMES[i]);
}
// Add Snapshot ROI
if ((isVolume ? volumeSnapshotROI : membraneSnapshotROI) != null) {
tableModel.addRow(new Object[] { (isVolume ? "Volume" : "Membrane") + " Variables and Functions", "Snapshot", (isVolume ? volumeSnapshotROIDescription : membraneSnapshotROIDescription) + ", (values = 1.0)" });
auxInfoV.add((isVolume ? volumeSnapshotROI : membraneSnapshotROI));
}
// Add user ROIs
SpatialSelection[] userROIArr = getPDEDataContextPanel1().fetchSpatialSelections(true, false);
for (int i = 0; userROIArr != null && i < userROIArr.length; i += 1) {
String descr = null;
boolean bPoint = false;
if (isVolume) {
if (userROIArr[i] instanceof SpatialSelectionVolume) {
Curve curve = ((SpatialSelectionVolume) userROIArr[i]).getCurveSelectionInfo().getCurve();
descr = curve.getDescription();
if (curve instanceof SinglePoint) {
bPoint = true;
}
}
} else {
if (userROIArr[i] instanceof SpatialSelectionMembrane) {
SampledCurve selectionSource = ((SpatialSelectionMembrane) userROIArr[i]).getSelectionSource();
descr = selectionSource.getDescription();
if (selectionSource instanceof SinglePoint) {
bPoint = true;
}
}
}
// Add Area User ROI
BitSet fillBitSet = null;
if (userROIArr[i] instanceof SpatialSelectionVolume) {
fillBitSet = getFillROI((SpatialSelectionVolume) userROIArr[i]);
if (fillBitSet != null) {
tableModel.addRow(new Object[] { "User Defined", descr, "Area Enclosed Volume ROI" });
auxInfoV.add(fillBitSet);
}
}
// Add Point and Line User ROI
if (fillBitSet == null) {
tableModel.addRow(new Object[] { "User Defined", descr, (bPoint ? "Point" : "Line") + (isVolume ? " Volume" : " Membrane") + " ROI " });
auxInfoV.add(userROIArr[i]);
}
}
// Add sorted Geometry ROI
final CartesianMesh cartesianMesh = getPdeDataContext().getCartesianMesh();
HashMap<Integer, ?> regionMapSubvolumesHashMap = (isVolume ? cartesianMesh.getVolumeRegionMapSubvolume() : cartesianMesh.getMembraneRegionMapSubvolumesInOut());
Set<?> regionMapSubvolumesEntrySet = regionMapSubvolumesHashMap.entrySet();
Iterator<?> regionMapSubvolumesEntryIter = regionMapSubvolumesEntrySet.iterator();
TreeSet<Object[]> sortedGeomROITreeSet = new TreeSet<Object[]>(new Comparator<Object[]>() {
public int compare(Object[] o1, Object[] o2) {
int result = ((String) ((Object[]) o1[0])[1]).compareToIgnoreCase((String) ((Object[]) o2[0])[1]);
if (result == 0) {
result = (((Entry<Integer, ?>) o1[1]).getKey()).compareTo(((Entry<Integer, ?>) o2[1]).getKey());
}
return result;
}
});
while (regionMapSubvolumesEntryIter.hasNext()) {
Entry<Integer, ?> regionMapSubvolumesEntry = (Entry<Integer, ?>) regionMapSubvolumesEntryIter.next();
sortedGeomROITreeSet.add(new Object[] { new Object[] { "Geometry", (isVolume ? getSimulationModelInfo().getVolumeNamePhysiology(((Integer) regionMapSubvolumesEntry.getValue())) : getSimulationModelInfo().getMembraneName(((int[]) regionMapSubvolumesEntry.getValue())[0], ((int[]) regionMapSubvolumesEntry.getValue())[1], false)), (isVolume ? "(svID=" + regionMapSubvolumesEntry.getValue() + " " : "(") + "vrID=" + regionMapSubvolumesEntry.getKey() + ") Predefined " + (isVolume ? "volume" : "membrane") + " region" }, regionMapSubvolumesEntry });
}
Iterator<Object[]> sortedGeomROIIter = sortedGeomROITreeSet.iterator();
while (sortedGeomROIIter.hasNext()) {
Object[] sortedGeomROIObjArr = (Object[]) sortedGeomROIIter.next();
tableModel.addRow((Object[]) sortedGeomROIObjArr[0]);
auxInfoV.add(sortedGeomROIObjArr[1]);
}
final ScrollTable roiTable = new ScrollTable();
roiTable.setModel(tableModel);
roiTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
roiTable.setPreferredScrollableViewportSize(new Dimension(500, 200));
final JPanel mainJPanel = new JPanel();
BoxLayout mainBL = new BoxLayout(mainJPanel, BoxLayout.Y_AXIS);
mainJPanel.setLayout(mainBL);
MiniTimePanel timeJPanel = new MiniTimePanel();
ActionListener okAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (((Double) timeJPanel.jcb_time_begin.getSelectedItem()).compareTo((Double) timeJPanel.jcb_time_end.getSelectedItem()) > 0) {
PopupGenerator.showErrorDialog(PDEDataViewer.this, "Selected 'Begin Time' must be less than or equal to 'End Time'");
return;
}
int[] selectedRows = roiTable.getSelectedRows();
if (selectedRows != null) {
try {
BitSet dataBitSet = new BitSet(getPdeDataContext().getDataValues().length);
for (int i = 0; i < selectedRows.length; i++) {
Object auxInfo = auxInfoV.elementAt(selectedRows[i]);
if (auxInfo instanceof BitSet) {
dataBitSet.or((BitSet) auxInfo);
} else if (auxInfo instanceof SpatialSelectionMembrane) {
int[] roiIndexes = ((SpatialSelectionMembrane) auxInfo).getIndexSamples().getSampledIndexes();
for (int j = 0; j < roiIndexes.length; j += 1) {
dataBitSet.set(roiIndexes[j], true);
}
} else if (auxInfo instanceof SpatialSelectionVolume) {
int[] roiIndexes = ((SpatialSelectionVolume) auxInfo).getIndexSamples(0, 1).getSampledIndexes();
for (int j = 0; j < roiIndexes.length; j += 1) {
dataBitSet.set(roiIndexes[j], true);
}
} else if (auxInfo instanceof Entry) {
Entry<Integer, Integer> entry = (Entry<Integer, Integer>) auxInfo;
if (isVolume) {
int volumeRegionID = entry.getKey();
dataBitSet.or(cartesianMesh.getVolumeROIFromVolumeRegionID(volumeRegionID));
} else {
int membraneRegionID = entry.getKey();
dataBitSet.or(cartesianMesh.getMembraneROIFromMembraneRegionID(membraneRegionID));
}
} else if (auxInfo instanceof BitSet) {
dataBitSet.or((BitSet) auxInfo);
} else {
throw new Exception("ROI table, Unknown data type: " + auxInfo.getClass().getName());
}
}
TimeSeriesJobSpec timeSeriesJobSpec = new TimeSeriesJobSpec(new String[] { dataIdentifier.getName() }, new BitSet[] { dataBitSet }, ((Double) timeJPanel.jcb_time_begin.getSelectedItem()).doubleValue(), 1, ((Double) timeJPanel.jcb_time_end.getSelectedItem()).doubleValue(), true, false, VCDataJobID.createVCDataJobID(getDataViewerManager().getUser(), true));
Hashtable<String, Object> hash = new Hashtable<String, Object>();
hash.put(StringKey_timeSeriesJobSpec, timeSeriesJobSpec);
AsynchClientTask task1 = new TimeSeriesDataRetrievalTask("Retrieve data for '" + dataIdentifier + "'", PDEDataViewer.this, getPdeDataContext());
AsynchClientTask task2 = new AsynchClientTask("Showing stat for '" + dataIdentifier + "'", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
TSJobResultsSpaceStats tsJobResultsSpaceStats = (TSJobResultsSpaceStats) hashTable.get(StringKey_timeSeriesJobResults);
plotSpaceStats(tsJobResultsSpaceStats);
}
};
ClientTaskDispatcher.dispatch(PDEDataViewer.this, hash, new AsynchClientTask[] { task1, task2 }, true, true, null);
} catch (Exception e1) {
e1.printStackTrace();
PopupGenerator.showErrorDialog(PDEDataViewer.this, "ROI Error.\n" + e1.getMessage(), e1);
}
}
BeanUtils.disposeParentWindow(mainJPanel);
}
};
ActionListener cancelAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
BeanUtils.disposeParentWindow(mainJPanel);
}
};
OkCancelSubPanel okCancelJPanel = new OkCancelSubPanel(okAction, cancelAction);
roiTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (roiTable.getSelectedRows() != null && roiTable.getSelectedRows().length > 0) {
okCancelJPanel.okButton.setEnabled(true);
} else {
okCancelJPanel.okButton.setEnabled(false);
}
}
});
mainJPanel.add(timeJPanel);
mainJPanel.add(roiTable.getEnclosingScrollPane());
mainJPanel.add(okCancelJPanel);
// showComponentInFrame(mainJPanel,
// "Calculate "+(isVolume?"volume":"membrane")+" statistics for '"+getPdeDataContext().getVariableName()+"'."+
// " Choose times and 1 or more ROI(s).");
Frame dialogOwner = JOptionPane.getFrameForComponent(this);
JOptionPane inputDialog = new JOptionPane(mainJPanel, JOptionPane.PLAIN_MESSAGE, 0, null, new Object[0]);
final JDialog d = inputDialog.createDialog(dialogOwner, "Calculate " + (isVolume ? "volume" : "membrane") + " statistics for '" + getPdeDataContext().getVariableName() + "'." + " Choose times and 1 or more ROI(s).");
d.setResizable(true);
try {
DialogUtils.showModalJDialogOnTop(d, PDEDataViewer.this);
} finally {
d.dispose();
}
} finally {
BeanUtils.setCursorThroughout(this, Cursor.getDefaultCursor());
}
}
use of cbit.vcell.simdata.SpatialSelectionMembrane in project vcell by virtualcell.
the class PDEExportDataPanel method getROISelections.
/**
* Return the JListSelections property value.
* @return javax.swing.JList
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private javax.swing.JList<Object> getROISelections() {
if (ivjJListSelections == null) {
try {
ivjJListSelections = new javax.swing.JList<Object>();
ivjJListSelections.setName("JListSelections");
ivjJListSelections.setBounds(0, 0, 160, 120);
ivjJListSelections.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
ivjJListSelections.setCellRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
// TODO Auto-generated method stub
// System.out.println(value.getClass().getName()+" "+value);
String curveDescr = "";
if (value instanceof SpatialSelectionMembrane) {
curveDescr = ((SpatialSelectionMembrane) value).getSelectionSource().getDescription() + " (" + ((SpatialSelectionMembrane) value).getSelectionSource().getBeginningCoordinate() + ")";
} else if (value instanceof SpatialSelectionVolume) {
curveDescr = ((SpatialSelectionVolume) value).getCurveSelectionInfo().getCurve().getDescription() + " (" + ((SpatialSelectionVolume) value).getCurveSelectionInfo().getCurve().getBeginningCoordinate() + ")";
} else {
curveDescr = value.toString();
}
return super.getListCellRendererComponent(list, curveDescr, index, isSelected, cellHasFocus);
}
});
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjJListSelections;
}
use of cbit.vcell.simdata.SpatialSelectionMembrane in project vcell by virtualcell.
the class PdeTimePlotMultipleVariablesPanel method initialize.
private void initialize() {
VariableType varType = multiTimePlotHelper.getPdeDatacontext().getDataIdentifier().getVariableType();
String varName = multiTimePlotHelper.getPdeDatacontext().getVariableName();
String[] plotNames = new String[pointVector.size()];
final SymbolTableEntry[] symbolTableEntries = new SymbolTableEntry[plotNames.length];
DefaultListModel<String> pointListModel = new DefaultListModel<String>();
for (int i = 0; i < pointVector.size(); i++) {
Coordinate tp = null;
if (varType.equals(VariableType.VOLUME) || varType.equals(VariableType.VOLUME_REGION) || varType.equals(VariableType.POSTPROCESSING)) {
SpatialSelectionVolume ssv = (SpatialSelectionVolume) pointVector.get(i);
tp = ssv.getCurveSelectionInfo().getCurve().getBeginningCoordinate();
} else if (varType.equals(VariableType.MEMBRANE) || varType.equals(VariableType.MEMBRANE_REGION)) {
SpatialSelectionMembrane ssm = (SpatialSelectionMembrane) pointVector.get(i);
double midU = ssm.getCurveSelectionInfo().getCurveUfromSelectionU(.5);
tp = ((SampledCurve) ssm.getCurveSelectionInfo().getCurve()).coordinateFromNormalizedU(midU);
}
plotNames[i] = varName + " at P[" + i + "]";
String point = "P[" + i + "] (" + niceCoordinateString(tp) + ")";
pointListModel.addElement(point);
if (multiTimePlotHelper.getsimulation() != null) {
symbolTableEntries[0] = multiTimePlotHelper.getsimulation().getMathDescription().getEntry(varName);
} else {
System.out.println("PdeTimePlotMultipleVariablesPanel.initialize() adding artificial symbol table entries for field data");
SimpleSymbolTable simpleSymbolTable = new SimpleSymbolTable(new String[] { varName });
symbolTableEntries[0] = simpleSymbolTable.getEntry(varName);
}
}
pointJList.setModel(pointListModel);
pointJList.setForeground(variableJList.getForeground());
pointJList.setVisibleRowCount(3);
pointJList.setBackground(getBackground());
pointJList.setSelectionBackground(getBackground());
pointJList.setSelectionForeground(Color.black);
plotPane = new PlotPane();
double[][] plotDatas = tsJobResultsNoStats.getTimesAndValuesForVariable(varName);
Plot2D plot2D = new SingleXPlot2D(symbolTableEntries, multiTimePlotHelper.getDataSymbolMetadataResolver(), ReservedVariable.TIME.getName(), plotNames, plotDatas, new String[] { "Time Plot", ReservedVariable.TIME.getName(), "" });
plotPane.setPlot2D(plot2D);
DataIdentifier[] dis = (multiTimePlotHelper.getCopyOfDisplayedDataIdentifiers() != null ? multiTimePlotHelper.getCopyOfDisplayedDataIdentifiers() : DataIdentifier.collectSortedSimilarDataTypes(multiTimePlotHelper.getVariableType(), multiTimePlotHelper.getPdeDatacontext().getDataIdentifiers()));
Arrays.sort(dis, new Comparator<DataIdentifier>() {
public int compare(DataIdentifier o1, DataIdentifier o2) {
int bEqualIgnoreCase = o1.getDisplayName().compareToIgnoreCase(o2.getDisplayName());
if (bEqualIgnoreCase == 0) {
return o1.getDisplayName().compareTo(o2.getDisplayName());
}
return bEqualIgnoreCase;
}
});
variableJList.setListData(dis);
initVariableListSelected(variableJList, multiTimePlotHelper.getPdeDatacontext().getDataIdentifier());
variableJList.setCellRenderer(multiTimePlotHelper.getListCellRenderer());
setLayout(new GridBagLayout());
JLabel label = new JLabel("Selected Points");
label.setFont(label.getFont().deriveFont(Font.BOLD));
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new java.awt.Insets(15, 10, 4, 4);
add(label, gbc);
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.fill = java.awt.GridBagConstraints.BOTH;
gbc.gridheight = 4;
gbc.weightx = 1;
gbc.weighty = 1;
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = new java.awt.Insets(0, 4, 0, 0);
add(plotPane, gbc);
JScrollPane sp = new JScrollPane(pointJList);
sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
gbc.anchor = GridBagConstraints.WEST;
gbc.weighty = 0.5;
gbc.fill = java.awt.GridBagConstraints.BOTH;
gbc.insets = new java.awt.Insets(4, 10, 4, 4);
add(sp, gbc);
label = new JLabel("Y Axis");
label.setFont(label.getFont().deriveFont(Font.BOLD));
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 2;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new java.awt.Insets(4, 10, 4, 4);
add(label, gbc);
sp = new JScrollPane(variableJList);
sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 3;
gbc.weightx = 0.2;
gbc.weighty = 1;
gbc.insets = new java.awt.Insets(4, 10, 50, 4);
gbc.fill = java.awt.GridBagConstraints.BOTH;
add(sp, gbc);
variableJList.addListSelectionListener(eventHandler);
multiTimePlotHelper.addPropertyChangeListener(eventHandler);
}
use of cbit.vcell.simdata.SpatialSelectionMembrane in project vcell by virtualcell.
the class PdeTimePlotMultipleVariablesPanel method showTimePlot.
public void showTimePlot() {
if ((plotChangeTimer = ClientTaskDispatcher.getBlockingTimer(this, multiTimePlotHelper.getPdeDatacontext(), null, plotChangeTimer, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e2) {
showTimePlot();
}
}, "PdeTimePlotMultipleVariablesPanel update...")) != null) {
return;
}
VariableType varType = multiTimePlotHelper.getVariableType();
Object[] selectedValues = variableJList.getSelectedValues();
DataIdentifier[] selectedDataIdentifiers = new DataIdentifier[selectedValues.length];
System.arraycopy(selectedValues, 0, selectedDataIdentifiers, 0, selectedValues.length);
if (selectedDataIdentifiers.length > 1) {
for (DataIdentifier selectedDataIdentifier : selectedDataIdentifiers) {
if (!selectedDataIdentifier.getVariableType().getVariableDomain().equals(varType.getVariableDomain())) {
PopupGenerator.showErrorDialog(this, "Please choose VOLUME variables or MEMBRANE variables only");
variableJList.clearSelection();
variableJList.setSelectedValue(multiTimePlotHelper.getPdeDatacontext().getVariableName(), true);
return;
}
}
}
try {
final int numSelectedVariables = selectedDataIdentifiers.length;
final int numSelectedSpatialPoints = pointVector.size();
int[][] indices = new int[numSelectedVariables][numSelectedSpatialPoints];
//
for (int i = 0; i < numSelectedSpatialPoints; i++) {
for (int v = 0; v < numSelectedVariables; v++) {
if (selectedDataIdentifiers[v].getVariableType().equals(varType)) {
if (varType.equals(VariableType.VOLUME) || varType.equals(VariableType.VOLUME_REGION) || varType.equals(VariableType.POSTPROCESSING)) {
SpatialSelectionVolume ssv = (SpatialSelectionVolume) pointVector.get(i);
indices[v][i] = ssv.getIndex(0);
} else if (varType.equals(VariableType.MEMBRANE) || varType.equals(VariableType.MEMBRANE_REGION)) {
SpatialSelectionMembrane ssm = (SpatialSelectionMembrane) pointVector.get(i);
indices[v][i] = ssm.getIndex(0);
}
} else {
if (varType.equals(VariableType.VOLUME) || varType.equals(VariableType.VOLUME_REGION) || varType.equals(VariableType.POSTPROCESSING)) {
SpatialSelectionVolume ssv = (SpatialSelectionVolume) pointVector2.get(i);
indices[v][i] = ssv.getIndex(0);
} else if (varType.equals(VariableType.MEMBRANE) || varType.equals(VariableType.MEMBRANE_REGION)) {
SpatialSelectionMembrane ssm = (SpatialSelectionMembrane) pointVector2.get(i);
indices[v][i] = ssm.getIndex(0);
}
}
}
}
final String[] selectedVarNames = new String[numSelectedVariables];
for (int i = 0; i < selectedVarNames.length; i++) {
selectedVarNames[i] = selectedDataIdentifiers[i].getName();
}
final double[] timePoints = multiTimePlotHelper.getPdeDatacontext().getTimePoints();
TimeSeriesJobSpec tsjs = new TimeSeriesJobSpec(selectedVarNames, indices, null, timePoints[0], 1, timePoints[timePoints.length - 1], VCDataJobID.createVCDataJobID(multiTimePlotHelper.getUser(), true));
if (!tsjs.getVcDataJobID().isBackgroundTask()) {
throw new RuntimeException("Use getTimeSeries(...) if not a background job");
}
Hashtable<String, Object> hash = new Hashtable<String, Object>();
hash.put(PDEDataViewer.StringKey_timeSeriesJobSpec, tsjs);
AsynchClientTask task1 = new PDEDataViewer.TimeSeriesDataRetrievalTask("Retrieving Data", multiTimePlotHelper, multiTimePlotHelper.getPdeDatacontext());
AsynchClientTask task2 = new AsynchClientTask("showing time plot", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
TSJobResultsNoStats tsJobResultsNoStats = (TSJobResultsNoStats) hashTable.get(PDEDataViewer.StringKey_timeSeriesJobResults);
int plotCount = numSelectedVariables * numSelectedSpatialPoints;
SymbolTableEntry[] symbolTableEntries = new SymbolTableEntry[plotCount];
String[] plotNames = new String[plotCount];
double[][] plotDatas = new double[1 + plotCount][];
plotDatas[0] = timePoints;
int plotIndex = 0;
for (int v = 0; v < numSelectedVariables; v++) {
String varName = selectedVarNames[v];
double[][] data = tsJobResultsNoStats.getTimesAndValuesForVariable(varName);
for (int i = 1; i < data.length; i++) {
symbolTableEntries[plotIndex] = multiTimePlotHelper.getsimulation().getMathDescription().getEntry(varName);
plotNames[plotIndex] = varName + " at P[" + (i - 1) + "]";
plotDatas[plotIndex + 1] = data[i];
plotIndex++;
}
}
Plot2D plot2D = new SingleXPlot2D(symbolTableEntries, multiTimePlotHelper.getDataSymbolMetadataResolver(), ReservedVariable.TIME.getName(), plotNames, plotDatas, new String[] { "Time Plot", ReservedVariable.TIME.getName(), "" });
plotPane.setPlot2D(plot2D);
}
};
ClientTaskDispatcher.dispatch(this, hash, new AsynchClientTask[] { task1, task2 }, false, true, true, null, false);
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
use of cbit.vcell.simdata.SpatialSelectionMembrane in project vcell by virtualcell.
the class PDEDataContextPanel method fetchSpatialSelections0.
/**
* Insert the method's description here.
* Creation date: (6/28/2003 4:57:18 PM)
* @return cbit.vcell.simdata.gui.SpatialSelection[]
*/
private SpatialSelection[] fetchSpatialSelections0(Curve curveOfInterest, boolean bFetchOnlyVisible, VariableType vt) {
//
java.util.Vector<SpatialSelection> spatialSelection = new java.util.Vector<SpatialSelection>();
//
if (getPdeDataContext() != null && getPdeDataContext().getCartesianMesh() != null && getImagePlaneManagerPanel() != null && getImagePlaneManagerPanel().getCurveRenderer() != null) {
//
CartesianMesh cm = getPdeDataContext().getCartesianMesh();
Curve[] curves = getImagePlaneManagerPanel().getCurveRenderer().getAllCurves();
//
if (curves != null && curves.length > 0) {
for (int i = 0; i < curves.length; i += 1) {
boolean bIsVisible = getImagePlaneManagerPanel().getCurveRenderer().getRenderPropertyVisible(curves[i]);
if ((bFetchOnlyVisible && !bIsVisible) || (curveOfInterest != null && curves[i] != curveOfInterest)) {
continue;
}
//
if ((vt.equals(VariableType.POSTPROCESSING) || vt.equals(VariableType.VOLUME) || vt.equals(VariableType.VOLUME_REGION)) && curves[i] instanceof ControlPointCurve && !(curves[i] instanceof CurveSelectionCurve) && (curves[i].getDescription() == null || curves[i].getDescription().startsWith(CurveValueProvider.DESCRIPTION_VOLUME)) && (membranesAndIndexes == null || !membranesAndIndexes.containsKey(curves[i]))) {
// Volume
//
Curve samplerCurve = null;
// if(isSpatial2D){
samplerCurve = projectCurveOntoSlice(curves[i].getSampledCurve());
// }
if (samplerCurve != null) {
samplerCurve.setDescription(curves[i].getDescription());
spatialSelection.add(new SpatialSelectionVolume(new CurveSelectionInfo(samplerCurve), vt, cm));
}
} else if ((vt.equals(VariableType.MEMBRANE) || vt.equals(VariableType.MEMBRANE_REGION)) && membranesAndIndexes != null) {
//
if (curves[i] instanceof CurveSelectionCurve) {
CurveSelectionCurve csCurve = (CurveSelectionCurve) curves[i];
if (csCurve.getSourceCurveSelectionInfo().getCurve() instanceof ControlPointCurve) {
int[] csisegsel = csCurve.getSourceCurveSelectionInfo().getSegmentsInSelectionOrder();
if (csisegsel != null) {
ControlPointCurve cscpcCurve = (ControlPointCurve) (csCurve.getSourceCurveSelectionInfo().getCurve());
Curve[] membraneCurves = (Curve[]) (membranesAndIndexes.keySet().toArray(new Curve[membranesAndIndexes.size()]));
// See if CurveSelectionCurve matches controlpoints in space of a membrane we have
for (int j = 0; j < membraneCurves.length; j += 1) {
if (membraneCurves[j] instanceof ControlPointCurve) {
// They should all be
ControlPointCurve cpc = (ControlPointCurve) membraneCurves[j];
boolean bSame = true;
for (int k = 0; k < csisegsel.length; k += 1) {
if (csisegsel[k] >= cpc.getControlPointCount() || csisegsel[k] >= cscpcCurve.getControlPointCount() || !Coordinate.get2DProjection(cpc.getControlPoint(csisegsel[k]), getNormalAxis()).equals(Coordinate.get2DProjection(cscpcCurve.getControlPoint(csisegsel[k]), getNormalAxis()))) {
//
bSame = false;
break;
}
}
if (bSame) {
int[] mi = (int[]) membranesAndIndexes.get(membraneCurves[j]);
spatialSelection.add(new SpatialSelectionMembrane(new CurveSelectionInfo(membraneCurves[j], csisegsel[0], csisegsel[csisegsel.length - 1], csCurve.getSourceCurveSelectionInfo().getDirectionNegative()), vt, cm, mi, csCurve));
}
}
}
}
}
} else if (curves[i] instanceof SinglePoint && (curves[i].getDescription() == null || curves[i].getDescription().startsWith(CurveValueProvider.DESCRIPTION_MEMBRANE))) {
CurveSelectionInfo[] csiArr = getImagePlaneManagerPanel().getCurveRenderer().getCloseCurveSelectionInfos(curves[i].getBeginningCoordinate());
if (csiArr != null && csiArr.length > 0) {
for (int j = 0; j < csiArr.length; j += 1) {
if (membranesAndIndexes.containsKey(csiArr[j].getCurve())) {
CurveSelectionInfo closestCSI = getImagePlaneManagerPanel().getCurveRenderer().getClosestSegmentSelectionInfo(curves[i].getBeginningCoordinate(), csiArr[j].getCurve());
int[] mi = (int[]) membranesAndIndexes.get(csiArr[j].getCurve());
spatialSelection.add(new SpatialSelectionMembrane(closestCSI, vt, cm, mi, (SinglePoint) curves[i]));
break;
}
}
}
}
}
}
}
}
//
if (spatialSelection.size() > 0) {
SpatialSelection[] ss = new SpatialSelection[spatialSelection.size()];
spatialSelection.copyInto(ss);
return ss;
}
return null;
}
Aggregations