MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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 int x = -1;
39 int y = -1;
40};
41
43
49{
50
51public:
57 virtual ~CSOVoxelSet();
58
59 /* METHODS */
60
62 void addVoxelValuePositions(const std::vector<Vector3>& positions, const std::vector<MLdouble>& values);
64 void addVoxelValuePositions(const std::vector<VoxelPosition>& positions, const std::vector<MLdouble>& values);
66 size_t numTotalVoxels() const;
68 Vector3 getVoxelPositionOfTotal(size_t index) const;
70 double getVoxelValueOfTotal(size_t index) const;
71
73 inline void setVoxelToWorldMatrix(const Matrix4& voxelToWorldMatrix)
74 {
75 _voxelToWorldMatrix = voxelToWorldMatrix;
76 }
78 inline const Matrix4& getVoxelToWorldMatrix() const
79 {
80 return _voxelToWorldMatrix;
81 }
82
84 size_t numSlices() const;
86 unsigned int startingSlice() const;
88 unsigned int endingSlice() const;
90 const VoxelVector& getPositionsAt(size_t index) const;
92 const VoxelValueVector& getValuesAt(size_t index) const;
94 unsigned int numVoxelsOnSliceAt(size_t sliceIndex) const;
98 void getVoxelPositionAtSlice(size_t sliceIndex, size_t voxelIndex, int& x, int& y);
100 bool getVoxelValueAtSlice(size_t sliceIndex, size_t voxelIndex, double& val) const;
103 {
104 return _boundingBoxV1;
105 }
108 {
109 return _boundingBoxV2;
110 }
113 {
114 return _minVoxelValue;
115 }
118 {
119 return _maxVoxelValue;
120 }
121
124 {
125 _csoVoxelSetList = list;
126 }
129 {
130 return _csoVoxelSetList;
131 }
133 inline unsigned int numGroups() const
134 {
135 return static_cast<unsigned int>(_groupIds.size());
136 }
138 inline int groupIdAt(size_t index) const
139 {
140 return _groupIds[index];
141 }
143 inline void addCSOVoxelSetGroupId(int groupId)
144 {
145 _groupIds.push_back(groupId);
146 }
147
149 inline void setLabel(const std::string& labelArg)
150 {
151 _label = labelArg;
152 }
154 inline const std::string& label() const
155 {
156 return _label;
157 }
159 inline void setCreator(const std::string& creatorArg)
160 {
161 _creator = creatorArg;
162 }
164 inline const std::string& creator() const
165 {
166 return _creator;
167 }
169 inline void setTimepoint(int timepointArg)
170 {
171 _timepoint = timepointArg;
172 }
174 inline int timepoint() const
175 {
176 return _timepoint;
177 }
179 inline void setDescription(const std::string& descriptionArg)
180 {
181 _description = descriptionArg;
182 }
184 inline const std::string& description() const
185 {
186 return _description;
187 }
188
189
191 inline void setUniqueId(int ID)
192 {
193 _uniqueId = ID;
194 }
196 inline int uniqueId() const
197 {
198 return _uniqueId;
199 }
200
201
202protected:
203private:
204 /* MEMBER VARIABLES */
205
206 std::vector<VoxelVector> _sliceVoxels;
207 std::vector<VoxelValueVector> _sliceVoxelValues;
208
209 int _startingSlice;
210 int _endingSlice;
211
212 int _uniqueId;
213 std::string _label;
214 std::string _description;
215 std::string _creator;
216 int _timepoint;
217
218 Matrix4 _voxelToWorldMatrix;
219
220 Vector3 _boundingBoxV1;
221 Vector3 _boundingBoxV2;
222
223 std::vector<int> _groupIds;
224
225 CSOVoxelSetList* _csoVoxelSetList;
226
227 MLdouble _minVoxelValue;
228 MLdouble _maxVoxelValue;
229
230 /* METHODS */
231
233 void _sortToSlices(const std::vector<Vector3>& positions, const std::vector<MLdouble>& values);
234};
235
237
#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:49
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 specified 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 specified x and y variables by a voxel position on a specified slice at a specified inde...
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 CSOVoxelSetGroup.
void setUniqueId(int ID)
Sets the unique ID.
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 specified slice at a specified index.
unsigned int numVoxelsOnSliceAt(size_t sliceIndex) const
Returns the number of voxels for the specified slice.
const std::string & description() const
Returns the description.
const VoxelValueVector & getValuesAt(size_t index) const
Returns the list of values at a specified index.
Vector3 getBoundingBoxV2() const
Returns the maximum 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 CSOVoxelSetGroup at the specified index.
Vector3 getVoxelPositionAtSlice(size_t sliceIndex, size_t voxelIndex) const
Returns a voxel position for a specified slice at a specified 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 CSOVoxelSetGroups this is in.
Vector3 getBoundingBoxV1() const
Returns the minimum bounding box corner.
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.
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:78
void setVoxelToWorldMatrix(const Matrix4 &voxelToWorldMatrix)
Sets the voxel-to-world matrix.
Definition CSOVoxelSet.h:73
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