DGtal
0.9.3
|
#include <DGtal/images/ImageAdapter.h>
Public Types | |
typedef ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 > | Self |
typedef TNewDomain | Domain |
typedef TNewDomain::Point | Point |
typedef TNewValue | Value |
typedef TImageContainer | ImageContainer |
typedef DefaultConstImageRange< Self > | ConstRange |
typedef DefaultImageRange< Self > | Range |
Protected Attributes | |
ImageContainer * | myImagePtr |
const Domain * | mySubDomainPtr |
const TFunctorD * | myFD |
const TFunctorV * | myFV |
const TFunctorVm1 * | myFVm1 |
Value | defaultValue |
Private Member Functions | |
ImageAdapter () | |
Aim: implements an image adapter with a given domain (i.e. a subdomain) and 3 functors : g for domain, f for accessing point values and f-1 for writing point values.
Description of template class 'ImageAdapter'
This class is (like Image class) a lightweight proxy on ImageContainers (models of CImage). It uses a given Domain (i.e. a subdomain) but work directly (for reading and writing processes) thanks to an alias (i.e. a pointer) on the original Image given in argument.
ImageAdapter class is also a model of CImage.
Caution :
TImageContainer | an image container type (model of CImage). |
TNewDomain | a domain. |
TFunctorD | the functor g that transforms the domain into another one |
TNewValue | the type of value return by the functor f. |
TFunctorV | the functor f that transforms the value into another one during reading process |
TFunctorVm1 | the functor f-1 that transforms the value into another one during writing process |
The values associated to accessing the point values are adapted with a functor g and a functor f given at construction so that operator() calls f(img(g(aPoint))), instead of calling directly operator() of the underlying image img.
The values associated to writing the points are adapted with a functor g and a functor f-1 given at construction so that setValue() is img.setValue(g(aPoint), f-1(aValue))
The use is the same that for ConstImageAdapter so here is the construction of a simple ConstImageAdapter that is a thresholded view of the initial scalar image:
NB: the underlying image as well as the 3 functors are stored in the adapter as aliasing pointer in order to avoid copies. The pointed objects must exist and must not be deleted during the use of the adapter
Definition at line 109 of file ImageAdapter.h.
typedef DefaultConstImageRange<Self> DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::ConstRange |
Definition at line 132 of file ImageAdapter.h.
typedef TNewDomain DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::Domain |
Definition at line 121 of file ImageAdapter.h.
typedef TImageContainer DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::ImageContainer |
Types copied from the container.
Definition at line 130 of file ImageAdapter.h.
typedef TNewDomain::Point DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::Point |
Definition at line 122 of file ImageAdapter.h.
typedef DefaultImageRange<Self> DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::Range |
Definition at line 133 of file ImageAdapter.h.
typedef ImageAdapter<TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1> DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::Self |
Definition at line 115 of file ImageAdapter.h.
typedef TNewValue DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::Value |
Definition at line 123 of file ImageAdapter.h.
|
inline |
Definition at line 139 of file ImageAdapter.h.
References DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::defaultValue, DGtal::trace, and DGtal::Trace::warning().
|
inline |
|
inlineprivate |
Default constructor.
Definition at line 311 of file ImageAdapter.h.
References DGtal::trace, and DGtal::Trace::warning().
DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::BOOST_CONCEPT_ASSERT | ( | (concepts::CImage< TImageContainer >) | ) |
Checking concepts.
DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::BOOST_CONCEPT_ASSERT | ( | (concepts::CDomain< TNewDomain >) | ) |
DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::BOOST_CONCEPT_ASSERT | ( | (concepts::CUnaryFunctor< TFunctorD, Point, typename TImageContainer::Point >) | ) |
DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::BOOST_CONCEPT_ASSERT | ( | (concepts::CUnaryFunctor< TFunctorV, typename TImageContainer::Value, Value >) | ) |
DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::BOOST_CONCEPT_ASSERT | ( | (concepts::CUnaryFunctor< TFunctorVm1, Value, typename TImageContainer::Value >) | ) |
|
inline |
Returns the range of the underlying image to iterate over its values
Definition at line 204 of file ImageAdapter.h.
|
inline |
Returns a reference to the underlying image domain.
Definition at line 193 of file ImageAdapter.h.
Referenced by DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::operator()(), and DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::setValue().
|
inline |
Definition at line 301 of file ImageAdapter.h.
|
inline |
Returns the pointer on the Image container data.
Definition at line 286 of file ImageAdapter.h.
References DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::myImagePtr.
|
inline |
Checks the validity/consistency of the object.
Definition at line 276 of file ImageAdapter.h.
References DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::myImagePtr.
|
inline |
Get the value of an image at a given position given by a Point.
aPoint | the point. |
Definition at line 232 of file ImageAdapter.h.
References aPoint(), DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::defaultValue, DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::domain(), DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::myFD, DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::myFV, and DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::myImagePtr.
|
inline |
Assignment.
other | the object to copy. |
Definition at line 159 of file ImageAdapter.h.
References DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::defaultValue, DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::myFD, DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::myFV, DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::myFVm1, DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::myImagePtr, DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::mySubDomainPtr, DGtal::trace, and DGtal::Trace::warning().
|
inline |
Returns the range of the underlying image to iterate over its values
Definition at line 215 of file ImageAdapter.h.
void DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Referenced by DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::setValue().
|
inline |
Allows to define a default value returned when point transformed by domain functor does not belongs to image domain.
Definition at line 296 of file ImageAdapter.h.
|
inline |
Set a value on an Image at a position specified by a Point.
it
must be a point in the image domain.aPoint | the point. |
aValue | the value. |
Definition at line 255 of file ImageAdapter.h.
References aPoint(), DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::domain(), DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::myFD, DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::myFVm1, DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::myImagePtr, and DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::selfDisplay().
|
protected |
Default value returned when point transformed by image functor does not belongs to image. Initial value is 0.
Definition at line 347 of file ImageAdapter.h.
Referenced by DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::getDefaultValue(), DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::ImageAdapter(), DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::operator()(), DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::operator=(), and DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::setDefaultValue().
|
protected |
Aliasing pointer on the underlying Domain functor
Definition at line 331 of file ImageAdapter.h.
Referenced by DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::operator()(), DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::operator=(), and DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::setValue().
|
protected |
Aliasing pointer on the underlying Value functor
Definition at line 336 of file ImageAdapter.h.
Referenced by DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::operator()(), and DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::operator=().
|
protected |
Aliasing pointer on the underlying "m-1" Value functor
Definition at line 341 of file ImageAdapter.h.
Referenced by DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::operator=(), and DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::setValue().
|
protected |
Alias on the image container.
Definition at line 321 of file ImageAdapter.h.
Referenced by DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::getPointer(), DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::isValid(), DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::operator()(), DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::operator=(), and DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::setValue().
|
protected |
The image SubDomain
Definition at line 326 of file ImageAdapter.h.
Referenced by DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::domain(), and DGtal::ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 >::operator=().