Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef _mitk_TubeGraphProperty_h
18 #define _mitk_TubeGraphProperty_h
19 
20 #include <MitkTubeGraphExports.h>
21 
22 #include "mitkTubeGraph.h"
23 #include <mitkBaseProperty.h>
24 #include <mitkColorProperty.h>
25 
26 #include <itkObject.h>
27 #include <map>
28 #include <vector>
29 
30 namespace mitk
31 {
36  {
37  public:
39  itkNewMacro(TubeGraphProperty);
40 
41  struct LabelGroup
42  {
43  struct Label
44  {
45  std::string labelName;
46  bool isVisible;
48  };
49  std::string labelGroupName;
50  std::vector<Label *> labels;
51  };
52 
55  typedef std::vector<TubeGraphProperty::LabelGroup *> LabelGroupSetType;
56  typedef std::pair<TubeDescriptorType, std::string> TubeToLabelGroupType;
58 
59  struct Annotation
60  {
61  std::string name;
62  std::string description;
63  TubeDescriptorType tube;
64  };
65 
71  bool IsTubeVisible(const TubeDescriptorType &tube);
72 
78  void SetTubeActive(const TubeDescriptorType &tube, const bool &active);
79 
84  void SetTubesActive(std::vector<TubeDescriptorType> &tubes);
85 
91  bool IsTubeActive(const TubeDescriptorType &tube);
92 
93  std::vector<TubeDescriptorType> GetActiveTubes();
94 
95  Color GetColorOfTube(const TubeDescriptorType &tube);
96 
97  void SetTubesToLabels(std::map<TubeToLabelGroupType, std::string> tubeToLabelMap);
98 
99  std::map<TubeToLabelGroupType, std::string> GetTubesToLabels();
100 
104  void DeactivateAllTubes();
105 
106  void AddAnnotation(Annotation *annotation);
107  Annotation *GetAnnotationByName(std::string annotation);
108  std::vector<Annotation *> GetAnnotations();
109  void RemoveAnnotation(Annotation *annotation);
110 
111  void AddLabelGroup(LabelGroup *labelGroup, unsigned int position); // Add LG by name and vec<labelName>??
112  void RemoveLabelGroup(LabelGroup *labelGroup);
113  LabelGroupSetType GetLabelGroups();
114  unsigned int GetNumberOfLabelGroups();
115  unsigned int GetIndexOfLabelGroup(LabelGroup *labelGroup);
116  LabelGroup *GetLabelGroupByName(std::string labelGroup);
117 
118  void SetLabelVisibility(LabelGroup::Label *label, bool isVisible);
119  void SetLabelColor(LabelGroup::Label *label, Color color);
120  void RenameLabel(LabelGroup *labelGroup, LabelGroup::Label *label, std::string newName);
121  void SetLabelForActivatedTubes(LabelGroup *labelGroup, LabelGroup::Label *label);
122 
123  LabelGroup::Label *GetLabelByName(LabelGroup *labelGroup, std::string labelName);
124 
125  virtual std::string GetValueAsString() const override;
126 
127  protected:
129  TubeGraphProperty(const TubeGraphProperty &other);
130  virtual ~TubeGraphProperty();
131 
132  private:
133  std::vector<TubeDescriptorType> m_ActiveTubes;
134  LabelGroupSetType m_LabelGroups;
135  std::map<TubeToLabelGroupType, std::string> m_TubeToLabelsMap;
136  std::vector<Annotation *> m_Annotations;
137 
138  bool TubeDescriptorsCompare(const TubeDescriptorType &tube1, const TubeDescriptorType &tube2);
139 
140  // purposely not implemented
141  TubeGraphProperty &operator=(const TubeGraphProperty &);
142 
143  virtual bool IsEqual(const BaseProperty &property) const override;
144  virtual bool Assign(const BaseProperty &property) override;
145  virtual itk::LightObject::Pointer InternalClone() const override;
146  };
147 
148 } // namespace mitk
149 
150 #endif /* _mitk_TubeGraphProperty_h */
TubeGraph::TubeDescriptorType TubeDescriptorType
#define MITKTUBEGRAPH_EXPORT
itk::SmartPointer< Self > Pointer
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:43
Property for tube graphs.
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
std::vector< TubeGraphProperty::LabelGroup * > LabelGroupSetType