Medical Imaging Interaction Toolkit  2018.4.99-b20efe7f
Medical Imaging Interaction Toolkit
mitkDataNode.cpp
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 #include "mitkDataNode.h"
14 #include "mitkCoreObjectFactory.h"
15 #include <vtkTransform.h>
16 
17 #include "mitkGroupTagProperty.h"
18 #include "mitkProperties.h"
20 #include "mitkStringProperty.h"
21 //#include "mitkMaterialProperty.h"
22 #include "mitkColorProperty.h"
23 #include "mitkCoreObjectFactory.h"
24 #include "mitkGenericProperty.h"
25 #include "mitkGeometry3D.h"
26 #include "mitkImageSource.h"
28 #include "mitkRenderingManager.h"
29 
31 {
32  if ((id >= m_Mappers.size()) || (m_Mappers[id].IsNull()))
33  {
34  if (id >= m_Mappers.capacity())
35  {
36  // int i, size=id-m_Mappers.capacity()+10;
37  m_Mappers.resize(id + 10);
38  }
39  m_Mappers[id] = CoreObjectFactory::GetInstance()->CreateMapper(const_cast<DataNode *>(this), id);
40  }
41  return m_Mappers[id];
42 }
43 
45 {
46  return m_Data;
47 }
48 
50 {
51  if (m_Data != baseData)
52  {
53  m_Mappers.clear();
54  m_Mappers.resize(10);
55 
56  if (m_Data.IsNotNull() && baseData != nullptr)
57  {
58  // Do previous and new data have same type? Keep existing properties.
59  if (0 == strcmp(m_Data->GetNameOfClass(), baseData->GetNameOfClass()))
60  {
61  m_Data = baseData;
62  }
63  else
64  {
65  m_Data = baseData;
66  this->GetPropertyList()->Clear();
67  mitk::CoreObjectFactory::GetInstance()->SetDefaultProperties(this);
68  }
69  }
70  else
71  {
72  m_Data = baseData;
73  mitk::CoreObjectFactory::GetInstance()->SetDefaultProperties(this);
74  }
75 
76  m_DataReferenceChangedTime.Modified();
77  Modified();
78  }
79 }
80 
84 {
85  m_Mappers.resize(10);
86 
87  // subscribe for modified event
88  itk::MemberCommand<mitk::DataNode>::Pointer _PropertyListModifiedCommand = itk::MemberCommand<mitk::DataNode>::New();
89  _PropertyListModifiedCommand->SetCallbackFunction(this, &mitk::DataNode::PropertyListModified);
90  m_PropertyListModifiedObserverTag = m_PropertyList->AddObserver(itk::ModifiedEvent(), _PropertyListModifiedCommand);
91 }
92 
94 {
95  if (m_PropertyList.IsNotNull())
97 
98  m_Mappers.clear();
99  m_Data = nullptr;
100 }
101 
103 {
105  node->SetData(right.GetData());
106  return *node;
107 }
108 
110 {
112  node->SetData(right);
113  return *node;
114 }
115 
116 #if (_MSC_VER > 1200) || !defined(_MSC_VER)
117 std::istream &mitk::operator>>(std::istream &i, mitk::DataNode::Pointer &dtn)
118 #endif
119 #if ((defined(_MSC_VER)) && (_MSC_VER <= 1200))
120  std::istream &
121  operator>>(std::istream &i, mitk::DataNode::Pointer &dtn)
122 #endif
123 {
124  dtn = mitk::DataNode::New();
125  // i >> av.get();
126  return i;
127 }
128 
129 #if (_MSC_VER > 1200) || !defined(_MSC_VER)
130 std::ostream &mitk::operator<<(std::ostream &o, mitk::DataNode::Pointer &dtn)
131 #endif
132 #if ((defined(_MSC_VER)) && (_MSC_VER <= 1200))
133  std::ostream &
134  operator<<(std::ostream &o, mitk::DataNode::Pointer &dtn)
135 #endif
136 {
137  if (dtn->GetData() != nullptr)
138  o << dtn->GetData()->GetNameOfClass();
139  else
140  o << "empty data";
141  return o;
142 }
143 
145 {
146  m_Mappers[id] = mapper;
147 
148  if (mapper != nullptr)
149  mapper->SetDataNode(this);
150 }
151 
153 {
154  if (this->GetSource())
155  {
156  this->GetSource()->UpdateOutputInformation();
157  }
158 }
159 
161 {
162 }
163 
165 {
166  return false;
167 }
168 
170 {
171  return true;
172 }
173 
174 void mitk::DataNode::SetRequestedRegion(const itk::DataObject * /*data*/)
175 {
176 }
177 
179 {
180  PropertyListKeyNames result;
181 
182  for (auto entries : m_MapOfPropertyLists)
183  result.push_back(entries.first);
184 
185  return result;
186 }
187 
188 void mitk::DataNode::CopyInformation(const itk::DataObject * /*data*/)
189 {
190 }
192 {
193  if (renderer == nullptr)
194  return m_PropertyList;
195 
196  return this->GetPropertyList(renderer->GetName());
197 }
198 
199 mitk::PropertyList *mitk::DataNode::GetPropertyList(const std::string &rendererName) const
200 {
201  if (rendererName.empty())
202  return m_PropertyList;
203 
204  mitk::PropertyList::Pointer &propertyList = m_MapOfPropertyLists[rendererName];
205 
206  if (propertyList.IsNull())
207  propertyList = mitk::PropertyList::New();
208 
209  assert(m_MapOfPropertyLists[rendererName].IsNotNull());
210 
211  return propertyList;
212 }
213 
215 {
216  m_PropertyList->ConcatenatePropertyList(pList, replace);
217 }
218 
219 mitk::BaseProperty *mitk::DataNode::GetProperty(const char *propertyKey, const mitk::BaseRenderer *renderer, bool fallBackOnDataProperties) const
220 {
221  if (nullptr == propertyKey)
222  return nullptr;
223 
224  if (nullptr != renderer)
225  {
226  auto it = m_MapOfPropertyLists.find(renderer->GetName());
227 
228  if (m_MapOfPropertyLists.end() != it)
229  {
230  auto property = it->second->GetProperty(propertyKey);
231 
232  if (nullptr != property)
233  return property;
234  }
235  }
236 
237  auto property = m_PropertyList->GetProperty(propertyKey);
238 
239  if (nullptr == property && fallBackOnDataProperties && m_Data.IsNotNull())
240  property = m_Data->GetProperty(propertyKey);
241 
242  return property;
243 }
244 
246 {
247  GroupTagList groups;
248  const PropertyList::PropertyMap *propertyMap = m_PropertyList->GetMap();
249 
250  for (auto groupIter =
251  propertyMap->begin(); // m_PropertyList is created in the constructor, so we don't check it here
252  groupIter != propertyMap->end();
253  ++groupIter)
254  {
255  const BaseProperty *bp = groupIter->second;
256  if (dynamic_cast<const GroupTagProperty *>(bp))
257  {
258  groups.insert(groupIter->first);
259  }
260  }
261 
262  return groups;
263 }
264 
265 bool mitk::DataNode::GetBoolProperty(const char *propertyKey, bool &boolValue, const mitk::BaseRenderer *renderer) const
266 {
267  mitk::BoolProperty::Pointer boolprop = dynamic_cast<mitk::BoolProperty *>(GetProperty(propertyKey, renderer));
268  if (boolprop.IsNull())
269  return false;
270 
271  boolValue = boolprop->GetValue();
272  return true;
273 }
274 
275 bool mitk::DataNode::GetIntProperty(const char *propertyKey, int &intValue, const mitk::BaseRenderer *renderer) const
276 {
277  mitk::IntProperty::Pointer intprop = dynamic_cast<mitk::IntProperty *>(GetProperty(propertyKey, renderer));
278  if (intprop.IsNull())
279  return false;
280 
281  intValue = intprop->GetValue();
282  return true;
283 }
284 
285 bool mitk::DataNode::GetFloatProperty(const char *propertyKey,
286  float &floatValue,
287  const mitk::BaseRenderer *renderer) const
288 {
289  mitk::FloatProperty::Pointer floatprop = dynamic_cast<mitk::FloatProperty *>(GetProperty(propertyKey, renderer));
290  if (floatprop.IsNull())
291  return false;
292 
293  floatValue = floatprop->GetValue();
294  return true;
295 }
296 
297 bool mitk::DataNode::GetDoubleProperty(const char *propertyKey,
298  double &doubleValue,
299  const mitk::BaseRenderer *renderer) const
300 {
301  mitk::DoubleProperty::Pointer doubleprop = dynamic_cast<mitk::DoubleProperty *>(GetProperty(propertyKey, renderer));
302  if (doubleprop.IsNull())
303  {
304  // try float instead
305  float floatValue = 0;
306  if (this->GetFloatProperty(propertyKey, floatValue, renderer))
307  {
308  doubleValue = floatValue;
309  return true;
310  }
311  return false;
312  }
313 
314  doubleValue = doubleprop->GetValue();
315  return true;
316 }
317 
318 bool mitk::DataNode::GetStringProperty(const char *propertyKey,
319  std::string &string,
320  const mitk::BaseRenderer *renderer) const
321 {
322  mitk::StringProperty::Pointer stringProp = dynamic_cast<mitk::StringProperty *>(GetProperty(propertyKey, renderer));
323  if (stringProp.IsNull())
324  {
325  return false;
326  }
327  else
328  {
329  // memcpy((void*)string, stringProp->GetValue(), strlen(stringProp->GetValue()) + 1 ); // looks dangerous
330  string = stringProp->GetValue();
331  return true;
332  }
333 }
334 
335 bool mitk::DataNode::GetColor(float rgb[3], const mitk::BaseRenderer *renderer, const char *propertyKey) const
336 {
337  mitk::ColorProperty::Pointer colorprop = dynamic_cast<mitk::ColorProperty *>(GetProperty(propertyKey, renderer));
338  if (colorprop.IsNull())
339  return false;
340 
341  memcpy(rgb, colorprop->GetColor().GetDataPointer(), 3 * sizeof(float));
342  return true;
343 }
344 
345 bool mitk::DataNode::GetOpacity(float &opacity, const mitk::BaseRenderer *renderer, const char *propertyKey) const
346 {
347  mitk::FloatProperty::Pointer opacityprop = dynamic_cast<mitk::FloatProperty *>(GetProperty(propertyKey, renderer));
348  if (opacityprop.IsNull())
349  return false;
350 
351  opacity = opacityprop->GetValue();
352  return true;
353 }
354 
356  const mitk::BaseRenderer *renderer,
357  const char *propertyKey) const
358 {
360  dynamic_cast<mitk::LevelWindowProperty *>(GetProperty(propertyKey, renderer));
361  if (levWinProp.IsNull())
362  return false;
363 
364  levelWindow = levWinProp->GetLevelWindow();
365  return true;
366 }
367 
368 void mitk::DataNode::SetColor(const mitk::Color &color, const mitk::BaseRenderer *renderer, const char *propertyKey)
369 {
371  prop = mitk::ColorProperty::New(color);
372  GetPropertyList(renderer)->SetProperty(propertyKey, prop);
373 }
374 
376  float red, float green, float blue, const mitk::BaseRenderer *renderer, const char *propertyKey)
377 {
378  float color[3];
379  color[0] = red;
380  color[1] = green;
381  color[2] = blue;
382  SetColor(color, renderer, propertyKey);
383 }
384 
385 void mitk::DataNode::SetColor(const float rgb[3], const mitk::BaseRenderer *renderer, const char *propertyKey)
386 {
388  prop = mitk::ColorProperty::New(rgb);
389  GetPropertyList(renderer)->SetProperty(propertyKey, prop);
390 }
391 
392 void mitk::DataNode::SetVisibility(bool visible, const mitk::BaseRenderer *renderer, const char *propertyKey)
393 {
395  prop = mitk::BoolProperty::New(visible);
396  GetPropertyList(renderer)->SetProperty(propertyKey, prop);
397 }
398 
399 void mitk::DataNode::SetOpacity(float opacity, const mitk::BaseRenderer *renderer, const char *propertyKey)
400 {
402  prop = mitk::FloatProperty::New(opacity);
403  GetPropertyList(renderer)->SetProperty(propertyKey, prop);
404 }
405 
407  const mitk::BaseRenderer *renderer,
408  const char *propertyKey)
409 {
411  prop = mitk::LevelWindowProperty::New(levelWindow);
412  GetPropertyList(renderer)->SetProperty(propertyKey, prop);
413 }
414 
415 void mitk::DataNode::SetIntProperty(const char *propertyKey, int intValue, const mitk::BaseRenderer *renderer)
416 {
417  GetPropertyList(renderer)->SetProperty(propertyKey, mitk::IntProperty::New(intValue));
418 }
419 void mitk::DataNode::SetBoolProperty(const char *propertyKey,
420  bool boolValue,
421  const mitk::BaseRenderer *renderer /*=nullptr*/)
422 {
423  GetPropertyList(renderer)->SetProperty(propertyKey, mitk::BoolProperty::New(boolValue));
424 }
425 
426 void mitk::DataNode::SetFloatProperty(const char *propertyKey,
427  float floatValue,
428  const mitk::BaseRenderer *renderer /*=nullptr*/)
429 {
430  if (dynamic_cast<DoubleProperty *>(this->GetProperty(propertyKey, renderer)) != nullptr)
431  {
432  MITK_WARN << "Setting float property " << propertyKey
433  << " although a double property with the same name already exists";
434  }
435  GetPropertyList(renderer)->SetProperty(propertyKey, mitk::FloatProperty::New(floatValue));
436 }
437 
438 void mitk::DataNode::SetDoubleProperty(const char *propertyKey, double doubleValue, const mitk::BaseRenderer *renderer)
439 {
440  if (dynamic_cast<FloatProperty *>(this->GetProperty(propertyKey, renderer)) != nullptr)
441  {
442  MITK_WARN << "Setting double property " << propertyKey
443  << " although a float property with the same name already exists";
444  }
445  GetPropertyList(renderer)->SetProperty(propertyKey, mitk::DoubleProperty::New(doubleValue));
446 }
447 
448 void mitk::DataNode::SetStringProperty(const char *propertyKey,
449  const char *stringValue,
450  const mitk::BaseRenderer *renderer /*=nullptr*/)
451 {
452  GetPropertyList(renderer)->SetProperty(propertyKey, mitk::StringProperty::New(stringValue));
453 }
454 
455 void mitk::DataNode::SetProperty(const char *propertyKey,
456  BaseProperty *propertyValue,
457  const mitk::BaseRenderer *renderer)
458 {
459  GetPropertyList(renderer)->SetProperty(propertyKey, propertyValue);
460 }
461 
462 void mitk::DataNode::ReplaceProperty(const char *propertyKey,
463  BaseProperty *propertyValue,
464  const mitk::BaseRenderer *renderer)
465 {
466  GetPropertyList(renderer)->ReplaceProperty(propertyKey, propertyValue);
467 }
468 
469 void mitk::DataNode::AddProperty(const char *propertyKey,
470  BaseProperty *propertyValue,
471  const mitk::BaseRenderer *renderer,
472  bool overwrite)
473 {
474  if ((overwrite) || (GetProperty(propertyKey, renderer) == nullptr))
475  {
476  SetProperty(propertyKey, propertyValue, renderer);
477  }
478 }
479 
480 vtkLinearTransform *mitk::DataNode::GetVtkTransform(int t) const
481 {
482  assert(m_Data.IsNotNull());
483 
484  mitk::BaseGeometry *geometry = m_Data->GetGeometry(t);
485 
486  if (geometry == nullptr)
487  return nullptr;
488 
489  return geometry->GetVtkTransform();
490 }
491 
492 unsigned long mitk::DataNode::GetMTime() const
493 {
494  unsigned long time = Superclass::GetMTime();
495  if (m_Data.IsNotNull())
496  {
497  if ((time < m_Data->GetMTime()) || ((m_Data->GetSource().IsNotNull()) && (time < m_Data->GetSource()->GetMTime())))
498  {
499  Modified();
500  return Superclass::GetMTime();
501  }
502  }
503  return time;
504 }
505 
506 void mitk::DataNode::SetSelected(bool selected, const mitk::BaseRenderer *renderer)
507 {
508  mitk::BoolProperty::Pointer selectedProperty = dynamic_cast<mitk::BoolProperty *>(GetProperty("selected"));
509 
510  if (selectedProperty.IsNull())
511  {
512  selectedProperty = mitk::BoolProperty::New();
513  selectedProperty->SetValue(false);
514  SetProperty("selected", selectedProperty, renderer);
515  }
516 
517  if (selectedProperty->GetValue() != selected)
518  {
519  selectedProperty->SetValue(selected);
520  itk::ModifiedEvent event;
521  InvokeEvent(event);
522  }
523 }
524 
525 /*
526 class SelectedEvent : public itk::ModifiedEvent
527 {
528 public:
529  typedef SelectedEvent Self;
530  typedef itk::ModifiedEvent Superclass;
531 
532  SelectedEvent(DataNode* dataNode)
533  { m_DataNode = dataNode; };
534  DataNode* GetDataNode()
535  { return m_DataNode; };
536  virtual const char * GetEventName() const
537  { return "SelectedEvent"; }
538  virtual bool CheckEvent(const ::itk::EventObject* e) const
539  { return dynamic_cast<const Self*>(e); }
540  virtual ::itk::EventObject* MakeObject() const
541  { return new Self(m_DataNode); }
542 private:
543  DataNode* m_DataNode;
544  SelectedEvent(const Self& event)
545  { m_DataNode = event.m_DataNode; };
546  void operator=(const Self& event)
547  { m_DataNode = event.m_DataNode; }
548 };
549 */
550 
552 {
553  bool selected;
554 
555  if (!GetBoolProperty("selected", selected, renderer))
556  return false;
557 
558  return selected;
559 }
560 
562 {
563  if (m_DataInteractor == interactor)
564  return;
565 
566  m_DataInteractor = interactor;
567  this->Modified();
568 
569  mitk::DataNode::InteractorChangedEvent changedEvent;
570  this->InvokeEvent(changedEvent);
571 }
572 
574 {
575  return m_DataInteractor;
576 }
577 
578 void mitk::DataNode::PropertyListModified(const itk::Object * /*caller*/, const itk::EventObject &)
579 {
580  Modified();
581 }
582 
583 mitk::BaseProperty::ConstPointer mitk::DataNode::GetConstProperty(const std::string &propertyKey, const std::string &contextName, bool fallBackOnDefaultContext) const
584 {
585  if (propertyKey.empty())
586  return nullptr;
587 
588  if (!contextName.empty())
589  {
590  auto propertyListIter = m_MapOfPropertyLists.find(contextName);
591 
592  if (m_MapOfPropertyLists.end() != propertyListIter)
593  {
594  BaseProperty::ConstPointer property = propertyListIter->second->GetProperty(propertyKey);
595 
596  if (property.IsNotNull())
597  return property;
598  }
599  }
600 
601  if (contextName.empty() || fallBackOnDefaultContext)
602  {
603  BaseProperty::ConstPointer property = m_PropertyList->GetProperty(propertyKey);
604 
605  if (property.IsNull() && m_Data.IsNotNull())
606  property = m_Data->GetProperty(propertyKey.c_str());
607 
608  return property;
609  }
610 
611  return nullptr;
612 }
613 
614 mitk::BaseProperty * mitk::DataNode::GetNonConstProperty(const std::string &propertyKey, const std::string &contextName, bool fallBackOnDefaultContext)
615 {
616  if (propertyKey.empty())
617  return nullptr;
618 
619  if (!contextName.empty())
620  {
621  auto propertyListIter = m_MapOfPropertyLists.find(contextName);
622 
623  if (m_MapOfPropertyLists.end() != propertyListIter)
624  {
625  auto property = propertyListIter->second->GetProperty(propertyKey);
626 
627  if (nullptr != property)
628  return property;
629  }
630  }
631 
632  if (contextName.empty() || fallBackOnDefaultContext)
633  {
634  auto property = m_PropertyList->GetProperty(propertyKey);
635 
636  if (nullptr == property && m_Data.IsNotNull())
637  property = m_Data->GetProperty(propertyKey.c_str());
638 
639  return property;
640  }
641 
642  return nullptr;
643 }
644 
645 void mitk::DataNode::SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName, bool fallBackOnDefaultContext)
646 {
647  if (propertyKey.empty())
648  mitkThrow() << "Property key is empty.";
649 
650  if (!contextName.empty())
651  {
652  auto propertyListIter = m_MapOfPropertyLists.find(contextName);
653 
654  if (m_MapOfPropertyLists.end() != propertyListIter)
655  {
656  propertyListIter->second->SetProperty(propertyKey, property);
657  return;
658  }
659  }
660 
661  if (contextName.empty() || fallBackOnDefaultContext)
662  {
663  m_PropertyList->SetProperty(propertyKey, property);
664  return;
665  }
666 
667  mitkThrow() << "Unknown property context.";
668 }
669 
670 void mitk::DataNode::RemoveProperty(const std::string &propertyKey, const std::string &contextName, bool fallBackOnDefaultContext)
671 {
672  if (propertyKey.empty())
673  mitkThrow() << "Property key is empty.";
674 
675  if (!contextName.empty())
676  {
677  auto propertyListIter = m_MapOfPropertyLists.find(contextName);
678 
679  if (m_MapOfPropertyLists.end() != propertyListIter)
680  {
681  propertyListIter->second->RemoveProperty(propertyKey);
682  return;
683  }
684  }
685 
686  if (contextName.empty() || fallBackOnDefaultContext)
687  {
688  m_PropertyList->RemoveProperty(propertyKey);
689  return;
690  }
691 
692  mitkThrow() << "Unknown property context.";
693 }
694 
695 std::vector<std::string> mitk::DataNode::GetPropertyKeys(const std::string &contextName, bool includeDefaultContext) const
696 {
697  std::vector<std::string> propertyKeys;
698 
699  if (contextName.empty())
700  {
701  for (auto property : *m_PropertyList->GetMap())
702  propertyKeys.push_back(property.first);
703 
704  return propertyKeys;
705  }
706 
707  auto propertyListIter = m_MapOfPropertyLists.find(contextName);
708 
709  if (m_MapOfPropertyLists.end() != propertyListIter)
710  {
711  for (auto property : *propertyListIter->second->GetMap())
712  propertyKeys.push_back(property.first);
713  }
714 
715  if (includeDefaultContext)
716  {
717  for (auto property : *m_PropertyList->GetMap())
718  {
719  auto propertyKeyIter = std::find(propertyKeys.begin(), propertyKeys.end(), property.first);
720 
721  if (propertyKeys.end() == propertyKeyIter)
722  propertyKeys.push_back(property.first);
723  }
724  }
725 
726  return propertyKeys;
727 }
728 
729 std::vector<std::string> mitk::DataNode::GetPropertyContextNames() const
730 {
731  return this->GetPropertyListNames();
732 }
void SetIntProperty(const char *propertyKey, int intValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting int properties (instances of IntProperty)
mitk::BaseProperty * GetProperty(const char *propertyKey, const mitk::BaseRenderer *renderer=nullptr, bool fallBackOnDataProperties=true) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the rendere...
bool GetDoubleProperty(const char *propertyKey, double &doubleValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for double properties (instances of DoubleProperty)
static Pointer New()
std::vector< std::string > GetPropertyContextNames() const override
Query names of existing contexts.
static Pointer New()
BaseProperty * GetNonConstProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) override
Get property by its key.
mitk::DataNode & operator=(const DataNode &right)
MapperVector m_Mappers
Mapper-slots.
Definition: mitkDataNode.h:566
The LevelWindowProperty class Property for the mitk::LevelWindow.
std::set< std::string > GroupTagList
Definition: mitkDataNode.h:64
void SetVisibility(bool visible, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="visible")
Convenience method for setting visibility properties (instances of BoolProperty)
std::vector< MapOfPropertyLists::key_type > PropertyListKeyNames
Definition: mitkDataNode.h:63
signed integer value
Definition: jsoncpp.h:348
virtual void SetMapper(MapperSlotId id, mitk::Mapper *mapper)
Base of all data objects.
Definition: mitkBaseData.h:42
static Pointer New()
bool GetStringProperty(const char *propertyKey, std::string &string, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for string properties (instances of StringProperty)
~DataNode() override
void ReplaceProperty(const char *propertyKey, BaseProperty *property, const mitk::BaseRenderer *renderer=nullptr)
Replace the property (instance of BaseProperty) with key propertyKey in the PropertyList of the rende...
static Pointer New()
bool GetFloatProperty(const char *propertyKey, float &floatValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for float properties (instances of FloatProperty)
itk::TimeStamp m_DataReferenceChangedTime
Timestamp of the last change of m_Data.
Definition: mitkDataNode.h:588
virtual void SetData(mitk::BaseData *baseData)
Set the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
PropertyList::Pointer m_PropertyList
BaseRenderer-independent PropertyList.
Definition: mitkDataNode.h:580
Organizes the rendering process.
void CopyInformation(const itk::DataObject *data) override
MapOfPropertyLists m_MapOfPropertyLists
Map associating each BaseRenderer with its own PropertyList.
Definition: mitkDataNode.h:583
virtual void SetDataNode(DataNode *_arg)
Set the DataNode containing the data to map.
Key-value list holding instances of BaseProperty.
unsigned long GetMTime() const override
Get the timestamp of the last change of the contents of this node or the referenced BaseData...
bool GetBoolProperty(const char *propertyKey, bool &boolValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for bool properties (instances of BoolProperty)
bool GetOpacity(float &opacity, const mitk::BaseRenderer *renderer, const char *propertyKey="opacity") const
Convenience access method for opacity properties (instances of FloatProperty)
Base class of all mappers, Vtk as well as OpenGL mappers.
Definition: mitkMapper.h:49
void SetRequestedRegionToLargestPossibleRegion() override
bool GetIntProperty(const char *propertyKey, int &intValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for int properties (instances of IntProperty)
BaseData::Pointer m_Data
The data object (instance of BaseData, e.g., an Image) managed by this DataNode.
Definition: mitkDataNode.h:572
The LevelWindow class Class to store level/window values.
static Pointer New()
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Add new or change existent property.
void ConcatenatePropertyList(PropertyList *pList, bool replace=false)
Add values from another PropertyList.
The ColorProperty class RGB color property.
void SetFloatProperty(const char *propertyKey, float floatValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting float properties (instances of FloatProperty)
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
Abstract base class for properties.
void AddProperty(const char *propertyKey, BaseProperty *property, const mitk::BaseRenderer *renderer=nullptr, bool overwrite=false)
Add the property (instance of BaseProperty) if it does not exist (or always ifoverwrite istrue) with ...
#define MITK_WARN
Definition: mitkLogMacros.h:19
std::map< std::string, BaseProperty::Pointer > PropertyMap
MITKCORE_EXPORT std::istream & operator>>(std::istream &i, DataNode::Pointer &dtn)
bool GetColor(float rgb[3], const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="color") const
Convenience access method for color properties (instances of ColorProperty)
unsigned long m_PropertyListModifiedObserverTag
Definition: mitkDataNode.h:590
void SetOpacity(float opacity, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="opacity")
Convenience method for setting opacity properties (instances of FloatProperty)
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Add new or change existent property.
static Pointer New()
void ReplaceProperty(const std::string &propertyKey, BaseProperty *property)
Set a property object in the list/map by reference.
bool IsSelected(const mitk::BaseRenderer *renderer=nullptr)
set the node as selected
virtual DataInteractor::Pointer GetDataInteractor() const
std::vector< std::string > GetPropertyKeys(const std::string &contextName="", bool includeDefaultContext=false) const override
Query keys of existing properties.
#define mitkThrow()
bool VerifyRequestedRegion() override
void SetColor(const mitk::Color &color, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="color")
Convenience method for setting color properties (instances of ColorProperty)
GroupTagList GetGroupTags() const
Get a set of all group tags from this node&#39;s property list.
void UpdateOutputInformation() override
vtkLinearTransform * GetVtkTransform(int t=0) const
Get the transformation applied prior to displaying the data as a vtkTransform.
PropertyListKeyNames GetPropertyListNames() const
The "names" used for (renderer-specific) PropertyLists in GetPropertyList(string).
void SetDoubleProperty(const char *propertyKey, double doubleValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting double properties (instances of DoubleProperty)
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
void SetSelected(bool selected, const mitk::BaseRenderer *renderer=nullptr)
set the node as selected
static Pointer New()
void SetBoolProperty(const char *propertyKey, bool boolValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting boolean properties (instances of BoolProperty)
void RemoveProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Removes a property. If the property does not exist, nothing will be done.
mitk::PropertyList * GetPropertyList(const mitk::BaseRenderer *renderer=nullptr) const
Get the PropertyList of the renderer. If renderer is nullptr, the BaseRenderer-independent PropertyLi...
mitk::Mapper * GetMapper(MapperSlotId id) const
virtual void PropertyListModified(const itk::Object *caller, const itk::EventObject &event)
Invoked when the property list was modified. Calls Modified() of the DataNode.
static Pointer New()
DataInteractor::Pointer m_DataInteractor
Definition: mitkDataNode.h:585
UTF-8 string value.
Definition: jsoncpp.h:351
void SetStringProperty(const char *propertyKey, const char *string, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting string properties (instances of StringProperty)
static const char * replace[]
This is a dictionary to replace long names of classes, modules, etc. to shorter versions in the conso...
BaseProperty::ConstPointer GetConstProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const override
Get property by its key.
void SetLevelWindow(mitk::LevelWindow levelWindow, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="levelwindow")
Convenience method for setting level-window properties (instances of LevelWindowProperty) ...
void SetRequestedRegion(const itk::DataObject *data) override
Property for strings.
bool RequestedRegionIsOutsideOfTheBufferedRegion() override
virtual void SetDataInteractor(const DataInteractor::Pointer interactor)
Set the Interactor.
bool GetLevelWindow(mitk::LevelWindow &levelWindow, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="levelwindow") const
Convenience access method for level-window properties (instances of LevelWindowProperty) ...
unsigned int MapperSlotId
Definition: mitkCommon.h:33
static Pointer New()
BaseGeometry Describes the geometry of a data object.
MITKCORE_EXPORT std::ostream & operator<<(std::ostream &o, DataNode::Pointer &dtn)
const char * GetName() const
get the name of the Renderer
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57