15 #include <vtkTransform.h> 56 if (
m_Data.IsNotNull() && baseData !=
nullptr)
59 if (0 == strcmp(
m_Data->GetNameOfClass(), baseData->GetNameOfClass()))
88 itk::MemberCommand<mitk::DataNode>::Pointer _PropertyListModifiedCommand = itk::MemberCommand<mitk::DataNode>::New();
116 #if (_MSC_VER > 1200) || !defined(_MSC_VER) 119 #if ((defined(_MSC_VER)) && (_MSC_VER <= 1200)) 129 #if (_MSC_VER > 1200) || !defined(_MSC_VER) 132 #if ((defined(_MSC_VER)) && (_MSC_VER <= 1200)) 137 if (dtn->GetData() !=
nullptr)
138 o << dtn->GetData()->GetNameOfClass();
148 if (mapper !=
nullptr)
154 if (this->GetSource())
156 this->GetSource()->UpdateOutputInformation();
183 result.push_back(entries.first);
193 if (renderer ==
nullptr)
201 if (rendererName.empty())
206 if (propertyList.IsNull())
221 if (
nullptr == propertyKey)
224 if (
nullptr != renderer)
230 auto property = it->second->GetProperty(propertyKey);
232 if (
nullptr != property)
239 if (
nullptr == property && fallBackOnDataProperties &&
m_Data.IsNotNull())
240 property =
m_Data->GetProperty(propertyKey);
250 for (
auto groupIter =
251 propertyMap->begin();
252 groupIter != propertyMap->end();
256 if (dynamic_cast<const GroupTagProperty *>(bp))
258 groups.insert(groupIter->first);
268 if (boolprop.IsNull())
271 boolValue = boolprop->GetValue();
278 if (intprop.IsNull())
281 intValue = intprop->GetValue();
290 if (floatprop.IsNull())
293 floatValue = floatprop->GetValue();
302 if (doubleprop.IsNull())
305 float floatValue = 0;
308 doubleValue = floatValue;
314 doubleValue = doubleprop->GetValue();
323 if (stringProp.IsNull())
330 string = stringProp->GetValue();
338 if (colorprop.IsNull())
341 memcpy(rgb, colorprop->GetColor().GetDataPointer(), 3 *
sizeof(float));
348 if (opacityprop.IsNull())
351 opacity = opacityprop->GetValue();
357 const char *propertyKey)
const 361 if (levWinProp.IsNull())
364 levelWindow = levWinProp->GetLevelWindow();
376 float red,
float green,
float blue,
const mitk::BaseRenderer *renderer,
const char *propertyKey)
382 SetColor(color, renderer, propertyKey);
408 const char *propertyKey)
430 if (dynamic_cast<DoubleProperty *>(this->
GetProperty(propertyKey, renderer)) !=
nullptr)
432 MITK_WARN <<
"Setting float property " << propertyKey
433 <<
" although a double property with the same name already exists";
440 if (dynamic_cast<FloatProperty *>(this->
GetProperty(propertyKey, renderer)) !=
nullptr)
442 MITK_WARN <<
"Setting double property " << propertyKey
443 <<
" although a float property with the same name already exists";
474 if ((overwrite) || (
GetProperty(propertyKey, renderer) ==
nullptr))
482 assert(
m_Data.IsNotNull());
486 if (geometry ==
nullptr)
489 return geometry->GetVtkTransform();
494 unsigned long time = Superclass::GetMTime();
497 if ((time < m_Data->
GetMTime()) || ((
m_Data->GetSource().IsNotNull()) && (time < m_Data->GetSource()->GetMTime())))
500 return Superclass::GetMTime();
510 if (selectedProperty.IsNull())
513 selectedProperty->SetValue(
false);
514 SetProperty(
"selected", selectedProperty, renderer);
517 if (selectedProperty->GetValue() != selected)
519 selectedProperty->SetValue(selected);
520 itk::ModifiedEvent event;
569 mitk::DataNode::InteractorChangedEvent changedEvent;
570 this->InvokeEvent(changedEvent);
585 if (propertyKey.empty())
588 if (!contextName.empty())
596 if (property.IsNotNull())
601 if (contextName.empty() || fallBackOnDefaultContext)
605 if (property.IsNull() &&
m_Data.IsNotNull())
606 property =
m_Data->GetProperty(propertyKey.c_str());
616 if (propertyKey.empty())
619 if (!contextName.empty())
625 auto property = propertyListIter->second->GetProperty(propertyKey);
627 if (
nullptr != property)
632 if (contextName.empty() || fallBackOnDefaultContext)
636 if (
nullptr == property &&
m_Data.IsNotNull())
637 property =
m_Data->GetProperty(propertyKey.c_str());
647 if (propertyKey.empty())
650 if (!contextName.empty())
656 propertyListIter->second->SetProperty(propertyKey, property);
661 if (contextName.empty() || fallBackOnDefaultContext)
667 mitkThrow() <<
"Unknown property context.";
672 if (propertyKey.empty())
675 if (!contextName.empty())
681 propertyListIter->second->RemoveProperty(propertyKey);
686 if (contextName.empty() || fallBackOnDefaultContext)
692 mitkThrow() <<
"Unknown property context.";
697 std::vector<std::string> propertyKeys;
699 if (contextName.empty())
702 propertyKeys.push_back(property.first);
711 for (
auto property : *propertyListIter->second->GetMap())
712 propertyKeys.push_back(property.first);
715 if (includeDefaultContext)
719 auto propertyKeyIter = std::find(propertyKeys.begin(), propertyKeys.end(),
property.first);
721 if (propertyKeys.end() == propertyKeyIter)
722 propertyKeys.push_back(property.first);
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)
std::vector< std::string > GetPropertyContextNames() const override
Query names of existing contexts.
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.
The LevelWindowProperty class Property for the mitk::LevelWindow.
std::set< std::string > GroupTagList
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
virtual void SetMapper(MapperSlotId id, mitk::Mapper *mapper)
Base of all data objects.
bool GetStringProperty(const char *propertyKey, std::string &string, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for string properties (instances of StringProperty)
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 GetInstance()
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.
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.
Organizes the rendering process.
void CopyInformation(const itk::DataObject *data) override
MapOfPropertyLists m_MapOfPropertyLists
Map associating each BaseRenderer with its own PropertyList.
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.
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.
The LevelWindow class Class to store level/window values.
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 ...
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
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.
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.
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'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
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.
DataInteractor::Pointer m_DataInteractor
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
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
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.