13 #ifndef mitkDataNode_h
14 #define mitkDataNode_h
35 class vtkLinearTransform;
73 itkFactorylessNewMacro(Self);
76 BaseProperty::ConstPointer
GetConstProperty(
const std::string &propertyKey,
const std::string &contextName =
"",
bool fallBackOnDefaultContext =
true)
const override;
77 std::vector<std::string>
GetPropertyKeys(
const std::string &contextName =
"",
bool includeDefaultContext =
false)
const override;
82 void SetProperty(
const std::string &propertyKey,
BaseProperty *property,
const std::string &contextName =
"",
bool fallBackOnDefaultContext =
false)
override;
83 void RemoveProperty(
const std::string &propertyKey,
const std::string &contextName =
"",
bool fallBackOnDefaultContext =
false)
override;
96 return dynamic_cast<T*
>(this->GetData());
194 bool overwrite =
false);
251 template <
typename T>
253 const char *propertyKey,
256 property =
dynamic_cast<T *
>(GetProperty(propertyKey, renderer));
257 return property.IsNotNull();
271 template <
typename T>
274 property =
dynamic_cast<T *
>(GetProperty(propertyKey, renderer));
275 return property !=
nullptr;
283 template <
typename T>
357 const char *propertyKey =
"levelwindow")
const;
377 const char *propertyKey =
"name")
const
379 return GetStringProperty(propertyKey, nodeName, renderer);
416 auto* data = this->GetData();
420 auto property = data->GetProperty(
"name");
422 if (property.IsNotNull())
424 auto* stringProperty =
dynamic_cast<StringProperty*
>(
property.GetPointer());
426 if (
nullptr != stringProperty)
434 this->SetStringProperty(
"name", name);
450 return GetBoolProperty(propertyKey, visible, renderer);
471 if (propertyKey ==
nullptr)
473 GetBoolProperty(propertyKey, defaultIsOn, renderer);
489 const char *propertyKey =
"visible",
490 bool defaultIsOn =
true)
const
492 return IsOn(propertyKey, renderer, defaultIsOn);
501 const char *propertyKey =
"color");
511 const char *propertyKey =
"color");
540 const char *propertyKey =
"levelwindow");
Base of all data objects.
Abstract base class for properties.
Class for nodes of the DataTree.
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)
set the node as 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 Interactor.
unsigned long GetDataReferenceChangedTime() const
Get the timestamp of the last change of the reference to the BaseData.
bool VerifyRequestedRegion() override
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
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()
void SetRequestedRegionToLargestPossibleRegion() override
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Add new or change existent property.
void SetRequestedRegion(const itk::DataObject *data) override
PropertyList::Pointer m_PropertyList
BaseRenderer-independent PropertyList.
virtual DataInteractor::Pointer GetDataInteractor() const
mitk::Mapper * GetMapper(MapperSlotId id) const
std::vector< MapOfPropertyLists::key_type > PropertyListKeyNames
mitk::Geometry3D::Pointer Geometry3DPointer
itk::TimeStamp m_DataReferenceChangedTime
Timestamp of the last change of m_Data.
virtual void SetMapper(MapperSlotId id, mitk::Mapper *mapper)
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
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 (instances of ColorProperty)
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 (instances of ColorProperty)
mitk::DataNode & operator=(BaseData *right)
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
Query names of existing contexts.
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
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
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
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
Get property by its key.
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
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.
std::vector< std::string > GetPropertyKeys(const std::string &contextName="", bool includeDefaultContext=false) const override
Query keys of existing properties.
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 (T being the type of the second parameter...
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
Get property by its key.
void CopyInformation(const itk::DataObject *data) override
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)
void SetSelected(bool selected, const mitk::BaseRenderer *renderer=nullptr)
set the node as selected
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,...
virtual T GetValue() const
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.
virtual const char * GetValue() const
virtual void SetValue(const char *_arg)
unsigned int MapperSlotId
Find image slices visible on a given plane.
MITKCORE_EXPORT std::istream & operator>>(std::istream &i, DataNode::Pointer &dtn)
static const char * replace[]
This is a dictionary to replace long names of classes, modules, etc. to shorter versions in the conso...
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
MITKCORE_EXPORT std::ostream & operator<<(std::ostream &o, DataNode::Pointer &dtn)
itkEventMacroDeclaration(BoundingShapeInteractionEvent, itk::AnyEvent)