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();
}
}
}
}
}
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;
}
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;
}
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;
}
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.");
}
}
Aggregations