use of cbit.vcell.math.VariableType in project vcell by virtualcell.
the class PDEDataContextPanel method updateContours.
/**
* Insert the method's description here.
* Creation date: (11/9/2000 4:14:39 PM)
*/
private void updateContours() {
//
if (getPdeDataContext() == null || getPdeDataContext().getDataIdentifier() == null) {
return;
}
// Remove previous curves
CurveRenderer curveRenderer = getImagePlaneManagerPanel().getCurveRenderer();
if (contoursAndValues != null) {
java.util.Enumeration<SampledCurve> keysEnum = contoursAndValues.keys();
while (keysEnum.hasMoreElements()) {
Curve curve = keysEnum.nextElement();
curveRenderer.removeCurve(curve);
}
}
//
contoursAndValues = null;
boolean hasValues = false;
if (meshDisplayAdapter != null) {
VariableType variableType = getPdeDataContext().getDataIdentifier().getVariableType();
if (variableType.equals(VariableType.VOLUME)) {
// Get curves with no values for overlay on volume Data
contoursAndValues = meshDisplayAdapter.getCurvesFromContours(null);
} else if (variableType.equals(VariableType.CONTOUR)) {
// get curves with values
contoursAndValues = meshDisplayAdapter.getCurvesFromContours(getPdeDataContext().getDataValues());
hasValues = true;
}
}
// Add new curves to curveRenderer
if (contoursAndValues != null) {
java.util.Enumeration<SampledCurve> keysEnum = contoursAndValues.keys();
while (keysEnum.hasMoreElements()) {
Curve curve = (Curve) keysEnum.nextElement();
//
curveRenderer.addCurve(curve);
//
curveRenderer.renderPropertyEditable(curve, false);
curveRenderer.renderPropertySelectable(curve, hasValues);
if (hasValues) {
curveRenderer.renderPropertySubSelectionType(curve, CurveRenderer.SUBSELECTION_SEGMENT);
} else {
curveRenderer.renderPropertyLineWidthMultiplier(curve, 3);
}
}
}
}
use of cbit.vcell.math.VariableType in project vcell by virtualcell.
the class PDEDataContextPanel method updateMembraneCurves.
/**
* Insert the method's description here.
* Creation date: (10/22/00 3:15:49 PM)
*/
private void updateMembraneCurves() {
//
if (getPdeDataContext() == null || getPdeDataContext().getDataIdentifier() == null) {
return;
}
int normalAxis = getImagePlaneManagerPanel().getImagePlaneManager().getNormalAxis();
int slice = getImagePlaneManagerPanel().getImagePlaneManager().getSlice();
// Remove previous curves
CurveRenderer curveRenderer = getImagePlaneManagerPanel().getCurveRenderer();
if (membranesAndIndexes != null) {
java.util.Enumeration<SampledCurve> keysEnum = membranesAndIndexes.keys();
while (keysEnum.hasMoreElements()) {
Curve curve = keysEnum.nextElement();
curveRenderer.removeCurve(curve);
}
}
//
membranesAndIndexes = null;
boolean hasValues = false;
if (meshDisplayAdapter != null) {
// Get new curves for slice and normalAxis
VariableType variableType = getPdeDataContext().getDataIdentifier().getVariableType();
if (variableType.equals(VariableType.VOLUME) || variableType.equals(VariableType.VOLUME_REGION)) {
// Turn off showing Membrane values over mouse
// getImagePlaneManagerPanel().setCurveValueProvider(null);
//
// GET CURVES WITH NO VALUES FOR OVERLAY ON VOLUME DATA
membranesAndIndexes = meshDisplayAdapter.getCurvesAndMembraneIndexes(normalAxis, slice);
} else if (variableType.equals(VariableType.MEMBRANE)) {
// Turn on showing Membrane values over mouse
// getImagePlaneManagerPanel().setCurveValueProvider(this);
//
// GET CURVES WITH VALUES
membranesAndIndexes = meshDisplayAdapter.getCurvesAndMembraneIndexes(normalAxis, slice);
hasValues = true;
} else if (variableType.equals(VariableType.MEMBRANE_REGION)) {
// Turn on showing Membrane values over mouse
// getImagePlaneManagerPanel().setCurveValueProvider(this);
//
// GET CURVES WITH REGIONIDS
membranesAndIndexes = meshDisplayAdapter.getCurvesAndMembraneIndexes(normalAxis, slice);
/*
//RegionID values
double[] regionValues = getPdeDataContext().getDataValues();
java.util.Iterator regionIDCurveValues = membranesAndValues.values().iterator();
//convert RegionID to value
while(regionIDCurveValues.hasNext()){
java.util.Vector regionIDValues = (java.util.Vector)regionIDCurveValues.next();
for(int i = 0;i < regionIDValues.size();i+= 1){
int regionID = (int)(((Double)(regionIDValues.elementAt(i))).doubleValue());
Double decodedRegionValue = new Double(regionValues[regionID]);
regionIDValues.setElementAt(decodedRegionValue,i);
}
}
*/
hasValues = true;
}
}
// Add new curves to curveRenderer
if (membranesAndIndexes != null) {
java.util.Enumeration<SampledCurve> keysEnum = membranesAndIndexes.keys();
while (keysEnum.hasMoreElements()) {
Curve curve = keysEnum.nextElement();
//
curveRenderer.addCurve(curve);
//
curveRenderer.renderPropertyEditable(curve, false);
curveRenderer.renderPropertySelectable(curve, false);
if (!hasValues) {
curveRenderer.renderPropertyLineWidthMultiplier(curve, 3);
}
// getImagePlaneManagerPanel().getCurveRenderer().renderPropertySelectable(curve, hasValues);
// if (hasValues) {
// getImagePlaneManagerPanel().getCurveRenderer().renderPropertySubSelectionType(curve, cbit.vcell.geometry.gui.CurveRenderer.SUBSELECTION_SEGMENT);
// }else{
// getImagePlaneManagerPanel().getCurveRenderer().renderPropertyLineWidthMultiplier(curve,3);
// }
}
}
//
refreshColorCurves();
//
// Set visibility of curve samplers
Curve[] curves = curveRenderer.getAllCurves();
if (curves != null && curves.length > 0) {
for (int i = 0; i < curves.length; i += 1) {
if (membranesAndIndexes == null || !membranesAndIndexes.containsKey(curves[i])) {
boolean isCurveValidDataSampler = isValidDataSampler(curves[i]);
curveRenderer.renderPropertyVisible(curves[i], isCurveValidDataSampler);
curveRenderer.renderPropertyEditable(curves[i], (membraneSamplerCurves != null && membraneSamplerCurves.contains(curves[i]) ? false : true));
}
}
}
// See if we should keep selection
if (curveRenderer.getSelection() != null) {
CurveSelectionInfo csi = curveRenderer.getSelection();
curveRenderer.selectNothing();
if (isValidDataSampler(csi.getCurve())) {
curveRenderer.setSelection(csi);
}
}
//
//
fireDataSamplers();
}
use of cbit.vcell.math.VariableType in project vcell by virtualcell.
the class PDEDataContextPanel method recodeDataForDomain0.
private void recodeDataForDomain0() {
Domain varDomain = getPdeDataContext().getDataIdentifier().getDomain();
double[] tempRecodedData = null;
Range dataRange = null;
VariableType vt = getPdeDataContext().getDataIdentifier().getVariableType();
boolean bRecoding = getDataInfoProvider() != null && varDomain != null;
Double notInDomainValue = null;
if (getPdeDataContext().getDataValues() != originalData || recodeDataForDomainInfo == null || ((getDataInfoProvider() == null) != bDataInfoProviderNull) || !Compare.isEqualOrNull(functionStatisticsRange, lastFunctionStatisticsRange)) {
lastFunctionStatisticsRange = functionStatisticsRange;
bDataInfoProviderNull = (getDataInfoProvider() == null);
originalData = getPdeDataContext().getDataValues();
tempRecodedData = originalData;
double illegalNumber = Double.POSITIVE_INFINITY;
if (bRecoding) {
tempRecodedData = new double[originalData.length];
System.arraycopy(originalData, 0, tempRecodedData, 0, tempRecodedData.length);
for (int i = 0; i < originalData.length; i++) {
if (!Double.isNaN(originalData[i])) {
illegalNumber = Math.min(illegalNumber, originalData[i]);
}
}
}
//
illegalNumber -= 1;
notInDomainValue = new Double(illegalNumber);
final CartesianMesh cartesianMesh = getPdeDataContext().getCartesianMesh();
double minCurrTime = Double.POSITIVE_INFINITY;
double maxCurrTime = Double.NEGATIVE_INFINITY;
for (int i = 0; i < tempRecodedData.length; i++) {
if (bRecoding) {
if (!isInDomain(cartesianMesh, varDomain, dataInfoProvider, i, vt)) {
tempRecodedData[i] = illegalNumber;
}
}
if (!Double.isNaN(tempRecodedData[i]) && tempRecodedData[i] != illegalNumber) {
minCurrTime = Math.min(minCurrTime, tempRecodedData[i]);
maxCurrTime = Math.max(maxCurrTime, tempRecodedData[i]);
}
}
if (!getdisplayAdapterService1().getAllTimes() || functionStatisticsRange == null) {
dataRange = new Range(minCurrTime, maxCurrTime);
} else if (functionStatisticsRange != null) {
dataRange = functionStatisticsRange;
} else {
throw new RuntimeException("Unexpected state for range calculation");
}
} else {
dataRange = recodeDataForDomainInfo.getRecodedDataRange();
tempRecodedData = recodeDataForDomainInfo.getRecodedDataForDomain();
}
if (bRecoding) {
recodeDataForDomainInfo = new RecodeDataForDomainInfo(true, tempRecodedData, dataRange, notInDomainValue);
} else {
recodeDataForDomainInfo = new RecodeDataForDomainInfo(false, tempRecodedData, dataRange, notInDomainValue);
}
}
use of cbit.vcell.math.VariableType 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);
}
use of cbit.vcell.math.VariableType in project vcell by virtualcell.
the class PDEDataContextPanel method getInitalCurveSelection.
/**
* Insert the method's description here.
* Creation date: (7/4/2003 6:10:48 PM)
*/
public CurveSelectionInfo getInitalCurveSelection(int tool, Coordinate wc) {
//
CurveSelectionInfo newCurveSelection = null;
VariableType variableType = getPdeDataContext().getDataIdentifier().getVariableType();
if (variableType.equals(VariableType.MEMBRANE) || variableType.equals(VariableType.MEMBRANE_REGION)) {
if (getPdeDataContext().getCartesianMesh().isChomboMesh() && tool == CurveEditorTool.TOOL_POINT) {
newCurveSelection = findChomboSinglePointSelectionInfoForPoint(wc);
} else {
CurveSelectionInfo[] closeCSI = getImagePlaneManagerPanel().getCurveRenderer().getCloseCurveSelectionInfos(wc);
if (closeCSI != null) {
for (int i = 0; i < closeCSI.length; i += 1) {
if (membranesAndIndexes != null && membranesAndIndexes.containsKey(closeCSI[i].getCurve())) {
if (tool == CurveEditorTool.TOOL_LINE) {
newCurveSelection = new CurveSelectionInfo(new CurveSelectionCurve((SampledCurve) (closeCSI[i].getCurve())));
} else if (tool == CurveEditorTool.TOOL_POINT) {
newCurveSelection = new CurveSelectionInfo(new CurveSelectionCurve((SampledCurve) (closeCSI[i].getCurve())));
double dist = closeCSI[i].getCurve().getDistanceTo(wc);
int segmentIndex = closeCSI[i].getCurve().pickSegment(wc, dist * 1.1);
Coordinate[] coordArr = closeCSI[i].getCurve().getSampledCurve().getControlPointsForSegment(segmentIndex);
Coordinate middleCoord = new Coordinate((coordArr[0].getX() + coordArr[1].getX()) / 2, (coordArr[0].getY() + coordArr[1].getY()) / 2, (coordArr[0].getZ() + coordArr[1].getZ()) / 2);
newCurveSelection = new CurveSelectionInfo(new SinglePoint(middleCoord));
}
break;
}
}
}
}
}
if (newCurveSelection != null) {
if (membraneSamplerCurves == null) {
membraneSamplerCurves = new java.util.Vector<Curve>();
}
membraneSamplerCurves.add(newCurveSelection.getCurve());
}
return newCurveSelection;
}
Aggregations