use of cbit.vcell.geometry.GeometrySpec in project vcell by virtualcell.
the class GeometrySurfaceUtils method getUpdatedRegionImage.
/**
* Insert the method's description here.
* Creation date: (6/28/2004 2:56:03 PM)
* @return cbit.vcell.geometry.RegionImage
* @param geoSurfaceDescription cbit.vcell.geometry.surface.GeometrySurfaceDescription
*/
static cbit.vcell.geometry.RegionImage getUpdatedRegionImage(GeometrySurfaceDescription geoSurfaceDescription) throws cbit.vcell.geometry.GeometryException, cbit.image.ImageException, cbit.vcell.parser.ExpressionException {
//
// make new RegionImage if necessary missing or wrong size
//
cbit.vcell.geometry.GeometrySpec geometrySpec = geoSurfaceDescription.getGeometry().getGeometrySpec();
if (geoSurfaceDescription.getRegionImage() == null || geoSurfaceDescription.getFilterCutoffFrequency() != geoSurfaceDescription.getRegionImage().getFilterCutoffFrequency() || geoSurfaceDescription.getRegionImage().getNumX() != geoSurfaceDescription.getVolumeSampleSize().getX() || geoSurfaceDescription.getRegionImage().getNumY() != geoSurfaceDescription.getVolumeSampleSize().getY() || geoSurfaceDescription.getRegionImage().getNumZ() != geoSurfaceDescription.getVolumeSampleSize().getZ()) {
cbit.image.VCImage image = geometrySpec.createSampledImage(geoSurfaceDescription.getVolumeSampleSize());
cbit.vcell.geometry.RegionImage regionImage = new RegionImage(image, geoSurfaceDescription.getGeometry().getDimension(), geoSurfaceDescription.getGeometry().getExtent(), geoSurfaceDescription.getGeometry().getOrigin(), geoSurfaceDescription.getFilterCutoffFrequency().doubleValue());
return regionImage;
}
return geoSurfaceDescription.getRegionImage();
}
use of cbit.vcell.geometry.GeometrySpec in project vcell by virtualcell.
the class SimulationWorkspaceModelInfo method getMembraneName.
/**
* Insert the method's description here.
* Creation date: (9/19/2005 1:30:44 PM)
* @return java.lang.String
* @param subVolumeIdIn int
* @param subVolumeIdOut int
*/
public String getMembraneName(int subVolumeIdIn, int subVolumeIdOut, boolean bFromGeometry) {
String results = null;
if (simulationOwner instanceof MathModel) {
MathModel mathModel = (MathModel) simulationOwner;
final GeometrySpec geometrySpec = mathModel.getMathDescription().getGeometry().getGeometrySpec();
if (geometrySpec.getSubVolume(subVolumeIdIn) != null && geometrySpec.getSubVolume(subVolumeIdOut) != null) {
SubVolume svIn = geometrySpec.getSubVolume(subVolumeIdIn);
SubVolume svOut = geometrySpec.getSubVolume(subVolumeIdOut);
SurfaceClass membrane = mathModel.getMathDescription().getGeometry().getGeometrySurfaceDescription().getSurfaceClass(svIn, svOut);
results = membrane.getName();
}
} else if (simulationOwner instanceof SimulationContext) {
SimulationContext simContext = (SimulationContext) simulationOwner;
SubVolume svIn = simContext.getGeometry().getGeometrySpec().getSubVolume(subVolumeIdIn);
SubVolume svOut = simContext.getGeometry().getGeometrySpec().getSubVolume(subVolumeIdOut);
if (bFromGeometry) {
SurfaceClass membrane = simContext.getMathDescription().getGeometry().getGeometrySurfaceDescription().getSurfaceClass(svIn, svOut);
results = membrane.getName();
} else {
if (svIn != null && svOut != null) {
GeometryClass[] geometryClasses = simContext.getGeometry().getGeometryClasses();
for (int i = 0; i < geometryClasses.length; i++) {
if (geometryClasses[i] instanceof SurfaceClass) {
SurfaceClass surface = (SurfaceClass) geometryClasses[i];
if (surface.isAdjacentTo(svIn) && surface.isAdjacentTo(svOut)) {
StructureMapping[] structureMappings = simContext.getGeometryContext().getStructureMappings(surface);
if (structureMappings != null && structureMappings.length > 0) {
results = surface.getName() + "(";
for (int j = 0; j < structureMappings.length; j++) {
results += structureMappings[j].getStructure().getName() + " ";
}
results += ")";
return results;
}
}
}
}
}
}
}
return results;
}
use of cbit.vcell.geometry.GeometrySpec in project vcell by virtualcell.
the class GeometrySubVolumePanel method refreshButtons.
/**
* This method was created in VisualAge.
*/
private void refreshButtons() {
boolean bHasGeometry = getGeometry() != null;
boolean bHasGeomSpec = (bHasGeometry ? getGeometry().getGeometrySpec() != null : false);
boolean bImageBased = (bHasGeomSpec ? getGeometry().getGeometrySpec().getImage() != null : false);
addShapeButton.setEnabled(!bImageBased);
SubVolume selectedSubVolume = getSelectedSubVolume();
if (!bHasGeomSpec || getGeometry().getDimension() == 0) {
getFrontButton().setEnabled(false);
getBackButton().setEnabled(false);
getDeleteButton().setEnabled(false);
addShapeButton.setEnabled(false);
} else if (selectedSubVolume == null) {
getFrontButton().setEnabled(false);
getBackButton().setEnabled(false);
getDeleteButton().setEnabled(false);
} else {
GeometrySpec geometrySpec = getGeometry().getGeometrySpec();
int numAnalyticOrCSGSubVolumes = geometrySpec.getNumAnalyticOrCSGSubVolumes();
if (numAnalyticOrCSGSubVolumes > 1) {
getFrontButton().setEnabled(geometrySpec.getSubVolumeIndex(selectedSubVolume) > 0);
getBackButton().setEnabled(geometrySpec.getSubVolumeIndex(selectedSubVolume) < (numAnalyticOrCSGSubVolumes - 1));
} else {
getFrontButton().setEnabled(false);
getBackButton().setEnabled(false);
}
if (selectedSubVolume instanceof ImageSubVolume || (!bImageBased && (geometrySpec.getNumSubVolumes() <= 1))) {
getDeleteButton().setEnabled(false);
} else {
getDeleteButton().setEnabled(true);
}
}
}
use of cbit.vcell.geometry.GeometrySpec in project vcell by virtualcell.
the class CurveRendererGeometry method addCurve.
/**
* This method was created in VisualAge.
* @param curve cbit.vcell.geometry.Curve
*/
public void addCurve(String filamentName, Curve curve) {
if (getGeometry() != null) {
GeometrySpec geometrySpec = getGeometry().getGeometrySpec();
geometrySpec.getFilamentGroup().addCurve(filamentName, curve);
}
}
use of cbit.vcell.geometry.GeometrySpec in project vcell by virtualcell.
the class GeometrySizeDialog method Ok.
/**
* Comment
*/
private void Ok() throws PropertyVetoException {
final double worldExtentX = Double.valueOf(getSizeXTextField().getText()).doubleValue();
final double worldExtentY = Double.valueOf(getSizeYTextField().getText()).doubleValue();
final double worldExtentZ = Double.valueOf(getSizeZTextField().getText()).doubleValue();
final double worldOriginX = Double.valueOf(getOriginXTextField().getText()).doubleValue();
final double worldOriginY = Double.valueOf(getOriginYTextField().getText()).doubleValue();
final double worldOriginZ = Double.valueOf(getOriginZTextField().getText()).doubleValue();
final GeometrySpec geometrySpec = getGeometry().getGeometrySpec();
AsynchClientTask extentOriginTask = new AsynchClientTask("Changing domain", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
geometrySpec.setExtent(new Extent(worldExtentX, worldExtentY, worldExtentZ));
geometrySpec.setOrigin(new Origin(worldOriginX, worldOriginY, worldOriginZ));
getGeometry().precomputeAll(new GeometryThumbnailImageFactoryAWT());
}
};
ClientTaskDispatcher.dispatch(this.getParent(), new Hashtable<String, Object>(), new AsynchClientTask[] { extentOriginTask }, false);
}
Aggregations