A.I.M.S algorithms


fastmarching.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 
35 #ifndef AIMS_DISTANCEMAP_FASTMARCHING_H
36 #define AIMS_DISTANCEMAP_FASTMARCHING_H
37 
41 #include <float.h>
42 
43 namespace aims
44 {
45 
46  namespace internal
47  {
48  namespace fastmarching
49  {
50  template <typename T>
52  {
53  public:
54  typedef T Type;
55  typedef T FloatType;
56  typedef T LowLevelType;
57  typedef T VoxelType;
59  };
60  }
61  }
62 
79  template <typename T>
81  {
82  public:
88 
97  bool mid_interface = false );
98  ~FastMarching();
99  void setVerbose( bool x );
100  bool verbose() const;
109  RCFloatType doit( const RCType & vol,
110  int16_t worklabel, int16_t inlabel, int16_t outlabel);
116  RCFloatType doit( const RCType & vol,
117  const std::set<int16_t> & worklabels,
118  const std::set<int16_t> & seedlabels);
119  /* RCFloatType doit( const RCType & vol,
120  const BucketMap<Void> & workbucket,
121  const std::map<int16_t,BucketMap<Void>*> & seedbuckets ); */
127  const BucketMap<float> & midInterface( int16_t label1,
128  int16_t label2 ) const;
135  int16_t label2 ) const;
140  std::vector<std::pair<int16_t,int16_t> > midInterfaceLabels () const;
142  RCType voronoiVol() const;
145  void setSpeedMap( RCFloatType speed );
148  void setInvSpeedMap( RCFloatType invspeed );
150  void clearSpeedMap();
151 
152  private:
153  struct Private;
154  Private *d;
155  };
156 
157 
158  namespace internal
159  {
160  namespace fastmarching
161  {
162 
163  template <typename T>
164  class StorageTrait<carto::Volume<T> >
165  {
166  public:
170  typedef T VoxelType;
172  static LowLevelType & lowlevel( RCType & x )
173  { return *x; }
174  static const LowLevelType & lowlevel( const RCType & x )
175  { return *x; }
176  };
177 
178  template <typename T>
180  {
181  public:
185  typedef T VoxelType;
187  static LowLevelType & lowlevel( RCType & x )
188  { return x->begin().second; }
189  static const LowLevelType & lowlevel( const RCType & x )
190  { return x->begin().second; }
191  };
192 
193  }
194  }
195 
196 
197  extern template class FastMarching<carto::Volume<int16_t> >;
198 
199 }
200 
201 #endif
202 
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...
void setVerbose(bool x)
RCType voronoiVol() const
get the resulting Voronoi regions (after propagation)
std::vector< std::pair< int16_t, int16_t > > midInterfaceLabels() const
Voronoi interfaces labels.
void setSpeedMap(RCFloatType speed)
sets an initialized speed map.
internal::fastmarching::StorageTrait< FloatType >::RCType RCFloatType
Definition: fastmarching.h:87
std::map< Point3d, T, BucketMapLess > Bucket
RCFloatType doit(const RCType &vol, int16_t worklabel, int16_t inlabel, int16_t outlabel)
Perform fast marching propagation from a label image "vol".
void setInvSpeedMap(RCFloatType invspeed)
sets an initialized inverse speed map (overrides any previous speed map)
internal::fastmarching::StorageTrait< T >::RCType RCType
Definition: fastmarching.h:85
static const LowLevelType & lowlevel(const RCType &x)
Definition: fastmarching.h:174
const BucketMap< float > & midInterface(int16_t label1, int16_t label2) const
get the interface between Voronoi regions label1 and label2, as a bucket
Fast marching algorithm implementation, for images or buckets.
Definition: fastmarching.h:80
void clearSpeedMap()
clear (inverse) speed map
carto::VolumeRef< float > midInterfaceVol(int16_t label1, int16_t label2) const
get the interface between Voronoi regions label1 and label2, as a volume
static const LowLevelType & lowlevel(const RCType &x)
Definition: fastmarching.h:189
bool verbose() const
internal::fastmarching::StorageTrait< T >::FloatType FloatType
Definition: fastmarching.h:84