24 m_ActiveTubes(other.m_ActiveTubes),
25 m_LabelGroups(other.m_LabelGroups),
26 m_TubeToLabelsMap(other.m_TubeToLabelsMap),
27 m_Annotations(other.m_Annotations)
33 m_ActiveTubes.clear();
34 m_TubeToLabelsMap.clear();
36 for (
auto it = m_LabelGroups.begin(); it != m_LabelGroups.end(); it++)
38 m_LabelGroups.clear();
44 if (m_LabelGroups.size() > 0)
46 for (
auto it = m_TubeToLabelsMap.begin(); it != m_TubeToLabelsMap.end(); it++)
48 if (this->TubeDescriptorsCompare(tube, (*it).first.first))
69 for (std::vector<TubeDescriptorType>::const_iterator it = m_ActiveTubes.begin(); it != m_ActiveTubes.end(); it++)
71 if (this->TubeDescriptorsCompare(tube, (*it)))
77 m_ActiveTubes.push_back(tube);
83 for (
auto it = m_ActiveTubes.begin(); it != m_ActiveTubes.end(); it++)
85 if (this->TubeDescriptorsCompare(tube, (*it)))
87 m_ActiveTubes.erase(it);
99 for (
auto it = tubes.begin(); it != tubes.end(); it++)
105 for (std::vector<TubeDescriptorType>::const_iterator it = m_ActiveTubes.begin(); it != m_ActiveTubes.end(); it++)
107 if (this->TubeDescriptorsCompare((*it), tube))
115 return m_ActiveTubes;
121 m_ActiveTubes.clear();
127 for (
auto it = m_Annotations.begin(); it != m_Annotations.end(); it++)
129 if ((*it)->name == annotation->
name)
131 MITK_INFO <<
"An Annotation with this name already exists.";
135 m_Annotations.push_back(annotation);
139 for (
auto it = m_Annotations.begin(); it != m_Annotations.end(); it++)
141 if ((*it)->name == annotation)
148 return m_Annotations;
152 for (
auto it = m_Annotations.begin(); it != m_Annotations.end(); it++)
154 if ((*it)->name == annotation->
name)
156 m_Annotations.erase(it);
170 bool isActive(
false);
171 bool hasLabel(
false);
173 for (std::vector<TubeDescriptorType>::const_iterator it = m_ActiveTubes.begin(); it != m_ActiveTubes.end(); it++)
175 if (this->TubeDescriptorsCompare(tube, (*it)))
188 if (m_LabelGroups.size() > 0)
190 for (
auto it = m_TubeToLabelsMap.begin(); it != m_TubeToLabelsMap.end(); it++)
192 if (this->TubeDescriptorsCompare(tube, (*it).first.first))
214 bool isUndefined(label->
labelName.compare(
"Undefined") == 0);
215 for (
unsigned int i = 0; i < m_ActiveTubes.size(); i++)
217 bool isInList(
false);
218 for (
auto it = m_TubeToLabelsMap.begin(); it != m_TubeToLabelsMap.end(); it++)
220 if ((this->TubeDescriptorsCompare(it->first.first, m_ActiveTubes[i])) &&
226 m_TubeToLabelsMap.erase(it);
236 if (!isInList && !isUndefined)
239 m_TubeToLabelsMap.insert(std::pair<TubeToLabelGroupType, std::string>(tubeToLabelGroup, label->
labelName));
243 m_ActiveTubes.clear();
248 m_TubeToLabelsMap = tubeToLabelMap;
253 return m_TubeToLabelsMap;
259 for (
auto it = m_LabelGroups.begin(); it != m_LabelGroups.end(); it++)
261 if (labelGroup->
labelGroupName.compare((*it)->labelGroupName) == 0)
263 MITK_ERROR <<
"The label group must be unique! This name already exists!";
269 if (position < m_LabelGroups.size() - 1)
271 auto it = m_LabelGroups.begin() + position;
272 m_LabelGroups.insert(it, labelGroup);
276 m_LabelGroups.push_back(labelGroup);
279 if (position >= m_LabelGroups.size())
280 MITK_INFO <<
"Position is out of space. So the label group was added on last position: " 281 << m_LabelGroups.size() - 1;
288 auto foundElement = std::find(m_LabelGroups.begin(), m_LabelGroups.end(), labelGroup);
289 unsigned int pos = foundElement - m_LabelGroups.begin();
292 if (pos < m_LabelGroups.size())
295 for (
auto it = m_TubeToLabelsMap.begin(); it != m_TubeToLabelsMap.end(); it++)
298 m_TubeToLabelsMap.erase(it);
301 m_LabelGroups.erase(foundElement);
305 MITK_ERROR <<
"Could not find the label group!";
336 for (
auto it = m_TubeToLabelsMap.begin(); it != m_TubeToLabelsMap.end(); it++)
341 if (label->
labelName.compare((*it).second) == 0)
343 (*it).second = newName;
353 return m_LabelGroups;
358 return m_LabelGroups.size();
363 unsigned int pos = std::find(m_LabelGroups.begin(), m_LabelGroups.end(), labelGroup) - m_LabelGroups.begin();
365 if (pos < m_LabelGroups.size())
370 MITK_ERROR <<
"Could not find such a label group!";
371 return m_LabelGroups.size();
377 for (
auto it = m_LabelGroups.begin(); it != m_LabelGroups.end(); it++)
379 if (labelGroup.compare((*it)->labelGroupName) == 0)
383 MITK_ERROR <<
"Could not find such a label group!";
388 std::string labelName)
390 for (
auto it = labelGroup->
labels.begin(); it != labelGroup->
labels.end(); it++)
392 if (labelName.compare((*it)->labelName) == 0)
402 if (((tube1.first == tube2.first) && (tube1.second == tube2.second)) ||
403 ((tube1.first == tube2.second) && (tube1.second == tube2.first)))
409 bool mitk::TubeGraphProperty::IsEqual(
const BaseProperty &)
const 414 bool mitk::TubeGraphProperty::Assign(
const BaseProperty &)
424 itk::LightObject::Pointer mitk::TubeGraphProperty::InternalClone()
const 426 itk::LightObject::Pointer result(
new Self(*
this));
~TubeGraphProperty() override
TubeGraph::TubeDescriptorType TubeDescriptorType
unsigned int GetNumberOfLabelGroups()
void DeactivateAllTubes()
void SetTubesToLabels(std::map< TubeToLabelGroupType, std::string > tubeToLabelMap)
void SetLabelForActivatedTubes(LabelGroup *labelGroup, LabelGroup::Label *label)
void RemoveAnnotation(Annotation *annotation)
void SetLabelColor(LabelGroup::Label *label, Color color)
LabelGroup * GetLabelGroupByName(std::string labelGroup)
void AddAnnotation(Annotation *annotation)
Color GetColorOfTube(const TubeDescriptorType &tube)
void AddLabelGroup(LabelGroup *labelGroup, unsigned int position)
Abstract base class for properties.
LabelGroupSetType GetLabelGroups()
std::pair< TubeDescriptorType, std::string > TubeToLabelGroupType
std::vector< TubeDescriptorType > GetActiveTubes()
Property for tube graphs.
std::vector< Annotation * > GetAnnotations()
void RemoveLabelGroup(LabelGroup *labelGroup)
void SetTubeActive(const TubeDescriptorType &tube, const bool &active)
std::map< TubeToLabelGroupType, std::string > GetTubesToLabels()
LabelGroup::Label * GetLabelByName(LabelGroup *labelGroup, std::string labelName)
std::string labelGroupName
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
void SetLabelVisibility(LabelGroup::Label *label, bool isVisible)
void SetTubesActive(std::vector< TubeDescriptorType > &tubes)
void RenameLabel(LabelGroup *labelGroup, LabelGroup::Label *label, std::string newName)
unsigned int GetIndexOfLabelGroup(LabelGroup *labelGroup)
std::vector< TubeGraphProperty::LabelGroup * > LabelGroupSetType
Annotation * GetAnnotationByName(std::string annotation)
bool IsTubeVisible(const TubeDescriptorType &tube)
std::string GetValueAsString() const override
bool IsTubeActive(const TubeDescriptorType &tube)
std::vector< Label * > labels