MeVisLabToolboxReference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00004 00009 //---------------------------------------------------------------------------------- 00010 00011 #ifndef __CSOVoxelSet_H 00012 #define __CSOVoxelSet_H 00013 00014 #include "MLCSOIncludes.h" 00015 00016 ML_START_NAMESPACE 00017 00018 00019 typedef std::vector<Vector3> VoxelVector; 00020 typedef std::vector<MLdouble> VoxelValueVector; 00021 00022 00023 // Forward declaration. 00024 class CSOVoxelSetList; 00025 00026 00028 00029 class MLCSO_EXPORT CSOVoxelSetPoint 00030 { 00031 public: 00032 00033 CSOVoxelSetPoint() { x = y = -1; } 00034 00035 int x, y; 00036 }; 00037 00039 00044 class MLCSO_EXPORT CSOVoxelSet 00045 { 00046 00047 public: 00048 00050 CSOVoxelSet(); 00052 CSOVoxelSet(const CSOVoxelSet &csoVoxelSet); 00054 virtual ~CSOVoxelSet(); 00055 00056 /* METHODS */ 00057 00059 void addVoxelValuePositions(const std::vector<Vector3>& positions, const std::vector<MLdouble>& values); 00061 size_t numTotalVoxels() const; 00063 Vector3 getVoxelPositionOfTotal(size_t index) const; 00065 double getVoxelValueOfTotal(size_t index) const; 00066 00068 void setVoxelToWorldMatrix(const Matrix4& voxelToWorldMatrix) { _voxelToWorldMatrix = voxelToWorldMatrix; } 00070 const Matrix4& getVoxelToWorldMatrix() const { return _voxelToWorldMatrix; } 00071 00073 size_t numSlices() const; 00075 unsigned int startingSlice() const; 00077 unsigned int endingSlice() const; 00079 const VoxelVector& getPositionsAt(size_t index) const; 00081 const VoxelValueVector& getValuesAt(size_t index) const; 00083 unsigned int numVoxelsOnSliceAt(size_t sliceIndex) const; 00085 Vector3 getVoxelPositionAtSlice(size_t sliceIndex, size_t voxelIndex) const; 00087 void getVoxelPositionAtSlice(size_t sliceIndex, size_t voxelIndex, int& x, int& y); 00089 bool getVoxelValueAtSlice(size_t sliceIndex, size_t voxelIndex, double& val) const; 00090 00091 00093 void setCSOVoxelSetList(CSOVoxelSetList* list) { _csoVoxelSetList = list; } 00095 CSOVoxelSetList* csoVoxelSetList() const { return _csoVoxelSetList; } 00097 unsigned int numGroups() const { return static_cast<unsigned int>(_groupIds.size()); } 00099 int groupIdAt(size_t index) const { return _groupIds[index]; } 00101 void addCSOVoxelSetGroupId(int groupId) { _groupIds.push_back(groupId); } 00102 00104 void setLabel(const std::string& labelArg) { _label = labelArg; } 00106 const std::string& label() const { return _label; } 00108 void setCreator(const std::string creatorArg) { _creator = creatorArg; } 00110 const std::string& creator() const { return _creator; } 00112 void setTimepoint(int timepointArg) { _timepoint = timepointArg; } 00114 int timepoint() const { return _timepoint; } 00116 void setDescription(const std::string& descriptionArg) { _description = descriptionArg; } 00118 const std::string& description() const { return _description; } 00119 00120 00122 void setUniqueId(int id) { _uniqueId = id; } 00124 int uniqueId() const { return _uniqueId; } 00125 00126 00127 protected: 00128 00129 private: 00130 00131 /* MEMBER VARIABLES */ 00132 00133 std::vector<VoxelVector> _sliceVoxels; 00134 std::vector<VoxelValueVector> _sliceVoxelValues; 00135 00136 int _startingSlice; 00137 int _endingSlice; 00138 00139 int _uniqueId; 00140 std::string _label; 00141 std::string _description; 00142 std::string _creator; 00143 int _timepoint; 00144 00145 Matrix4 _voxelToWorldMatrix; 00146 00147 std::vector<int> _groupIds; 00148 00149 CSOVoxelSetList* _csoVoxelSetList; 00150 00151 /* METHODS */ 00152 00154 void _sortToSlices(const std::vector<Vector3>& positions, const std::vector<MLdouble>& values); 00155 }; 00156 00158 00159 00160 ML_END_NAMESPACE 00161 00162 00163 #endif // __CSOVoxelSet_H 00164