Medical Imaging Interaction Toolkit  2023.04.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 mitkTubeGraphProperty_h
14 #define mitkTubeGraphProperty_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;
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::LabelGroup::Label::isVisible
bool isVisible
Definition: mitkTubeGraphProperty.h:42
mitkTubeGraph.h
mitk::BaseProperty
Abstract base class for properties.
Definition: mitkBaseProperty.h:35
mitk::TubeGraphProperty::Annotation::description
std::string description
Definition: mitkTubeGraphProperty.h:58
mitk::TubeGraphProperty::TubeDescriptorType
TubeGraph::TubeDescriptorType TubeDescriptorType
Definition: mitkTubeGraphProperty.h:50
mitk::Color
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
Definition: mitkColorProperty.h:35
mitk::TubeGraph::TubeDescriptorType
std::pair< VertexDescriptorType, VertexDescriptorType > TubeDescriptorType
Definition: mitkTubeGraph.h:49
mitk::TubeGraphProperty::Annotation::name
std::string name
Definition: mitkTubeGraphProperty.h:57
MITKTUBEGRAPH_EXPORT
#define MITKTUBEGRAPH_EXPORT
Definition: MitkTubeGraphExports.h:15
mitk::TubeGraphProperty::Annotation
Definition: mitkTubeGraphProperty.h:55
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitk::TubeGraphProperty
Property for tube graphs.
Definition: mitkTubeGraphProperty.h:31
mitk::TubeGraphProperty::LabelGroup::labels
std::vector< Label * > labels
Definition: mitkTubeGraphProperty.h:46
mitk::TubeGraphProperty::LabelGroup
Definition: mitkTubeGraphProperty.h:37
mitk::TubeGraphProperty::LabelGroup::Label::labelColor
Color labelColor
Definition: mitkTubeGraphProperty.h:43
mitk::TubeGraphProperty::Annotation::tube
TubeDescriptorType tube
Definition: mitkTubeGraphProperty.h:59
mitk::TubeGraphProperty::LabelGroup::Label
Definition: mitkTubeGraphProperty.h:39
mitk::TubeGraphProperty::TubeToLabelGroupType
std::pair< TubeDescriptorType, std::string > TubeToLabelGroupType
Definition: mitkTubeGraphProperty.h:52
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitkColorProperty.h
mitk::TubeGraphProperty::LabelGroupSetType
std::vector< TubeGraphProperty::LabelGroup * > LabelGroupSetType
Definition: mitkTubeGraphProperty.h:51
mitk::TubeGraphProperty::LabelGroup::labelGroupName
std::string labelGroupName
Definition: mitkTubeGraphProperty.h:45
mitkBaseProperty.h
MitkTubeGraphExports.h
mitk::TubeGraphProperty::LabelGroup::Label::labelName
std::string labelName
Definition: mitkTubeGraphProperty.h:41