aimsalgo  5.1.2
Neuroimaging image processing
aims::FastMarching< T > Class Template Reference

Fast marching algorithm implementation, for images or buckets. More...

#include <aims/distancemap/fastmarching.h>

Public Types

typedef internal::fastmarching::StorageTrait< T >::FloatType FloatType
 
typedef internal::fastmarching::StorageTrait< T >::RCType RCType
 
typedef internal::fastmarching::StorageTrait< FloatType >::RCType RCFloatType
 

Public Member Functions

 FastMarching (Connectivity::Type c=Connectivity::CONNECTIVITY_26_XYZ, bool mid_interface=false)
 The connectivity type is only used to build the interfaces between the work region and the seeds: the fast marching itself only uses 6-connectivity. More...
 
 ~FastMarching ()
 
void setVerbose (bool x)
 
bool verbose () const
 
RCFloatType doit (const RCType &vol, int16_t worklabel, int16_t inlabel, int16_t outlabel)
 Perform fast marching propagation from a label image "vol". More...
 
RCFloatType doit (const RCType &vol, const std::set< int16_t > &worklabels, const std::set< int16_t > &seedlabels)
 Perform fast marching propagation from a label image "vol". More...
 
const BucketMap< float > & midInterface (int16_t label1, int16_t label2) const
 get the interface between Voronoi regions label1 and label2, as a bucket More...
 
carto::VolumeRef< float > midInterfaceVol (int16_t label1, int16_t label2) const
 get the interface between Voronoi regions label1 and label2, as a volume More...
 
std::vector< std::pair< int16_t, int16_t > > midInterfaceLabels () const
 Voronoi interfaces labels. More...
 
RCType voronoiVol () const
 get the resulting Voronoi regions (after propagation) More...
 
void setSpeedMap (RCFloatType speed)
 sets an initialized speed map. More...
 
void setInvSpeedMap (RCFloatType invspeed)
 sets an initialized inverse speed map (overrides any previous speed map). More...
 
void clearSpeedMap ()
 clear (inverse) speed map More...
 
RCFloatType invSpeedMap () const
 get the current inverse speed map. More...
 

Detailed Description

template<typename T>
class aims::FastMarching< T >

Fast marching algorithm implementation, for images or buckets.

The fast marching is a propagation algorithm which is typically used to perform distance maps. It may use a speed map to locally change the propagation speed and distance. It may also be used to perform a Voronoi diagam, and to get Voronoi regions boundaries.

It is used the following way: instantiate a FastMarching object, with specified connectivity if needed, set the speed map (or inverse speed map) using setSpeedMap() or setInvSpeedMap() propagate using one of the doit() methods. It will return the distanc map. Voronoi and boundaries can then be retreived using voronoiVol(), midInterface() or midInterfaceVol()

Definition at line 80 of file fastmarching.h.

Member Typedef Documentation

◆ FloatType

Definition at line 84 of file fastmarching.h.

◆ RCFloatType

Definition at line 87 of file fastmarching.h.

◆ RCType

template<typename T >
typedef internal::fastmarching::StorageTrait<T>::RCType aims::FastMarching< T >::RCType

Definition at line 85 of file fastmarching.h.

Constructor & Destructor Documentation

◆ FastMarching()

template<typename T >
aims::FastMarching< T >::FastMarching ( Connectivity::Type  c = Connectivity::CONNECTIVITY_26_XYZ,
bool  mid_interface = false 
)

The connectivity type is only used to build the interfaces between the work region and the seeds: the fast marching itself only uses 6-connectivity.

If mid_interface is false (the default), voronoi boundaries will not be available after propagation.

◆ ~FastMarching()

template<typename T >
aims::FastMarching< T >::~FastMarching ( )

Member Function Documentation

◆ clearSpeedMap()

template<typename T >
void aims::FastMarching< T >::clearSpeedMap ( )

clear (inverse) speed map

◆ doit() [1/2]

template<typename T >
RCFloatType aims::FastMarching< T >::doit ( const RCType vol,
const std::set< int16_t > &  worklabels,
const std::set< int16_t > &  seedlabels 
)

Perform fast marching propagation from a label image "vol".

Propagation will take place in the regions listed in "worklabels", from all seeds in the "seedlabels" list.

WARNING: the propagation labels in worklabels should be positive

◆ doit() [2/2]

template<typename T >
RCFloatType aims::FastMarching< T >::doit ( const RCType vol,
int16_t  worklabel,
int16_t  inlabel,
int16_t  outlabel 
)

Perform fast marching propagation from a label image "vol".

This is a simplified interface to the other, more general, doit() method.

Propagation will take place in the region "worklabel", from seeds "inlabel" and "outlabel".

◆ invSpeedMap()

template<typename T >
RCFloatType aims::FastMarching< T >::invSpeedMap ( ) const

get the current inverse speed map.

Note that if you modify it the FastMarching object will not be "aware" it has been modified unless you use the setInvSpeedMap() method. If the speed map has never been manually set, then it will be recalculated when doit() is invoked.

◆ midInterface()

template<typename T >
const BucketMap<float>& aims::FastMarching< T >::midInterface ( int16_t  label1,
int16_t  label2 
) const

get the interface between Voronoi regions label1 and label2, as a bucket

the mid_interface option must have been used when instantiating the FastMarching object, and propagation maust have taken place.

◆ midInterfaceLabels()

template<typename T >
std::vector<std::pair<int16_t,int16_t> > aims::FastMarching< T >::midInterfaceLabels ( ) const

Voronoi interfaces labels.

Given as a vector of pairs of labels

◆ midInterfaceVol()

template<typename T >
carto::VolumeRef<float> aims::FastMarching< T >::midInterfaceVol ( int16_t  label1,
int16_t  label2 
) const

get the interface between Voronoi regions label1 and label2, as a volume

The mid_interface option must have been used when instantiating the FastMarching object, and propagation maust have taken place.

◆ setInvSpeedMap()

template<typename T >
void aims::FastMarching< T >::setInvSpeedMap ( RCFloatType  invspeed)

sets an initialized inverse speed map (overrides any previous speed map).

Once a speed map (or inverse speed map) has been setup manually, it will be used during propagation in doit(), for only one run. The speed map data contents will be modified during the process, and the map will not be reusable for other data (seed voxels will be printed in it). The input inverse speed map object will also be modified since it is a shared reference, the algorithm will directly work in it.

◆ setSpeedMap()

template<typename T >
void aims::FastMarching< T >::setSpeedMap ( RCFloatType  speed)

sets an initialized speed map.

The inverse speed will be deduced from it. Once a speed map (or inverse speed map) has been setup manually, it will be used during propagation in doit(), for only one run. The speed map data contents will be modified during the process, and the map will not be reusable for other data (seed voxels will be printed in it).

◆ setVerbose()

template<typename T >
void aims::FastMarching< T >::setVerbose ( bool  x)

◆ verbose()

template<typename T >
bool aims::FastMarching< T >::verbose ( ) const

◆ voronoiVol()

template<typename T >
RCType aims::FastMarching< T >::voronoiVol ( ) const

get the resulting Voronoi regions (after propagation)


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