Commit 9b65c422 authored by Edwin Carlinet's avatar Edwin Carlinet
Browse files

Merge branch 'development/image-concepts' into 'development/ranges'

Image concept (PR2)

See merge request !33
parents e8493cb9 ac05b6d4
Pipeline #12571 passed with stages
in 14 minutes and 37 seconds
......@@ -34,7 +34,8 @@
"/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed",
"/usr/include/x86_64-linux-gnu",
"/usr/include",
"${workspaceRoot}"
"${workspaceRoot}",
"${workspaceFolder}/pylene/include"
],
"defines": [],
"intelliSenseMode": "clang-x64",
......
......@@ -37,7 +37,27 @@
"string_view": "cpp",
"unordered_set": "cpp",
"bitset": "cpp",
"memory": "cpp"
"memory": "cpp",
"optional": "cpp",
"variant": "cpp",
"random": "cpp",
"__debug": "cpp",
"__functional_03": "cpp",
"__functional_base": "cpp",
"__functional_base_03": "cpp",
"__string": "cpp",
"__tuple": "cpp",
"atomic": "cpp",
"limits": "cpp",
"complex": "cpp",
"list": "cpp",
"unordered_map": "cpp",
"valarray": "cpp",
"chrono": "cpp",
"ratio": "cpp",
"system_error": "cpp",
"thread": "cpp"
},
"python.pythonPath": "/usr/bin/python3"
"python.pythonPath": "/usr/bin/python3",
"C_Cpp.configurationWarnings": "Disabled"
}
\ No newline at end of file
......@@ -7,9 +7,139 @@ Core Module
.. toctree::
:hidden:
core/values
core/points
core/pixels
core/domains
core/indexes
core/ranges
core/images
core/neighborhood
core/algorithms
core/stl
.. raw:: html
<h2>Values</h2>
:doc:`core/values` are the fundamentals tools to model values held by images.
.. topic:: Concepts
* :ref:`Value <concept-values-Value>`
* :ref:`ComparableValue <concept-values-ComparableValue>`
* :ref:`OrderedValue <concept-values-OrderedValue>`
.. topic:: Predefined values
* :doc:`core/values/rgba`
.. topic:: Utilities
TODO channel utilities
.. * :cpp:func:`is_multichannel`
.. * :cpp:func:`dynamic_channel_get`
.. * :cpp:func:`dynamic_channel_size`
.. * :cpp:func:`static_channel_get`
.. * :cpp:func:`static_channel_size`
.. raw:: html
<h2>Points</h2>
:doc:`core/points` are the fundamentals tools to locate a value inside an images.
.. topic:: Concepts
* :ref:`Point <concept-points-Point>`
.. raw:: html
<h2>Pixels</h2>
:doc:`core/pixels` are the fundamentals tools when browsing an images to access both the point and the value.
.. topic:: Concepts
* :ref:`Pixel <concept-pixels-Pixel>`
.. raw:: html
<h2>Domains</h2>
:doc:`core/domains` are the fundamental tools when expressing the valid set of points for an image.
.. topic:: Concepts
* :ref:`Domain <concept-domains-Domain>`
.. raw:: html
<h2>Indexes</h2>
:doc:`core/indexes` are the lowest level tools to locate a value inside an images.
.. topic:: Concepts
* :ref:`Index <concept-indexes-Index>`
.. raw:: html
<h2>Images</h2>
:doc:`core/images` represent an image and all its properties.
.. topic:: Concepts
* :ref:`Image <concept-images-Image>`
* :ref:`IndexableImage <concept-images-IndexableImage>`
* :ref:`AccessibleImage <concept-images-AccessibleImage>`
* :ref:`ReversibleImage <concept-images-ReversibleImage>`
* :ref:`RandomAccessImage <concept-images-RandomAccessImage>`
* :ref:`ExtendedImage <concept-images-ExtendedImage>`
* :ref:`ChValueImage <concept-images-ChValueImage>`
* :ref:`RawImage <concept-images-RawImage>`
* :ref:`WritableImage <concept-images-WritableImage>`
* :ref:`ViewImage <concept-images-ViewImage>`
* :ref:`ConcreteImage <concept-images-ConcreteImage>`
.. topic:: Utilities
TODO
.. topic:: Images
* :doc:`core/images/ndimage`
......@@ -24,8 +154,8 @@ Core Module
.. topic:: Concepts
* :cpp:concept:`Segmented Range <mln::ranges::SegmentedRange>`
* :cpp:concept:`Reversible Range <mln::ranges::ReversibleRange>`
* :ref:`Segmented Range <concept-ranges-SegmentedRange>`
* :ref:`Reversible Range <concept-ranges-ReversibleRange>`
.. topic:: Utilities
......
=================
Domains (details)
=================
.. contents:: Table of Contents
:local:
.. cpp:namespace:: mln::concepts
Domain
######
.. cpp:concept:: template<typename D> Domain
#. Refines the :cpp:concept:`Regular <stl::Regular>` concept.
#. ``Dom::point_type`` models :cpp:concept:`Point <Point>` concept.
#. ``Dom`` provides methods `has`, `shape`, `empty`, `is_continuous`, `is_discrete` and `points`.
**Notation**
.. cpp:type:: Dom
.. cpp:type:: point_type = Dom::point_type
.. cpp:var:: Dom dom
.. cpp:var:: Dom dom_cpy
.. cpp:var:: const Dom cdom
.. cpp:var:: const Dom lhs
.. cpp:var:: const Dom rhs
.. cpp:var:: point_type p
**Valid Expressions**
- :cpp:expr:`dom()` returns an instance of :cpp:expr:`Dom`.
- :cpp:expr:`cdom()` returns an instance of :cpp:expr:`const Dom`.
- :cpp:expr:`dom_cpy(dom)` returns an instance of :cpp:expr:`Dom`.
- :cpp:expr:`dom_cpy(cdom)` returns an instance of :cpp:expr:`Dom`.
- :cpp:expr:`dom_cpy(move(dom))` returns an instance of :cpp:expr:`Dom`.
- :cpp:expr:`dom_cpy = dom` returns an instance of :cpp:expr:`Dom&`.
- :cpp:expr:`dom_cpy = cdom` returns an instance of :cpp:expr:`Dom&`.
- :cpp:expr:`dom_cpy = move(dom)` returns an instance of :cpp:expr:`Dom&`.
- :cpp:expr:`lhs == rhs` return-type models :cpp:concept:`Boolean <stl::Boolean>`.
- :cpp:expr:`lhs != rhs` return-type models :cpp:concept:`Boolean <stl::Boolean>`.
- :cpp:expr:`rhs == lhs` return-type models :cpp:concept:`Boolean <stl::Boolean>`.
- :cpp:expr:`rhs != lhs` return-type models :cpp:concept:`Boolean <stl::Boolean>`.
- :cpp:expr:`cdom.has(p)` return-type models :cpp:concept:`Boolean <stl::Boolean>`.
- :cpp:expr:`cdom.empty()` return-type models :cpp:concept:`Boolean <stl::Boolean>`.
- :cpp:expr:`cdom.size()` return-type models :cpp:concept:`UnsignedIntegral <stl::UnsignedIntegral>`.
**Implementation**
.. literalinclude:: ../../../../pylene/include/mln/core/concept/new/domains.hpp
:language: cpp
:lines: 17-25
================
Images (details)
================
TODO
=================
Indexes (details)
=================
.. contents:: Table of Contents
:local:
.. cpp:namespace:: mln::concepts
Index
#####
.. cpp:concept:: template <typename Idx> Index
#. Refines the :cpp:concept:`Integral <stl::Integral>` concept.
**Valid Expressions**
All expressions valid with the following C++ integral types :
- `bool`
- `char`
- `unsigned char`
- `char16_t`
- `char32_t`
- `wchar_t`
- `unsigned wchar_t`
- `short`
- `unsigned short`
- `int`
- `unsigned int`
- `long`
- `unsigned long`
- `long long`
- `unsigned long long`
- or any implementation-defined extended integer types, including any signed, unsigned, and cv-qualified variants.
**Implementation**
.. literalinclude:: ../../../../pylene/include/mln/core/concept/new/indexes.hpp
:language: cpp
:lines: 12-13
================
Pixels (details)
================
.. contents:: Table of Contents
:local:
.. cpp:namespace:: mln::concepts
Pixel
#####
.. cpp:concept:: template <typename Pix> Pixel
#. Refines the :cpp:concept:`Regular (stl) <stl::Regular>` concept.
#. ``Pix::value_type`` models the :cpp:concept:`Value <Value>` concept, is non-const and is not a reference.
#. ``Pix::point_type`` models the :cpp:concept:`Point <Point>` concept.
#. ``Pix`` provides methods ``val`` and ``point``.
**Notation**
.. cpp:type:: value_type = Pix::value_type
.. cpp:type:: point_type = Pix::point_type
.. cpp:type:: image_type = Pix::image_type
.. cpp:type:: reference = Pix::reference
.. cpp:var:: Pix pix
.. cpp:var:: Pix pix_cpy
.. cpp:var:: const Pix cpix
.. cpp:var:: const Pix t
.. cpp:var:: const Pix u
**Valid Expressions**
- :cpp:expr:`pix()` returns an instance of :cpp:expr:`Pix`.
- :cpp:expr:`cpix()` returns an instance of :cpp:expr:`const Pix`.
- :cpp:expr:`pix_cpy(pix)` returns an instance of :cpp:expr:`Pix`.
- :cpp:expr:`pix_cpy(cpix)` returns an instance of :cpp:expr:`Pix`.
- :cpp:expr:`pix_cpy(move(pix))` returns an instance of :cpp:expr:`Pix`.
- :cpp:expr:`pix_cpy = pix` returns an instance of :cpp:expr:`Pix&`.
- :cpp:expr:`pix_cpy = cpix` returns an instance of :cpp:expr:`Pix&`.
- :cpp:expr:`pix_cpy = move(pix)` returns an instance of :cpp:expr:`Pix&`.
- :cpp:expr:`t == u` return-type models :cpp:concept:`template<typename B> Boolean`.
- :cpp:expr:`t != u` return-type models :cpp:concept:`template<typename B> Boolean`.
- :cpp:expr:`u == t` return-type models :cpp:concept:`template<typename B> Boolean`.
- :cpp:expr:`u != t` return-type models :cpp:concept:`template<typename B> Boolean`.
- :cpp:expr:`cpix.val()` returns :cpp:expr:`const reference`.
- :cpp:expr:`cpix.point()` returns :cpp:expr:`const point_type`.
**Implementation**
.. literalinclude:: ../../../../pylene/include/mln/core/concept/new/pixels.hpp
:language: cpp
:lines: 17-32
================
Points (details)
================
.. contents:: Table of Contents
:local:
.. cpp:namespace:: mln::concepts
Point
#####
.. cpp:concept:: template <typename Pnt> Point
#. Refines the :cpp:concept:`Regular (stl) <stl::Regular>` concept.
#. Refines the :cpp:concept:`StrictTotallyOrdered (stl) <stl::StrictTotallyOrdered>` concept.
**Notation**
.. cpp:var:: Pnt pnt
.. cpp:var:: Pnt pnt_cpy
.. cpp:var:: const Pnt cpnt
.. cpp:var:: const Pnt lhs
.. cpp:var:: const Pnt rhs
**Valid Expressions**
- :cpp:expr:`pnt()` returns an instance of :cpp:expr:`Pnt`.
- :cpp:expr:`cpnt()` returns an instance of :cpp:expr:`const Pnt`.
- :cpp:expr:`pnt_cpy(pnt)` returns an instance of :cpp:expr:`Pnt`.
- :cpp:expr:`pnt_cpy(cpnt)` returns an instance of :cpp:expr:`Pnt`.
- :cpp:expr:`pnt_cpy(move(pnt))` returns an instance of :cpp:expr:`Pnt`.
- :cpp:expr:`pnt_cpy = pnt` returns an instance of :cpp:expr:`Pnt&`.
- :cpp:expr:`pnt_cpy = cpnt` returns an instance of :cpp:expr:`Pnt&`.
- :cpp:expr:`pnt_cpy = move(pnt)` returns an instance of :cpp:expr:`Pnt&`.
- :cpp:expr:`lhs == rhs` return-type models :cpp:concept:`Boolean (stl) <stl::Boolean>`.
- :cpp:expr:`lhs != rhs` return-type models :cpp:concept:`Boolean (stl) <stl::Boolean>`.
- :cpp:expr:`rhs == lhs` return-type models :cpp:concept:`Boolean (stl) <stl::Boolean>`.
- :cpp:expr:`rhs != lhs` return-type models :cpp:concept:`Boolean (stl) <stl::Boolean>`.
- :cpp:expr:`lhs < rhs` return-type models :cpp:concept:`Boolean (stl) <stl::Boolean>`.
- :cpp:expr:`lhs > rhs` return-type models :cpp:concept:`Boolean (stl) <stl::Boolean>`.
- :cpp:expr:`lhs <= rhs` return-type models :cpp:concept:`Boolean (stl) <stl::Boolean>`.
- :cpp:expr:`lhs >= rhs` return-type models :cpp:concept:`Boolean (stl) <stl::Boolean>`.
**Implementation**
.. literalinclude:: ../../../../pylene/include/mln/core/concept/new/points.hpp
:language: cpp
:lines: 12-15
......@@ -21,19 +21,20 @@ SegmentedRange
**Notation**
.. cpp:var:: const SegRng crng
.. cpp:var:: SegRng rng
**Valid Expressions**
- All expression from :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>` are valid.
- :cpp:expr:`crng.rows()` return-type models :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>`.
- :cpp:expr:`rng.rows()` return-type models :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>`.
- :cpp:expr:`stl::iter_value_t<stl::iterator_t<stl::iter_value_t<stl::iterator_t<decltype(rng.rows())>>>>` must be the same as :cpp:expr:`stl::iter_value_t<stl::iterator_t<SegRng>>`.
**Implementation**d
**Implementation**
.. literalinclude:: ../../../../pylene/include/mln/core/concept/new/ranges.hpp
:language: cpp
:lines: 15-21
:lines: 15-23
ReversibleRange
......@@ -46,16 +47,17 @@ ReversibleRange
**Notation**
.. cpp:var:: const RevRng crng
.. cpp:var:: RevRng rng
**Valid Expressions**
- All expression from :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>` are valid.
- :cpp:expr:`crng.reversed()` return-type models :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>`.
- :cpp:expr:`rng.reversed()` return-type models :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>`.
- :cpp:expr:`stl::iter_value_t<stl::iterator_t<decltype(rng.reversed())>>>` must be the same as :cpp:expr:`stl::iter_value_t<stl::iterator_t<RevRng>>`.
**Implementation**d
**Implementation**
.. literalinclude:: ../../../../pylene/include/mln/core/concept/new/ranges.hpp
:language: cpp
:lines: 25-30
:lines: 27-35
===============
Values (detail)
===============
.. contents::
:local:
.. cpp:namespace:: mln::concepts
Value
#####
.. cpp:concept:: template <typename Val> Value
#. Refines the :cpp:concept:`Semiregular (stl) <stl::Semiregular>` concept.
#. Limits operations `numeric_limits<Val>` are defined.
**Notation**
.. cpp:var:: Val val
.. cpp:var:: Val val_cpy
.. cpp:var:: const Val cval
**Valid Expressions**
- :cpp:expr:`val()` returns an instance of :cpp:expr:`Val`.
- :cpp:expr:`cval()` returns an instance of :cpp:expr:`const Val`.
- :cpp:expr:`val_cpy(val)` returns an instance of :cpp:expr:`Val`.
- :cpp:expr:`val_cpy(cval)` returns an instance of :cpp:expr:`Val`.
- :cpp:expr:`val_cpy(move(val))` returns an instance of :cpp:expr:`Val`.
- :cpp:expr:`val_cpy = val` returns an instance of :cpp:expr:`Val&`.
- :cpp:expr:`val_cpy = cval` returns an instance of :cpp:expr:`Val&`.
- :cpp:expr:`val_cpy = move(val)` returns an instance of :cpp:expr:`Val&`.
- :cpp:expr:`numeric_limits<Val>` is valid. See the `reference documentation <https://en.cppreference.com/w/cpp/types/numeric_limits>`_ for details.
**Implementation**
.. literalinclude:: ../../../../pylene/include/mln/core/concept/new/values.hpp
:language: cpp
:lines: 12-13
ComparableValue
###############
.. cpp:concept:: template <typename CompVal> ComparableValue
#. Refines the :cpp:concept:`Value <Value>` concept.
#. Refines the :cpp:concept:`Regular (stl) <stl::Regular>` concept.
**Notation**
.. cpp:var:: const CompVal lhs
.. cpp:var:: const CompVal rhs
**Valid Expressions**
- :cpp:expr:`lhs == rhs` return-type models :cpp:concept:`Boolean (stl) <stl::Boolean>`.
- :cpp:expr:`lhs != rhs` return-type models :cpp:concept:`Boolean (stl) <stl::Boolean>`.
- :cpp:expr:`rhs == lhs` return-type models :cpp:concept:`Boolean (stl) <stl::Boolean>`.
- :cpp:expr:`rhs != lhs` return-type models :cpp:concept:`Boolean (stl) <stl::Boolean>`.
**Implementation**
.. literalinclude:: ../../../../pylene/include/mln/core/concept/new/values.hpp
:language: cpp
:lines: 17-20
OrderedValue
############
.. cpp:concept:: template <typename OrdVal> OrderedValue
#. Refines the :cpp:concept:`ComparableValue <ComparableValue>` concept.
#. Refines the :cpp:concept:`StrictTotallyOrdered (stl) <stl::StrictTotallyOrdered>` concept.
**Notation**
.. cpp:var:: const OrdVal lhs
.. cpp:var:: const OrdVal rhs
**Valid Expressions**
- :cpp:expr:`lhs < rhs` return-type models :cpp:concept:`Boolean (stl) <stl::Boolean>`.
- :cpp:expr:`lhs > rhs` return-type models :cpp:concept:`Boolean (stl) <stl::Boolean>`.
- :cpp:expr:`lhs <= rhs` return-type models :cpp:concept:`Boolean (stl) <stl::Boolean>`.
- :cpp:expr:`lhs >= rhs` return-type models :cpp:concept:`Boolean (stl) <stl::Boolean>`.
**Implementation**
.. literalinclude:: ../../../../pylene/include/mln/core/concept/new/values.hpp
:language: cpp
:lines: 24-27
=======
Domains
=======
Information about the valid set of points for an image.
.. contents::
:local:
Concepts
--------
.. cpp:namespace:: mln::concepts
.. _concept-domains-Domain:
Domain
######
Let `Dom` be a type that models :cpp:concept:`Domain (details) <Domain>`.
Then `Dom` also models :cpp:concept:`Regular (stl) <stl::Regular>`.
.. _concept-domains-Domain-types:
.. rubric:: Types
Then we can define :
+-------------------+-----------------+----------------------------------------------+
| Definition | Description | Requirement |
+===================+=================+==============================================+
| `Dom::point_type` | type of a point | models :ref:`concept-points-Point` concept |
+-------------------+-----------------+----------------------------------------------+
| `Dom::value_type` | type of a value | - models :ref:`concept-values-Value` concept |
| | | - non-const |
| | | - not a reference |
+-------------------+-----------------+----------------------------------------------+
.. _concept-domains-Domain-expressions:
.. rubric:: Expressions
Let :
- ``cdom`` be an instance of `const Dom`.
- ``lhs`` be an instance of `const Dom`.
- ``rhs`` be an instance of `const Dom`.
- ``p`` be an instance of `Dom::point_type`.
Then we have the following valid expressions :
+------------------+----------------------------------------------------------------------+---------------+----------------+---------------------------------------------------+
| Expression | Return type | Pre-condition | Post-condition | Description |
+==================+======================================================================+===============+================+===================================================+
| ``lhs == rhs`` | ``bool`` | none | none | Compare wether two domains are equal |
+------------------+----------------------------------------------------------------------+---------------+----------------+---------------------------------------------------+