DGtal 1.3.0
|
Aim: Implementation of the linear in time Power map construction. More...
#include <DGtal/geometry/volumes/distance/PowerMap.h>
Public Types | |
typedef TWeightImage | WeightImage |
Copy of the distance image types. More... | |
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 |
Definition of the underlying domain type. More... | |
typedef TPowerSeparableMetric | PowerSeparableMetric |
We construct the type associated to the separable metric. More... | |
typedef TImageContainer | OutputImage |
Type of resulting image. More... | |
typedef Vector | Value |
Definition of the image model value type. More... | |
typedef OutputImage::ConstRange | ConstRange |
Definition of the image value type. More... | |
typedef PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer > | Self |
Self type. More... | |
typedef std::array< bool, Space::dimension > | PeriodicitySpec |
Periodicity specification type. More... | |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((concepts::CImage< TImageContainer >)) | |
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 (ConstAlias< Domain > aDomain, ConstAlias< WeightImage > aWeightImage, ConstAlias< PowerSeparableMetric > aMetric, PeriodicitySpec const &aPeriodicitySpec) | |
PowerMap ()=delete | |
~PowerMap ()=default | |
Self & | operator= (const Self &aOtherPowerMap)=default |
const Domain & | domain () const |
ConstRange | constRange () const |
Value | operator() (const Point &aPoint) const |
const PowerSeparableMetric * | metricPtr () const |
const WeightImage * | weightImagePtr () const |
PeriodicitySpec const & | getPeriodicitySpec () const |
bool | isPeriodic (const Dimension n) const |
Point | projectPoint (Point aPoint) const |
void | selfDisplay (std::ostream &out) const |
Protected Attributes | |
const PowerSeparableMetric * | myMetricPtr |
Pointer to the separable metric instance. More... | |
CountedPtr< OutputImage > | myImagePtr |
Power map image. More... | |
const WeightImage * | myWeightImagePtr |
Pointer to the point predicate. More... | |
PeriodicitySpec | myPeriodicitySpec |
Periodicity along each dimension. More... | |
Private Member Functions | |
void | compute () |
void | computeOtherSteps (const Dimension dim) const |
void | computeOtherStep1D (const Point &row, const Dimension dim) const |
Point | projectPoint (Point aPoint, const Dimension aMaxDim) const |
Point::Coordinate | projectCoordinate (typename Point::Coordinate aCoordinate, const Dimension aDim) const |
Private Attributes | |
const Domain * | myDomainPtr |
Pointer to the computation domain. More... | |
Point | myLowerBoundCopy |
Copy of the image lower bound. More... | |
Point | myUpperBoundCopy |
Copy of the image lower bound. More... | |
Point | myInfinity |
Value to act as a +infinity value. More... | |
std::vector< Dimension > | myPeriodicityIndex |
Index of the periodic dimensions. More... | |
Point | myDomainExtent |
Domain extent. More... | |
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 [25]. Along periodic dimensions, the algorithm is adapted following [32].
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.
By default, the domain is considered non-periodic but per-dimension periodicity can be specified in the constructor. When the domain has periodic dimensions, the closest point coordinates B
to a given point A
may not be between the lower and upper bounds of the domain, in such a way that the non-periodic power distance between A
and B
is equal to their power distance considering the periodicity.
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 concepts::CConstImage.
TWeightImage | model of CConstImage |
TPowerSeparableMetric | model of concepts::CPowerSeparableMetric |
TImageContainer | any 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 110 of file PowerMap.h.
typedef Space::Point::Coordinate DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Abscissa |
Definition at line 127 of file PowerMap.h.
typedef OutputImage::ConstRange DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::ConstRange |
Definition of the image value type.
Definition at line 153 of file PowerMap.h.
typedef Space::Dimension DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Dimension |
Definition at line 125 of file PowerMap.h.
typedef TImageContainer::Domain DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Domain |
Definition of the underlying domain type.
Definition at line 142 of file PowerMap.h.
typedef TImageContainer DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::OutputImage |
Type of resulting image.
Definition at line 148 of file PowerMap.h.
typedef std::array< bool, Space::dimension > DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::PeriodicitySpec |
Periodicity specification type.
Definition at line 159 of file PowerMap.h.
typedef Space::Point DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Point |
Definition at line 124 of file PowerMap.h.
typedef TPowerSeparableMetric DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::PowerSeparableMetric |
We construct the type associated to the separable metric.
Definition at line 145 of file PowerMap.h.
typedef PowerMap<TWeightImage, TPowerSeparableMetric, TImageContainer> DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Self |
Self type.
Definition at line 156 of file PowerMap.h.
typedef Space::Size DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Size |
Definition at line 126 of file PowerMap.h.
typedef WeightImage::Domain::Space DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Space |
Definition at line 122 of file PowerMap.h.
typedef Vector DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Value |
Definition of the image model value type.
Definition at line 151 of file PowerMap.h.
typedef Space::Vector DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Vector |
Definition at line 123 of file PowerMap.h.
typedef TWeightImage::Value DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::Weight |
Definition at line 121 of file PowerMap.h.
typedef TWeightImage DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::WeightImage |
Copy of the distance image types.
Definition at line 120 of file PowerMap.h.
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 on a non-periodic domain.
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.
aDomain | defines the (hyper-rectangular) domain on which the computation is performed. |
aWeightImage | an image returning the weight for some points |
aMetric | a power seprable metric instance. |
DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::PowerMap | ( | ConstAlias< Domain > | aDomain, |
ConstAlias< WeightImage > | aWeightImage, | ||
ConstAlias< PowerSeparableMetric > | aMetric, | ||
PeriodicitySpec const & | aPeriodicitySpec | ||
) |
Constructor with periodicity specification.
This constructor computes the Power Map of a set of point sites using a SeparableMetric metric, on a domain with specified periodicity.
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.
aDomain | defines the (hyper-rectangular) domain on which the computation is performed. |
aWeightImage | an image returning the weight for some points. |
aMetric | a power separable metric instance. |
aPeriodicitySpec | an array of size equal to the space dimension where the i-th value is true if the i-th dimension of the space is periodic, false otherwise. |
|
delete |
Disable default constructor.
|
default |
Default destructor
DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::BOOST_CONCEPT_ASSERT | ( | (concepts::CConstImage< TWeightImage >) | ) |
DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::BOOST_CONCEPT_ASSERT | ( | (concepts::CImage< TImageContainer >) | ) |
DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::BOOST_CONCEPT_ASSERT | ( | (concepts::CPowerSeparableMetric< TPowerSeparableMetric >) | ) |
DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::BOOST_STATIC_ASSERT | ( | (boost::is_same< HyperRectDomain< typename TWeightImage::Domain::Space >, typename TImageContainer::Domain >::value) | ) |
DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::BOOST_STATIC_ASSERT | ( | (boost::is_same< typename TWeightImage::Domain::Space, typename TImageContainer::Domain::Space >::value) | ) |
DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::BOOST_STATIC_ASSERT | ( | (boost::is_same< typename TWeightImage::Domain::Space::Vector, typename TImageContainer::Value >::value) | ) |
|
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|).
|
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.
row | starting point of the 1D process. |
dim | dimension of the update. |
|
private |
Compute the other steps of the separable Power map.
dim | the dimension to process |
|
inline |
Returns a const range on the Power map values.
Definition at line 249 of file PowerMap.h.
References DGtal::ImageContainerBySTLVector< TDomain, TValue >::constRange(), and DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::myImagePtr.
|
inline |
Returns a reference (const) to the Power map domain.
Definition at line 239 of file PowerMap.h.
References DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::myDomainPtr.
Referenced by checkPowerMap(), and DGtal::ReverseDistanceTransformation< TWeightImage, TPSeparableMetric, TImageContainer >::domain().
|
inline |
Periodicity specification.
Definition at line 284 of file PowerMap.h.
References DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::myPeriodicitySpec.
|
inline |
Periodicity specification along one dimensions.
[in] | n | the dimension index. |
true
if the n-th dimension is periodic, false
otherwise. Definition at line 295 of file PowerMap.h.
References DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::myPeriodicitySpec.
Referenced by checkPowerMap().
|
inline |
Definition at line 267 of file PowerMap.h.
References DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::myMetricPtr.
Referenced by checkPowerMap(), and DGtal::ReverseDistanceTransformation< TWeightImage, TPSeparableMetric, TImageContainer >::metricPtr().
|
inline |
Access to a Power value (a.k.a. vector to the closest site) at a point.
aPoint | the point to probe. |
Definition at line 259 of file PowerMap.h.
References aPoint(), and DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::myImagePtr.
|
default |
Assignment operator from another Power map.
aOtherPowerMap | another instance of Self |
|
private |
Project a coordinate into the domain, taking into account the periodicity.
aCoordinate | the coordinate. |
aDim | dimension of the coordinate. |
Point DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::projectPoint | ( | Point | aPoint | ) | const |
Project point coordinates into the domain, taking into account the periodicity.
aPoint | the point to project |
Referenced by checkPowerMap().
|
private |
Project point coordinates into the domain, taking into account the periodicity up to a fixed dimension.
aPoint | the point to project |
aMaxDim | maximal dimension along which to project the coordinates. |
void DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::selfDisplay | ( | std::ostream & | out | ) | const |
Self Display method.
out | output stream |
Referenced by DGtal::ReverseDistanceTransformation< TWeightImage, TPSeparableMetric, TImageContainer >::selfDisplay().
|
inline |
Definition at line 275 of file PowerMap.h.
References DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::myWeightImagePtr.
Referenced by checkPowerMap().
|
private |
Domain extent.
Definition at line 401 of file PowerMap.h.
|
private |
Pointer to the computation domain.
Definition at line 386 of file PowerMap.h.
Referenced by DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::domain().
|
protected |
Power map image.
Definition at line 408 of file PowerMap.h.
Referenced by DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::constRange(), DGtal::ReverseDistanceTransformation< TWeightImage, TPSeparableMetric, TImageContainer >::getPowerVector(), DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::operator()(), and DGtal::ReverseDistanceTransformation< TWeightImage, TPSeparableMetric, TImageContainer >::operator()().
|
private |
Value to act as a +infinity value.
Definition at line 395 of file PowerMap.h.
|
private |
Copy of the image lower bound.
Definition at line 389 of file PowerMap.h.
|
protected |
Pointer to the separable metric instance.
Definition at line 405 of file PowerMap.h.
Referenced by DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::metricPtr(), and DGtal::ReverseDistanceTransformation< TWeightImage, TPSeparableMetric, TImageContainer >::operator()().
|
private |
Index of the periodic dimensions.
Definition at line 398 of file PowerMap.h.
|
protected |
Periodicity along each dimension.
Definition at line 414 of file PowerMap.h.
Referenced by DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::getPeriodicitySpec(), and DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::isPeriodic().
|
private |
Copy of the image lower bound.
Definition at line 392 of file PowerMap.h.
|
protected |
Pointer to the point predicate.
Definition at line 411 of file PowerMap.h.
Referenced by DGtal::PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer >::weightImagePtr().