|
| BOOST_CONCEPT_ASSERT ((concepts::CImage< TImage >)) |
|
| BOOST_CONCEPT_ASSERT ((concepts::CDigitalSet< TSet >)) |
|
| BOOST_CONCEPT_ASSERT ((concepts::CPointPredicate< TPointPredicate >)) |
|
| BOOST_CONCEPT_ASSERT ((concepts::CPointFunctor< TPointFunctor >)) |
|
| BOOST_STATIC_ASSERT ((boost::is_same< Point, typename AcceptedPointSet::Point >::value)) |
|
| BOOST_STATIC_ASSERT ((boost::is_same< Point, typename PointPredicate::Point >::value)) |
|
| FMM (Image &aImg, AcceptedPointSet &aSet, ConstAlias< PointPredicate > aPointPredicate) |
|
| FMM (Image &aImg, AcceptedPointSet &aSet, ConstAlias< PointPredicate > aPointPredicate, const Area &aAreaThreshold, const Value &aValueThreshold) |
|
| FMM (Image &aImg, AcceptedPointSet &aSet, ConstAlias< PointPredicate > aPointPredicate, PointFunctor &aPointFunctor) |
|
| FMM (Image &aImg, AcceptedPointSet &aSet, ConstAlias< PointPredicate > aPointPredicate, const Area &aAreaThreshold, const Value &aValueThreshold, PointFunctor &aPointFunctor) |
|
| ~FMM () |
|
void | compute () |
|
bool | computeOneStep (Point &aPoint, Value &aValue) |
|
Value | min () const |
|
Value | max () const |
|
Value | getMin () const |
|
Value | getMax () const |
|
void | selfDisplay (std::ostream &out) const |
|
bool | isValid () const |
|
|
template<typename TIteratorOnPoints > |
static void | initFromPointsRange (const TIteratorOnPoints &itb, const TIteratorOnPoints &ite, Image &aImg, AcceptedPointSet &aSet, const Value &aValue) |
|
template<typename KSpace , typename TIteratorOnBels > |
static void | initFromBelsRange (const KSpace &aK, const TIteratorOnBels &itb, const TIteratorOnBels &ite, Image &aImg, AcceptedPointSet &aSet, const Value &aValue, bool aFlagIsPositive=true) |
|
template<typename KSpace , typename TIteratorOnBels , typename TImplicitFunction > |
static void | initFromBelsRange (const KSpace &aK, const TIteratorOnBels &itb, const TIteratorOnBels &ite, const TImplicitFunction &aF, Image &aImg, AcceptedPointSet &aSet, bool aFlagIsPositive=true) |
|
template<typename TIteratorOnPairs > |
static void | initFromIncidentPointsRange (const TIteratorOnPairs &itb, const TIteratorOnPairs &ite, Image &aImg, AcceptedPointSet &aSet, const Value &aValue, bool aFlagIsPositive=true) |
|
template<typename TImage, typename TSet, typename TPointPredicate, typename TPointFunctor = L2FirstOrderLocalDistance<TImage,TSet>>
class DGtal::FMM< TImage, TSet, TPointPredicate, TPointFunctor >
Aim: Fast Marching Method (FMM) for nd distance transforms.
Description of template class 'FMM'
In this approach, a signed distance function is computed at each digital point by marching out from an initial set of points, for which the values of the signed distance are known. This set is an initialization of the so-called accepted point set. Each digital point adjacent to one of the accepted points is put into the so-called candidate point set. A tentative value is computed for its signed distance, using only the values of the accepted points lying in its neighborhood. This task is delegated to an instance of a point functor, which is defined as L2FirstOrderLocalDistance by default. However, you are free to use L2SecondOrderLocalDistance, which provides more accurate distance values, L1LocalDistance and LInfLocalDistance for other norms.
Then the point of smallest tentative value is added to the set of accepted points. The tentative values of the candidates adjacent to the newly added point are updated using the distance value of the newly added point. The search of the point of smallest tentative value is accelerated using a STL set of pairs (point, tentative value).
- Template Parameters
-
TImage | any model of CImage |
TSet | any model of CDigitalSet |
TPointPredicate | any model of concepts::CPointPredicate, used to bound the computation within a domain |
TPointFunctor | any model of CPointFunctor, used to compute the new distance value |
You can define the FMM type as follows:
typedef ImageContainerBySTLMap<Domain,double> DistanceImage;
typedef Domain::Predicate DomainPredicate;
typedef FMM<DistanceImage, AcceptedPointSet, DomainPredicate >
FMM;
FMM(Image &aImg, AcceptedPointSet &aSet, ConstAlias< PointPredicate > aPointPredicate)
You can construct and initialize the external data structures as follows:
DistanceImage imageDistance(
domain, 0.0 );
imageDistance, initialPointSet, 0.5 );
static void initFromBelsRange(const KSpace &aK, const TIteratorOnBels &itb, const TIteratorOnBels &ite, Image &aImg, AcceptedPointSet &aSet, const Value &aValue, bool aFlagIsPositive=true)
Then, the algorithm is ran as follows:
FMM fmm( imageDistance, initialPointSet,
domain.predicate(),
domain.size(), maximalDistance );
fmm.compute();
- See also
- exampleFMM2D.cpp
-
exampleFMM3D.cpp
-
testFMM.cpp
Definition at line 150 of file FMM.h.
template<typename TImage , typename TSet , typename TPointPredicate , typename TPointFunctor = L2FirstOrderLocalDistance<TImage,TSet>>
void DGtal::FMM< TImage, TSet, TPointPredicate, TPointFunctor >::compute |
( |
| ) |
|
template<typename TImage , typename TSet , typename TPointPredicate , typename TPointFunctor = L2FirstOrderLocalDistance<TImage,TSet>>
template<typename KSpace , typename TIteratorOnBels , typename TImplicitFunction >
static void DGtal::FMM< TImage, TSet, TPointPredicate, TPointFunctor >::initFromBelsRange |
( |
const KSpace & |
aK, |
|
|
const TIteratorOnBels & |
itb, |
|
|
const TIteratorOnBels & |
ite, |
|
|
const TImplicitFunction & |
aF, |
|
|
Image & |
aImg, |
|
|
AcceptedPointSet & |
aSet, |
|
|
bool |
aFlagIsPositive = true |
|
) |
| |
|
static |
Initialize aImg and aSet from the points incident to the signed cells of the range [itb , ite ). If aFlagIsPositive is 'true' (default), assign to the inner points a negative distance interpolated from the distance values of the neighbors given by the function aF and assign to the outer points a positive distance interpolated from the distance values of the neighbors given by the function aF. Swap the signs if aFlagIsPositive is 'false'.
- Parameters
-
aK | a Khalimsky space in which the signed cells live. |
itb | begin iterator (on signed cells) |
ite | end iterator (on signed cells) |
aF | any implicit function |
aImg | the distance image |
aSet | the set of points for which the distance has been assigned |
aFlagIsPositive | The flag controlling the aValue sign assigned to inner points. |
template<typename TImage , typename TSet , typename TPointPredicate , typename TPointFunctor = L2FirstOrderLocalDistance<TImage,TSet>>
template<typename KSpace , typename TIteratorOnBels >
static void DGtal::FMM< TImage, TSet, TPointPredicate, TPointFunctor >::initFromBelsRange |
( |
const KSpace & |
aK, |
|
|
const TIteratorOnBels & |
itb, |
|
|
const TIteratorOnBels & |
ite, |
|
|
Image & |
aImg, |
|
|
AcceptedPointSet & |
aSet, |
|
|
const Value & |
aValue, |
|
|
bool |
aFlagIsPositive = true |
|
) |
| |
|
static |
Initialize aImg and aSet from the points incident to the signed cells of the range [itb , ite ) Assign to the inner points a distance equal to - aValue if aFlagIsPositive is 'true' (default) but aValue otherwise, and conversely for the outer points.
- Parameters
-
aK | a Khalimsky space in which the signed cells live. |
itb | begin iterator (on signed cells) |
ite | end iterator (on signed cells) |
aImg | the distance image |
aSet | the set of points for which the distance has been assigned |
aValue | distance default value |
aFlagIsPositive | The flag controlling the aValue sign assigned to inner points. |
template<typename TImage , typename TSet , typename TPointPredicate , typename TPointFunctor = L2FirstOrderLocalDistance<TImage,TSet>>
template<typename TIteratorOnPairs >
static void DGtal::FMM< TImage, TSet, TPointPredicate, TPointFunctor >::initFromIncidentPointsRange |
( |
const TIteratorOnPairs & |
itb, |
|
|
const TIteratorOnPairs & |
ite, |
|
|
Image & |
aImg, |
|
|
AcceptedPointSet & |
aSet, |
|
|
const Value & |
aValue, |
|
|
bool |
aFlagIsPositive = true |
|
) |
| |
|
static |
Initialize aImg and aSet from the inner and outer points of the range [itb , ite ) of pairs of points.
Assign to the inner points a distance equal to - aValue if aFlagIsPositive is 'true' (default) but aValue otherwise, and conversely for the outer points.
- Parameters
-
itb | begin iterator (on points) |
ite | end iterator (on points) |
aImg | the distance image |
aSet | the set of points for which the distance has been assigned |
aValue | distance default value |
aFlagIsPositive | The flag controlling the aValue sign assigned to inner points. |