Search in sources :

Example 16 with CoordinateIndex

use of org.vcell.util.CoordinateIndex in project vcell by virtualcell.

the class CartesianMesh method getVolumeSliceIndices.

/**
 * This method was created in VisualAge.
 * @return java.lang.String
 * @param variable java.lang.String
 * @param time double
 */
public int[] getVolumeSliceIndices(int normalAxis, int sliceNumber) {
    Coordinate normalAxisDimension = Coordinate.convertAxisFromStandardXYZToNormal(getSizeX(), getSizeY(), getSizeZ(), normalAxis);
    int[] indices = new int[(int) normalAxisDimension.getX() * (int) normalAxisDimension.getY()];
    int counter = 0;
    CoordinateIndex coordIndex = new CoordinateIndex();
    for (int y = 0; y < normalAxisDimension.getY(); y += 1) {
        for (int x = 0; x < normalAxisDimension.getX(); x += 1) {
            // 
            // indexing through "normal" slice, converting each X,Y pair into equivalent
            // (X,Y,Z) in mesh coordinates.
            // 
            coordIndex.x = x;
            coordIndex.y = y;
            coordIndex.z = sliceNumber;
            Coordinate.convertCoordinateIndexFromNormalToStandardXYZ(coordIndex, normalAxis);
            // 
            // store mesh coordinates in "normal" slice sample array.
            // 
            indices[counter] = getVolumeIndex(coordIndex.x, coordIndex.y, coordIndex.z);
            counter += 1;
        }
    }
    return indices;
}
Also used : Coordinate(org.vcell.util.Coordinate) CoordinateIndex(org.vcell.util.CoordinateIndex)

Example 17 with CoordinateIndex

use of org.vcell.util.CoordinateIndex in project vcell by virtualcell.

the class CartesianMesh method calculateMeshElementVolumeFromVolumeIndex.

/**
 * Insert the method's description here.
 * Creation date: (2/23/2006 12:52:44 PM)
 */
public double calculateMeshElementVolumeFromVolumeIndex(int volumeIndex) {
    CoordinateIndex ci = getCoordinateIndexFromVolumeIndex(volumeIndex);
    double fxMESize = (ci.x == 0 || ci.x == (getSizeX() - 1) ? .5 : 1);
    double fyMESize = (getGeometryDimension() >= 2 ? (ci.y == 0 || ci.y == (getSizeY() - 1) ? .5 : 1) : 0);
    double fzMESize = (getGeometryDimension() == 3 ? (ci.z == 0 || ci.z == (getSizeZ() - 1) ? .5 : 1) : 0);
    return (fxMESize != 0 ? fxMESize * (getExtent().getX() / (getSizeX() - 1)) : 1) * (fyMESize != 0 ? fyMESize * (getExtent().getY() / (getSizeY() - 1)) : 1) * (fzMESize != 0 ? fzMESize * (getExtent().getZ() / (getSizeZ() - 1)) : 1);
}
Also used : CoordinateIndex(org.vcell.util.CoordinateIndex)

Example 18 with CoordinateIndex

use of org.vcell.util.CoordinateIndex in project vcell by virtualcell.

the class CartesianMeshChombo method findMembraneIndexFromVolumeCoordinate.

public int findMembraneIndexFromVolumeCoordinate(Coordinate wc) {
    if (dx == null) {
        dx = new double[3];
        dx[0] = getExtent().getX() / getSizeX();
        dx[1] = getExtent().getY() / getSizeY();
        dx[2] = getExtent().getZ() / getSizeZ();
    }
    int i = (int) ((wc.getX() - getOrigin().getX()) / dx[0]);
    int j = (int) ((wc.getY() - getOrigin().getY()) / dx[1]);
    int k = dimension < 3 ? 0 : (int) ((wc.getZ() - getOrigin().getZ()) / dx[2]);
    return findMembraneIndexFromVolumeIndex(new CoordinateIndex(i, j, k));
}
Also used : CoordinateIndex(org.vcell.util.CoordinateIndex)

Example 19 with CoordinateIndex

use of org.vcell.util.CoordinateIndex in project vcell by virtualcell.

the class CartesianMeshChombo method findMembraneIndexFromVolumeIndex.

public int findMembraneIndexFromVolumeIndex(CoordinateIndex ci) {
    for (MembraneElementMetricsEntry me : membraneElementMetrics) {
        CoordinateIndex ci0 = new CoordinateIndex(me.i, me.j, me.k);
        CoordinateIndex ci1 = ci;
        if (me.level < viewLevel) {
            ci1 = convertDownToLevel(ci1, me.level, viewLevel);
        } else if (me.level > viewLevel) {
            // we will worry about this later.
            return -1;
        }
        if (ci0.x == ci1.x && ci0.y == ci1.y && (dimension == 2 || ci0.z == ci1.z)) {
            return me.index;
        }
    }
    return -1;
}
Also used : CoordinateIndex(org.vcell.util.CoordinateIndex)

Example 20 with CoordinateIndex

use of org.vcell.util.CoordinateIndex in project vcell by virtualcell.

the class MeshDisplayAdapter method isMembraneElementVisible.

/**
 * Insert the method's description here.
 * Creation date: (8/30/00 6:25:14 PM)
 * @return cbit.vcell.geometry.Line
 */
private boolean isMembraneElementVisible(MembraneElement membraneElement, int normalAxis, int slice) {
    int membranePlane = getNormalAxis(membraneElement);
    if (membranePlane == normalAxis) {
        // MembraneElement perpendicular to our view
        return false;
    }
    CoordinateIndex insideCI = mesh.getCoordinateIndexFromVolumeIndex(membraneElement.getInsideVolumeIndex());
    // MembraneElement not visible in slice
    if (normalAxis == Coordinate.Z_AXIS && insideCI.z != slice) {
        return false;
    } else if (normalAxis == Coordinate.Y_AXIS && insideCI.y != slice) {
        return false;
    } else if (normalAxis == Coordinate.X_AXIS && insideCI.x != slice) {
        return false;
    }
    return true;
}
Also used : CoordinateIndex(org.vcell.util.CoordinateIndex)

Aggregations

CoordinateIndex (org.vcell.util.CoordinateIndex)30 Coordinate (org.vcell.util.Coordinate)15 Point (java.awt.Point)7 SinglePoint (cbit.vcell.geometry.SinglePoint)4 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)3 Hashtable (java.util.Hashtable)3 Vector (java.util.Vector)3 ISize (org.vcell.util.ISize)3 CurveSelectionInfo (cbit.vcell.geometry.CurveSelectionInfo)2 RegionImage (cbit.vcell.geometry.RegionImage)2 SampledCurve (cbit.vcell.geometry.SampledCurve)2 DataBufferByte (java.awt.image.DataBufferByte)2 StringTokenizer (java.util.StringTokenizer)2 DisplayAdapterService (cbit.image.DisplayAdapterService)1 SourceDataInfo (cbit.image.SourceDataInfo)1 VCImage (cbit.image.VCImage)1 VCImageUncompressed (cbit.image.VCImageUncompressed)1 ImagePlaneManagerPanel (cbit.image.gui.ImagePlaneManagerPanel)1 Plot2D (cbit.plot.Plot2D)1 PlotData (cbit.plot.PlotData)1