MeVisLab Toolbox Reference
CSOVisualizationSettingsWithStylePalette.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2016, 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 #include <SoCSOSystem.h>
18 #include <SoCSODefines.h>
19 #include <mlStylePalette.h>
21 
22 #include <ThirdPartyWarningsDisable.h>
23 #include <boost/unordered_set.hpp>
24 #include <ThirdPartyWarningsRestore.h>
25 
26 ML_START_NAMESPACE
27 
30 
32 {
33  CSOs = 0,
34  Groups = 1
35 };
36 
40 {
41  CSOId = 0,
45 };
46 
49 #define addMemberAndAccessMethod(type, name) \
50  public:\
51  type name() const { return _##name; } \
52  void name(type value) { _##name = value; } \
53  protected: \
54  type _##name;
55 
56 #define addMemberAndAccessMethodWithCSO(type, name) \
57  public:\
58  type name() const { return _##name; } \
59  virtual type name(CSO* cso) const; \
60  void name(type value) { _##name = value; } \
61  protected: \
62  type _##name;
63 
64 #define overwriteAccessMethodsWithCSO(type, name) \
65  public:\
66  using CSOVisualizationSettings::name; \
67  virtual type name(CSO* cso) const override;
68 
69 
71 
73 {
74 public:
77 
78  bool isCSOVisible(CSO* cso) override;
79  void setStylePalette(StylePalette* stylePalette) { _stylePalette = stylePalette; }
80  overwriteAccessMethodsWithCSO(int, pathPointsOnSliceLineStyle);
81  overwriteAccessMethodsWithCSO(float, pathPointsOnSliceLineWidth);
82  overwriteAccessMethodsWithCSO(SbColor, pathPointsOnSliceColor);
83  overwriteAccessMethodsWithCSO(int, seedPointOnSliceStyle);
84  overwriteAccessMethodsWithCSO(float, seedPointOnSliceSize);
85  overwriteAccessMethodsWithCSO(SbColor, seedPointOnSliceColor);
86  //style palette settings
87  addMemberAndAccessMethod(bool, shouldUseStylePaletteLookUpForSeedPoints);
88  addMemberAndAccessMethod(int, stylePaletteLookUpSeedPoints);
89  // path points
90  addMemberAndAccessMethod(bool, shouldUseStylePaletteLookUpForPathPoints);
91  addMemberAndAccessMethod(int, stylePaletteLookUpPathPoints);
92  // visibility filtering
93  addMemberAndAccessMethod(int, visibleByMode);
94  addMemberAndAccessMethod(std::string, visibleIdList);
95  addMemberAndAccessMethod(bool, invertVisibility);
96 
97 public:
99 private:
100 
102  MLssize_t getStylePalettePathPointsLookUp(CSO* cso) const;
104  MLssize_t getStylePaletteSeedPointsLookUp(CSO* cso) const;
106  MLssize_t getStylePaletteLookUp(CSO* cso, int lookUpType) const;
108  bool hasStylePalette() const;
109 
111  SbColor getColorFromStylePalette(MLssize_t index) const;
112  unsigned short getLineStyleFromStylePalette(MLssize_t index) const;
113  int getLineWidthFromStylePalette(MLssize_t index) const;
114  int getSeedPointStyleFromStylePalette(MLssize_t index) const;
115  int getSeedPointSizeFromStylePalette(MLssize_t index) const;
117  boost::unordered_set < int > _visibleIds;
118 
119  StylePalette* _stylePalette;
120 
122 };
123 
124 #undef addMemberAndAccessMethodWithCSO
125 #undef addMemberAndAccessMethod
126 
127 ML_END_NAMESPACE
#define SOCSO_EXPORT
Header file for system independent resolution.
Definition: SoCSOSystem.h:21
addMemberAndAccessMethod(int, stylePaletteLookUpPathPoints)
overwriteAccessMethodsWithCSO(float, seedPointOnSliceSize)
addMemberAndAccessMethod(int, stylePaletteLookUpSeedPoints)
overwriteAccessMethodsWithCSO(SbColor, pathPointsOnSliceColor)
overwriteAccessMethodsWithCSO(int, seedPointOnSliceStyle)
addMemberAndAccessMethod(bool, shouldUseStylePaletteLookUpForSeedPoints)
addMemberAndAccessMethod(bool, shouldUseStylePaletteLookUpForPathPoints)
overwriteAccessMethodsWithCSO(int, pathPointsOnSliceLineStyle)
CSOVisualizationSettingsWithStylePalette()
Constructor sets members to default values.
addMemberAndAccessMethod(std::string, visibleIdList)
overwriteAccessMethodsWithCSO(SbColor, seedPointOnSliceColor)
overwriteAccessMethodsWithCSO(float, pathPointsOnSliceLineWidth)
addMemberAndAccessMethod(bool, invertVisibility)
ML_CLASS_HEADER(CSOVisualizationSettings)
The CSO represents a contour segmentation object.
Definition: CSO.h:44
Base object class StylePalette for providing a collection of colors, line styles and marker types.
SSIZE_T MLssize_t
The signed ML size type which is a signed 32 bit size_t on 32 bit platforms and 64 bit one on 64 bit ...
Definition: mlTypeDefs.h:654
CSOStylePaletteLookUpType
Defines how the optionally attached StylePalette should be used.
CSOVisibleObjectIdsFor
Mode for setting the CSOs' or CSOGroups' visibility by their id.
@ CSOs
Ids represent CSO ids.
@ Groups
Ids represent Group ids.