MeVisLab Toolbox Reference
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 
21 ML_START_NAMESPACE
22 
29 {
30 
31 public:
32 
34  CSOGenerator(std::string type="CSOGenerator", int numInImg=0, int numOutImg=0);
35 
37  inline std::string getType() const { return _type; }
38 
39 protected:
40 
41  /* FIELDS */
42 
46 
49 
53 
57 
61 
70 
79 
84 
85 
86  /* MEMBER VARIABLES */
87 
88 
89  /* METHODS */
90 
91  // The indirection of the following three methods is not really necessary, we
92  // could call those methods implemented in CSOGeneratorBase directly where needed.
93 
94  // The indirection is here because we do not want to change all calls in all
95  // other modules (which may be implemented by external colleagues).
96 
97 
102  CSO* _addCSO(CSOList* csoList, bool useUndoRedo=true) { return generatorAddCSO(csoList, useUndoRedo); }
104  CSO* _addCSONoEvent(CSOList* csoList, bool useUndoRedo = true) { return generatorAddCSONoEvent(csoList, useUndoRedo); }
106  CSOGroup* _getParentGroup(CSOList* csoList, bool useUndoRedo=false, bool generate=false) { return generatorGetParentGroup(csoList, useUndoRedo, generate); }
109 
111  int getModuleCreatorId() const override { return static_cast<int>(_idFld->getIntValue()); }
113  std::string getModuleType() const override { return getType(); }
114 
117  bool getShouldEmptyBeforeGeneration() const override { return _emptyGroupBeforeGenerationFld->getBoolValue(); }
119  int getAddCSOToGroupMode() const override { return _addCSOToGroupMode->getEnumValue(); }
121  std::string getAddCSOToGroupLabel() const override { return _addCSOToGroupWithLabelFld->getStringValue(); }
123  int getAddCSOToGroupId() const override { return static_cast<int>(_addCSOToGroupWithIdFld->getIntValue()); }
124 
126  int getDefaultPathPointStyle() const override { return _pathPointStyleFld->getEnumValue(); }
128  float getDefaultPathPointWidth() const override { return _pathPointWidthFld->getFloatValue(); }
130  Vector3 getDefaultPathPointColor() const override { return _pathPointColorFld->getVector3Value(); }
132  float getDefaultPathPointAlpha() const override { return _pathPointAlphaFld->getFloatValue(); }
133 
135  int getDefaultSeedPointStyle() const override { return _seedPointStyleFld->getEnumValue(); }
137  float getDefaultSeedPointSize() const override { return _seedPointSizeFld->getFloatValue(); }
139  Vector3 getDefaultSeedPointColor() const override { return _seedPointColorFld->getVector3Value(); }
141  float getDefaultSeedPointAlpha() const override { return _seedPointAlphaFld->getFloatValue(); }
142 
144  int getDefaultVoxelWriteMode() const override { return _voxelWriteModeFld->getEnumValue(); }
146  float getDefaultVoxelWriteValue() const override { return _voxelWriteValueFld->getFloatValue(); }
147 
149  ~CSOGenerator() override;
150 
151 private:
152 
154 };
155 
157 
158 ML_END_NAMESPACE
#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:62
bool getBoolValue() const
Returns the value of the field as a Boolean.
Base class for CSOModules.
Definition: CSOBaseModule.h:29
std::string _type
The processor type as a string.
Definition: CSOBaseModule.h:72
ML_MODULE_CLASS_HEADER(CSOBaseModule)
CSO * generatorAddCSO(CSOList *csoList, bool useUndoRedo=true)
Adds a new CSO to the CSOList.
CSO * generatorAddCSONoEvent(CSOList *csoList, bool useUndoRedo=true, bool sendEvent=false)
See generatorAddCSO, but no group scope event is emitted. (So this method is faster!...
void generatorEmptyGroupOnDemand(CSOList *csoList)
Empties a group on demand of the given CSOList with the set label.
CSOGroup * generatorGetParentGroup(CSOList *csoList, bool useUndoRedo=false, bool generate=false)
Returns the parent group according to current group settings.
The CSOGenerator is the base class for all modules that generate CSOs, be it automatically or interac...
Definition: CSOGenerator.h:29
IntField * _idFld
The id of this processor.
Definition: CSOGenerator.h:60
Vector3 getDefaultSeedPointColor() const override
Returns the set default seed point color for a new CSO.
Definition: CSOGenerator.h:139
StringField * _addCSOToGroupWithLabelFld
This label defines the group the generator should add its created CSOs to.
Definition: CSOGenerator.h:52
FloatField * _pathPointAlphaFld
The path point's alpha value. Default is 1.
Definition: CSOGenerator.h:69
CSO * _addCSO(CSOList *csoList, bool useUndoRedo=true)
Adds a new CSO to the CSOList.
Definition: CSOGenerator.h:102
CSO * _addCSONoEvent(CSOList *csoList, bool useUndoRedo=true)
See _addCSO, but without group event. (This method is faster!).
Definition: CSOGenerator.h:104
BoolField * _emptyGroupBeforeGenerationFld
If checked and a group name is provided, the group is emptied before a new generation.
Definition: CSOGenerator.h:45
CSOGroup * _getParentGroup(CSOList *csoList, bool useUndoRedo=false, bool generate=false)
Returns the parent group according to current group settings.
Definition: CSOGenerator.h:106
TypedEnumField< CSOAddToGroupModes > * _addCSOToGroupMode
Defines if the CSOs are added to a group and how the group is identified.
Definition: CSOGenerator.h:48
int getModuleCreatorId() const override
Returns the module's creator id.
Definition: CSOGenerator.h:111
FloatField * _seedPointAlphaFld
The marker's alpha value. Default is 1.
Definition: CSOGenerator.h:78
~CSOGenerator() override
Destructor.
int getDefaultVoxelWriteMode() const override
Returns the set default voxel write mode for a new CSO.
Definition: CSOGenerator.h:144
TypedEnumField< CSOSeedPointStyle > * _seedPointStyleFld
The marker's mode (none, rect, circle). Default is 'rect'.
Definition: CSOGenerator.h:72
Vector3 getDefaultPathPointColor() const override
Returns the set default path point color for a new CSO.
Definition: CSOGenerator.h:130
TypedEnumField< CSOPathPointsStyle > * _pathPointStyleFld
The path point's line style (none, solid, dashed, dotted). Default is 'solid'.
Definition: CSOGenerator.h:63
std::string getAddCSOToGroupLabel() const override
Returns the label string of a target group.
Definition: CSOGenerator.h:121
FloatField * _pathPointWidthFld
The path point's line width. Default is 1.
Definition: CSOGenerator.h:65
CSOGenerator(std::string type="CSOGenerator", int numInImg=0, int numOutImg=0)
Constructor.
float getDefaultPathPointAlpha() const override
Returns the set default path point alpha for a new CSO.
Definition: CSOGenerator.h:132
ColorField * _seedPointColorFld
The marker's color. Default is green.
Definition: CSOGenerator.h:76
int getDefaultSeedPointStyle() const override
Returns the set default seed point style for a new CSO.
Definition: CSOGenerator.h:135
bool getShouldEmptyBeforeGeneration() const override
Returns whether the module should empty a group before generating CSOs into it.
Definition: CSOGenerator.h:117
int getAddCSOToGroupMode() const override
Returns the group generation mode.
Definition: CSOGenerator.h:119
float getDefaultSeedPointSize() const override
Returns the set default seed point size for a new CSO.
Definition: CSOGenerator.h:137
FloatField * _seedPointSizeFld
The marker's size. Default is 3.
Definition: CSOGenerator.h:74
FloatField * _voxelWriteValueFld
The CSO's voxel write value. Default is 1024.
Definition: CSOGenerator.h:83
TypedEnumField< CSOVoxelWriteModes > * _voxelWriteModeFld
The CSO's voxel write mode (module, const, const plus id, id). Default is 'module'.
Definition: CSOGenerator.h:81
int getAddCSOToGroupId() const override
Returns the id of a target group.
Definition: CSOGenerator.h:123
int getDefaultPathPointStyle() const override
Returns the set default path point style for a new CSO.
Definition: CSOGenerator.h:126
float getDefaultSeedPointAlpha() const override
Returns the set default seed point alpha for a new CSO.
Definition: CSOGenerator.h:141
IntField * _addCSOToGroupWithIdFld
This id defines the group the generator should add its created CSOs to.
Definition: CSOGenerator.h:56
std::string getType() const
Returns the type of the CSOGenerator.
Definition: CSOGenerator.h:37
std::string getModuleType() const override
Returns the module's type string.
Definition: CSOGenerator.h:113
void _emptyGroupOnDemand(CSOList *csoList)
Empties a group on demand of the given CSOList with the set label.
Definition: CSOGenerator.h:108
float getDefaultPathPointWidth() const override
Returns the set default path point width for a new CSO.
Definition: CSOGenerator.h:128
float getDefaultVoxelWriteValue() const override
Returns the set default voxel write value for a new CSO.
Definition: CSOGenerator.h:146
ColorField * _pathPointColorFld
The path point's color. Default is yellow.
Definition: CSOGenerator.h:67
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 3 float values representing an (rgb) color with all properties of Ve...
Definition: mlFields.h:2065
Field to encapsulate a float value.
Definition: mlFields.h:627
float getFloatValue() const
Returns the value of the field.
Field to encapsulate an integer value.
Definition: mlFields.h:161
MLint getIntValue() const
Returns the value of the field as an MLint.
Field to encapsulate a string value.
Definition: mlFields.h:1000
std::string getStringValue() const override
Returns the value of the field as a string value setStringValue must be able to reinterpret this retu...
EnumType getEnumValue() const
Gets the current enum value.
Definition: mlFields.h:609
const Vector3 & getVector3Value() const
Returns the value of the field.