Search in sources :

Example 1 with ImageShort

use of mcib3d.image3d.ImageShort 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 2 with ImageShort

use of mcib3d.image3d.ImageShort 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 3 with ImageShort

use of mcib3d.image3d.ImageShort 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)

Example 4 with ImageShort

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

the class Viewer3D_Utils method computeMeshSurface.

public static List computeMeshSurface(Object3D object3D, boolean calibrated) {
    // IJ.showStatus("computing mesh");
    // use miniseg
    ImageInt miniseg = object3D.getLabelImage();
    ImageByte miniseg8 = ((ImageShort) (miniseg)).convertToByte(false);
    ImagePlus objectImage = miniseg8.getImagePlus();
    if (calibrated) {
        objectImage.setCalibration(getCalibration(object3D));
    }
    boolean[] bl = { true, true, true };
    Volume vol = new Volume(objectImage, bl);
    vol.setAverage(true);
    List l = MCCube.getTriangles(vol, 0);
    // needs to invert surface
    l = Object3DSurface.invertNormals(l);
    // translate object with units coordinates
    float tx, ty, tz;
    if (calibrated) {
        tx = (float) (miniseg.offsetX * object3D.getResXY());
        ty = (float) (miniseg.offsetY * object3D.getResXY());
        tz = (float) (miniseg.offsetZ * object3D.getResZ());
    } else {
        tx = (float) (miniseg.offsetX);
        ty = (float) (miniseg.offsetY);
        tz = (float) (miniseg.offsetZ);
    }
    l = Object3DSurface.translateTool(l, tx, ty, tz);
    return l;
}
Also used : ImageByte(mcib3d.image3d.ImageByte) ImageShort(mcib3d.image3d.ImageShort) Volume(ij3d.Volume) ImageInt(mcib3d.image3d.ImageInt) List(java.util.List) ImagePlus(ij.ImagePlus)

Example 5 with ImageShort

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

the class MaximaFinder method computePeaks.

private void computePeaks() {
    imagePeaks = new ImageShort("peaks", img.sizeX, img.sizeY, img.sizeZ);
    if (verbose) {
        IJ.log("Finding all peaks");
    }
    ArrayList<Voxel3DComparable> maximaTmp = FastFilters3D.getListMaxima(img, radXY, radXY, radZ, nbCpus, false);
    Collections.sort(maximaTmp);
    for (Voxel3DComparable V : maximaTmp) {
        imagePeaks.setPixel(V, (float) V.getValue());
    }
    if (verbose) {
        IJ.log(maximaTmp.size() + " peaks found");
    }
    if (verbose) {
        IJ.log("Removing peaks below noise");
    }
    maxima = new ArrayList<Voxel3D>();
    int c = 1;
    int nb = maximaTmp.size();
    Date start = new Date();
    Date temp;
    for (Voxel3DComparable V : maximaTmp) {
        if (img.getPixel(V) > 0) {
            if (V.getValue() > noiseTolerance) {
                maxima.add(V);
                if (verbose) {
                    temp = new Date();
                    if ((temp.getTime() - start.getTime()) > 100) {
                        IJ.showStatus("Processing peak " + c + "/" + nb + " " + V);
                        start = new Date();
                    }
                    c++;
                }
                Flood3D.flood3DNoise26(img, new IntCoord3D(V.getRoundX(), V.getRoundY(), V.getRoundZ()), (int) (Math.max(1, V.getValue() - noiseTolerance)), 0);
            }
        }
    }
    if (verbose) {
        IJ.log(maxima.size() + " peaks found");
    }
    if (verbose) {
        IJ.log("Creating final peaks");
    }
    imagePeaks.fill(0);
    for (Voxel3D V : maxima) {
        imagePeaks.setPixel(V, (float) V.getValue());
    }
    if (verbose) {
        IJ.log("MaximaFinder3D finished.");
    }
}
Also used : ImageShort(mcib3d.image3d.ImageShort) IntCoord3D(mcib3d.geom.IntCoord3D) Voxel3D(mcib3d.geom.Voxel3D) Voxel3DComparable(mcib3d.geom.Voxel3DComparable) Date(java.util.Date)

Aggregations

ImageShort (mcib3d.image3d.ImageShort)10 ImageHandler (mcib3d.image3d.ImageHandler)5 ImageInt (mcib3d.image3d.ImageInt)4 Voxel3DComparable (mcib3d.geom.Voxel3DComparable)3 Voxel3D (mcib3d.geom.Voxel3D)2 ImageLabeller (mcib3d.image3d.ImageLabeller)2 ImagePlus (ij.ImagePlus)1 Volume (ij3d.Volume)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 List (java.util.List)1 IntCoord3D (mcib3d.geom.IntCoord3D)1 Object3D (mcib3d.geom.Object3D)1 ImageByte (mcib3d.image3d.ImageByte)1 Segment3DImage (mcib3d.image3d.Segment3DImage)1