MeVisLab Toolbox Reference
CSOVoxelSet.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13
15
16#pragma once
17
18
19#include "MLCSOIncludes.h"
20#include <CSOBase/CSODefines.h>
21
23
24
25typedef std::vector<Vector3> VoxelVector;
26typedef std::vector<MLdouble> VoxelValueVector;
27
28
29// Forward declaration.
30class CSOVoxelSetList;
31
32
34
36{
37public:
38
39 int x = -1;
40 int y = -1;
41};
42
44
50{
51
52public:
53
59 virtual ~CSOVoxelSet();
60
61 /* METHODS */
62
64 void addVoxelValuePositions(const std::vector<Vector3>& positions, const std::vector<MLdouble>& values);
66 void addVoxelValuePositions(const std::vector<VoxelPosition>& positions, const std::vector<MLdouble>& values);
68 size_t numTotalVoxels() const;
70 Vector3 getVoxelPositionOfTotal(size_t index) const;
72 double getVoxelValueOfTotal(size_t index) const;
73
75 inline void setVoxelToWorldMatrix(const Matrix4& voxelToWorldMatrix) { _voxelToWorldMatrix = voxelToWorldMatrix; }
77 inline const Matrix4& getVoxelToWorldMatrix() const { return _voxelToWorldMatrix; }
78
80 size_t numSlices() const;
82 unsigned int startingSlice() const;
84 unsigned int endingSlice() const;
86 const VoxelVector& getPositionsAt(size_t index) const;
88 const VoxelValueVector& getValuesAt(size_t index) const;
90 unsigned int numVoxelsOnSliceAt(size_t sliceIndex) const;
94 void getVoxelPositionAtSlice(size_t sliceIndex, size_t voxelIndex, int& x, int& y);
96 bool getVoxelValueAtSlice(size_t sliceIndex, size_t voxelIndex, double& val) const;
98 inline Vector3 getBoundingBoxV1() const { return _boundingBoxV1; }
100 inline Vector3 getBoundingBoxV2() const { return _boundingBoxV2; }
102 inline MLdouble getMinVoxelValue() const { return _minVoxelValue; }
104 inline MLdouble getMaxVoxelValue() const { return _maxVoxelValue; }
105
107 inline void setCSOVoxelSetList(CSOVoxelSetList* list) { _csoVoxelSetList = list; }
109 inline CSOVoxelSetList* csoVoxelSetList() const { return _csoVoxelSetList; }
111 inline unsigned int numGroups() const { return static_cast<unsigned int>(_groupIds.size()); }
113 inline int groupIdAt(size_t index) const { return _groupIds[index]; }
115 inline void addCSOVoxelSetGroupId(int groupId) { _groupIds.push_back(groupId); }
116
118 inline void setLabel(const std::string& labelArg) { _label = labelArg; }
120 inline const std::string& label() const { return _label; }
122 inline void setCreator(const std::string& creatorArg) { _creator = creatorArg; }
124 inline const std::string& creator() const { return _creator; }
126 inline void setTimepoint(int timepointArg) { _timepoint = timepointArg; }
128 inline int timepoint() const { return _timepoint; }
130 inline void setDescription(const std::string& descriptionArg) { _description = descriptionArg; }
132 inline const std::string& description() const { return _description; }
133
134
136 inline void setUniqueId(int id) { _uniqueId = id; }
138 inline int uniqueId() const { return _uniqueId; }
139
140
141protected:
142
143private:
144
145 /* MEMBER VARIABLES */
146
147 std::vector<VoxelVector> _sliceVoxels;
148 std::vector<VoxelValueVector> _sliceVoxelValues;
149
150 int _startingSlice;
151 int _endingSlice;
152
153 int _uniqueId;
154 std::string _label;
155 std::string _description;
156 std::string _creator;
157 int _timepoint;
158
159 Matrix4 _voxelToWorldMatrix;
160
161 Vector3 _boundingBoxV1;
162 Vector3 _boundingBoxV2;
163
164 std::vector<int> _groupIds;
165
166 CSOVoxelSetList* _csoVoxelSetList;
167
168 MLdouble _minVoxelValue;
169 MLdouble _maxVoxelValue;
170
171 /* METHODS */
172
174 void _sortToSlices(const std::vector<Vector3>& positions, const std::vector<MLdouble>& values);
175};
176
178
#define MLCSO_EXPORT
Defines export symbols for classes, so they can be used in other DLLs.
Definition MLCSOSystem.h:23
The CSOVoxelSet represents a contour segmentation object in discrete voxel coordinates.
Definition CSOVoxelSet.h:50
void setCSOVoxelSetList(CSOVoxelSetList *list)
Sets the CSOVoxelSetList pointer.
CSOVoxelSet()
Standard constructor. The unique id is initialized with 0.
const VoxelVector & getPositionsAt(size_t index) const
Returns the list of positions at a given index.
void setCreator(const std::string &creatorArg)
Sets the creator.
void getVoxelPositionAtSlice(size_t sliceIndex, size_t voxelIndex, int &x, int &y)
Fills up the given x and y variables by a voxel position on a certain slice at a certain index.
MLdouble getMinVoxelValue() const
Returns the minimum voxel value.
Vector3 getVoxelPositionOfTotal(size_t index) const
Returns a voxel position regardless of its slice.
void addVoxelValuePositions(const std::vector< VoxelPosition > &positions, const std::vector< MLdouble > &values)
Adds a vector of positions at once (MLint).
void addCSOVoxelSetGroupId(int groupId)
Adds an id of a Group.
const std::string & creator() const
Returns the creator.
bool getVoxelValueAtSlice(size_t sliceIndex, size_t voxelIndex, double &val) const
Returns a voxel value for a given slice at a given index.
unsigned int numVoxelsOnSliceAt(size_t sliceIndex) const
Returns the number of voxels for the given slice.
const std::string & description() const
Returns the description.
const VoxelValueVector & getValuesAt(size_t index) const
Returns the list of values at a given index.
Vector3 getBoundingBoxV2() const
Returns the max bounding box corner.
void addVoxelValuePositions(const std::vector< Vector3 > &positions, const std::vector< MLdouble > &values)
Adds a vector of positions at once (double).
int timepoint() const
Returns the timepoint.
void setDescription(const std::string &descriptionArg)
Sets the description.
int groupIdAt(size_t index) const
Returns the id of a Group at the given index.
Vector3 getVoxelPositionAtSlice(size_t sliceIndex, size_t voxelIndex) const
Returns a voxel position for a given slice at a given index.
unsigned int endingSlice() const
Returns the ending slice.
MLdouble getMaxVoxelValue() const
Returns the maximum voxel value.
CSOVoxelSetList * csoVoxelSetList() const
Returns the CSOVoxelSetList pointer.
unsigned int numGroups() const
Returns the number of Groups this is in.
Vector3 getBoundingBoxV1() const
Returns the min bounding box corner.
Definition CSOVoxelSet.h:98
void setLabel(const std::string &labelArg)
Sets the label.
int uniqueId() const
Returns the unique id.
virtual ~CSOVoxelSet()
Standard destructor.
double getVoxelValueOfTotal(size_t index) const
Returns a voxel value regardless of its slice.
const std::string & label() const
Returns the label.
void setUniqueId(int id)
Sets the unique id.
size_t numTotalVoxels() const
Returns the number of total voxel positions.
size_t numSlices() const
Returns the number of slices the voxels are spread over.
const Matrix4 & getVoxelToWorldMatrix() const
Returns the voxel-to-world matrix.
Definition CSOVoxelSet.h:77
void setVoxelToWorldMatrix(const Matrix4 &voxelToWorldMatrix)
Sets the voxel-to-world matrix.
Definition CSOVoxelSet.h:75
unsigned int startingSlice() const
Returns the starting slice.
void setTimepoint(int timepointArg)
Sets the timepoint.
CSOVoxelSet(const CSOVoxelSet &csoVoxelSet)
Copy constructor; the unique id is initialized with 0.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
double MLdouble
Definition mlTypeDefs.h:217
std::vector< MLdouble > VoxelValueVector
Definition CSOVoxelSet.h:26
std::vector< Vector3 > VoxelVector
Definition CSOVoxelSet.h:25