Search in sources :

Example 6 with Object3D

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

the class Association method drawAssociation.

@Deprecated
public void drawAssociation(ImageHandler draw) {
    if (CostsAll == null)
        computeAssociation();
    int max = 0;
    for (String a : CostsOK.keySet()) {
        int[] vals = Association.getValues(a);
        int val1 = vals[0];
        int val2 = vals[1];
        Object3D object3D2 = population2.getObjectByValue(val2);
        // object3D2.setValue(val1);
        object3D2.draw(draw, val1);
        if (val1 > max)
            max = val1;
    }
    // orphan2
    for (String orphan : Orphan2) {
        int val = Integer.parseInt(orphan);
        max++;
        Object3D object3D2 = population2.getObjectByValue(val);
        // object3D2.setValue(max);
        object3D2.draw(draw, max);
    }
}
Also used : Object3D(mcib3d.geom.Object3D)

Example 7 with Object3D

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

the class InteractionsComputeContours method compute.

@Override
public InteractionsList compute(ImageHandler image) {
    // get population from image
    Objects3DPopulation population = new Objects3DPopulation(image);
    InteractionsList interactions = new InteractionsList();
    for (Object3D object3D : population.getObjectsList()) {
        LinkedList<Voxel3D> list = object3D.getContours();
        for (Voxel3D voxel3D : list) {
            ArrayUtil util = image.getNeighborhood3x3x3(voxel3D.getRoundX(), voxel3D.getRoundY(), voxel3D.getRoundZ());
            util = util.distinctValues();
            for (int i = 0; i < util.size(); i++) {
                for (int j = i + 1; j < util.size(); j++) {
                    int vali = util.getValueInt(i);
                    int valj = util.getValueInt(j);
                    if ((vali > 0) && (valj > 0)) {
                        if ((vali == object3D.getValue()) || (valj == object3D.getValue())) {
                            if (!interactions.contains(vali, valj)) {
                                interactions.addInteraction(population.getObjectByValue(vali), population.getObjectByValue(valj));
                            }
                            interactions.incrementPairVolume(vali, valj);
                        }
                    }
                }
            }
        }
    }
    return interactions;
}
Also used : Voxel3D(mcib3d.geom.Voxel3D) Objects3DPopulation(mcib3d.geom.Objects3DPopulation) Object3D(mcib3d.geom.Object3D) ArrayUtil(mcib3d.utils.ArrayUtil)

Example 8 with Object3D

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

the class Segment3DSpots method segmentAll.

/**
 */
public void segmentAll() {
    segmentedObjects = new ArrayList<Object3D>();
    LinkedList<Voxel3D> obj;
    int o = 1;
    int localThreshold = localValue;
    if (labelImage == null) {
        this.createLabelImage();
    }
    // locate seeds
    for (int z = 0; z < seedsImage.sizeZ; z++) {
        IJ.showStatus("Segmenting slice " + (z + 1));
        // IJ.log("Segmenting slice " + (z + 1));
        for (int y = 0; y < seedsImage.sizeY; y++) {
            for (int x = 0; x < seedsImage.sizeX; x++) {
                if (seedsImage.getPixel(x, y, z) > seedsThreshold) {
                    // LOCAL THRESHOLD
                    if (localMethod == LOCAL_MEAN) {
                        localThreshold = (int) localMean(x, y, z);
                    } else if (localMethod == LOCAL_GAUSS) {
                        double[] gauss;
                        gauss = this.gaussianFit(x, y, z, false);
                        if (gauss != null) {
                            double thresh = CurveFitter.f(CurveFitter.GAUSSIAN, gauss, GAUSS_PC * gauss[3]);
                            // IJ.log("gauss sigma : " + gauss[3] + " thresh=" + thresh);
                            localThreshold = (int) thresh;
                        }
                    } else if (localMethod == LOCAL_DIFF) {
                        localThreshold = (int) Math.max(1, seedsImage.getPixel(x, y, z) - diff);
                    }
                    if (localThreshold > 0) {
                        if (show) {
                            IJ.log("segmenting spot at : " + x + " " + y + " " + " " + z + " lc=" + localThreshold);
                        }
                    }
                    switch(methodSeg) {
                        case SEG_CLASSICAL:
                            obj = this.segmentSpotClassical(x, y, z, localThreshold, o);
                            break;
                        case SEG_MAX:
                            obj = this.segmentSpotMax(x, y, z, localThreshold, o);
                            break;
                        case SEG_BLOCK:
                            obj = this.segmentSpotBlock(x, y, z, localThreshold, o);
                            break;
                        default:
                            obj = this.segmentSpotClassical(x, y, z, localThreshold, o);
                            break;
                    }
                    if ((obj != null) && (obj.size() >= volMin) && (obj.size() <= volMax)) {
                        segmentedObjects.add(new Object3DVoxels(obj));
                        // IJ.log("obj size: "+obj.size());
                        o++;
                    } else if (obj != null) {
                        // erase from label image
                        for (Voxel3D vo : obj) {
                            labelImage.setPixel(vo.getRoundX(), vo.getRoundY(), vo.getRoundZ(), 0);
                        }
                        if (show) {
                            IJ.log("object volume outside range : " + obj.size());
                        }
                    }
                }
            }
        }
    }
}
Also used : Object3DVoxels(mcib3d.geom.Object3DVoxels) Voxel3D(mcib3d.geom.Voxel3D) Object3D(mcib3d.geom.Object3D)

Example 9 with Object3D

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

the class Mitosis method checkValidMitosis.

public static boolean checkValidMitosis(Object3D daughter1, Object3D daughter2, ImageHandler image) {
    Object3D convex = createConvexDaughters(daughter1, daughter2);
    ArrayUtil values = convex.listValues(image).distinctValues();
    IJ.log("Checking mitosis " + daughter1.getValue() + "-" + daughter2.getValue() + " " + values);
    int val1 = daughter1.getValue();
    int val2 = daughter2.getValue();
    for (int i = 0; i < values.size(); i++) {
        int val = values.getValueInt(i);
        if (val != val1 && val != val2 && val > 0)
            return false;
    }
    return true;
}
Also used : Object3D(mcib3d.geom.Object3D) ArrayUtil(mcib3d.utils.ArrayUtil)

Example 10 with Object3D

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

the class TrackingAssociation method drawAssociation.

private void drawAssociation() {
    if (finalAssociations == null)
        computeTracking();
    // create results
    this.tracked = this.img1.createSameDimensions();
    if (this.path != null)
        this.pathed = this.img1.createSameDimensions();
    // draw results
    int max = 0;
    for (AssociationPair pair : finalAssociations) {
        int val1 = pair.getObject3D1().getValue();
        // object3D2.setValue(val1);
        pair.getObject3D2().draw(this.tracked, val1);
        if (val1 > max)
            max = val1;
    }
    // orphan2
    for (Object3D object3D : finalOrphan2) {
        max++;
        object3D.draw(this.tracked, max);
    }
    // mitosis
    if ((mitosis) && (this.path != null)) {
        for (Mitosis mitosis : finalMitosis) {
            Object3D d1 = mitosis.getDaughter1();
            Object3D d2 = mitosis.getDaughter2();
            Object3D mo = mitosis.getMother();
            int valPath = (int) mo.getPixMeanValue(this.path);
            d1.draw(this.pathed, valPath);
            d2.draw(this.pathed, valPath);
        }
    }
}
Also used : Object3D(mcib3d.geom.Object3D)

Aggregations

Object3D (mcib3d.geom.Object3D)18 Objects3DPopulation (mcib3d.geom.Objects3DPopulation)6 ArrayUtil (mcib3d.utils.ArrayUtil)4 Voxel3D (mcib3d.geom.Voxel3D)3 ResultsTable (ij.measure.ResultsTable)2 Object3DVoxels (mcib3d.geom.Object3DVoxels)2 LinkedList (java.util.LinkedList)1 Vector3D (mcib3d.geom.Vector3D)1 ImageHandler (mcib3d.image3d.ImageHandler)1 ImageShort (mcib3d.image3d.ImageShort)1