Search in sources :

Example 1 with ImageHandler

use of mcib3d.image3d.ImageHandler in project mcib3d-core by mcib3d.

the class GeomTransform3D method getImageTransformed.

private ImageHandler getImageTransformed(ImageHandler img, GeomTransform3D transform3D) {
    final ImageHandler out = img.createSameDimensions();
    final int n_cpus = ThreadUtil.getNbCpus();
    final int dec = (int) Math.ceil((double) img.sizeZ / (double) n_cpus);
    Thread[] threads = ThreadUtil.createThreadArray(n_cpus);
    final AtomicInteger ai = new AtomicInteger(0);
    final ImageHandler input = img;
    for (int ithread = 0; ithread < threads.length; ithread++) {
        threads[ithread] = new Thread() {

            @Override
            public void run() {
                for (int k = ai.getAndIncrement(); k < n_cpus; k = ai.getAndIncrement()) {
                    getImageTransformed(input, out, dec * k, dec * (k + 1));
                }
            }
        };
    }
    ThreadUtil.startAndJoin(threads);
    return out;
}
Also used : ImageHandler(mcib3d.image3d.ImageHandler) AtomicInteger(java.util.concurrent.atomic.AtomicInteger)

Example 2 with ImageHandler

use of mcib3d.image3d.ImageHandler in project mcib3d-core by mcib3d.

the class MereoAnalysis method computeFastRelationships.

public void computeFastRelationships() {
    int[] size = popB.getMaxSizeAllObjects();
    ImageHandler segB = new ImageShort("popB", size[0] + 1, size[1] + 1, size[2] + 1);
    // segB.show();
    popB.draw(segB);
    boolean[] checkedObject = new boolean[popB.getNbObjects()];
    int nbA = popA.getNbObjects();
    for (int a = 0; a < nbA; a++) {
        log.log("Processing object A" + a);
        for (int o = 0; o < popB.getNbObjects(); o++) {
            checkedObject[o] = false;
            relationships[a][o] = MereoObject3D.DC;
        }
        Object3D A = popA.getObject(a);
        Object3D Adil = A.getDilatedObject(RadX, RadY, RadZ);
        // TEST
        // Adil.getLabelImage().show("dilated "+Adil);
        ArrayList<Voxel3D> al = Adil.listVoxels(segB);
        for (Voxel3D vox : al) {
            int pix = (int) vox.getValue();
            if (pix != 0) {
                int idx = popB.getIndexFromValue(pix);
                if (!checkedObject[idx]) {
                    checkedObject[idx] = true;
                    Object3D B = popB.getObject(idx);
                    MereoObject3D mereo = new MereoObject3D(A, B, RadX, RadY, RadZ);
                    relationships[a][idx] = mereo.getRCC8Relationship();
                }
            }
        }
    }
}
Also used : ImageHandler(mcib3d.image3d.ImageHandler) ImageShort(mcib3d.image3d.ImageShort)

Example 3 with ImageHandler

use of mcib3d.image3d.ImageHandler in project mcib3d-core by mcib3d.

the class SymmetryFilter method computeSymmetry.

private void computeSymmetry() {
    if (bin1 == null) {
        computeBins();
    }
    ImageHandler bin22 = bin2.duplicate();
    ImageHandler bin11 = bin1.duplicate();
    bin22.multiplyByValue((float) scaling);
    bin11.multiplyByValue((float) pow(normalize, scaling));
    sym = bin11.addImage(bin22, 1, 1);
    sym.setTitle("Symmetry_" + radius);
    sym2 = sym.duplicate();
    ij.plugin.GaussianBlur3D.blur(sym2.getImagePlus(), 2, 2, 2);
    sym2.setTitle("Symmetry_" + radius + "_smoothed");
}
Also used : ImageHandler(mcib3d.image3d.ImageHandler)

Example 4 with ImageHandler

use of mcib3d.image3d.ImageHandler in project mcib3d-core by mcib3d.

the class SpatialRandom method getSampleImage.

@Override
public ImageHandler getSampleImage() {
    ImageHandler tmp = new ImageShort(getName(), mask.getXmax() + 1, mask.getYmax() + 1, mask.getZmax() + 1);
    getSample().draw(tmp);
    return tmp;
}
Also used : ImageHandler(mcib3d.image3d.ImageHandler) ImageShort(mcib3d.image3d.ImageShort)

Example 5 with ImageHandler

use of mcib3d.image3d.ImageHandler in project mcib3d-core by mcib3d.

the class SpatialRandomHardCore method getSampleImage.

@Override
public ImageHandler getSampleImage() {
    ImageHandler tmp = new ImageShort(getName(), mask.getXmax() + 1, mask.getYmax() + 1, mask.getZmax() + 1);
    getSample().draw(tmp);
    return tmp;
}
Also used : ImageHandler(mcib3d.image3d.ImageHandler) ImageShort(mcib3d.image3d.ImageShort)

Aggregations

ImageHandler (mcib3d.image3d.ImageHandler)11 ImageShort (mcib3d.image3d.ImageShort)5 ImageProcessor (ij.process.ImageProcessor)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Object3D (mcib3d.geom.Object3D)1 Point3D (mcib3d.geom.Point3D)1 Vector3D (mcib3d.geom.Vector3D)1 Voxel3D (mcib3d.geom.Voxel3D)1 Voxel3DComparable (mcib3d.geom.Voxel3DComparable)1 ImageFloat (mcib3d.image3d.ImageFloat)1 ImageInt (mcib3d.image3d.ImageInt)1 ImageLabeller (mcib3d.image3d.ImageLabeller)1