DGtal  0.9.2
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer > Class Template Reference

#include <DGtal/geometry/volumes/distance/PowerMap.h>

Inheritance diagram for DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >:
[legend]
Collaboration diagram for DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >:
[legend]

Public Types

typedef TWeightImage WeightImage
 
typedef TWeightImage::Value Weight
 
typedef WeightImage::Domain::Space Space
 
typedef Space::Vector Vector
 
typedef Space::Point Point
 
typedef Space::Dimension Dimension
 
typedef Space::Size Size
 
typedef Space::Point::Coordinate Abscissa
 
typedef TImageContainer::Domain Domain
 
typedef TPowerSeparableMetric PowerSeparableMetric
 
typedef TImageContainer OutputImage
 
typedef Vector Value
 
typedef OutputImage::ConstRange ConstRange
 
typedef PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer > Self
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CConstImage< TWeightImage >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CPowerSeparableMetric< TPowerSeparableMetric >))
 
 BOOST_STATIC_ASSERT ((boost::is_same< typename TWeightImage::Domain::Space, typename TImageContainer::Domain::Space >::value))
 
 BOOST_STATIC_ASSERT ((boost::is_same< typename TWeightImage::Domain::Space::Vector, typename TImageContainer::Value >::value))
 
 BOOST_STATIC_ASSERT ((boost::is_same< HyperRectDomain< typename TWeightImage::Domain::Space >, typename TImageContainer::Domain >::value))
 
 PowerMap (ConstAlias< Domain > aDomain, ConstAlias< WeightImage > aWeightImage, ConstAlias< PowerSeparableMetric > aMetric)
 
 ~PowerMap ()
 
Selfoperator= (const Self &aOtherPowerMap)
 
const Domaindomain () const
 
ConstRange constRange () const
 
Value operator() (const Point &aPoint) const
 
const PowerSeparableMetricmetricPtr () const
 
const WeightImageweightImagePtr () const
 
void selfDisplay (std::ostream &out) const
 

Protected Member Functions

 PowerMap ()
 

Protected Attributes

const PowerSeparableMetricmyMetricPtr
 
CountedPtr< OutputImagemyImagePtr
 
const WeightImagemyWeightImagePtr
 

Private Member Functions

void compute ()
 
void computeOtherSteps (const Dimension dim) const
 
void computeOtherStep1D (const Point &row, const Dimension dim) const
 

Private Attributes

const DomainmyDomainPtr
 
Point myLowerBoundCopy
 
Point myUpperBoundCopy
 
Point myInfinity
 

Detailed Description

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
class DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >

Aim: Implementation of the linear in time Power map construction.

Description of template class 'PowerMap'

The algorithm uses a separable process to construct Power maps as discussed in [17]

Given an image mapping points to values and a power separable metric, the class computes the power map of the weighted points specified in the image. Similarly to the VoronoiMap class, if two points are equi-distant according to the power distance, this power map will only consider one of them.

If the separable metric has a complexity of O(h) for its "hiddenByPower" predicate, the overall Power map construction algorithm is in \( O(h.d.n^d)\) for \( n^d\) domains (see class constructor). For Euclidean the \( l_2\) metric, the overall computation is in \( O(d.n^d)\), which is optimal.

This class is a model of CConstImage.

Template Parameters
TWeightImagemodel of CConstImage
TPowerSeparableMetricmodel of CPowerSeparableMetric
TImageContainerany model of CImage to store the PowerMap (default: ImageContainerBySTLVector). The space of the image container and the TSpace should match. Furthermore the container value type must be TSpace::Vector. Lastly, the domain of the container must be HyperRectDomain.

Definition at line 98 of file PowerMap.h.

Member Typedef Documentation

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
typedef Space::Point::Coordinate DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Abscissa

Definition at line 114 of file PowerMap.h.

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
typedef OutputImage::ConstRange DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::ConstRange

Definition of the image value type.

Definition at line 140 of file PowerMap.h.

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
typedef Space::Dimension DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Dimension

Definition at line 112 of file PowerMap.h.

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
typedef TImageContainer::Domain DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Domain

Definition of the underlying domain type.

Definition at line 129 of file PowerMap.h.

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
typedef TImageContainer DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::OutputImage

Type of resulting image.

Definition at line 135 of file PowerMap.h.

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
typedef Space::Point DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Point

Definition at line 111 of file PowerMap.h.

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
typedef TPowerSeparableMetric DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::PowerSeparableMetric

We construct the type associated to the separable metric.

Definition at line 132 of file PowerMap.h.

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
typedef PowerMap<TWeightImage, TPowerSeparableMetric, TImageContainer> DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Self

Self type.

Definition at line 143 of file PowerMap.h.

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
typedef Space::Size DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Size

Definition at line 113 of file PowerMap.h.

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
typedef WeightImage::Domain::Space DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Space

Definition at line 109 of file PowerMap.h.

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
typedef Vector DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Value

Definition of the image model value type.

Definition at line 138 of file PowerMap.h.

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
typedef Space::Vector DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Vector

Definition at line 110 of file PowerMap.h.

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
typedef TWeightImage::Value DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Weight

Definition at line 108 of file PowerMap.h.

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
typedef TWeightImage DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::WeightImage

Copy of the distance image types.

Definition at line 107 of file PowerMap.h.

Constructor & Destructor Documentation

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::PowerMap ( ConstAlias< Domain aDomain,
ConstAlias< WeightImage aWeightImage,
ConstAlias< PowerSeparableMetric aMetric 
)

Constructor.

This constructor computes the Power Map of a set of point sites using a SeparableMetric metric. The method associates to each point satisfying the foreground predicate, the closest site for which the predicate is false.

All parameters are aliased in this class.

Parameters
aDomaindefines the (hyper-rectangular) domain on which the computation is performed.
aWeightImagean image returning the weight for some points
aMetrica power seprable metric instance.
template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::~PowerMap ( )

Default destructor

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::PowerMap ( )
protected

Default Constructor.

Member Function Documentation

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::BOOST_CONCEPT_ASSERT ( (concepts::CConstImage< TWeightImage >)  )
template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::BOOST_CONCEPT_ASSERT ( (concepts::CPowerSeparableMetric< TPowerSeparableMetric >)  )
template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::BOOST_STATIC_ASSERT ( (boost::is_same< typename TWeightImage::Domain::Space, typename TImageContainer::Domain::Space >::value)  )
template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::BOOST_STATIC_ASSERT ( (boost::is_same< typename TWeightImage::Domain::Space::Vector, typename TImageContainer::Value >::value)  )
template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::BOOST_STATIC_ASSERT ( (boost::is_same< HyperRectDomain< typename TWeightImage::Domain::Space >, typename TImageContainer::Domain >::value)  )
template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
void DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::compute ( )
private

Compute the Power Map of a set of point sites using a SeparableMetric metric. The method associates to each point satisfying the foreground predicate, the closest site for which the predicate is false. This algorithm is O(d.|domain size|).

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
void DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::computeOtherStep1D ( const Point row,
const Dimension  dim 
) const
private

Given a voronoi map valid at dimension dim-1, this method updates the map to make it consistent at dimension dim along the 1D span starting at row along the dimension dim.

Parameters
rowstarting point of the 1D process.
dimdimension of the update.
template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
void DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::computeOtherSteps ( const Dimension  dim) const
private

Compute the other steps of the separable Power map.

Parameters
dimthe dimension to process
template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
ConstRange DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::constRange ( ) const
inline

Returns a const range on the Power map values.

Returns
a const range

Definition at line 197 of file PowerMap.h.

198  {
199  return myImagePtr->constRange();
200  }
CountedPtr< OutputImage > myImagePtr
Power map image.
Definition: PowerMap.h:295
template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
const Domain& DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::domain ( ) const
inline

Returns a reference (const) to the Power map domain.

Returns
a domain

Definition at line 187 of file PowerMap.h.

Referenced by DGtal::ReverseDistanceTransformation< TWeightImage, TPSeparableMetric, TImageContainer >::domain().

188  {
189  return *myDomainPtr;
190  }
const Domain * myDomainPtr
Pointer to the computation domain.
Definition: PowerMap.h:279
template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
const PowerSeparableMetric* DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::metricPtr ( ) const
inline
Returns
Returns the underlying metric.

Definition at line 215 of file PowerMap.h.

Referenced by DGtal::ReverseDistanceTransformation< TWeightImage, TPSeparableMetric, TImageContainer >::metricPtr().

216  {
217  return myMetricPtr;
218  }
const PowerSeparableMetric * myMetricPtr
Pointer to the separable metric instance.
Definition: PowerMap.h:292
template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
Value DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::operator() ( const Point aPoint) const
inline

Access to a Power value (a.k.a. vector to the closest site) at a point.

Parameters
aPointthe point to probe.

Definition at line 207 of file PowerMap.h.

208  {
209  return myImagePtr->operator()(aPoint);
210  }
CountedPtr< OutputImage > myImagePtr
Power map image.
Definition: PowerMap.h:295
template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
Self& DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::operator= ( const Self aOtherPowerMap)

Assignment operator from another Power map.

Parameters
aOtherPowerMapanother instance of Self
Returns
a reference to Self
template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
void DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::selfDisplay ( std::ostream &  out) const
template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
const WeightImage* DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::weightImagePtr ( ) const
inline
Returns
Returns the underlying weight image.

Definition at line 223 of file PowerMap.h.

224  {
225  return myWeightImagePtr;
226  }
const WeightImage * myWeightImagePtr
Pointer to the point predicate.
Definition: PowerMap.h:298

Field Documentation

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
const Domain* DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::myDomainPtr
private

Pointer to the computation domain.

Definition at line 279 of file PowerMap.h.

Referenced by DGtal::PowerMap< TWeightImage, TPSeparableMetric, TImageContainer >::domain().

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
CountedPtr<OutputImage> DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::myImagePtr
protected
template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
Point DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::myInfinity
private

Value to act as a +infinity value.

Definition at line 288 of file PowerMap.h.

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
Point DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::myLowerBoundCopy
private

Copy of the image lower bound.

Definition at line 282 of file PowerMap.h.

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
const PowerSeparableMetric* DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::myMetricPtr
protected

Pointer to the separable metric instance.

Definition at line 292 of file PowerMap.h.

Referenced by DGtal::PowerMap< TWeightImage, TPSeparableMetric, TImageContainer >::metricPtr().

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
Point DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::myUpperBoundCopy
private

Copy of the image lower bound.

Definition at line 285 of file PowerMap.h.

template<typename TWeightImage, typename TPowerSeparableMetric, typename TImageContainer = ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>, typename TWeightImage::Domain::Space::Vector>>
const WeightImage* DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::myWeightImagePtr
protected

Pointer to the point predicate.

Definition at line 298 of file PowerMap.h.

Referenced by DGtal::PowerMap< TWeightImage, TPSeparableMetric, TImageContainer >::weightImagePtr().


The documentation for this class was generated from the following file: