Medical Imaging Interaction Toolkit  2021.10.00
Medical Imaging Interaction Toolkit
mitkTubeGraphProperty.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef _mitk_TubeGraphProperty_h
14 #define _mitk_TubeGraphProperty_h
15 
16 #include <MitkTubeGraphExports.h>
17 
18 #include "mitkTubeGraph.h"
19 #include <mitkBaseProperty.h>
20 #include <mitkColorProperty.h>
21 
22 #include <itkObject.h>
23 #include <map>
24 #include <vector>
25 
26 namespace mitk
27 {
32  {
33  public:
35  itkNewMacro(TubeGraphProperty);
36 
37  struct LabelGroup
38  {
39  struct Label
40  {
41  std::string labelName;
42  bool isVisible;
44  };
45  std::string labelGroupName;
46  std::vector<Label *> labels;
47  };
48 
51  typedef std::vector<TubeGraphProperty::LabelGroup *> LabelGroupSetType;
52  typedef std::pair<TubeDescriptorType, std::string> TubeToLabelGroupType;
54 
55  struct Annotation
56  {
57  std::string name;
58  std::string description;
59  TubeDescriptorType tube;
60  };
61 
67  bool IsTubeVisible(const TubeDescriptorType &tube);
68 
74  void SetTubeActive(const TubeDescriptorType &tube, const bool &active);
75 
80  void SetTubesActive(std::vector<TubeDescriptorType> &tubes);
81 
87  bool IsTubeActive(const TubeDescriptorType &tube);
88 
89  std::vector<TubeDescriptorType> GetActiveTubes();
90 
91  Color GetColorOfTube(const TubeDescriptorType &tube);
92 
93  void SetTubesToLabels(std::map<TubeToLabelGroupType, std::string> tubeToLabelMap);
94 
95  std::map<TubeToLabelGroupType, std::string> GetTubesToLabels();
96 
100  void DeactivateAllTubes();
101 
102  void AddAnnotation(Annotation *annotation);
103  Annotation *GetAnnotationByName(std::string annotation);
104  std::vector<Annotation *> GetAnnotations();
105  void RemoveAnnotation(Annotation *annotation);
106 
107  void AddLabelGroup(LabelGroup *labelGroup, unsigned int position); // Add LG by name and vec<labelName>??
108  void RemoveLabelGroup(LabelGroup *labelGroup);
109  LabelGroupSetType GetLabelGroups();
110  unsigned int GetNumberOfLabelGroups();
111  unsigned int GetIndexOfLabelGroup(LabelGroup *labelGroup);
112  LabelGroup *GetLabelGroupByName(std::string labelGroup);
113 
114  void SetLabelVisibility(LabelGroup::Label *label, bool isVisible);
115  void SetLabelColor(LabelGroup::Label *label, Color color);
116  void RenameLabel(LabelGroup *labelGroup, LabelGroup::Label *label, std::string newName);
117  void SetLabelForActivatedTubes(LabelGroup *labelGroup, LabelGroup::Label *label);
118 
119  LabelGroup::Label *GetLabelByName(LabelGroup *labelGroup, std::string labelName);
120 
121  std::string GetValueAsString() const override;
122 
123  protected:
125  TubeGraphProperty(const TubeGraphProperty &other);
126  ~TubeGraphProperty() override;
127 
128  private:
129  std::vector<TubeDescriptorType> m_ActiveTubes;
130  LabelGroupSetType m_LabelGroups;
131  std::map<TubeToLabelGroupType, std::string> m_TubeToLabelsMap;
132  std::vector<Annotation *> m_Annotations;
133 
134  bool TubeDescriptorsCompare(const TubeDescriptorType &tube1, const TubeDescriptorType &tube2);
135 
136  // purposely not implemented
137  TubeGraphProperty &operator=(const TubeGraphProperty &);
138 
139  bool IsEqual(const BaseProperty &property) const override;
140  bool Assign(const BaseProperty &property) override;
141  itk::LightObject::Pointer InternalClone() const override;
142  };
143 
144 } // namespace mitk
145 
146 #endif /* _mitk_TubeGraphProperty_h */
TubeGraph::TubeDescriptorType TubeDescriptorType
#define MITKTUBEGRAPH_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
Abstract base class for properties.
std::pair< TubeDescriptorType, std::string > TubeToLabelGroupType
std::pair< VertexDescriptorType, VertexDescriptorType > TubeDescriptorType
Definition: mitkTubeGraph.h:49
Property for tube graphs.
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
std::vector< TubeGraphProperty::LabelGroup * > LabelGroupSetType