aimsdata 6.0.0
Neuroimaging data handling
connectivity.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_CONNECTCLASS_H
35#define AIMS_CONNECTIVITY_CONNECTCLASS_H
36
37#include <string>
38
40#include <aims/vector/vector.h>
41#include <aims/bucket/bucketMap.h> // for CoordinatesLess operator
42#include <set>
43
44
45namespace aims
46{
47
51 {
52 public:
88
89 static Type type_from_string(const std::string &);
90 static std::string type_to_string(Type);
91
92 Connectivity( int oline, int oslice, Type type);
93 virtual ~Connectivity();
94
96 Type type() const { return _type; }
98 std::string type_string() const { return type_to_string(_type); }
100 int nbNeighbors() const { return _nbNeighbors; }
102 int offset( int n ) const { return _offset[n]; }
104 const Point3d& xyzOffset( int n ) const { return _xyzOffset[n]; }
106 const Point3df& dir( int n ) const { return _dir[n]; }
107 bool isNeighbor( const Point3d & offset )
108 { return _xyzOffsets.find( offset ) != _xyzOffsets.end(); }
109
112 {
113 if( &other == this )
114 return *this ;
115
116 _xSize = other._xSize ;
117 _sliceSize = other._sliceSize ;
118 _type = other._type ;
119
120 if( _xyzOffset ){
121 delete[] _xyzOffset;
122 _xyzOffset = 0 ;
123 }
124
125 if(_offset){
126 delete[] _offset;
127 _offset = 0 ;
128 }
129
130 if( _dir ){
131 delete[] _dir;
132 _dir = 0 ;
133 }
135 return *this ;
136 }
137
138 protected:
150 std::set<Point3d, BucketMapLess> _xyzOffsets;
153
210 };
211
212}
213
214
215#endif
Topology of a data container.
void setConnectivity_4_XZ()
4-neighbor connectivity in (xz) plane
void setConnectivity_9_YZ_Xminus()
9-neighbor connectivity in (xyz) inferior in x space
int * _offset
Linear offset pointer.
void setConnectivity_5_XminusZ()
5-neighbor connectivity in (xz) inferior in x plane
void setConnectivity_9_XZ_Yminus()
9-neighbor connectivity in (xyz) inferior in y space
void setConnectivity_5_XplusZ()
5-neighbor connectivity in (xz) superior in x plane
void setConnectivity_5_YminusZ()
5-neighbor connectivity in (yz) inferior in y plane
void setConnectivity_4_YZ()
4-neighbor connectivity in (yz) plane
std::string type_string() const
Get the type of the connectivity.
void setConnectivity_4_XY()
4-neighbor connectivity in (xy) plane
bool isNeighbor(const Point3d &offset)
void setConnectivity_18_XYZ()
18-neighbor connectivity in (xyz) space
void setConnectivity_5_XYminus()
5-neighbor connectivity in (xy) inferior in y plane
Type _type
Type of connectivity.
std::set< Point3d, BucketMapLess > _xyzOffsets
xyz offsets as a searchcable set
Point3df * _dir
Normalized vectors for the different directions.
Connectivity & operator=(const Connectivity &other)
void setConnectivity_8_XZ()
8-neighbor connectivity in (xz) plane
void setConnectivity_5_YZminus()
5-neighbor connectivity in (yz) inferior in z plane
void setConnectivity_5_XZminus()
5-neighbor connectivity in (xz) inferior in z plane
void setConnectivity_5_XYplus()
5-neighbor connectivity in (xy) superior in y plane
Point3d * _xyzOffset
xyz offset pointer
int _nbNeighbors
Number of neighbors.
void setConnectivity_8_XY()
8-neighbor connectivity in (xy) plane
void setConnectivity_9_YZ_Xplus()
9-neighbor connectivity in (xyz) superior in x space
Type type() const
Get the type of the connectivity.
void setConnectivity_9_XY_Zminus()
9-neighbor connectivity in (xyz) inferior in z space
void setConnectivity_5_YZplus()
5-neighbor connectivity in (yz) superior in z plane
void setConnectivity_5_XplusY()
5-neighbor connectivity in (xy) superior in x plane
Connectivity(int oline, int oslice, Type type)
const Point3df & dir(int n) const
Get the normalized directive vector of the nth element.
virtual ~Connectivity()
void setConnectivity_8_YZ()
8-neighbor connectivity in (yz) plane
const Point3d & xyzOffset(int n) const
Get the X/Y/Z offsets of the nth element.
void setConnectivity_9_XY_Zplus()
9-neighbor connectivity in (xyz) superior in z space
void setConnectivity_9_XZ_Yplus()
9-neighbor connectivity in (xyz) superior in y space
void setConnectivity_6_XYZ()
6-neighbor connectivity in (xyz) space
static Type type_from_string(const std::string &)
void setConnectivity_5_XZplus()
5-neighbor connectivity in (xz) superior in z plane
int nbNeighbors() const
Get the number of neighbors for that connectivity.
void setConnectivity_26_XYZ()
26-neighbor connectivity in (xyz) space
int offset(int n) const
Get the linear offset of the nth element.
void setConnectivity_5_XminusY()
5-neighbor connectivity in (xy) inferior in x plane
Type
The different kinds of connectivity.
static std::string type_to_string(Type)
void setConnectivity_5_YplusZ()
5-neighbor connectivity in (yz) superior in y plane
void setConnectivity()
Set the right connectivity according to the given type.
The class for EcatSino data write operation.
AimsVector< float, 3 > Point3df
AimsVector< int16_t, 3 > Point3d