aimsalgo
5.1.2
Neuroimaging image processing
bucketblob.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_SCALESPACE_BUCKETBLOB_H
36
#define AIMS_SCALESPACE_BUCKETBLOB_H
37
38
#include <
aims/bucket/bucket.h
>
39
#include <
aims/connectivity/connectivity.h
>
40
41
42
namespace
aims
43
{
44
47
template
<
typename
T>
48
class
BucketBlobExtractor
49
{
50
public
:
51
struct
BlobStruct
52
{
53
BlobStruct
() :
newblobnum
( 0 ),
keepallblobs
( false ),
background
( -10 )
54
{}
55
BucketMap<Void>
*
blobs
;
56
int
newblobnum
;
57
std::map<int, int>
mergemap
;
58
// value in this map is the merge position
59
std::map<int, Point3d>
deadblobs
;
60
bool
keepallblobs
;
61
int
background
;
62
};
63
64
class
StopCriterion
65
{
66
public
:
67
virtual
~StopCriterion
() {}
68
#if __GNUC__ == 3 && __GNUC_MINOR__ == 2
// bug in gcc 3.2 (mingw)
69
virtual
bool
stops
(
const
Point3d
&,
const
BlobStruct
& bs ) {}
70
#else
71
virtual
bool
stops
(
const
Point3d
&,
const
BlobStruct
& bs ) = 0;
72
#endif
73
virtual
bool
doesKeepBlob
(
int
,
const
BlobStruct
& ) {
return
true
; }
74
};
75
76
class
NoStopCriterion
:
public
StopCriterion
77
{
78
public
:
79
virtual
~NoStopCriterion
() {}
80
virtual
bool
stops
(
const
Point3d
&,
const
BlobStruct
& )
81
{
return
false
; }
82
};
83
84
class
OneComponentStopCriterion
:
public
StopCriterion
85
{
86
public
:
87
OneComponentStopCriterion
88
(
const
std::set<Point3d, BucketMapLess> & toJoin );
89
virtual
~OneComponentStopCriterion
();
90
virtual
bool
stops
(
const
Point3d
&,
const
BlobStruct
& bs );
91
virtual
bool
doesKeepBlob
(
int
blob,
const
BlobStruct
& );
92
93
std::set<Point3d, BucketMapLess>
pointsToJoin
;
94
int
mainblob
;
95
};
96
97
98
class
BlobsMerger
99
{
100
public
:
101
virtual
~BlobsMerger
();
102
virtual
void
merge
(
const
std::set<int> & tomerge,
BlobStruct
& bs,
103
const
Point3d
& p );
104
};
105
106
107
class
GLBlobsMerger
:
public
BlobsMerger
108
{
109
public
:
110
GLBlobsMerger
();
111
virtual
~GLBlobsMerger
();
112
virtual
void
merge
(
const
std::set<int> & tomerge,
BlobStruct
& bs,
113
const
Point3d
& p );
114
};
115
116
117
BucketBlobExtractor
(
StopCriterion
* sc,
bool
minima,
118
bool
keepallblobs =
false
,
BlobsMerger
* m = 0 );
119
~BucketBlobExtractor
();
120
121
void
setConnectivity
(
Connectivity::Type
t ) {
_connectivity
= t; }
122
Connectivity::Type
connectivity
()
const
{
return
_connectivity
; }
126
BucketMap<Void>
*
extractBlobs
(
const
BucketMap<T>
& valuemap );
127
128
protected
:
129
void
neighborBlobs
( std::set<int> &,
const
Point3d
&,
const
BlobStruct & );
130
131
StopCriterion
*
_stop
;
132
BlobsMerger
*
_merger
;
133
bool
_minima
;
134
bool
_keepallblobs
;
135
Connectivity::Type
_connectivity
;
136
};
137
138
139
extern
template
class
BucketBlobExtractor<float>
;
140
141
}
142
143
#endif
144
145
146
bucket.h
AimsVector< int16_t, 3 >
aims::BucketBlobExtractor::BlobsMerger
Definition:
bucketblob.h:99
aims::BucketBlobExtractor::BlobsMerger::~BlobsMerger
virtual ~BlobsMerger()
Definition:
bucketblob_d.h:234
aims::BucketBlobExtractor::BlobsMerger::merge
virtual void merge(const std::set< int > &tomerge, BlobStruct &bs, const Point3d &p)
Definition:
bucketblob_d.h:240
aims::BucketBlobExtractor::GLBlobsMerger
Definition:
bucketblob.h:108
aims::BucketBlobExtractor::GLBlobsMerger::merge
virtual void merge(const std::set< int > &tomerge, BlobStruct &bs, const Point3d &p)
Definition:
bucketblob_d.h:274
aims::BucketBlobExtractor::GLBlobsMerger::GLBlobsMerger
GLBlobsMerger()
Definition:
bucketblob_d.h:261
aims::BucketBlobExtractor::GLBlobsMerger::~GLBlobsMerger
virtual ~GLBlobsMerger()
Definition:
bucketblob_d.h:268
aims::BucketBlobExtractor::NoStopCriterion
Definition:
bucketblob.h:77
aims::BucketBlobExtractor::NoStopCriterion::~NoStopCriterion
virtual ~NoStopCriterion()
Definition:
bucketblob.h:79
aims::BucketBlobExtractor::NoStopCriterion::stops
virtual bool stops(const Point3d &, const BlobStruct &)
Definition:
bucketblob.h:80
aims::BucketBlobExtractor::OneComponentStopCriterion
Definition:
bucketblob.h:85
aims::BucketBlobExtractor::OneComponentStopCriterion::~OneComponentStopCriterion
virtual ~OneComponentStopCriterion()
Definition:
bucketblob_d.h:179
aims::BucketBlobExtractor::OneComponentStopCriterion::stops
virtual bool stops(const Point3d &, const BlobStruct &bs)
Definition:
bucketblob_d.h:186
aims::BucketBlobExtractor::OneComponentStopCriterion::mainblob
int mainblob
Definition:
bucketblob.h:94
aims::BucketBlobExtractor::OneComponentStopCriterion::pointsToJoin
std::set< Point3d, BucketMapLess > pointsToJoin
Definition:
bucketblob.h:93
aims::BucketBlobExtractor::OneComponentStopCriterion::doesKeepBlob
virtual bool doesKeepBlob(int blob, const BlobStruct &)
Definition:
bucketblob_d.h:225
aims::BucketBlobExtractor::OneComponentStopCriterion::OneComponentStopCriterion
OneComponentStopCriterion(const std::set< Point3d, BucketMapLess > &toJoin)
Definition:
bucketblob_d.h:171
aims::BucketBlobExtractor::StopCriterion
Definition:
bucketblob.h:65
aims::BucketBlobExtractor::StopCriterion::stops
virtual bool stops(const Point3d &, const BlobStruct &bs)=0
aims::BucketBlobExtractor::StopCriterion::~StopCriterion
virtual ~StopCriterion()
Definition:
bucketblob.h:67
aims::BucketBlobExtractor::StopCriterion::doesKeepBlob
virtual bool doesKeepBlob(int, const BlobStruct &)
Definition:
bucketblob.h:73
aims::BucketBlobExtractor
Blobs and watershed.
Definition:
bucketblob.h:49
aims::BucketBlobExtractor::~BucketBlobExtractor
~BucketBlobExtractor()
Definition:
bucketblob_d.h:57
aims::BucketBlobExtractor::extractBlobs
BucketMap< Void > * extractBlobs(const BucketMap< T > &valuemap)
Extracts blobs or watershed.
Definition:
bucketblob_d.h:94
aims::BucketBlobExtractor::neighborBlobs
void neighborBlobs(std::set< int > &, const Point3d &, const BlobStruct &)
Definition:
bucketblob_d.h:65
aims::BucketBlobExtractor::BucketBlobExtractor
BucketBlobExtractor(StopCriterion *sc, bool minima, bool keepallblobs=false, BlobsMerger *m=0)
Definition:
bucketblob_d.h:44
aims::BucketBlobExtractor::_connectivity
Connectivity::Type _connectivity
Definition:
bucketblob.h:135
aims::BucketBlobExtractor::_minima
bool _minima
Definition:
bucketblob.h:133
aims::BucketBlobExtractor::_merger
BlobsMerger * _merger
Definition:
bucketblob.h:132
aims::BucketBlobExtractor::_stop
StopCriterion * _stop
Definition:
bucketblob.h:131
aims::BucketBlobExtractor::connectivity
Connectivity::Type connectivity() const
Definition:
bucketblob.h:122
aims::BucketBlobExtractor::setConnectivity
void setConnectivity(Connectivity::Type t)
Definition:
bucketblob.h:121
aims::BucketBlobExtractor::_keepallblobs
bool _keepallblobs
Definition:
bucketblob.h:134
BucketMap< Void >
aims::Connectivity::Type
Type
connectivity.h
aims
aims::BucketBlobExtractor::BlobStruct
Definition:
bucketblob.h:52
aims::BucketBlobExtractor::BlobStruct::deadblobs
std::map< int, Point3d > deadblobs
Definition:
bucketblob.h:59
aims::BucketBlobExtractor::BlobStruct::mergemap
std::map< int, int > mergemap
Definition:
bucketblob.h:57
aims::BucketBlobExtractor::BlobStruct::background
int background
Definition:
bucketblob.h:61
aims::BucketBlobExtractor::BlobStruct::keepallblobs
bool keepallblobs
Definition:
bucketblob.h:60
aims::BucketBlobExtractor::BlobStruct::BlobStruct
BlobStruct()
Definition:
bucketblob.h:53
aims::BucketBlobExtractor::BlobStruct::newblobnum
int newblobnum
Definition:
bucketblob.h:56
aims::BucketBlobExtractor::BlobStruct::blobs
BucketMap< Void > * blobs
Definition:
bucketblob.h:55
aims
scalespace
bucketblob.h
Generated by
1.9.1