![]() |
aimsalgo
5.1.2
Neuroimaging image processing
|
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... | |
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.
typedef internal::fastmarching::StorageTrait<T>::FloatType aims::FastMarching< T >::FloatType |
Definition at line 84 of file fastmarching.h.
typedef internal::fastmarching::StorageTrait<FloatType>::RCType aims::FastMarching< T >::RCFloatType |
Definition at line 87 of file fastmarching.h.
typedef internal::fastmarching::StorageTrait<T>::RCType aims::FastMarching< T >::RCType |
Definition at line 85 of file fastmarching.h.
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.
aims::FastMarching< T >::~FastMarching | ( | ) |
void aims::FastMarching< T >::clearSpeedMap | ( | ) |
clear (inverse) speed map
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
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".
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.
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.
std::vector<std::pair<int16_t,int16_t> > aims::FastMarching< T >::midInterfaceLabels | ( | ) | const |
Voronoi interfaces labels.
Given as a vector of pairs of labels
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.
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.
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).
void aims::FastMarching< T >::setVerbose | ( | bool | x | ) |
bool aims::FastMarching< T >::verbose | ( | ) | const |
RCType aims::FastMarching< T >::voronoiVol | ( | ) | const |
get the resulting Voronoi regions (after propagation)