Search in sources :

Example 16 with GeometrySpec

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();
}
Also used : GeometrySpec(cbit.vcell.geometry.GeometrySpec) RegionImage(cbit.vcell.geometry.RegionImage) RegionImage(cbit.vcell.geometry.RegionImage)

Example 17 with GeometrySpec

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;
}
Also used : GeometrySpec(cbit.vcell.geometry.GeometrySpec) MathModel(cbit.vcell.mathmodel.MathModel) SurfaceClass(cbit.vcell.geometry.SurfaceClass) SubVolume(cbit.vcell.geometry.SubVolume) SimulationContext(cbit.vcell.mapping.SimulationContext)

Example 18 with GeometrySpec

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);
        }
    }
}
Also used : GeometrySpec(cbit.vcell.geometry.GeometrySpec) SubVolume(cbit.vcell.geometry.SubVolume) ImageSubVolume(cbit.vcell.geometry.ImageSubVolume) AnalyticSubVolume(cbit.vcell.geometry.AnalyticSubVolume) ImageSubVolume(cbit.vcell.geometry.ImageSubVolume)

Example 19 with GeometrySpec

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);
    }
}
Also used : GeometrySpec(cbit.vcell.geometry.GeometrySpec)

Example 20 with GeometrySpec

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);
}
Also used : GeometrySpec(cbit.vcell.geometry.GeometrySpec) Origin(org.vcell.util.Origin) GeometryThumbnailImageFactoryAWT(cbit.vcell.geometry.GeometryThumbnailImageFactoryAWT) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Extent(org.vcell.util.Extent) Hashtable(java.util.Hashtable)

Aggregations

GeometrySpec (cbit.vcell.geometry.GeometrySpec)23 SubVolume (cbit.vcell.geometry.SubVolume)12 VCImage (cbit.image.VCImage)7 SurfaceClass (cbit.vcell.geometry.SurfaceClass)6 GeometrySurfaceDescription (cbit.vcell.geometry.surface.GeometrySurfaceDescription)6 Expression (cbit.vcell.parser.Expression)6 ArrayList (java.util.ArrayList)6 AnalyticSubVolume (cbit.vcell.geometry.AnalyticSubVolume)5 Geometry (cbit.vcell.geometry.Geometry)5 GeometryThumbnailImageFactoryAWT (cbit.vcell.geometry.GeometryThumbnailImageFactoryAWT)5 GeometricRegion (cbit.vcell.geometry.surface.GeometricRegion)5 SurfaceGeometricRegion (cbit.vcell.geometry.surface.SurfaceGeometricRegion)5 VolumeGeometricRegion (cbit.vcell.geometry.surface.VolumeGeometricRegion)5 CompartmentSubDomain (cbit.vcell.math.CompartmentSubDomain)5 MembraneSubDomain (cbit.vcell.math.MembraneSubDomain)5 Extent (org.vcell.util.Extent)5 Origin (org.vcell.util.Origin)5 CSGObject (cbit.vcell.geometry.CSGObject)4 ISize (org.vcell.util.ISize)4 VCImageUncompressed (cbit.image.VCImageUncompressed)3