23 #ifndef __vtkMRMLSegmentationDisplayNode_h 24 #define __vtkMRMLSegmentationDisplayNode_h 51 double OverrideColor[3];
55 bool Visible2DFill{
true};
56 bool Visible2DOutline{
true};
58 double Opacity3D{1.0};
59 double Opacity2DFill{1.0};
60 double Opacity2DOutline{1.0};
65 OverrideColor[0] = SEGMENT_COLOR_NO_OVERRIDE;
66 OverrideColor[1] = SEGMENT_COLOR_NO_OVERRIDE;
67 OverrideColor[2] = SEGMENT_COLOR_NO_OVERRIDE;
79 void PrintSelf(ostream& os, vtkIndent indent)
override;
87 void WriteXML(ostream& of,
int indent)
override;
99 vtkGetStringMacro(PreferredDisplayRepresentationName2D);
101 vtkSetStringMacro(PreferredDisplayRepresentationName2D);
103 vtkGetStringMacro(PreferredDisplayRepresentationName3D);
105 vtkSetStringMacro(PreferredDisplayRepresentationName3D);
108 vtkGetMacro(Visibility2DFill,
bool);
109 vtkSetMacro(Visibility2DFill,
bool);
110 vtkBooleanMacro(Visibility2DFill,
bool);
112 vtkGetMacro(Visibility2DOutline,
bool);
113 vtkSetMacro(Visibility2DOutline,
bool);
114 vtkBooleanMacro(Visibility2DOutline,
bool);
117 vtkGetMacro(Opacity3D,
double);
118 vtkSetMacro(Opacity3D,
double);
120 vtkGetMacro(Opacity2DFill,
double);
121 vtkSetMacro(Opacity2DFill,
double);
123 vtkGetMacro(Opacity2DOutline,
double);
124 vtkSetMacro(Opacity2DOutline,
double);
132 bool GetSegmentDisplayProperties(std::string segmentID, SegmentDisplayProperties &properties);
135 void SetSegmentDisplayProperties(std::string segmentID, SegmentDisplayProperties &properties);
138 void SetSegmentDisplayPropertiesToDefault(
const std::string& segmentId);
141 void RemoveSegmentDisplayProperties(std::string segmentID);
144 void ClearSegmentDisplayProperties();
149 bool CalculateAutoOpacitiesForSegments();
157 void GenerateSegmentColor(
double color[3],
int colorNumber=0);
160 void GenerateSegmentColor(
double &r,
double &g,
double &b);
163 void GetPolyDataRepresentationNames(std::set<std::string> &representationNames);
170 std::string GetDisplayRepresentationName3D();
175 std::string GetDisplayRepresentationName2D();
181 vtkVector3d GetSegmentColor(std::string segmentID);
183 bool GetSegmentColor(std::string segmentID,
double* color);
185 bool GetSegmentColor(std::string segmentID,
double &r,
double &g,
double &b);
189 vtkVector3d GetSegmentOverrideColor(std::string segmentID);
195 void SetSegmentOverrideColor(std::string segmentID,
double r,
double g,
double b);
197 void SetSegmentOverrideColor(std::string segmentID, vtkVector3d overrideColor);
199 void UnsetSegmentOverrideColor(std::string segmentID);
203 bool GetSegmentVisibility(std::string segmentID);
205 void SetSegmentVisibility(std::string segmentID,
bool visible);
206 void SetAllSegmentsVisibility(
bool visible);
210 bool GetSegmentVisibility3D(std::string segmentID);
212 void SetSegmentVisibility3D(std::string segmentID,
bool visible);
213 void SetAllSegmentsVisibility3D(
bool visible,
bool changeVisibleSegmentsOnly =
false);
217 bool GetSegmentVisibility2DFill(std::string segmentID);
219 void SetSegmentVisibility2DFill(std::string segmentID,
bool visible);
220 void SetAllSegmentsVisibility2DFill(
bool visible,
bool changeVisibleSegmentsOnly =
false);
224 bool GetSegmentVisibility2DOutline(std::string segmentID);
226 void SetSegmentVisibility2DOutline(std::string segmentID,
bool visible);
227 void SetAllSegmentsVisibility2DOutline(
bool visible,
bool changeVisibleSegmentsOnly =
false);
231 double GetSegmentOpacity3D(std::string segmentID);
233 void SetSegmentOpacity3D(std::string segmentID,
double opacity);
234 void SetAllSegmentsOpacity3D(
double opacity,
bool changeVisibleSegmentsOnly =
false);
238 double GetSegmentOpacity2DFill(std::string segmentID);
240 void SetSegmentOpacity2DFill(std::string segmentID,
double opacity);
241 void SetAllSegmentsOpacity2DFill(
double opacity,
bool changeVisibleSegmentsOnly =
false);
245 double GetSegmentOpacity2DOutline(std::string segmentID);
247 void SetSegmentOpacity2DOutline(std::string segmentID,
double opacity);
248 void SetAllSegmentsOpacity2DOutline(
double opacity,
bool changeVisibleSegmentsOnly =
false);
251 void SetSegmentOpacity(std::string segmentID,
double opacity);
252 void SetAllSegmentsOpacity(
double opacity,
bool changeVisibleSegmentsOnly =
false);
255 void GetVisibleSegmentIDs(vtkStringArray* segmentIDs);
258 void GetVisibleSegmentIDs(std::vector<std::string>& segmentIDs);
262 void GetSegmentIDs(std::vector<std::string>& segmentIDs,
bool visibleSegmentsOnly);
267 void UpdateSegmentList(
bool removeUnusedDisplayProperties =
true);
280 char* PreferredDisplayRepresentationName2D{
nullptr};
285 char* PreferredDisplayRepresentationName3D{
nullptr};
293 unsigned int NumberOfGeneratedColors{0};
296 vtkMTimeType SegmentListUpdateTime{0};
302 bool Visibility2DFill{
true};
306 bool Visibility2DOutline{
true};
309 double Opacity3D{1.0};
311 double Opacity2DFill{0.5};
313 double Opacity2DOutline{1.0};
SegmentDisplayPropertiesMap SegmentationDisplayProperties
void PrintSelf(ostream &os, vtkIndent indent) override
void ReadXMLAttributes(const char **atts) override
virtual vtkMRMLNode * CreateNodeInstance()=0
Create instance of the default node. Like New only virtual.
Display properties per segment.
vtkMRMLCopyContentMacro(vtkMRMLDisplayNode)
SegmentDisplayProperties()
void WriteXML(ostream &of, int indent) override
This class encapsulates a segmentation that can contain multiple segments and multiple representation...
static const double SEGMENT_COLOR_NO_OVERRIDE
void operator=(const vtkMRMLDisplayNode &)
MRML node for representing segmentation display attributes.
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
std::map< std::string, SegmentDisplayProperties > SegmentDisplayPropertiesMap
Abstract class that contains graphical display properties for displayable nodes.
Abstract Superclass for all specific types of MRML nodes.
MRML node to represent discrete color information.
MRML node containing segmentationsSegmentation node stores a set of segments (also known as contours ...