Milena is the generic C++ library at the heart of the Olena platform for image processing and pattern recognition. The library provides a framework to implement simple, fast, safe, reusable and extensible image processing tool chains. Milena features many ready-to-use image data structures (regular 1D, 2D, 3D images, graph-based images, etc.) and algorithms. Milena's algorithms are built upon classical entities from the image processing field (images, points/sites, domains, neighborhoods, etc.). This design allows image processing developers and practitioners to easily understand, modify, develop and extend new algorithms while retaining the core traits of Milena: genericity and efficiency.
A generic algorithm is defined in an abstract way so that it can be used with a wide varieties of inputs. Such algorithms are written once, and can then be reused with data of many different types. For instance the following (unique) generic segmentation chain algorithm was used to generate the three output images below.
- #include <mln/morpho/closing/area.hh>
- #include <mln/morpho/watershed/flooding.hh>
- template <typename I, typename N, typename L>
- mln_ch_value(I, L)
- chain(const mln::Image<I>& ima, const mln::Neighborhood<N>& nbh, unsigned lambda, L& nbasins)
- mln_concrete(I) c = mln::morpho::closing::area(ima, nbh, lambda);
- mln_ch_value(I, L) s = mln::morpho::watershed::flooding(c, nbh, nbasins);
- return s;
Each input must satisfy constraints corresponding to the nature of the data expected by the algorithm. E.g. in the previous algorithm, the argument ima must be an image, and the argument nbh must be neighborhood (compatible with the type of ima).
|Input||"Classical" image, with 6-connectivity||Graph with (distance-based) weighted edges|| Triangle mesh (weighted with curvature|
information), seen as a simplicial 2-complex.
Milena is a C++ library written following a programming paradigm called SCOOP (Static C++ Object-Oriented Programming), combining the power of Object-Oriented Programming (OOP) and Generic Programming (GP), with no run-time cost.
In addition, the paradigm allow users to provide additional definitions of algorithms known to be faster (or using less memory) on certain classes of input types, depending on their properties (e.g., an array-based container, a fixed-size neighborhood, etc.). This mechanism is more powerful than just overloading or inclusion polymorphism, and is akin to concept-based overloading.