aimsalgo 6.0.0
Neuroimaging image processing
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
38#include <cartodata/volume/volume.h>
39#include <aims/bucket/sparsevolume.h>
40#include <aims/connectivity/connectivity.h>
41#include <float.h>
42
43namespace 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 );
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);
118 RCFloatType doit( const RCType & vol,
119 const std::set<int16_t> & worklabels,
120 const std::set<int16_t> & seedlabels);
121 /* RCFloatType doit( const RCType & vol,
122 const BucketMap<Void> & workbucket,
123 const std::map<int16_t,BucketMap<Void>*> & seedbuckets ); */
129 const BucketMap<float> & midInterface( int16_t label1,
130 int16_t label2 ) const;
137 int16_t label2 ) const;
142 std::vector<std::pair<int16_t,int16_t> > midInterfaceLabels () const;
164 void setInvSpeedMap( RCFloatType invspeed );
174
175 private:
176 struct Private;
177 Private *d;
178 };
179
180
181 namespace internal
182 {
183 namespace fastmarching
184 {
185
186 template <typename T>
187 class StorageTrait<carto::Volume<T> >
188 {
189 public:
193 typedef T VoxelType;
196 { return *x; }
197 static const LowLevelType & lowlevel( const RCType & x )
198 { return *x; }
199 };
200
201 template <typename T>
203 {
204 public:
208 typedef T VoxelType;
211 { return x->begin().second; }
212 static const LowLevelType & lowlevel( const RCType & x )
213 { return x->begin().second; }
214 };
215
216 }
217 }
218
219
220 extern template class FastMarching<carto::Volume<int16_t> >;
221
222}
223
224#endif
225
std::map< Point3d, T, BucketMapLess > Bucket
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".
const BucketMap< float > & midInterface(int16_t label1, int16_t label2) const
get the interface between Voronoi regions label1 and label2, as a bucket
std::vector< std::pair< int16_t, int16_t > > midInterfaceLabels() const
Voronoi interfaces labels.
void setSpeedMap(RCFloatType speed)
sets an initialized 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
bool verbose() const
void clearSpeedMap()
clear (inverse) speed map
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 setInvSpeedMap(RCFloatType invspeed)
sets an initialized inverse speed map (overrides any previous speed map).
void setVerbose(bool x)
RCType voronoiVol() const
get the resulting Voronoi regions (after propagation)
RCFloatType doit(const RCType &vol, int16_t worklabel, int16_t inlabel, int16_t outlabel)
Perform fast marching propagation from a label image "vol".
internal::fastmarching::StorageTrait< FloatType >::RCType RCFloatType
internal::fastmarching::StorageTrait< T >::FloatType FloatType
internal::fastmarching::StorageTrait< T >::RCType RCType
RCFloatType invSpeedMap() const
get the current inverse speed map.
static const LowLevelType & lowlevel(const RCType &x)
static const LowLevelType & lowlevel(const RCType &x)