Search in sources :

Example 11 with Vector3D

use of mcib3d.geom.Vector3D in project mcib3d-core by mcib3d.

the class Image3D method getLinePixelValue.

public double[] getLinePixelValue(Point3D origin, Vector3D dir, double distNeg, double distPos, boolean interpolated) {
    Vector3D dirN = dir.getNormalizedVector();
    int x0 = (int) Math.round(origin.getX() - distNeg * dirN.getX());
    int y0 = (int) Math.round(origin.getY() - distNeg * dirN.getY());
    int z0 = (int) Math.round(origin.getZ() - distNeg * dirN.getZ());
    int x1 = (int) Math.round(origin.getX() + distPos * dirN.getX());
    int y1 = (int) Math.round(origin.getY() + distPos * dirN.getY());
    int z1 = (int) Math.round(origin.getZ() + distPos * dirN.getZ());
    return getLinePixelValue(x0, y0, z0, x1, y1, z1, interpolated);
}
Also used : Vector3D(mcib3d.geom.Vector3D)

Example 12 with Vector3D

use of mcib3d.geom.Vector3D in project mcib3d-core by mcib3d.

the class CostPairMitosis method cost.

public double cost(Object3D object3D1, Object3D object3D2) {
    double cost = -1.0D;
    if (object3D1 == object3D2)
        return this.maxCost;
    int val1 = object3D1.getValue();
    int val2 = object3D2.getValue();
    if (this.interactions != null && !this.interactions.contains(Math.min(val1, val2), Math.max(val1, val2)))
        return -1.0D;
    Vector3D cen1 = object3D1.getCenterAsVector();
    object3D1.setNewCenter(object3D2);
    double pc1 = object3D1.pcColoc(object3D2);
    double pc2 = object3D2.pcColoc(object3D1);
    object3D1.setNewCenter(cen1);
    if (pc1 > this.minColoc && pc2 > this.minColoc)
        cost = 100.0D - Math.min(pc1, pc2);
    return cost;
}
Also used : Vector3D(mcib3d.geom.Vector3D)

Example 13 with Vector3D

use of mcib3d.geom.Vector3D in project mcib3d-core by mcib3d.

the class MeasureEllipsoid method computeAll.

@Override
protected void computeAll() {
    Matrix mat = new Matrix(3, 3);
    MeasureCentroid centroid = new MeasureCentroid(object3DInt);
    Double[] sums = computation3D.computeMoments2(centroid.getCentroidAsVoxel(), true);
    // xx
    mat.set(0, 0, sums[0]);
    // xy
    mat.set(0, 1, sums[3]);
    // xz
    mat.set(0, 2, sums[4]);
    // xy
    mat.set(1, 0, sums[3]);
    // yy
    mat.set(1, 1, sums[1]);
    // yz
    mat.set(1, 2, sums[5]);
    // xz
    mat.set(2, 0, sums[4]);
    // yz
    mat.set(2, 1, sums[5]);
    // zz
    mat.set(2, 2, sums[2]);
    EigenvalueDecomposition eigen = new EigenvalueDecomposition(mat);
    double[] eigenValues = eigen.getRealEigenvalues();
    double R1 = Math.sqrt(5.0 * eigenValues[2]);
    double R2 = Math.sqrt(5.0 * eigenValues[1]);
    double R3 = Math.sqrt(5.0 * eigenValues[0]);
    double volEll = (4.0 / 3.0) * Math.PI * R1 * R2 * R3;
    MeasureVolume volume = new MeasureVolume(object3DInt);
    keysValues.put(ELL_VOL_UNIT, volEll);
    keysValues.put(ELL_SPARENESS, volume.getValueMeasurement(MeasureVolume.VOLUME_UNIT) / volEll);
    keysValues.put(ELL_MAJOR_RADIUS_UNIT, R1);
    keysValues.put(ELL_ELONGATION, R1 / R2);
    keysValues.put(ELL_FLATNESS, R2 / R3);
    radius1 = R1;
    radius2 = R2;
    radius3 = R3;
    // vectors
    Matrix eVectors = eigen.getV();
    Axis1 = new Vector3D(eVectors.get(0, 2), eVectors.get(1, 2), eVectors.get(2, 2));
    Axis2 = new Vector3D(eVectors.get(0, 1), eVectors.get(1, 1), eVectors.get(2, 1));
    Axis3 = new Vector3D(eVectors.get(0, 0), eVectors.get(1, 0), eVectors.get(2, 0));
}
Also used : Matrix(mcib3d.Jama.Matrix) Vector3D(mcib3d.geom.Vector3D) EigenvalueDecomposition(mcib3d.Jama.EigenvalueDecomposition)

Example 14 with Vector3D

use of mcib3d.geom.Vector3D in project mcib3d-core by mcib3d.

the class DeformableMesh method roughDisplacement.

public void roughDisplacement(double maxDispl) {
    this.computeAllForces(false);
    for (Vector3D force : forces) {
        if ((force != null) && (force.getLength() > maxDispl)) {
            Vector3D dirForce = force.getNormalizedVector();
            force = dirForce.multiply(maxDispl);
        }
        // loop on vertices
        if (force != null) {
            for (Point3f vertice : vertices) {
                vertice.add(force.getPoint3f());
            }
        }
    }
    this.computeVerticesNormals();
}
Also used : Point3f(org.scijava.vecmath.Point3f) Vector3D(mcib3d.geom.Vector3D)

Example 15 with Vector3D

use of mcib3d.geom.Vector3D in project mcib3d-core by mcib3d.

the class DeformableMesh method computeAllForces.

public void computeAllForces(boolean stats) {
    forces = new ArrayList<Vector3D>();
    minForce = Double.MAX_VALUE;
    maxForce = 0;
    avgForce = 0;
    int cpt = 0;
    for (int i = 0; i < getNbUniqueVertices(); i++) {
        Vector3D force = getBestDisplacement(i);
        forces.add(force);
        // compute Statistics
        if ((stats) && (force != null)) {
            double le = force.getLength();
            if (le > maxForce) {
                maxForce = le;
            }
            if (le < minForce) {
                minForce = le;
            }
            avgForce += le;
            cpt++;
        }
    }
    avgForce /= cpt;
}
Also used : Vector3D(mcib3d.geom.Vector3D)

Aggregations

Vector3D (mcib3d.geom.Vector3D)18 Point3D (mcib3d.geom.Point3D)4 EigenvalueDecomposition (mcib3d.Jama.EigenvalueDecomposition)1 Matrix (mcib3d.Jama.Matrix)1 Object3D (mcib3d.geom.Object3D)1 Objects3DPopulation (mcib3d.geom.Objects3DPopulation)1 ImageFloat (mcib3d.image3d.ImageFloat)1 ImageHandler (mcib3d.image3d.ImageHandler)1 ArrayUtil (mcib3d.utils.ArrayUtil)1 Chrono (mcib3d.utils.Chrono)1 Point3f (org.scijava.vecmath.Point3f)1