Search in sources :

Example 21 with ArrayUtil

use of mcib3d.utils.ArrayUtil in project mcib3d-core by mcib3d.

the class Objects3DPopulation method computeDistances.

/**
 * @param evaluationPoints
 * @return
 */
public ArrayUtil computeDistances(Point3D[] evaluationPoints) {
    final int numPoints = evaluationPoints.length;
    ArrayUtil array;
    Point3D P;
    Object3D cl;
    array = new ArrayUtil(numPoints);
    for (int i = 0; i < numPoints; i++) {
        P = evaluationPoints[i];
        cl = this.closestCenter(P);
        array.putValue(i, cl.distPixelCenter(P.getX(), P.getY(), P.getZ()));
    }
    return array;
}
Also used : ArrayUtil(mcib3d.utils.ArrayUtil)

Example 22 with ArrayUtil

use of mcib3d.utils.ArrayUtil in project mcib3d-core by mcib3d.

the class Object3DLabel method listValues.

@Override
public ArrayUtil listValues(ImageHandler ima, float thresh) {
    ArrayUtil list = new ArrayUtil(this.getVolumePixels());
    float pixel;
    int xmin0;
    int ymin0;
    int zmin0;
    int xmax0;
    int ymax0;
    int zmax0;
    xmin0 = getXmin();
    ymin0 = getYmin();
    zmin0 = getZmin();
    xmax0 = getXmax();
    ymax0 = getYmax();
    zmax0 = getZmax();
    int idx = 0;
    for (int k = zmin0; k <= zmax0; k++) {
        for (int j = ymin0; j <= ymax0; j++) {
            for (int i = xmin0; i <= xmax0; i++) {
                if (labelImage.getPixel(i, j, k) == value) {
                    pixel = ima.getPixel(i, j, k);
                    if (pixel > thresh) {
                        list.putValue(idx, pixel);
                        idx++;
                    }
                }
            }
        }
    }
    return list;
}
Also used : ArrayUtil(mcib3d.utils.ArrayUtil)

Example 23 with ArrayUtil

use of mcib3d.utils.ArrayUtil in project mcib3d-core by mcib3d.

the class Object3DLabel method listValues.

@Override
public ArrayUtil listValues(ImageHandler ima) {
    ArrayUtil list = new ArrayUtil(this.getVolumePixels());
    Voxel3D pixel;
    int xmin0;
    int ymin0;
    int zmin0;
    int xmax0;
    int ymax0;
    int zmax0;
    xmin0 = getXmin();
    ymin0 = getYmin();
    zmin0 = getZmin();
    xmax0 = getXmax();
    ymax0 = getYmax();
    zmax0 = getZmax();
    int idx = 0;
    for (int k = zmin0; k <= zmax0; k++) {
        for (int j = ymin0; j <= ymax0; j++) {
            for (int i = xmin0; i <= xmax0; i++) {
                if (labelImage.getPixel(i, j, k) == value) {
                    list.putValue(idx, ima.getPixel(i, j, k));
                    idx++;
                }
            }
        }
    }
    return list;
}
Also used : ArrayUtil(mcib3d.utils.ArrayUtil)

Example 24 with ArrayUtil

use of mcib3d.utils.ArrayUtil in project mcib3d-core by mcib3d.

the class Object3DSurface method listValues.

@Override
public ArrayUtil listValues(ImageHandler ima) {
    ArrayUtil vector = new ArrayUtil(this.getVolumePixels());
    float pixvalue;
    int idx = 0;
    for (Voxel3D pixel : voxels) {
        if (ima.contains(pixel)) {
            pixvalue = ima.getPixel(pixel);
            vector.addValue(idx, pixvalue);
            idx++;
        }
    }
    vector.setSize(idx);
    return vector;
}
Also used : ArrayUtil(mcib3d.utils.ArrayUtil)

Example 25 with ArrayUtil

use of mcib3d.utils.ArrayUtil in project mcib3d-core by mcib3d.

the class Object3DVoxels method listVoxels.

// list voxels when object translated to new position for center
public ArrayUtil listVoxels(ImageHandler ima, int newCenterX, int newCenterY, int newCenterZ) {
    ArrayUtil list = new ArrayUtil(this.getVolumePixels());
    Voxel3D voxel;
    Iterator<Voxel3D> it = voxels.iterator();
    float pixvalue;
    double tx = newCenterX - bx;
    double ty = newCenterY - by;
    double tz = newCenterZ - bz;
    int idx = 0;
    while (it.hasNext()) {
        voxel = it.next();
        int px = (int) Math.round(tx + voxel.getX());
        int py = (int) Math.round(ty + voxel.getY());
        int pz = (int) Math.round(tz + voxel.getZ());
        if (ima.contains(px, py, pz)) {
            pixvalue = ima.getPixel(px, py, pz);
            list.putValue(idx, pixvalue);
            idx++;
        }
    }
    list.setSize(idx);
    return list;
}
Also used : ArrayUtil(mcib3d.utils.ArrayUtil)

Aggregations

ArrayUtil (mcib3d.utils.ArrayUtil)66 ArrayList (java.util.ArrayList)9 Iterator (java.util.Iterator)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 Voxel3D (mcib3d.geom.Voxel3D)2 Voxel3DComparable (mcib3d.geom.Voxel3DComparable)2 RoiManager (ij.plugin.frame.RoiManager)1 HashMap (java.util.HashMap)1 Random (java.util.Random)1 Point3D (mcib3d.geom.Point3D)1 Vector3D (mcib3d.geom.Vector3D)1 ImageInt (mcib3d.image3d.ImageInt)1