13 #ifndef mitkDataNode_h
14 #define mitkDataNode_h
33 class vtkLinearTransform;
86 itkFactorylessNewMacro(Self);
105 BaseProperty::ConstPointer
GetConstProperty(
const std::string &propertyKey,
const std::string &contextName =
"",
bool fallBackOnDefaultContext =
true)
const override;
115 std::vector<std::string>
GetPropertyKeys(
const std::string &contextName =
"",
bool includeDefaultContext =
false)
const override;
154 void SetProperty(
const std::string &propertyKey,
BaseProperty *property,
const std::string &contextName =
"",
bool fallBackOnDefaultContext =
false)
override;
166 void RemoveProperty(
const std::string &propertyKey,
const std::string &contextName =
"",
bool fallBackOnDefaultContext =
false)
override;
195 template <
typename T>
198 return dynamic_cast<T*
>(this->GetData());
350 bool overwrite =
false);
417 template <
typename T>
419 const char *propertyKey,
422 property =
dynamic_cast<T *
>(GetProperty(propertyKey, renderer));
423 return property.IsNotNull();
437 template <
typename T>
440 property =
dynamic_cast<T *
>(GetProperty(propertyKey, renderer));
441 return property !=
nullptr;
455 template <
typename T>
557 const char *propertyKey =
"levelwindow")
const;
587 const char *propertyKey =
"name")
const
589 return GetStringProperty(propertyKey, nodeName, renderer);
629 auto* data = this->GetData();
633 auto property = data->GetProperty(
"name");
635 if (property.IsNotNull())
637 auto* stringProperty =
dynamic_cast<StringProperty*
>(
property.GetPointer());
639 if (
nullptr != stringProperty)
647 this->SetStringProperty(
"name", name);
663 return GetBoolProperty(propertyKey, visible, renderer);
688 if (propertyKey ==
nullptr)
690 GetBoolProperty(propertyKey, defaultIsOn, renderer);
706 const char *propertyKey =
"visible",
707 bool defaultIsOn =
true)
const
709 return IsOn(propertyKey, renderer, defaultIsOn);
722 const char *propertyKey =
"color");
738 const char *propertyKey =
"color");
779 const char *propertyKey =
"levelwindow");
Base class of all data objects.
Abstract base class for properties.
Organizes the rendering process.
Central node class of the MITK data tree, associating a data object with properties and mappers.
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...
bool IsSelected(const mitk::BaseRenderer *renderer=nullptr)
Query whether this node is currently selected.
unsigned long m_PropertyListModifiedObserverTag
PropertyListKeyNames GetPropertyListNames() const
The "names" used for (renderer-specific) PropertyLists in GetPropertyList(string).
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).
mitk::PropertyList * GetPropertyList(const mitk::BaseRenderer *renderer=nullptr) const
Get the PropertyList of the renderer. If renderer is nullptr, the BaseRenderer-independent PropertyLi...
bool GetDoubleProperty(const char *propertyKey, double &doubleValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for double properties (instances of DoubleProperty).
virtual void SetDataInteractor(const DataInteractor::Pointer interactor)
Set the DataInteractor associated with this node.
unsigned long GetDataReferenceChangedTime() const
Get the timestamp of the last change of the reference to the BaseData.
bool VerifyRequestedRegion() override
Verify that the requested region is valid.
virtual void SetName(const std::string &name)
Extra convenience access method to set the name of an object.
std::map< std::string, mitk::PropertyList::Pointer > MapOfPropertyLists
Map from renderer name strings to renderer-specific PropertyList instances.
void SetLevelWindow(mitk::LevelWindow levelWindow, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="levelwindow")
Convenience method for setting level-window properties (instances of LevelWindowProperty).
static std::string NO_NAME_VALUE()
Sentinel value indicating that a node name has not been set yet.
void SetRequestedRegionToLargestPossibleRegion() override
Set the requested region to the largest possible region (no-op for DataNode).
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Set a property in the given context (IPropertyOwner interface).
void SetRequestedRegion(const itk::DataObject *data) override
Set the requested region from another data object (no-op for DataNode).
PropertyList::Pointer m_PropertyList
BaseRenderer-independent PropertyList.
virtual DataInteractor::Pointer GetDataInteractor() const
Get the DataInteractor associated with this node.
mitk::Mapper * GetMapper(MapperSlotId id) const
Get the Mapper for the given mapper slot, creating it on demand if necessary.
std::vector< MapOfPropertyLists::key_type > PropertyListKeyNames
Vector of renderer name keys used in the MapOfPropertyLists.
mitk::Geometry3D::Pointer Geometry3DPointer
Smart pointer type for Geometry3D.
itk::TimeStamp m_DataReferenceChangedTime
Timestamp of the last change of m_Data.
virtual void SetMapper(MapperSlotId id, mitk::Mapper *mapper)
Set a specific Mapper for the given mapper slot.
bool GetName(std::string &nodeName, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="name") const
Convenience access method for accessing the name of an object (instance of StringProperty with proper...
std::vector< itk::SmartPointer< Mapper > > MapperVector
Vector of Mapper smart pointers, indexed by MapperSlotId.
bool IsVisible(const mitk::BaseRenderer *renderer, const char *propertyKey="visible", bool defaultIsOn=true) const
Convenience access method for visibility properties (instances of BoolProperty). Return value is the ...
bool GetBoolProperty(const char *propertyKey, bool &boolValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for bool properties (instances of BoolProperty).
void SetColor(const float rgb[3], const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="color")
Convenience method for setting color properties from a float array.
bool GetProperty(itk::SmartPointer< T > &property, const char *propertyKey, const mitk::BaseRenderer *renderer=nullptr) const
Get the property of type T with key propertyKey from the PropertyList of the renderer,...
virtual void SetData(mitk::BaseData *baseData)
Set the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
mitkClassMacroItkParent(DataNode, itk::DataObject)
bool GetColor(float rgb[3], const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="color") const
Convenience access method for color properties (instances of ColorProperty).
bool GetOpacity(float &opacity, const mitk::BaseRenderer *renderer, const char *propertyKey="opacity") const
Convenience access method for opacity properties (instances of FloatProperty).
void SetColor(float red, float green, float blue, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="color")
Convenience method for setting color properties from individual RGB components.
mitk::DataNode & operator=(BaseData *right)
Assignment operator. Creates a new DataNode with the given BaseData.
T * GetDataAs() const
Convenience method to get the data object cast to a specific type.
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
GroupTagList GetGroupTags() const
Get a set of all group tags from this node's property list.
void SetProperty(const char *propertyKey, BaseProperty *property, const mitk::BaseRenderer *renderer=nullptr)
Set the property (instance of BaseProperty) with key propertyKey in the PropertyList of the renderer ...
std::vector< std::string > GetPropertyContextNames() const override
Retrieve all available property context names (IPropertyProvider interface).
virtual void PropertyListModified(const itk::Object *caller, const itk::EventObject &event)
Invoked when the property list was modified. Calls Modified() of the DataNode.
bool GetVisibility(bool &visible, const mitk::BaseRenderer *renderer, const char *propertyKey="visible") const
Convenience access method for visibility properties (instances of BoolProperty with property-key "vis...
void SetVisibility(bool visible, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="visible")
Convenience method for setting visibility properties (instances of BoolProperty)
virtual std::string GetName() const
Extra convenience access method for accessing the name of an object (instance of StringProperty with ...
itk::ModifiedTimeType GetMTime() const override
Get the timestamp of the last change of the contents of this node or the referenced BaseData.
bool RequestedRegionIsOutsideOfTheBufferedRegion() override
Check if the requested region is outside of the buffered region.
void SetDoubleProperty(const char *propertyKey, double doubleValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting double properties (instances of DoubleProperty).
void SetOpacity(float opacity, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="opacity")
Convenience method for setting opacity properties (instances of FloatProperty).
BaseData::Pointer m_Data
The data object (instance of BaseData, e.g., an Image) managed by this DataNode.
bool GetFloatProperty(const char *propertyKey, float &floatValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for float properties (instances of FloatProperty).
DataInteractor::Pointer m_DataInteractor
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 ...
void SetColor(const mitk::Color &color, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="color")
Convenience method for setting color properties (instances of ColorProperty).
void UpdateOutputInformation() override
Update the output information by calling the source's UpdateOutputInformation().
void SetStringProperty(const char *propertyKey, const char *string, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting string properties (instances of StringProperty).
mitk::PropertyList * GetPropertyList(const std::string &rendererName) const
Get the PropertyList for a renderer identified by name.
virtual void SetName(const char *name)
Extra convenience access method to set the name of an object.
BaseProperty::ConstPointer GetConstProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const override
Retrieve a property as a const pointer (IPropertyProvider interface).
bool GetIntProperty(const char *propertyKey, int &intValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for int properties (instances of IntProperty).
bool IsOn(const char *propertyKey, const mitk::BaseRenderer *renderer, bool defaultIsOn=true) const
Convenience access method for boolean properties (instances of BoolProperty). Return value is the val...
std::set< std::string > GroupTagList
Set of group tag name strings (keys of GroupTagProperty entries).
void RemoveProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Remove a property from the given context (IPropertyOwner interface).
std::vector< std::string > GetPropertyKeys(const std::string &contextName="", bool includeDefaultContext=false) const override
Retrieve all property keys for a given context (IPropertyProvider interface).
void SetBoolProperty(const char *propertyKey, bool boolValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting boolean properties (instances of BoolProperty).
MapOfPropertyLists m_MapOfPropertyLists
Map associating each BaseRenderer with its own PropertyList.
MapperVector m_Mappers
Mapper-slots.
void ConcatenatePropertyList(PropertyList *pList, bool replace=false)
Add values from another PropertyList.
bool GetStringProperty(const char *propertyKey, std::string &string, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for string properties (instances of StringProperty).
vtkLinearTransform * GetVtkTransform(int t=0) const
Get the transformation applied prior to displaying the data as a vtkTransform.
bool GetPropertyValue(const char *propertyKey, T &value, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for GenericProperty<T> properties.
void SetFloatProperty(const char *propertyKey, float floatValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting float properties (instances of FloatProperty).
BaseProperty * GetNonConstProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) override
Retrieve a mutable property pointer (IPropertyOwner interface).
void CopyInformation(const itk::DataObject *data) override
Copy information from another data object (no-op for DataNode).
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...
mitk::DataNode & operator=(const DataNode &right)
Assignment operator. Creates a new DataNode with the data from right.
void SetSelected(bool selected, const mitk::BaseRenderer *renderer=nullptr)
Set the selection state of this node.
void SetIntProperty(const char *propertyKey, int intValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting int properties (instances of IntProperty).
bool GetProperty(T *&property, const char *propertyKey, const mitk::BaseRenderer *renderer=nullptr) const
Get the property of type T with key propertyKey from the PropertyList of the renderer,...
Template class for generating properties for simple value types (int, float, bool,...
virtual T GetValue() const
Get the property value.
Interface implemented by classes that provide write/read access to property information.
The LevelWindow class Class to store level/window values.
Base class of all mappers, Vtk as well as OpenGL mappers.
Key-value list holding instances of BaseProperty.
Property for storing string values.
virtual const char * GetValue() const
Get the string value.
virtual void SetValue(const char *_arg)
Set the string value.
unsigned int MapperSlotId
Find image slices visible on a given plane.
MITKCORE_EXPORT std::istream & operator>>(std::istream &i, DataNode::Pointer &dtn)
Stream input operator for DataNode smart pointers.
static const char * replace[]
Dictionary for abbreviating class, module, and namespace names in log output.
itk::RGBPixel< float > Color
Standard RGB color typedef using float components.
MITKCORE_EXPORT std::ostream & operator<<(std::ostream &o, DataNode::Pointer &dtn)
Stream output operator for DataNode smart pointers.
itkEventMacroDeclaration(BoundingShapeInteractionEvent, itk::AnyEvent)