use of mcib3d.geom.Objects3DPopulation in project mcib3d-core by mcib3d.
the class SpatialRandom method getSample.
@Override
public Objects3DPopulation getSample() {
Point3D[] points = new Point3D[nbObjects];
Objects3DPopulation pop = new Objects3DPopulation();
pop.setMask(mask);
ImageInt maskimgTmp = maskimg.duplicate();
Random ra = new Random();
for (int i = 0; i < nbObjects; i++) {
Voxel3D vox = maskVox.getRandomvoxel(ra);
while (maskimgTmp.getPixel(vox) == 0) {
vox = maskVox.getRandomvoxel(ra);
}
points[i] = vox;
maskimgTmp.setPixel(vox, 0);
}
pop.addPoints(points);
return pop;
}
use of mcib3d.geom.Objects3DPopulation in project mcib3d-core by mcib3d.
the class SpatialRandomHardCore method getSample.
@Override
public Objects3DPopulation getSample() {
Point3D[] points = new Point3D[nbObjects];
Objects3DPopulation pop = new Objects3DPopulation();
pop.setMask(mask);
Random ra = new Random();
ImageInt maskImgTmp = maskimg.duplicate();
ObjectCreator3D create = new ObjectCreator3D(maskImgTmp);
for (int i = 0; i < nbObjects; i++) {
Voxel3D vox = maskVox.getRandomvoxel(ra);
while (maskImgTmp.getPixel(vox) == 0) {
vox = maskVox.getRandomvoxel(ra);
}
points[i] = vox;
create.createSphere(vox.getRoundX(), vox.getRoundY(), vox.getRoundZ(), distHardCore, 0, false);
}
pop.addPoints(points);
return pop;
}
Aggregations