MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
CSOGenerator.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#include "CSOBaseModule.h"
19#include "CSOGeneratorBase.h"
20
22
29{
30
31public:
33 CSOGenerator(std::string type = "CSOGenerator", int numInImg = 0, int numOutImg = 0);
34
36 inline std::string getType() const
37 {
38 return _type;
39 }
40
41protected:
42 /* FIELDS */
43
47
50
54
58
62
71
80
85
86
87 /* MEMBER VARIABLES */
88
89
90 /* METHODS */
91
92 // The indirection of the following three methods is not really necessary, we
93 // could call those methods implemented in CSOGeneratorBase directly where needed.
94
95 // The indirection is here because we do not want to change all calls in all
96 // other modules (which may be implemented by external colleagues).
97
98
103 CSO* _addCSO(CSOList* csoList, bool useUndoRedo = true)
104 {
105 return generatorAddCSO(csoList, useUndoRedo);
106 }
108 CSO* _addCSONoEvent(CSOList* csoList, bool useUndoRedo = true)
109 {
110 return generatorAddCSONoEvent(csoList, useUndoRedo);
111 }
113 CSOGroup* _getParentGroup(CSOList* csoList, bool useUndoRedo = false, bool generate = false)
114 {
116 }
119 {
121 }
122
124 int getModuleCreatorId() const override
125 {
126 return static_cast<int>(_idFld->getIntValue());
127 }
129 std::string getModuleType() const override
130 {
131 return getType();
132 }
133
136 bool getShouldEmptyBeforeGeneration() const override
137 {
138 return _emptyGroupBeforeGenerationFld->getBoolValue();
139 }
141 int getAddCSOToGroupMode() const override
142 {
143 return _addCSOToGroupMode->getEnumValue();
144 }
146 std::string getAddCSOToGroupLabel() const override
147 {
148 return _addCSOToGroupWithLabelFld->getStringValue();
149 }
151 int getAddCSOToGroupId() const override
152 {
153 return static_cast<int>(_addCSOToGroupWithIdFld->getIntValue());
154 }
155
157 int getDefaultPathPointStyle() const override
158 {
159 return _pathPointStyleFld->getEnumValue();
160 }
162 float getDefaultPathPointWidth() const override
163 {
164 return _pathPointWidthFld->getFloatValue();
165 }
168 {
169 return _pathPointColorFld->getVector3Value();
170 }
172 float getDefaultPathPointAlpha() const override
173 {
174 return _pathPointAlphaFld->getFloatValue();
175 }
176
178 int getDefaultSeedPointStyle() const override
179 {
180 return _seedPointStyleFld->getEnumValue();
181 }
183 float getDefaultSeedPointSize() const override
184 {
185 return _seedPointSizeFld->getFloatValue();
186 }
189 {
190 return _seedPointColorFld->getVector3Value();
191 }
193 float getDefaultSeedPointAlpha() const override
194 {
195 return _seedPointAlphaFld->getFloatValue();
196 }
197
199 int getDefaultVoxelWriteMode() const override
200 {
201 return _voxelWriteModeFld->getEnumValue();
202 }
204 float getDefaultVoxelWriteValue() const override
205 {
206 return _voxelWriteValueFld->getFloatValue();
207 }
208
210 ~CSOGenerator() override;
211
212private:
214};
215
217
#define MLCSO_EXPORT
Defines export symbols for classes, so they can be used in other DLLs.
Definition MLCSOSystem.h:23
Field to encapsulate a boolean value.
Definition mlFields.h:56
bool getBoolValue() const
Returns the value of the field as a boolean.
Base class for CSOModules.
std::string _type
The processor type as a string.
CSOGroup * generatorGetParentGroup(CSOList *csoList, bool useUndoRedo=false, bool generate=false)
Returns the parent CSOGroup according to current CSOGroup settings.
void generatorEmptyGroupOnDemand(CSOList *csoList)
Empties a CSOGroup on demand of the given CSOList with the set label.
CSO * generatorAddCSONoEvent(CSOList *csoList, bool useUndoRedo=true, bool sendEvent=false)
See generatorAddCSO, but no CSOGroup scope event is emitted. (So this method is faster!...
CSO * generatorAddCSO(CSOList *csoList, bool useUndoRedo=true)
Adds a new CSO to the CSOList.
The CSOGenerator is the base class for all modules that generate CSOs, be it automatically or interac...
IntField * _idFld
The ID of this processor.
Vector3 getDefaultSeedPointColor() const override
Returns the set default seed point color for a new CSO.
StringField * _addCSOToGroupWithLabelFld
This label defines the CSOGroup the generator should add its created CSOs to.
FloatField * _pathPointAlphaFld
The path point's alpha value. Default is 1.
BoolField * _emptyGroupBeforeGenerationFld
If checked and a CSOGroup name is provided, the CSOGroup is emptied before a new generation.
TypedEnumField< CSOAddToGroupModes > * _addCSOToGroupMode
Defines whether the CSOs are added to a CSOGroup and how the CSOGroup is identified.
int getModuleCreatorId() const override
Returns the module's creator ID.
FloatField * _seedPointAlphaFld
The marker's alpha value. Default is 1.
~CSOGenerator() override
Destructor.
int getDefaultVoxelWriteMode() const override
Returns the set default voxel write mode for a new CSO.
TypedEnumField< CSOSeedPointStyle > * _seedPointStyleFld
The marker's mode (none, rect, circle). Default is 'rect'.
Vector3 getDefaultPathPointColor() const override
Returns the set default path point color for a new CSO.
TypedEnumField< CSOPathPointsStyle > * _pathPointStyleFld
The path point's line style (none, solid, dashed, dotted). Default is 'solid'.
std::string getAddCSOToGroupLabel() const override
Returns the label string of a target CSOGroup.
FloatField * _pathPointWidthFld
The path point's line width. Default is 1.
CSOGroup * _getParentGroup(CSOList *csoList, bool useUndoRedo=false, bool generate=false)
Returns the parent CSOGroup according to current CSOGroup settings.
CSOGenerator(std::string type="CSOGenerator", int numInImg=0, int numOutImg=0)
Constructor.
CSO * _addCSONoEvent(CSOList *csoList, bool useUndoRedo=true)
See _addCSO, but without CSOGroup event. (This method is faster!).
CSO * _addCSO(CSOList *csoList, bool useUndoRedo=true)
Adds a new CSO to the CSOList.
float getDefaultPathPointAlpha() const override
Returns the set default path point alpha for a new CSO.
ColorField * _seedPointColorFld
The marker's color. Default is green.
int getDefaultSeedPointStyle() const override
Returns the set default seed point style for a new CSO.
bool getShouldEmptyBeforeGeneration() const override
Returns whether the module should empty a CSOGroup before generating CSOs into it.
int getAddCSOToGroupMode() const override
Returns the CSOGroup generation mode.
float getDefaultSeedPointSize() const override
Returns the set default seed point size for a new CSO.
FloatField * _seedPointSizeFld
The marker's size. Default is 3.
FloatField * _voxelWriteValueFld
The CSO's voxel write value. Default is 1024.
TypedEnumField< CSOVoxelWriteModes > * _voxelWriteModeFld
The CSO's voxel write mode (module, const, const plus ID, ID). Default is 'module'.
int getAddCSOToGroupId() const override
Returns the ID of a target CSOGroup.
int getDefaultPathPointStyle() const override
Returns the set default path point style for a new CSO.
float getDefaultSeedPointAlpha() const override
Returns the set default seed point alpha for a new CSO.
IntField * _addCSOToGroupWithIdFld
This ID defines the CSOGroup the generator should add its created CSOs to.
std::string getType() const
Returns the type of the CSOGenerator.
std::string getModuleType() const override
Returns the module's type string.
void _emptyGroupOnDemand(CSOList *csoList)
Empties a CSOGroup on demand of the given CSOList with the set label.
float getDefaultPathPointWidth() const override
Returns the set default path point width for a new CSO.
float getDefaultVoxelWriteValue() const override
Returns the set default voxel write value for a new CSO.
ColorField * _pathPointColorFld
The path point's color. Default is yellow.
A CSOGroup comprises a number of CSOs, which themselves can be in a number of different CSOGroups.
Definition CSOGroup.h:38
A CSOList comprises a number of CSOs and CSOGroups and is the central object for contour segmentation...
Definition CSOList.h:61
The CSO represents a contour segmentation object.
Definition CSO.h:44
Field to encapsulate a vector of three float values representing an (RGB) color with all properties o...
Definition mlFields.h:1547
Field to encapsulate a float value.
Definition mlFields.h:449
float getFloatValue() const
Returns the value of the field.
Field to encapsulate an integer value.
Definition mlFields.h:123
MLint getIntValue() const
Returns the value of the field as an MLint.
Field to encapsulate a string value.
Definition mlFields.h:634
std::string getStringValue() const override
Returns the value of the field as a string value setStringValue must be able to reinterpret this retu...
TypedEnumField is used to encapsulate a C++ enum value and work with a real enum value instead of int...
Definition mlFields.h:398
EnumType getEnumValue() const
Returns the current enum value.
Definition mlFields.h:413
const Vector3 & getVector3Value() const
Returns the value of the field.
#define ML_MODULE_CLASS_HEADER(className)
Similar to ML_CLASS_HEADER for the usage of derived classes from Module.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.