Public Member Functions |
| BOOST_CONCEPT_ASSERT ((CImage< TImage >)) |
| BOOST_CONCEPT_ASSERT ((CDigitalSet< TSet >)) |
| BOOST_CONCEPT_ASSERT ((CPointPredicate< TPointPredicate >)) |
| BOOST_CONCEPT_ASSERT ((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, const PointPredicate &aPointPredicate) |
| FMM (Image &aImg, AcceptedPointSet &aSet, const PointPredicate &aPointPredicate, const Area &aAreaThreshold, const Value &aValueThreshold) |
| FMM (Image &aImg, AcceptedPointSet &aSet, const PointPredicate &aPointPredicate, PointFunctor &aPointFunctor) |
| FMM (Image &aImg, AcceptedPointSet &aSet, const 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 |
Static Public Member Functions |
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=false) |
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=false) |
template<typename TIteratorOnPairs > |
static void | initFromIncidentPointsRange (const TIteratorOnPairs &itb, const TIteratorOnPairs &ite, Image &aImg, AcceptedPointSet &aSet, const Value &aValue, bool aFlagIsPositive=false) |
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.
- See also:
- FMMPointFunctors.h
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 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 FMM<DistanceImage, PointSet, Domain::Predicate >
FMM;
You can run the algorithm as follows (d is a domain):
FMM fmm( image, points, d.predicate(), d.size(), maximalWidth );
fmm.compute();
- See also:
- exampleFMM2D.cpp
-
exampleFMM3D.cpp
-
testFMM.cpp
Definition at line 148 of file FMM.h.
template<typename TImage , typename TSet , typename TPointPredicate , typename TPointFunctor >
template<typename KSpace , typename TIteratorOnBels >
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 = false |
|
) |
| |
|
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 'false' (default) but aValue otherwise, and conversely for the outer points.
- Parameters:
-
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 |
Definition at line 152 of file FMM.ih.
References DGtal::insertAndAlwaysSetValue().
{
if (aFlagIsPositive) k = 1;
aSet.clear();
for (TIteratorOnBels it = itb; it != ite; ++it)
{
}
}
template<typename TImage , typename TSet , typename TPointPredicate , typename TPointFunctor >
template<typename KSpace , typename TIteratorOnBels , typename TImplicitFunction >
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 = false |
|
) |
| |
|
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 'false' (default) but aValue otherwise, and conversely for the outer points.
- Parameters:
-
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 |
types
1) store a value for each bel (== distance of the inner point to the interface)
2) for each inner/outer point computes its distance from the values of its incident bels
Definition at line 177 of file FMM.ih.
References DGtal::abs(), and DGtal::insertAndAlwaysSetValue().
{
if (aFlagIsPositive) k = 1;
typedef typename KSpace::Cell Bel;
typedef typename TImplicitFunction::Value
Value;
typedef std::pair<const Bel, Value> BelValue;
typedef std::map<Bel, Value> Buffer;
typedef std::vector<Pair> IncidentPoints;
IncidentPoints incidentPoints;
Buffer buffer;
for (TIteratorOnBels it = itb; it != ite; ++it)
{
Pair points = getIncidentPoints( *it );
incidentPoints.push_back( points );
Value vin = aF( points.first );
Value vout = aF( points.second );
ASSERT( v >= 0 );
buffer.insert( BelValue( aK.unsigns( *it ), v ) );
}
aSet.clear();
Computer4InnerPts computerIn(aK, buffer);
Computer4OuterPts computerOut(aK, buffer);
for (typename IncidentPoints::const_iterator it = incidentPoints.begin();
it != incidentPoints.end(); ++it)
{
Value vin = computerIn( it->first );
Value vout = computerOut( it->second );
}
}
template<typename TImage , typename TSet , typename TPointPredicate , typename TPointFunctor >
template<typename TIteratorOnPairs >
void DGtal::FMM< TImage, TSet, TPointPredicate, TPointFunctor >::initFromIncidentPointsRange |
( |
const TIteratorOnPairs & |
itb, |
|
|
const TIteratorOnPairs & |
ite, |
|
|
Image & |
aImg, |
|
|
AcceptedPointSet & |
aSet, |
|
|
const Value & |
aValue, |
|
|
bool |
aFlagIsPositive = false |
|
) |
| |
|
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 'false' (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 |
Definition at line 241 of file FMM.ih.
References DGtal::insertAndAlwaysSetValue().
{
if (aFlagIsPositive) k = 1;
aSet.clear();
for (TIteratorOnPairs it = itb; it != ite; ++it)
{
}
}
template<typename TImage , typename TSet , typename TPointPredicate , typename TPointFunctor >
template<typename TIteratorOnPoints >
void DGtal::FMM< TImage, TSet, TPointPredicate, TPointFunctor >::initFromPointsRange |
( |
const TIteratorOnPoints & |
itb, |
|
|
const TIteratorOnPoints & |
ite, |
|
|
Image & |
aImg, |
|
|
AcceptedPointSet & |
aSet, |
|
|
const Value & |
aValue |
|
) |
| |
|
static |
Initialize aImg and aSet from the points of the range [itb , ite ) Assign a distance equal to aValue
- 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 |
Definition at line 136 of file FMM.ih.
References DGtal::insertAndAlwaysSetValue().
{
aSet.clear();
for (TIteratorOnPoints it = itb; it != ite; ++it)
{
}
}
template<typename TImage, typename TSet, typename TPointPredicate, typename TPointFunctor = L2FirstOrderLocalDistance<TImage,TSet>>
const bool DGtal::FMM< TImage, TSet, TPointPredicate, TPointFunctor >::myFlagIsOwning |
|
private |
'true' if myPointFunctorPtr is an owning pointer (default case), 'false' if it is an aliasing pointer on a point functor given at construction
Definition at line 218 of file FMM.h.