-
Notifications
You must be signed in to change notification settings - Fork 0
Main concepts of DGtal
The core of DGtal is built on a small set of concepts:
-
The concept space (CSpace) describes digital spaces of arbitrary dimension, with user-chosen integer types (CInteger). One available model of this concept is SpaceND, which defines fundamental types associated to a digital space like the type of point or vector lying in this space, etc. The point (or vector) is besides the key geometrical element of many components of the library (hierarchy of concepts of points to do).
-
The concept of value (CValue) describes a very abstract type that is default constructible, assignable, copyable, and equally comparable.
-
Sets and Images: There are concepts for the unbounded (i) and bounded (ii) cases :
-
(i)
- The concept of image (CImage) merely describes a mapping between points and values. Models must at least provide a point and a value as inner types and a reading service, ie. an operator () that takes a point as argument and returns a value.
- Sets can be implicitly defined through images (by thresholding) if the image has values that are less-than comparable (any number or boolean values for instance). (We can have CImplicitPointPredicate and CPointPredicate, which are a refinement of CImage, with the constraint that the values are respectively less-than comparable and boolean to facilitate concepts checking, but it's not necessary).
-
(ii)
- The concept CBoundable gather types having a method domain () that can return a (reference on a) domain.
- Being a refinement of CBoundable, the concepts of domain and set (CDomain and CDigitalSet (CSet ?), which is a refinement of CDomain) describe bounded sets of points, of known size, that can be enumerated from a lower bound to a upper bound. The difference is that the former is not-mutable, basically used to bound the space part where the computations have to be performed, while the latter is mutable (insertion/deletion of a point is available).
A key model of domain is HyperRectDomain. It used to bound usual digital images.
Models of sets are DigitalSetBySTLVector or DigitalSetBySTLSet.
Note that at some time, a digital set (mutable) can be converted into a domain (not mutable) for having a domain of arbitrary shape.
Moreover, since points either belong to or not belong to a given set of points, there are adapters of domains (DomainPredicate), or sets (SetPredicate), which are predicate. - Lastly, the concept of image container is a refinement of CBoundable and CImage that provides extra services, especially writing a value associated to a point with the method setValue.
Different models are available: ImageContainerBySTLVector, ImageContainerBySTLMap, mageContainerByITKImage, ImageContainerByHashTree.
-
Note for the developer: In order to kept algorithms as generic as possible, models of different concepts are required according to the operations that are performed:
- a simple membership test only requires a model of CPointPredicate
- visiting the points of a set requires a model of CDomain
- insertion/deletion of points require a model of CSet
- reading (resp. writing) values associated to a given point requires a model of CImage (resp. CImageContainer).
-
Implement a generic adapter of models of implicit point predicate that is a model of point predicate (inspired by Point2ShapePredicate)
-
CDigitalOrientedShape becomes CImplicitPointPredicate
-
CDigitalBoundedShape is replaced by CBoundable
-
CEuclideanX can be removed: Euclidean shapes (implicitBall for instance) should be templated by a model of point (instead of space) and should be a model of CImplicitPointPredicate. When used with GaussDigitizer in order to generate digital shapes, the chosen type of point should be a model of RealPoint provided by SpaceND. GaussDigitizer, templated by a model of space and a model of CImplicitPointPredicate, can check if the type of point provided by the model of CImplicitPointPredicate is the same that the type of RealPoint provided by the model of CSpace. GaussDigitizer is itself a model of CImplicitPointPredicate, but such as the inner type Point is equal to the inner type Point of its model of CSpace.
-
Lastly, shapes directory should be put into the image directory
ImageBySTLMap should be both a model of CImageContainer and CDigitalSet and should have a default value (which can be given as an argument at construction, being 0 by default) for points being in the domain but that are not stored in the map.
Renaming concepts could help in making them more abstract and more understandable for the beginner or the non-specialist. For instance:
-
Space, Point
-
Image or Function
-
ThresholdableImage or ...?Function (instead of ImplicitPointPredicate)
-
BinaryImage or BooleanValuedFunction (instead of PointPredicate)
-
NotMutableSet (instead of Domain)
-
MutableSet (instead of DigitalSet)
-
ImageContainer (or ContainableImage or StorableImage)
Note that we could rename these concepts without changing the name of the models: for instance, the term HyperRectDomain makes sense because it names a type whose instances bound the computation domain for image processing algorithms.