Image processing library in C++

Germ/Grain framework. More...


class  pop::RandomGeometry
 Germ-Grain framework. More...

Detailed Description

Germ/Grain framework.

The germ-grain model includes four components:

The ModelGermGrain class represent this model.The aim of the RandomGeometry class is to construct the compenents of this model. For instance, in this following code, we construct the boolean model with disk at a given expected porosity.

F32 porosity=0.4;
F32 mean=20;
F32 standard_deviation=7;
DistributionNormal dnormal (mean,standard_deviation);//Normal distribution for disk radius
F32 moment_order_2 = pop::Statistics::moment(dnormal,2,0,40);
F32 surface_expectation = moment_order_2*3.14159265;
Vec2F32 domain(1024);//2d field domain
F32 lambda=-std::log(porosity)/std::log(2.718)/surface_expectation;
ModelGermGrain2 grain = RandomGeometry::poissonPointProcess(domain,lambda);//generate the 2d Poisson point process
RandomGeometry::sphere(grain,dnormal);//Dress these germs with sphere
Mat2UI8 lattice = RandomGeometry::continuousToDiscrete(grain);//Convert the continuous model to the lattice
Mat2F32 mhisto= Analysis::histogram(lattice);
std::cout<<"Expected porosity="<<porosity<<std::endl;
std::cout<<"Realization porosity="<<mhisto(0,1)<<std::endl;