Search in sources :

Example 1 with Volume

use of ij3d.Volume 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 2 with Volume

use of ij3d.Volume in project TrakEM2 by trakem2.

the class MCTriangulator method getTriangles.

@Override
public List getTriangles(ImagePlus image, final int threshold, final boolean[] channels, final int resamplingF) {
    if (resamplingF != 1)
        image = NaiveResampler.resample(image, resamplingF);
    // There is no need to zero pad any more. MCCube automatically
    // scans one pixel more in each direction, assuming a value
    // of zero outside the image.
    // zeroPad(image);
    // create Volume
    final Volume volume = new Volume(image, channels);
    volume.setAverage(true);
    // get triangles
    final List l = MCCube.getTriangles(volume, threshold);
    return l;
}
Also used : Volume(ij3d.Volume) List(java.util.List)

Example 3 with Volume

use of ij3d.Volume in project mcib3d-core by mcib3d.

the class Object3D method computeMeshSurface.

/**
 * @param calibrated
 * @return
 * @deprecated use Object3D-IJUtils
 */
public List computeMeshSurface(boolean calibrated) {
    // IJ.showStatus("computing mesh");
    // use miniseg
    ImageInt miniseg = this.getLabelImage();
    ImageByte miniseg8 = ((ImageShort) (miniseg)).convertToByte(false);
    ImagePlus objectImage = miniseg8.getImagePlus();
    if (calibrated) {
        objectImage.setCalibration(Object3D_IJUtils.getCalibration(this));
    }
    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 * resXY);
        ty = (float) (miniseg.offsetY * resXY);
        tz = (float) (miniseg.offsetZ * resZ);
    } else {
        tx = (float) (miniseg.offsetX);
        ty = (float) (miniseg.offsetY);
        tz = (float) (miniseg.offsetZ);
    }
    l = Object3DSurface.translateTool(l, tx, ty, tz);
    return l;
}
Also used : Volume(ij3d.Volume) ArrayList(java.util.ArrayList) List(java.util.List) ImagePlus(ij.ImagePlus)

Aggregations

Volume (ij3d.Volume)3 List (java.util.List)3 ImagePlus (ij.ImagePlus)2 ArrayList (java.util.ArrayList)1 ImageByte (mcib3d.image3d.ImageByte)1 ImageInt (mcib3d.image3d.ImageInt)1 ImageShort (mcib3d.image3d.ImageShort)1