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;
}
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;
}
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;
}