Pobject
. A Pandore object is an object that can be loaded from a file and saved in a file. Pandore distinguishes six objects divided in four basic objects and two compound objects.point
(Point1d, Point2d, Point3d) represents a location in coordinate space specified in Long precision;dimension
(Dimension1d, Dimension2d, Dimension3d) encapsulates size measures specified in Long precision;image
(Imx1d, Img1d, Imx2d, Img2d, Imc2d, Imx3d, Img3d, Imc3d) is an array of pixels;region
map (Reg1d, Reg2d, Reg3d) is an array of labels.collection
(Collection) is a map of any base type or Pandore object referenced by a name;graph
(Graph2d, Graph3d) is a graph of indexes, where an index refers to an element in an array. Any array is available which allows to create a graph of anything: a graph of points (index refers to element in an array of points), a graph of region maps (an array of region maps), a graph of integer, etc.panfile.h
contains the enumerated list Typobj
of all the magic numbers. Each item in the enumerated list is built with the name of the class and the prefix Po_
. For instance Po_Img2duc
is set with the magic number of the object Img2duc
(a 2D gray levels image of bytes) or Po_Point2d
corresponds to a Point2d
.The magic number and the name are accessible from the member function:
String Name()
: returns the name of the object (eg. Img2duc, Point2d);Typobj Type()
: returns the magic number of the object (eg. Po_Img2duc, Po_Point2d).For example:
Pobject *p = new Img2duc(122,256); if (p->Type() == Po_Img2duc) std::cout << p->Name() << std::endl;
Imc2duc
is defined by the dimension of the array and the color space or the class Reg2d
is defined by the dimension and the higher label value. However, there exists a structure named PobjectProps
which gathers all the attributes that are exchangeable between objects, such as the dimension, the number of bands, the color space, the higher label value for region maps, etc. This structure can be used to create an object with the properties of an another object.For example, to build a region map with the same size than a given image, use:
Img2duc ims1(40,125); Reg2d rgs(ims1.Props());
For example, to build a graph from a region map dimension and then an image from the resulted graph dimension use:
Reg2d rgs(120,256);
Graph2d *g=new Graph2d(rgs.Props());
Imc2duc ims2;
ims2.New(g.Props());