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 SetSegmentColorGeneratorSourceColorNodeID(
const char* colorNodeID);
166 const char* GetSegmentColorGeneratorSourceColorNodeID();
170 void GetPolyDataRepresentationNames(std::set<std::string> &representationNames);
177 std::string GetDisplayRepresentationName3D();
182 std::string GetDisplayRepresentationName2D();
188 vtkVector3d GetSegmentColor(std::string segmentID);
190 bool GetSegmentColor(std::string segmentID,
double* color);
192 bool GetSegmentColor(std::string segmentID,
double &r,
double &g,
double &b);
196 vtkVector3d GetSegmentOverrideColor(std::string segmentID);
202 void SetSegmentOverrideColor(std::string segmentID,
double r,
double g,
double b);
204 void SetSegmentOverrideColor(std::string segmentID, vtkVector3d overrideColor);
206 void UnsetSegmentOverrideColor(std::string segmentID);
210 bool GetSegmentVisibility(std::string segmentID);
212 void SetSegmentVisibility(std::string segmentID,
bool visible);
213 void SetAllSegmentsVisibility(
bool visible);
217 bool GetSegmentVisibility3D(std::string segmentID);
219 void SetSegmentVisibility3D(std::string segmentID,
bool visible);
220 void SetAllSegmentsVisibility3D(
bool visible,
bool changeVisibleSegmentsOnly =
false);
224 bool GetSegmentVisibility2DFill(std::string segmentID);
226 void SetSegmentVisibility2DFill(std::string segmentID,
bool visible);
227 void SetAllSegmentsVisibility2DFill(
bool visible,
bool changeVisibleSegmentsOnly =
false);
231 bool GetSegmentVisibility2DOutline(std::string segmentID);
233 void SetSegmentVisibility2DOutline(std::string segmentID,
bool visible);
234 void SetAllSegmentsVisibility2DOutline(
bool visible,
bool changeVisibleSegmentsOnly =
false);
238 double GetSegmentOpacity3D(std::string segmentID);
240 void SetSegmentOpacity3D(std::string segmentID,
double opacity);
241 void SetAllSegmentsOpacity3D(
double opacity,
bool changeVisibleSegmentsOnly =
false);
245 double GetSegmentOpacity2DFill(std::string segmentID);
247 void SetSegmentOpacity2DFill(std::string segmentID,
double opacity);
248 void SetAllSegmentsOpacity2DFill(
double opacity,
bool changeVisibleSegmentsOnly =
false);
252 double GetSegmentOpacity2DOutline(std::string segmentID);
254 void SetSegmentOpacity2DOutline(std::string segmentID,
double opacity);
255 void SetAllSegmentsOpacity2DOutline(
double opacity,
bool changeVisibleSegmentsOnly =
false);
258 void SetSegmentOpacity(std::string segmentID,
double opacity);
259 void SetAllSegmentsOpacity(
double opacity,
bool changeVisibleSegmentsOnly =
false);
262 void GetVisibleSegmentIDs(vtkStringArray* segmentIDs);
265 void GetVisibleSegmentIDs(std::vector<std::string>& segmentIDs);
268 std::vector<std::string> GetVisibleSegmentIDs();
272 void GetSegmentIDs(std::vector<std::string>& segmentIDs,
bool visibleSegmentsOnly);
277 void UpdateSegmentList(
bool removeUnusedDisplayProperties =
true);
290 char* PreferredDisplayRepresentationName2D{
nullptr};
295 char* PreferredDisplayRepresentationName3D{
nullptr};
303 unsigned int NumberOfGeneratedColors{0};
306 vtkMTimeType SegmentListUpdateTime{0};
312 bool Visibility2DFill{
true};
316 bool Visibility2DOutline{
true};
319 double Opacity3D{1.0};
321 double Opacity2DFill{0.5};
323 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 ...