use of mcib3d.geom.ObjectCreator3D 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