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