aimsdata 6.0.0
Neuroimaging data handling
component.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#ifndef AIMS_CONNECTIVITY_COMPONENT_H
35#define AIMS_CONNECTIVITY_COMPONENT_H
36
37
40#include <cartodata/volume/volume.h>
41
42template <typename T> class AimsBucket;
43class Void;
44
45
46namespace aims
47{
48
49 template <typename T> class BucketMap;
50
51 template <typename T, typename O>
52 class ConnectedComponentEngine
53 {
54
55 private :
56 ConnectedComponentEngine();
57 };
58
59 // Specialization
60 template <typename T, typename O>
61 class ConnectedComponentEngine<carto::VolumeRef<T>, carto::VolumeRef<O> >
62 {
63
64 public :
65 static void connected( const carto::VolumeRef<T>& data,
67 aims::Connectivity::Type connectivity,
68 std::map<O, size_t>& valids,
69 const T & backgrnd = 0, bool bin = true,
70 size_t minSize = 0, size_t maxSize = 0,
71 size_t numMax = 0,
72 bool verbose = true );
73
74
75 static void connected( const carto::VolumeRef<T>& data,
77 aims::Connectivity::Type connectivity,
78 const T & backgrnd = 0, bool bin = true,
79 size_t minSize = 0, size_t maxSize = 0,
80 size_t numMax = 0,
81 bool verbose = true );
82
83 static void filterInFrame( const carto::VolumeRef<T>& cc,
85 std::map<O, size_t>& valids,
86 int t,
87 bool verbose = true );
88 static void connectedInFrame( const carto::VolumeRef<T>& data,
90 Connectivity::Type connectivity,
91 std::multimap<size_t, O>& compSizes,
92 int t,
93 const T & backgrnd = 0, bool bin = true,
94 bool verbose = true );
95
96 private:
97 ConnectedComponentEngine();
98
99 };
100
101 // inline
102
103 template<typename T, typename O>
104 inline
107 const carto::VolumeRef<T>& data,
109 aims::Connectivity::Type connectivity,
110 const T & backgrnd, bool bin,
111 size_t minSize, size_t maxSize, size_t numMax,
112 bool verbose )
113 {
114 std::map<O, size_t> valids;
115 connected(data,
116 out,
117 connectivity,
118 valids,
119 backgrnd, bin, minSize, maxSize,
120 numMax, verbose);
121 }
122
123 template<typename T>
124 inline
126 aims::Connectivity::Type connectivity,
127 std::map<T, size_t>& valids,
128 const T & backgrnd = 0, bool bin = true,
129 size_t minSize = 0, size_t maxSize = 0,
130 size_t numMax = 0,
131 bool verbose = true )
132 {
134 carto::VolumeRef<T> >::connected(
135 data,
136 data,
137 connectivity,
138 valids,
139 backgrnd, bin, minSize, maxSize,
140 numMax, verbose);
141 }
142
143 template<typename T>
144 inline
146 aims::Connectivity::Type connectivity,
147 const T & backgrnd = 0, bool bin = true,
148 size_t minSize = 0, size_t maxSize = 0,
149 size_t numMax = 0,
150 bool verbose = true )
151 {
152 std::map<T, size_t> valids;
153
155 carto::VolumeRef<T> >::connected(
156 data,
157 data,
158 connectivity,
159 valids,
160 backgrnd, bin, minSize, maxSize,
161 numMax, verbose);
162 }
163
164 template<typename T>
165 void AimsConnectedComponent( BucketMap<T>& data,
166 aims::Connectivity::Type connectivity,
167 const T & backgrnd = 0, bool bin = true,
168 size_t minSize = 0, size_t maxSize = 0,
169 size_t numMax = 0,
170 bool verbose = true );
171
172 template <typename T>
174 const carto::VolumeRef<T>& data,
175 aims::Connectivity::Type connectivity,
176 const T & backgrnd = 0, bool bin = true,
177 size_t minsize = 0, size_t maxSize = 0,
178 size_t maxcomp = 0,
179 bool verbose = true );
180
181 template <typename T>
183 const BucketMap<T>& data,
184 Connectivity::Type connectivity,
185 const T & backgrnd = 0, bool bin = true,
186 size_t minsize = 0, size_t maxSize = 0,
187 size_t maxcomp = 0,
188 bool verbose = true );
189
190 template <typename T>
192 AimsBucket<Void>& component,
193 const carto::VolumeRef<T>& data,
194 aims::Connectivity::Type connectivity,
195 const T & backgrnd = 0, bool bin = true,
196 size_t minsize = 0, size_t maxSize = 0, size_t maxcomp = 0,
197 bool verbose = true );
198
199}
200
201#endif
The bucket base class to manage packages of points associated to their value during time.
Definition bucket.h:70
An alternate, ordered, representation for buckets (voxels lists).
Definition bucketMap.h:99
static void filterInFrame(const carto::VolumeRef< T > &cc, carto::VolumeRef< O > out, std::map< O, size_t > &valids, int t, bool verbose=true)
Definition component_d.h:54
static void connected(const carto::VolumeRef< T > &data, carto::VolumeRef< O > out, aims::Connectivity::Type connectivity, std::map< O, size_t > &valids, const T &backgrnd=0, bool bin=true, size_t minSize=0, size_t maxSize=0, size_t numMax=0, bool verbose=true)
static void connectedInFrame(const carto::VolumeRef< T > &data, carto::VolumeRef< O > out, Connectivity::Type connectivity, std::multimap< size_t, O > &compSizes, int t, const T &backgrnd=0, bool bin=true, bool verbose=true)
Definition component_d.h:94
Type
The different kinds of connectivity.
The class for EcatSino data write operation.
carto::VolumeRef< int16_t > AimsLabeledConnectedComponent(AimsBucket< Void > &component, const carto::VolumeRef< T > &data, aims::Connectivity::Type connectivity, const T &backgrnd=0, bool bin=true, size_t minsize=0, size_t maxSize=0, size_t maxcomp=0, bool verbose=true)
void AimsConnectedComponent(carto::VolumeRef< T > data, aims::Connectivity::Type connectivity, std::map< T, size_t > &valids, const T &backgrnd=0, bool bin=true, size_t minSize=0, size_t maxSize=0, size_t numMax=0, bool verbose=true)
Definition component.h:125