Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
mitk::Annotation Class Referenceabstract

Base class for all Annotation This class is to be implemented in order to create Annotation which are managed by a AbstractAnnotationRenderer. This class contains an internal Propertylist for configuring the appearance of the implemented Overlay. More...

#include <mitkAnnotation.h>

Inheritance diagram for mitk::Annotation:
Collaboration diagram for mitk::Annotation:

Classes

class  BaseLocalStorage
 Base class for mapper specific rendering resources. More...
 
struct  Bounds
 Container for position and size on the display. More...
 

Public Member Functions

void SetProperty (const std::string &propertyKey, const BaseProperty::Pointer &property)
 Set the property (instance of BaseProperty) with key propertyKey in the PropertyList of the renderer (if nullptr, use BaseRenderer-independent PropertyList). This is set-by-value. More...
 
void ReplaceProperty (const std::string &propertyKey, const BaseProperty::Pointer &property)
 Replace the property (instance of BaseProperty) with key propertyKey in the PropertyList of the renderer (if nullptr, use BaseRenderer-independent PropertyList). This is set-by-reference. More...
 
void AddProperty (const std::string &propertyKey, const BaseProperty::Pointer &property, bool overwrite=false)
 Add the property (instance of BaseProperty) if it does not exist (or always if overwrite is true) with key propertyKey in the PropertyList of the renderer (if nullptr, use BaseRenderer-independent PropertyList). This is set-by-value. More...
 
void ConcatenatePropertyList (PropertyList *pList, bool replace=false)
 Add values from another PropertyList. More...
 
mitk::BasePropertyGetProperty (const std::string &propertyKey) const
 Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the renderer, if available there, otherwise use the BaseRenderer-independent PropertyList. More...
 
template<typename T >
bool GetProperty (itk::SmartPointer< T > &property, const std::string &propertyKey) const
 Get the property of type T with key propertyKey from the PropertyList of the renderer, if available there, otherwise use the BaseRenderer-independent PropertyList. More...
 
template<typename T >
bool GetProperty (T *&property, const std::string &propertyKey) const
 Get the property of type T with key propertyKey from the PropertyList of the renderer, if available there, otherwise use the BaseRenderer-independent PropertyList. More...
 
template<typename T >
bool GetPropertyValue (const std::string &propertyKey, T &value) const
 Convenience access method for GenericProperty<T> properties (T being the type of the second parameter) More...
 
bool GetBoolProperty (const std::string &propertyKey, bool &boolValue) const
 Convenience access method for bool properties (instances of BoolProperty) More...
 
bool GetIntProperty (const std::string &propertyKey, int &intValue) const
 Convenience access method for int properties (instances of IntProperty) More...
 
bool GetFloatProperty (const std::string &propertyKey, float &floatValue) const
 Convenience access method for float properties (instances of FloatProperty) More...
 
bool GetDoubleProperty (const std::string &propertyKey, double &doubleValue) const
 Convenience access method for double properties (instances of DoubleProperty) More...
 
bool GetStringProperty (const std::string &propertyKey, std::string &string) const
 Convenience access method for string properties (instances of StringProperty) More...
 
void SetIntProperty (const std::string &propertyKey, int intValue)
 Convenience method for setting int properties (instances of IntProperty) More...
 
void SetBoolProperty (const std::string &propertyKey, bool boolValue)
 Convenience method for setting int properties (instances of IntProperty) More...
 
void SetFloatProperty (const std::string &propertyKey, float floatValue)
 Convenience method for setting int properties (instances of IntProperty) More...
 
void SetDoubleProperty (const std::string &propertyKey, double doubleValue)
 Convenience method for setting int properties (instances of IntProperty) More...
 
void SetStringProperty (const std::string &propertyKey, const std::string &string)
 Convenience method for setting int properties (instances of IntProperty) More...
 
bool IsOn (const std::string &propertyKey, bool defaultIsOn=true) const
 Convenience access method for boolean properties (instances of BoolProperty). Return value is the value of the property. If the property is not found, the value of defaultIsOn is returned. More...
 
bool GetName (std::string &nodeName, const std::string &propertyKey="name") const
 Convenience access method for accessing the name of an object (instance of StringProperty with property-key "name") More...
 
virtual std::string GetName () const
 Extra convenience access method for accessing the name of an object (instance of StringProperty with property-key "name"). More...
 
virtual void SetName (const std::string &name)
 Extra convenience access method to set the name of an object. More...
 
bool GetColor (float rgb[], const std::string &propertyKey="color") const
 Convenience access method for color properties (instances of ColorProperty) More...
 
void SetColor (const mitk::Color &color, const std::string &propertyKey="color")
 Convenience method for setting color properties (instances of ColorProperty) More...
 
void SetColor (float red, float green, float blue, const std::string &propertyKey="color")
 Convenience method for setting color properties (instances of ColorProperty) More...
 
void SetColor (const float rgb[], const std::string &propertyKey="color")
 Convenience method for setting color properties (instances of ColorProperty) More...
 
bool GetOpacity (float &opacity, const std::string &propertyKey="opacity") const
 Convenience access method for opacity properties (instances of FloatProperty) More...
 
void SetOpacity (float opacity, const std::string &propertyKey="opacity")
 Convenience method for setting opacity properties (instances of FloatProperty) More...
 
void SetText (std::string text)
 
std::string GetText () const
 
void SetFontSize (int fontSize)
 
int GetFontSize () const
 
bool GetVisibility (bool &visible, const std::string &propertyKey="visible") const
 Convenience access method for visibility properties (instances of BoolProperty with property-key "visible") More...
 
bool IsVisible (const std::string &propertyKey="visible", bool defaultIsOn=true) const
 Convenience access method for visibility properties (instances of BoolProperty). Return value is the visibility. Default is visible==true, i.e., true is returned even if the property (propertyKey) is not found. More...
 
void SetVisibility (bool visible, const std::string &propertyKey="visible")
 Convenience method for setting visibility properties (instances of BoolProperty) More...
 
virtual void AddToBaseRenderer (BaseRenderer *renderer)=0
 Adds the Annotation to the specified renderer. Update Annotation should be called soon in order to apply all properties. More...
 
virtual void AddToRenderer (BaseRenderer *renderer, vtkRenderer *vtkrenderer)=0
 Adds the Annotation to the specified renderer. Update Annotation should be called soon in order to apply all properties. More...
 
virtual void RemoveFromBaseRenderer (BaseRenderer *renderer)=0
 Removes the Annotation from the specified renderer. It is not visible anymore then. More...
 
virtual void RemoveFromRenderer (BaseRenderer *renderer, vtkRenderer *vtkrenderer)=0
 Removes the Annotation from the specified renderer. It is not visible anymore then. More...
 
virtual void Update (BaseRenderer *renderer)=0
 Applies all properties and should be called before the rendering procedure. More...
 
virtual Bounds GetBoundsOnDisplay (BaseRenderer *renderer) const
 Returns position and size of the Annotation on the display. More...
 
virtual void SetBoundsOnDisplay (BaseRenderer *renderer, const Bounds &)
 Sets position and size of the Annotation on the display. More...
 
void SetForceInForeground (bool forceForeground)
 
bool IsForceInForeground () const
 
PropertyListGetPropertyList () const
 
std::string GetMicroserviceID ()
 Returns the id that this device is registered with. The id will only be valid, if the Annotation has been registered using RegisterAsMicroservice(). More...
 
virtual void RegisterAsMicroservice (us::ServiceProperties props)
 Registers this object as a Microservice, making it available to every module and/or plugin. To unregister, call UnregisterMicroservice(). More...
 
virtual void UnRegisterMicroservice ()
 Registers this object as a Microservice, making it available to every module and/or plugin. More...
 
void AnnotationModified ()
 
 mitkClassMacroItkParent (Annotation, itk::Object)
 

Static Public Attributes

static const std::string US_INTERFACE_NAME
 These Constants are used in conjunction with Microservices. More...
 
static const std::string US_PROPKEY_AnnotationNAME
 
static const std::string US_PROPKEY_ID
 
static const std::string US_PROPKEY_MODIFIED
 
static const std::string US_PROPKEY_RENDERER_ID
 
static const std::string US_PROPKEY_AR_ID
 

Protected Member Functions

 Annotation ()
 explicit constructor which disallows implicit conversions More...
 
 ~Annotation () override
 virtual destructor in order to derive from this class More...
 
void SetUSProperty (const std::string &propertyKey, us::Any value)
 

Protected Attributes

PropertyList::Pointer m_PropertyList
 BaseRenderer-independent PropertyList. More...
 
itk::TimeStamp m_DataReferenceChangedTime
 Timestamp of the last change of m_Data. More...
 

Detailed Description

Base class for all Annotation This class is to be implemented in order to create Annotation which are managed by a AbstractAnnotationRenderer. This class contains an internal Propertylist for configuring the appearance of the implemented Overlay.

Definition at line 27 of file mitkAnnotation.h.

Constructor & Destructor Documentation

◆ Annotation()

mitk::Annotation::Annotation ( )
protected

explicit constructor which disallows implicit conversions

◆ ~Annotation()

mitk::Annotation::~Annotation ( )
overrideprotected

virtual destructor in order to derive from this class

Member Function Documentation

◆ AddProperty()

void mitk::Annotation::AddProperty ( const std::string &  propertyKey,
const BaseProperty::Pointer property,
bool  overwrite = false 
)

Add the property (instance of BaseProperty) if it does not exist (or always if overwrite is true) with key propertyKey in the PropertyList of the renderer (if nullptr, use BaseRenderer-independent PropertyList). This is set-by-value.

For overwrite == false the property is not changed if it already exists. For overwrite == true the method is identical to SetProperty.

See also
SetProperty
GetProperty
m_PropertyList
m_MapOfPropertyLists

◆ AddToBaseRenderer()

virtual void mitk::Annotation::AddToBaseRenderer ( BaseRenderer renderer)
pure virtual

Adds the Annotation to the specified renderer. Update Annotation should be called soon in order to apply all properties.

Implemented in mitk::VtkAnnotation.

◆ AddToRenderer()

virtual void mitk::Annotation::AddToRenderer ( BaseRenderer renderer,
vtkRenderer *  vtkrenderer 
)
pure virtual

Adds the Annotation to the specified renderer. Update Annotation should be called soon in order to apply all properties.

Implemented in mitk::VtkAnnotation.

◆ AnnotationModified()

void mitk::Annotation::AnnotationModified ( )

◆ ConcatenatePropertyList()

void mitk::Annotation::ConcatenatePropertyList ( PropertyList pList,
bool  replace = false 
)

Add values from another PropertyList.

Overwrites values in m_PropertyList only when possible (i.e. when types are compatible). If you want to allow for object type changes (replacing a "visible":BoolProperty with "visible":IntProperty, set replace.

Parameters
pList
replacetrue: if pList contains a property "visible" of type ColorProperty and our m_PropertyList also has a "visible" property of a different type (e.g. BoolProperty), change the type, i.e. replace the objects behind the pointer.
See also
SetProperty
ReplaceProperty
m_PropertyList

◆ GetBoolProperty()

bool mitk::Annotation::GetBoolProperty ( const std::string &  propertyKey,
bool &  boolValue 
) const

Convenience access method for bool properties (instances of BoolProperty)

Returns
true property was found

◆ GetBoundsOnDisplay()

virtual Bounds mitk::Annotation::GetBoundsOnDisplay ( BaseRenderer renderer) const
virtual

Returns position and size of the Annotation on the display.

Reimplemented in mitk::TextAnnotation2D, and mitk::VtkAnnotation2D.

◆ GetColor()

bool mitk::Annotation::GetColor ( float  rgb[],
const std::string &  propertyKey = "color" 
) const

Convenience access method for color properties (instances of ColorProperty)

Returns
true property was found

◆ GetDoubleProperty()

bool mitk::Annotation::GetDoubleProperty ( const std::string &  propertyKey,
double &  doubleValue 
) const

Convenience access method for double properties (instances of DoubleProperty)

Returns
true property was found

◆ GetFloatProperty()

bool mitk::Annotation::GetFloatProperty ( const std::string &  propertyKey,
float &  floatValue 
) const

Convenience access method for float properties (instances of FloatProperty)

Returns
true property was found

◆ GetFontSize()

int mitk::Annotation::GetFontSize ( ) const

◆ GetIntProperty()

bool mitk::Annotation::GetIntProperty ( const std::string &  propertyKey,
int &  intValue 
) const

Convenience access method for int properties (instances of IntProperty)

Returns
true property was found

◆ GetMicroserviceID()

std::string mitk::Annotation::GetMicroserviceID ( )

Returns the id that this device is registered with. The id will only be valid, if the Annotation has been registered using RegisterAsMicroservice().

◆ GetName() [1/2]

virtual std::string mitk::Annotation::GetName ( ) const
virtual

Extra convenience access method for accessing the name of an object (instance of StringProperty with property-key "name").

This method does not take the renderer specific propertylists into account, because the name of an object should never be renderer specific.

Returns
a std::string with the name of the object (content of "name" Property). If there is no "name" Property, an empty string will be returned.

◆ GetName() [2/2]

bool mitk::Annotation::GetName ( std::string &  nodeName,
const std::string &  propertyKey = "name" 
) const

Convenience access method for accessing the name of an object (instance of StringProperty with property-key "name")

Returns
true property was found

◆ GetOpacity()

bool mitk::Annotation::GetOpacity ( float &  opacity,
const std::string &  propertyKey = "opacity" 
) const

Convenience access method for opacity properties (instances of FloatProperty)

Returns
true property was found

◆ GetProperty() [1/3]

mitk::BaseProperty* mitk::Annotation::GetProperty ( const std::string &  propertyKey) const

Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the renderer, if available there, otherwise use the BaseRenderer-independent PropertyList.

If renderer is nullptr or the propertyKey cannot be found in the PropertyList specific to renderer or is disabled there, the BaseRenderer-independent PropertyList of this Annotation is queried.

See also
GetPropertyList
m_PropertyList
m_MapOfPropertyLists

◆ GetProperty() [2/3]

template<typename T >
bool mitk::Annotation::GetProperty ( itk::SmartPointer< T > &  property,
const std::string &  propertyKey 
) const
inline

Get the property of type T with key propertyKey from the PropertyList of the renderer, if available there, otherwise use the BaseRenderer-independent PropertyList.

If renderer is nullptr or the propertyKey cannot be found in the PropertyList specific to renderer or is disabled there, the BaseRenderer-independent PropertyList of this Annotation is queried.

See also
GetPropertyList
m_PropertyList
m_MapOfPropertyLists

Definition at line 137 of file mitkAnnotation.h.

◆ GetProperty() [3/3]

template<typename T >
bool mitk::Annotation::GetProperty ( T *&  property,
const std::string &  propertyKey 
) const
inline

Get the property of type T with key propertyKey from the PropertyList of the renderer, if available there, otherwise use the BaseRenderer-independent PropertyList.

If renderer is nullptr or the propertyKey cannot be found in the PropertyList specific to renderer or is disabled there, the BaseRenderer-independent PropertyList of this Annotation is queried.

See also
GetPropertyList
m_PropertyList
m_MapOfPropertyLists

Definition at line 155 of file mitkAnnotation.h.

◆ GetPropertyList()

PropertyList* mitk::Annotation::GetPropertyList ( ) const

◆ GetPropertyValue()

template<typename T >
bool mitk::Annotation::GetPropertyValue ( const std::string &  propertyKey,
T &  value 
) const
inline

Convenience access method for GenericProperty<T> properties (T being the type of the second parameter)

Returns
true property was found

Definition at line 167 of file mitkAnnotation.h.

References mitk::GenericProperty< T >::GetValue().

◆ GetStringProperty()

bool mitk::Annotation::GetStringProperty ( const std::string &  propertyKey,
std::string &  string 
) const

Convenience access method for string properties (instances of StringProperty)

Returns
true property was found

◆ GetText()

std::string mitk::Annotation::GetText ( ) const

◆ GetVisibility()

bool mitk::Annotation::GetVisibility ( bool &  visible,
const std::string &  propertyKey = "visible" 
) const

Convenience access method for visibility properties (instances of BoolProperty with property-key "visible")

Returns
true property was found
See also
IsVisible

◆ IsForceInForeground()

bool mitk::Annotation::IsForceInForeground ( ) const

◆ IsOn()

bool mitk::Annotation::IsOn ( const std::string &  propertyKey,
bool  defaultIsOn = true 
) const
inline

Convenience access method for boolean properties (instances of BoolProperty). Return value is the value of the property. If the property is not found, the value of defaultIsOn is returned.

Thus, the return value has a different meaning than in the GetBoolProperty method!

See also
GetBoolProperty

Definition at line 252 of file mitkAnnotation.h.

◆ IsVisible()

bool mitk::Annotation::IsVisible ( const std::string &  propertyKey = "visible",
bool  defaultIsOn = true 
) const

Convenience access method for visibility properties (instances of BoolProperty). Return value is the visibility. Default is visible==true, i.e., true is returned even if the property (propertyKey) is not found.

Thus, the return value has a different meaning than in the GetVisibility method!

See also
GetVisibility
IsOn

◆ mitkClassMacroItkParent()

mitk::Annotation::mitkClassMacroItkParent ( Annotation  ,
itk::Object   
)

◆ RegisterAsMicroservice()

virtual void mitk::Annotation::RegisterAsMicroservice ( us::ServiceProperties  props)
virtual

Registers this object as a Microservice, making it available to every module and/or plugin. To unregister, call UnregisterMicroservice().

◆ RemoveFromBaseRenderer()

virtual void mitk::Annotation::RemoveFromBaseRenderer ( BaseRenderer renderer)
pure virtual

Removes the Annotation from the specified renderer. It is not visible anymore then.

Implemented in mitk::VtkAnnotation.

◆ RemoveFromRenderer()

virtual void mitk::Annotation::RemoveFromRenderer ( BaseRenderer renderer,
vtkRenderer *  vtkrenderer 
)
pure virtual

Removes the Annotation from the specified renderer. It is not visible anymore then.

Implemented in mitk::VtkAnnotation.

◆ ReplaceProperty()

void mitk::Annotation::ReplaceProperty ( const std::string &  propertyKey,
const BaseProperty::Pointer property 
)

Replace the property (instance of BaseProperty) with key propertyKey in the PropertyList of the renderer (if nullptr, use BaseRenderer-independent PropertyList). This is set-by-reference.

If renderer is nullptr the property is set in the BaseRenderer-independent PropertyList of this Annotation.

See also
GetProperty
m_PropertyList
m_MapOfPropertyLists

◆ SetBoolProperty()

void mitk::Annotation::SetBoolProperty ( const std::string &  propertyKey,
bool  boolValue 
)

Convenience method for setting int properties (instances of IntProperty)

◆ SetBoundsOnDisplay()

virtual void mitk::Annotation::SetBoundsOnDisplay ( BaseRenderer renderer,
const Bounds  
)
virtual

Sets position and size of the Annotation on the display.

Reimplemented in mitk::TextAnnotation2D, and mitk::VtkAnnotation2D.

◆ SetColor() [1/3]

void mitk::Annotation::SetColor ( const float  rgb[],
const std::string &  propertyKey = "color" 
)

Convenience method for setting color properties (instances of ColorProperty)

◆ SetColor() [2/3]

void mitk::Annotation::SetColor ( const mitk::Color color,
const std::string &  propertyKey = "color" 
)

Convenience method for setting color properties (instances of ColorProperty)

◆ SetColor() [3/3]

void mitk::Annotation::SetColor ( float  red,
float  green,
float  blue,
const std::string &  propertyKey = "color" 
)

Convenience method for setting color properties (instances of ColorProperty)

◆ SetDoubleProperty()

void mitk::Annotation::SetDoubleProperty ( const std::string &  propertyKey,
double  doubleValue 
)

Convenience method for setting int properties (instances of IntProperty)

◆ SetFloatProperty()

void mitk::Annotation::SetFloatProperty ( const std::string &  propertyKey,
float  floatValue 
)

Convenience method for setting int properties (instances of IntProperty)

◆ SetFontSize()

void mitk::Annotation::SetFontSize ( int  fontSize)

◆ SetForceInForeground()

void mitk::Annotation::SetForceInForeground ( bool  forceForeground)

◆ SetIntProperty()

void mitk::Annotation::SetIntProperty ( const std::string &  propertyKey,
int  intValue 
)

Convenience method for setting int properties (instances of IntProperty)

◆ SetName()

virtual void mitk::Annotation::SetName ( const std::string &  name)
virtual

Extra convenience access method to set the name of an object.

The name will be stored in the non-renderer-specific PropertyList in a StringProperty named "name".

◆ SetOpacity()

void mitk::Annotation::SetOpacity ( float  opacity,
const std::string &  propertyKey = "opacity" 
)

Convenience method for setting opacity properties (instances of FloatProperty)

◆ SetProperty()

void mitk::Annotation::SetProperty ( const std::string &  propertyKey,
const BaseProperty::Pointer property 
)

Set the property (instance of BaseProperty) with key propertyKey in the PropertyList of the renderer (if nullptr, use BaseRenderer-independent PropertyList). This is set-by-value.

Warning
Change in semantics since Aug 25th 2006. Check your usage of this method if you do more with properties than just call SetProperty( "key", new SomeProperty("value") ).
See also
GetProperty
m_PropertyList
m_MapOfPropertyLists

◆ SetStringProperty()

void mitk::Annotation::SetStringProperty ( const std::string &  propertyKey,
const std::string &  string 
)

Convenience method for setting int properties (instances of IntProperty)

◆ SetText()

void mitk::Annotation::SetText ( std::string  text)

◆ SetUSProperty()

void mitk::Annotation::SetUSProperty ( const std::string &  propertyKey,
us::Any  value 
)
protected

◆ SetVisibility()

void mitk::Annotation::SetVisibility ( bool  visible,
const std::string &  propertyKey = "visible" 
)

Convenience method for setting visibility properties (instances of BoolProperty)

Parameters
visibleIf set to true, the data will be rendered. If false, the render will skip this data.
propertyKeyCan be used to specify a user defined name of the visibility property.

◆ UnRegisterMicroservice()

virtual void mitk::Annotation::UnRegisterMicroservice ( )
virtual

Registers this object as a Microservice, making it available to every module and/or plugin.

◆ Update()

virtual void mitk::Annotation::Update ( BaseRenderer renderer)
pure virtual

Applies all properties and should be called before the rendering procedure.

Implemented in mitk::VtkAnnotation.

Member Data Documentation

◆ m_DataReferenceChangedTime

itk::TimeStamp mitk::Annotation::m_DataReferenceChangedTime
protected

Timestamp of the last change of m_Data.

Definition at line 433 of file mitkAnnotation.h.

◆ m_PropertyList

PropertyList::Pointer mitk::Annotation::m_PropertyList
protected

BaseRenderer-independent PropertyList.

Properties herein can be overwritten specifically for each BaseRenderer by the BaseRenderer-specific properties defined in m_MapOfPropertyLists.

Definition at line 428 of file mitkAnnotation.h.

◆ US_INTERFACE_NAME

const std::string mitk::Annotation::US_INTERFACE_NAME
static

These Constants are used in conjunction with Microservices.

Definition at line 393 of file mitkAnnotation.h.

◆ US_PROPKEY_AnnotationNAME

const std::string mitk::Annotation::US_PROPKEY_AnnotationNAME
static

Definition at line 394 of file mitkAnnotation.h.

◆ US_PROPKEY_AR_ID

const std::string mitk::Annotation::US_PROPKEY_AR_ID
static

Definition at line 398 of file mitkAnnotation.h.

◆ US_PROPKEY_ID

const std::string mitk::Annotation::US_PROPKEY_ID
static

Definition at line 395 of file mitkAnnotation.h.

◆ US_PROPKEY_MODIFIED

const std::string mitk::Annotation::US_PROPKEY_MODIFIED
static

Definition at line 396 of file mitkAnnotation.h.

◆ US_PROPKEY_RENDERER_ID

const std::string mitk::Annotation::US_PROPKEY_RENDERER_ID
static

Definition at line 397 of file mitkAnnotation.h.


The documentation for this class was generated from the following file: