diff --git a/Core/Code/DataManagement/mitkAnnotationProperty.cpp b/Core/Code/DataManagement/mitkAnnotationProperty.cpp index 93b1ca4bbd..8c35f10ae3 100644 --- a/Core/Code/DataManagement/mitkAnnotationProperty.cpp +++ b/Core/Code/DataManagement/mitkAnnotationProperty.cpp @@ -1,100 +1,96 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2008-04-14 19:45:53 +0200 (Mo, 14 Apr 2008) $ Version: $Revision: 14081 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "mitkAnnotationProperty.h" mitk::AnnotationProperty::AnnotationProperty() { } mitk::AnnotationProperty::AnnotationProperty( const char *label, const Point3D &position ) : m_Label( "" ), m_Position( position ) { if ( label != NULL ) { m_Label = label; } } mitk::AnnotationProperty::AnnotationProperty( const std::string &label, const Point3D &position ) : m_Label( label ), m_Position( position ) { } mitk::AnnotationProperty::AnnotationProperty( const char *label, ScalarType x, ScalarType y, ScalarType z ) : m_Label( "" ) { if ( label != NULL ) { m_Label = label; } m_Position[0] = x; m_Position[1] = y; m_Position[2] = z; } mitk::AnnotationProperty::AnnotationProperty( const std::string &label, ScalarType x, ScalarType y, ScalarType z ) : m_Label( label ) { m_Position[0] = x; m_Position[1] = y; m_Position[2] = z; } const mitk::Point3D &mitk::AnnotationProperty::GetPosition() const { return m_Position; } void mitk::AnnotationProperty::SetPosition( const mitk::Point3D &position ) { m_Position = position; } -bool mitk::AnnotationProperty::operator==( const BaseProperty &property ) const +bool mitk::AnnotationProperty::IsEqual( const BaseProperty &property ) const { - const Self *other = dynamic_cast< const Self * >( &property ); - - if ( other == NULL ) return false; - - return ( (other->m_Label == m_Label ) - && (other->m_Position == m_Position ) ); + return ( (this->m_Label == static_cast(property).m_Label ) + && (this->m_Position == static_cast(property).m_Position ) ); } std::string mitk::AnnotationProperty::GetValueAsString() const { std::stringstream myStr; myStr << this->GetLabel() << this->GetPosition(); return myStr.str(); } diff --git a/Core/Code/DataManagement/mitkAnnotationProperty.h b/Core/Code/DataManagement/mitkAnnotationProperty.h index 30474030d4..863a2b6079 100644 --- a/Core/Code/DataManagement/mitkAnnotationProperty.h +++ b/Core/Code/DataManagement/mitkAnnotationProperty.h @@ -1,79 +1,82 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2008-04-14 19:45:53 +0200 (Mo, 14 Apr 2008) $ Version: $Revision: 14081 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKANNOTATIONPROPERTY_H_HEADER_INCLUDED #define MITKANNOTATIONPROPERTY_H_HEADER_INCLUDED #include #include "mitkBaseProperty.h" #include "mitkVector.h" #include #include namespace mitk { /** * \brief Property for annotations * \ingroup DataManagement */ class MITK_CORE_EXPORT AnnotationProperty : public BaseProperty { public: mitkClassMacro(AnnotationProperty, BaseProperty); typedef std::string ValueType; itkNewMacro( AnnotationProperty ); mitkNewMacro2Param( AnnotationProperty, const char *, const Point3D & ); mitkNewMacro2Param( AnnotationProperty, const std::string &, const Point3D & ); mitkNewMacro4Param( AnnotationProperty, const char *, ScalarType, ScalarType, ScalarType ); mitkNewMacro4Param( AnnotationProperty, const std::string &, ScalarType, ScalarType, ScalarType ); itkGetStringMacro( Label ); itkSetStringMacro( Label ); const Point3D &GetPosition() const; void SetPosition( const Point3D &position ); - virtual bool operator==(const BaseProperty& property ) const; virtual std::string GetValueAsString() const; virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } \ protected: std::string m_Label; Point3D m_Position; AnnotationProperty(); AnnotationProperty( const char *label, const Point3D &position ); AnnotationProperty( const std::string &label, const Point3D &position ); AnnotationProperty( const char *label, ScalarType x, ScalarType y, ScalarType z ); AnnotationProperty( const std::string &label, ScalarType x, ScalarType y, ScalarType z ); +private: + + virtual bool IsEqual(const BaseProperty& property ) const; + }; } // namespace mitk #endif /* MITKANNOTATIONPROPERTY_H_HEADER_INCLUDED */ diff --git a/Core/Code/DataManagement/mitkBaseProperty.cpp b/Core/Code/DataManagement/mitkBaseProperty.cpp index aaee90bfca..aa8fd9ec62 100644 --- a/Core/Code/DataManagement/mitkBaseProperty.cpp +++ b/Core/Code/DataManagement/mitkBaseProperty.cpp @@ -1,56 +1,56 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "mitkBaseProperty.h" mitk::BaseProperty::BaseProperty() { } mitk::BaseProperty::~BaseProperty() { } std::string mitk::BaseProperty::GetValueAsString() const { return std::string("n/a"); } -/*! - Should be implemented by subclasses to indicate whether they can accept the parameter - as the right-hand-side argument of an assignment. This test will most probably include - some dynamic_cast. - */ bool mitk::BaseProperty::Assignable( const BaseProperty& ) const { return false; } /*! To be implemented more meaningful by subclasses. This version just accepts the assignment of BaseProperty objects to others, but the assignment has NO MEANING, values are not changed at all! */ mitk::BaseProperty& mitk::BaseProperty::operator=(const BaseProperty& rhs) { if (this == &rhs) return *this; // no self assignment // place meaningful copy code here (nothing possible with BaseProeprties) return *this; } + +bool mitk::BaseProperty::operator==(const BaseProperty& property) const +{ + return (typeid(*this) == typeid(property) && IsEqual(property)); +} diff --git a/Core/Code/DataManagement/mitkBaseProperty.h b/Core/Code/DataManagement/mitkBaseProperty.h index 5bd4622248..927129981e 100644 --- a/Core/Code/DataManagement/mitkBaseProperty.h +++ b/Core/Code/DataManagement/mitkBaseProperty.h @@ -1,74 +1,83 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef BASEPROPERTY_H_HEADER_INCLUDED_C1F4DF54 #define BASEPROPERTY_H_HEADER_INCLUDED_C1F4DF54 #include #include #include #include namespace mitk { /*! \brief Abstract base class for properties \ingroup DataManagement Base class for properties. Properties are arbitrary additional information (to define a new type of information you have to define a subclass of BaseProperty) that can be added to a PropertyList. Concrete subclasses of BaseProperty should define Set-/Get-methods to assess the property value, which should be stored by value (not by reference). Subclasses must implement an operator==(const BaseProperty& property), which is used by PropertyList to check whether a property has been changed. */ class MITK_CORE_EXPORT BaseProperty : public itk::Object { public: mitkClassMacro(BaseProperty,itk::Object); - /*! @brief Subclasses must implement this operator==. - Operator== which is used by PropertyList to check whether a property has been changed. + /*! @brief Subclasses must implement IsEqual(const BaseProperty&) to support comparison. + + operator== which is used by PropertyList to check whether a property has been changed. */ - virtual bool operator==(const BaseProperty& property) const = 0; + bool operator==(const BaseProperty& property) const; virtual BaseProperty& operator=(const BaseProperty& property); virtual std::string GetValueAsString() const; + /*! + Should be implemented by subclasses to indicate whether they can accept the parameter + as the right-hand-side argument of an assignment. This test will most probably include + some dynamic_cast. + */ virtual bool Assignable(const BaseProperty& ) const; protected: BaseProperty(); virtual ~BaseProperty(); - friend class PropertyList; // for VALUE - - static std::string VALUE; + private: + /*! + Override this method in subclasses to implement a meaningful comparison. The property + argument is guaranteed to be castable to the type of the implementing subclass. + */ + virtual bool IsEqual(const BaseProperty& property) const = 0; }; } // namespace mitk #endif /* BASEPROPERTY_H_HEADER_INCLUDED_C1F4DF54 */ diff --git a/Core/Code/DataManagement/mitkClippingProperty.cpp b/Core/Code/DataManagement/mitkClippingProperty.cpp index 354a2c8085..d4e07041c7 100644 --- a/Core/Code/DataManagement/mitkClippingProperty.cpp +++ b/Core/Code/DataManagement/mitkClippingProperty.cpp @@ -1,95 +1,91 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2008-04-14 19:45:53 +0200 (Mo, 14 Apr 2008) $ Version: $Revision: 14081 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "mitkClippingProperty.h" namespace mitk { ClippingProperty::ClippingProperty() : m_ClippingEnabled( false ) { } ClippingProperty::ClippingProperty( const Point3D &origin, const Vector3D &normal ) : m_ClippingEnabled( true ), m_Origin( origin ), m_Normal( normal ) { } bool ClippingProperty::GetClippingEnabled() const { return m_ClippingEnabled; } void ClippingProperty::SetClippingEnabled( bool enabled ) { m_ClippingEnabled = enabled; } const Point3D &ClippingProperty::GetOrigin() const { return m_Origin; } void ClippingProperty::SetOrigin( const Point3D &origin ) { m_Origin = origin; } const Vector3D &ClippingProperty::GetNormal() const { return m_Normal; } void ClippingProperty::SetNormal( const Vector3D &normal ) { m_Normal = normal; } -bool ClippingProperty::operator==( const BaseProperty &property ) const +bool ClippingProperty::IsEqual( const BaseProperty &property ) const { - const Self *other = dynamic_cast< const Self * >( &property ); - - if ( other == NULL ) return false; - - return ( (other->m_Origin == m_Origin ) - && (other->m_Normal == m_Normal ) ); + return ( (this->m_Origin == static_cast(property).m_Origin ) + && (this->m_Normal == static_cast(property).m_Normal ) ); } std::string ClippingProperty::GetValueAsString() const { std::stringstream myStr; myStr << this->GetOrigin() << this->GetNormal(); return myStr.str(); } } // namespace diff --git a/Core/Code/DataManagement/mitkClippingProperty.h b/Core/Code/DataManagement/mitkClippingProperty.h index f5afb820fa..31884fe57d 100644 --- a/Core/Code/DataManagement/mitkClippingProperty.h +++ b/Core/Code/DataManagement/mitkClippingProperty.h @@ -1,77 +1,80 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2008-04-14 19:45:53 +0200 (Mo, 14 Apr 2008) $ Version: $Revision: 14081 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKCLIPPINGPROPERTY_H_HEADER_INCLUDED #define MITKCLIPPINGPROPERTY_H_HEADER_INCLUDED #include #include "mitkBaseProperty.h" #include "mitkVector.h" #include #include namespace mitk { /** * \brief Property for clipping datasets; currently only * clipping planes are possible * \ingroup DataManagement */ class MITK_CORE_EXPORT ClippingProperty : public BaseProperty { public: mitkClassMacro(ClippingProperty, BaseProperty); virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } typedef std::string ValueType; itkNewMacro( ClippingProperty ); mitkNewMacro2Param( ClippingProperty, const Point3D &, const Vector3D & ); bool GetClippingEnabled() const; void SetClippingEnabled( bool enabled ); const Point3D &GetOrigin() const; void SetOrigin( const Point3D &origin ); const Vector3D &GetNormal() const; void SetNormal( const Vector3D &normal ); - virtual bool operator==(const BaseProperty& property ) const; virtual std::string GetValueAsString() const; protected: bool m_ClippingEnabled; Point3D m_Origin; Vector3D m_Normal; ClippingProperty(); ClippingProperty( const Point3D &origin, const Vector3D &normal ); +private: + + virtual bool IsEqual(const BaseProperty& property ) const; + }; } // namespace mitk #endif /* MITKCLIPPINGPROPERTY_H_HEADER_INCLUDED */ diff --git a/Core/Code/DataManagement/mitkColorProperty.cpp b/Core/Code/DataManagement/mitkColorProperty.cpp index ab15c17964..6d1353091e 100644 --- a/Core/Code/DataManagement/mitkColorProperty.cpp +++ b/Core/Code/DataManagement/mitkColorProperty.cpp @@ -1,122 +1,110 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include #include "mitkColorProperty.h" mitk::ColorProperty::ColorProperty() : m_Color() { } mitk::ColorProperty::ColorProperty(const float color[3]) : m_Color(color) { } mitk::ColorProperty::ColorProperty(const float red, const float green, const float blue) { m_Color.Set(red, green, blue); } mitk::ColorProperty::ColorProperty(const mitk::Color & color) : m_Color(color) { } -mitk::ColorProperty::~ColorProperty() -{ -} - bool mitk::ColorProperty::Assignable(const mitk::BaseProperty& other) const { try { dynamic_cast(other); // dear compiler, please don't optimize this away! return true; } catch (std::bad_cast) { } return false; } mitk::BaseProperty& mitk::ColorProperty::operator=(const mitk::BaseProperty& other) { try { const Self& otherProp( dynamic_cast(other) ); if (this->m_Color != otherProp.m_Color) { this->m_Color = otherProp.m_Color; this->Modified(); } } catch (std::bad_cast) { // nothing to do then } return *this; } -bool mitk::ColorProperty::operator==(const BaseProperty& property) const +bool mitk::ColorProperty::IsEqual(const BaseProperty& property) const { - try - { - const Self& other = dynamic_cast(property); - return other.m_Color == m_Color; - } - catch (std::bad_cast&) - { - return false; - } + return this->m_Color == static_cast(property).m_Color; } const mitk::Color & mitk::ColorProperty::GetColor() const { return m_Color; } void mitk::ColorProperty::SetColor(const mitk::Color & color ) { if(m_Color!=color) { m_Color = color; Modified(); } } void mitk::ColorProperty::SetColor( float red, float green, float blue ) { m_Color.Set(red, green, blue); } std::string mitk::ColorProperty::GetValueAsString() const { std::stringstream myStr; myStr.imbue(std::locale::classic()); myStr << GetValue() ; return myStr.str(); } const mitk::Color & mitk::ColorProperty::GetValue() const { return GetColor(); } diff --git a/Core/Code/DataManagement/mitkColorProperty.h b/Core/Code/DataManagement/mitkColorProperty.h index c285f50640..fe37ce7144 100644 --- a/Core/Code/DataManagement/mitkColorProperty.h +++ b/Core/Code/DataManagement/mitkColorProperty.h @@ -1,78 +1,78 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKCOLORPROPERTY_H_HEADER_INCLUDED_C17953D1 #define MITKCOLORPROPERTY_H_HEADER_INCLUDED_C17953D1 #include #include "mitkBaseProperty.h" #include namespace mitk { //##Documentation //## @brief Standard RGB color typedef (float) //## //## Standard RGB color typedef to get rid of template argument (float). //## @ingroup Property typedef itk::RGBPixel< float > Color; //##Documentation //## @brief RGB color property //## //## @ingroup DataManagement class MITK_CORE_EXPORT ColorProperty : public BaseProperty { protected: mitk::Color m_Color; ColorProperty(); ColorProperty(const float red, const float green, const float blue); ColorProperty(const float color[3]); ColorProperty(const mitk::Color & color); public: mitkClassMacro(ColorProperty, BaseProperty); itkNewMacro(ColorProperty); mitkNewMacro1Param(ColorProperty, const float*); mitkNewMacro1Param(ColorProperty, const mitk::Color&); mitkNewMacro3Param(ColorProperty, const float, const float, const float); - virtual ~ColorProperty(); - virtual bool Assignable(const BaseProperty& other) const; virtual BaseProperty& operator=(const BaseProperty& other); - - virtual bool operator==(const BaseProperty& property) const; const mitk::Color & GetColor() const; const mitk::Color & GetValue() const; std::string GetValueAsString() const; void SetColor(const mitk::Color & color ); void SetColor( float red, float green, float blue ); +private: + + virtual bool IsEqual(const BaseProperty& property) const; + }; } // namespace mitk #endif /* MITKCOLORPROPERTY_H_HEADER_INCLUDED_C17953D1 */ diff --git a/Core/Code/DataManagement/mitkEnumerationProperty.cpp b/Core/Code/DataManagement/mitkEnumerationProperty.cpp index 5bfb0a837b..f45845c89a 100644 --- a/Core/Code/DataManagement/mitkEnumerationProperty.cpp +++ b/Core/Code/DataManagement/mitkEnumerationProperty.cpp @@ -1,194 +1,185 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "mitkEnumerationProperty.h" #include // static map members of EnumerationProperty. These Maps point to per-classname-maps of ID <-> String. Accessed by GetEnumIds() and GetEnumString(). mitk::EnumerationProperty::IdMapForClassNameContainerType mitk::EnumerationProperty::s_IdMapForClassName; mitk::EnumerationProperty::StringMapForClassNameContainerType mitk::EnumerationProperty::s_StringMapForClassName; mitk::EnumerationProperty::EnumerationProperty() { m_CurrentValue = 0; } bool mitk::EnumerationProperty::AddEnum( const std::string& name, const IdType& id ) { if ( ( ! IsValidEnumerationValue( name ) ) && ( ! IsValidEnumerationValue( id ) ) ) { GetEnumIds().insert( std::make_pair( id, name ) ); GetEnumStrings().insert( std::make_pair( name, id ) ); return true; } else { return false; } } bool mitk::EnumerationProperty::SetValue( const std::string& name ) { if ( IsValidEnumerationValue( name ) ) { m_CurrentValue = GetEnumId( name ); Modified(); return true; } else { return false; } } bool mitk::EnumerationProperty::SetValue( const IdType& id ) { if ( IsValidEnumerationValue( id ) ) { m_CurrentValue = id; Modified(); return true; } else { return false; } } mitk::EnumerationProperty::IdType mitk::EnumerationProperty::GetValueAsId() const { return m_CurrentValue; } std::string mitk::EnumerationProperty::GetValueAsString() const { return GetEnumString( m_CurrentValue ); } void mitk::EnumerationProperty::Clear() { GetEnumIds().clear(); GetEnumStrings().clear(); m_CurrentValue = 0; } mitk::EnumerationProperty::EnumIdsContainerType::size_type mitk::EnumerationProperty::Size() const { return GetEnumIds().size(); } mitk::EnumerationProperty::EnumConstIterator mitk::EnumerationProperty::Begin() const { return GetEnumIds().begin(); } mitk::EnumerationProperty::EnumConstIterator mitk::EnumerationProperty::End() const { return GetEnumIds().end(); } std::string mitk::EnumerationProperty::GetEnumString( const IdType& id ) const { if ( IsValidEnumerationValue( id ) ) { return GetEnumIds().find( id )->second; } else { return "invalid enum id or enums empty"; } } mitk::EnumerationProperty::IdType mitk::EnumerationProperty::GetEnumId( const std::string& name ) const { if ( IsValidEnumerationValue( name ) ) { return GetEnumStrings().find( name )->second; } else { return 0; } } -bool mitk::EnumerationProperty::operator==( const BaseProperty& property ) const +bool mitk::EnumerationProperty::IsEqual( const BaseProperty& property ) const { - const Self * other = dynamic_cast( &property ); - - if ( other == NULL ) - return false; - - if ( this->Size() != other->Size() ) - return false; - - if ( this->GetValueAsId() != other->GetValueAsId() ) - return false; - - return std::equal( this->Begin(), this->End(), other->Begin() ); + const Self& other = static_cast(property); + return this->Size() == other.Size() && this->GetValueAsId() == other.GetValueAsId() && + std::equal( this->Begin(), this->End(), other.Begin() ); } bool mitk::EnumerationProperty::IsValidEnumerationValue( const IdType& val ) const { return ( GetEnumIds().find( val ) != GetEnumIds().end() ); } bool mitk::EnumerationProperty::IsValidEnumerationValue( const std::string& val ) const { return ( GetEnumStrings().find( val ) != GetEnumStrings().end() ); } mitk::EnumerationProperty::EnumIdsContainerType& mitk::EnumerationProperty::GetEnumIds() { std::string className = this->GetNameOfClass(); // virtual! return s_IdMapForClassName[ className ]; } const mitk::EnumerationProperty::EnumIdsContainerType& mitk::EnumerationProperty::GetEnumIds() const { std::string className = this->GetNameOfClass(); // virtual! return s_IdMapForClassName[ className ]; } mitk::EnumerationProperty::EnumStringsContainerType& mitk::EnumerationProperty::GetEnumStrings() { std::string className = this->GetNameOfClass(); // virtual! return s_StringMapForClassName[ className ]; } const mitk::EnumerationProperty::EnumStringsContainerType& mitk::EnumerationProperty::GetEnumStrings() const { std::string className = this->GetNameOfClass(); // virtual! return s_StringMapForClassName[ className ]; } diff --git a/Core/Code/DataManagement/mitkEnumerationProperty.h b/Core/Code/DataManagement/mitkEnumerationProperty.h index 550965a713..7351960ace 100644 --- a/Core/Code/DataManagement/mitkEnumerationProperty.h +++ b/Core/Code/DataManagement/mitkEnumerationProperty.h @@ -1,215 +1,216 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef _MITK_ENUMERATION_PROPERTY__H_ #define _MITK_ENUMERATION_PROPERTY__H_ #include "mitkBaseProperty.h" #include #include namespace mitk { /** * This class may be used to store properties similar to enumeration values. * Each enumeration value is identified via a string representation and a * id. Note, that both string representation and id MUST be unique. This is checked * when inserting a new enumeration value. Please note that you have to add valid * enumeration values before you may use the Get/SetValue methods. * * To use the class enumeration property you have 2 choices: * * 1. Directly use the class and add your possible enumeration values via * AddEnum(name, id). NOte that the ids do not have to be in any order, they * just have to be unique. The current value is set via SetValue(...) and * retrieved via GetValueAsId() or GetValueAsString(). * 2. Create a subclass, which adds the possible enumeration values in its * constructor and maybe adds some additional convenience functions to * set/get the value. NOte that you should override AddEnum(...) as protected * so that the user may not add additional invalid enumeration values. * As example see mitk::VtkRepresentationProperty or mitk::VtkInterpolationProperty * * @ingroup DataManagement */ class MITK_CORE_EXPORT EnumerationProperty : public BaseProperty { public: mitkClassMacro( EnumerationProperty, BaseProperty ); itkNewMacro(EnumerationProperty); /** * Represents the unique id which is asigned to each enumeration value */ typedef unsigned int IdType; /** * Type used to store a mapping from enumeration id to enumeration string/ * description */ typedef std::map EnumIdsContainerType; /** * Type used to store a mapping from enumeration string/description to * enumeration id */ typedef std::map EnumStringsContainerType; /** * Type used for iterators over all defined enumeration values. */ typedef EnumIdsContainerType::const_iterator EnumConstIterator; /** * Adds an enumeration value into the enumeration. The name and id provided * must be unique. This is checked while adding the new enumeration value. * If it is not unique, false is returned. If addition was successful, true * is returned. * @param name the unique string representation of the enumeration value * @param id the unique integer representation of the enumeration value * @returns true, if the name/id combination was successfully added to the * enumeration values or true otherwise */ virtual bool AddEnum( const std::string& name, const IdType& id ); /** * Sets the current value of the enumeration * @param name the string representation of the enumeration value to set * @returns true if the value was successfully set (i.e. it was valid), or * false, if the name provided is incalid. */ virtual bool SetValue( const std::string& name ); /** * Sets the current value of the enumeration * @param id the integer representation of the enumeration value to set * @returns true if the value was successfully set (i.e. it was valid), or * false, if the id provided is invalid. */ virtual bool SetValue( const IdType& id ); /** * Returns the id of the current enumeration value. If it was not yet set, * the return value is unspecified */ virtual IdType GetValueAsId() const; /** * Returns the string representation of the current enumeration value. If it * was not yet set, the return value is unspecified */ virtual std::string GetValueAsString() const; /** * Clears all possible enumeration values and the current enumeration value. */ virtual void Clear(); /** * Determines the number of enumeration values which have been added via * AddEnum(...). * @returns the number of enumeration values associated with this Enumeration * Property */ virtual EnumIdsContainerType::size_type Size() const; /** * Provides access to the set of known enumeration values. The string representation * may be accessed via iterator->second, the id may be access via iterator->first * @returns an iterator over all enumeration values. */ virtual EnumConstIterator Begin() const; /** * Specifies the end of the range of the known enumeration values. * @returns an iterator pointing past the last known element of the possible * enumeration values. */ virtual EnumConstIterator End() const; /** * Returns the string representation for the given id. * @param id the id for which the string representation should be determined * if id is invalid, the return value is unspecified. * @returns the string representation of the given enumeration value */ virtual std::string GetEnumString( const IdType& id ) const; /** * Returns the integer representation for the given string. * @param name the enumeration name for which the integer representation should be determined * if the name is invalid, the return value is unspecified. * @returns the integer representation of the given enumeration value */ virtual IdType GetEnumId( const std::string& name ) const; /** * Determines if a given integer representation of an enumeration value * is valid or not * @param val the integer value to check * @returns true if the given value is valid or false otherwise */ virtual bool IsValidEnumerationValue( const IdType& val ) const; /** * Determines if a given string representation of an enumeration value * is valid or not * @param val the string to check * @returns true if the given value is valid or false otherwise */ virtual bool IsValidEnumerationValue( const std::string& val ) const; - virtual bool operator==( const BaseProperty& property ) const; virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } const EnumIdsContainerType& GetEnumIds() const; const EnumStringsContainerType& GetEnumStrings() const; EnumIdsContainerType& GetEnumIds(); EnumStringsContainerType& GetEnumStrings(); protected: /** * Default constructor. The current value of the enumeration is undefined. */ EnumerationProperty(); private: + virtual bool IsEqual( const BaseProperty& property ) const; + IdType m_CurrentValue; EnumIdsContainerType m_EnumIds; EnumStringsContainerType m_EnumStrings; typedef std::map IdMapForClassNameContainerType; typedef std::map StringMapForClassNameContainerType; static IdMapForClassNameContainerType s_IdMapForClassName; static StringMapForClassNameContainerType s_StringMapForClassName; }; } // namespace #endif diff --git a/Core/Code/DataManagement/mitkGenericProperty.h b/Core/Code/DataManagement/mitkGenericProperty.h index 70a3460dca..5da251b791 100644 --- a/Core/Code/DataManagement/mitkGenericProperty.h +++ b/Core/Code/DataManagement/mitkGenericProperty.h @@ -1,150 +1,134 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKGENERICPROPERTY_H_HEADER_INCLUDED_C1061CEE #define MITKGENERICPROPERTY_H_HEADER_INCLUDED_C1061CEE #include #include #include #include "mitkVector.h" #include #include "mitkBaseProperty.h" namespace mitk { /*! @ brief Template class for generating properties for int, float, bool, etc. This class template can be instantiated for all classes/internal types that fulfills these requirements: - an operator<< so that the properties value can be put into a std::stringstream - an operator== so that two properties can be checked for equality Note: you must use the macro mitkSpecializeGenericProperty to provide specializations for concrete types (e.g. BoolProperty). Please see mitkProperties.h for examples. If you don't use the mitkSpecializeGenericProperty Macro, GetNameOfClass() returns a wrong name. */ template class GenericProperty : public BaseProperty { public: mitkClassMacro(GenericProperty, BaseProperty); mitkNewMacro1Param(GenericProperty, T); typedef T ValueType; - virtual ~GenericProperty() - { - } - itkSetMacro(Value,T); itkGetConstMacro(Value,T); - - virtual bool operator==(const BaseProperty& other) const - { - try - { - const Self *otherProp = dynamic_cast(&other); - if(otherProp==NULL) return false; - if (this->m_Value == otherProp->m_Value) return true; - } - catch (std::bad_cast) - { - // nothing to do now - just return false - } - - return false; - } virtual std::string GetValueAsString() const { std::stringstream myStr; myStr << GetValue() ; return myStr.str(); } virtual bool Assignable(const BaseProperty& other) const { try { dynamic_cast(other); // dear compiler, please don't optimize this away! return true; } catch (std::bad_cast) { } return false; } virtual BaseProperty& operator=(const BaseProperty& other) { try { const Self& otherProp( dynamic_cast(other) ); if (this->m_Value != otherProp.m_Value) { this->m_Value = otherProp.m_Value; this->Modified(); } } catch (std::bad_cast) { // nothing to do then } return *this; } protected: GenericProperty() {} GenericProperty(T x) : m_Value(x) {} T m_Value; + + private: + + virtual bool IsEqual(const BaseProperty& other) const + { + return (this->m_Value == static_cast(other).m_Value); + } }; } // namespace mitk /** * Generates a specialized subclass of mitk::GenericProperty. * This way, GetNameOfClass() returns the value provided by PropertyName. * Please see mitkProperties.h for examples. * @param PropertyName the name of the instantiation of GenericProperty * @param Type the value type of the GenericProperty */ #define mitkSpecializeGenericProperty(PropertyName,Type,DefaultValue) \ class MITK_EXPORT PropertyName: public GenericProperty< Type > \ { \ public: \ mitkClassMacro(PropertyName, GenericProperty< Type >); \ itkNewMacro(PropertyName); \ mitkNewMacro1Param(PropertyName, Type); \ - virtual ~PropertyName() {} \ - virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } \ protected: \ PropertyName() { m_Value = DefaultValue; } \ PropertyName(Type x) : GenericProperty(x) {} \ }; -#endif /* MITKGENERICPROPERTY_H_HEADER_INCLUDED_C1061CEE */ - +#endif /* MITKGENERICPROPERTY_H_HEADER_INCLUDED_C1061CEE */ diff --git a/Core/Code/DataManagement/mitkGroupTagProperty.cpp b/Core/Code/DataManagement/mitkGroupTagProperty.cpp index c11d532c78..0a885f1243 100644 --- a/Core/Code/DataManagement/mitkGroupTagProperty.cpp +++ b/Core/Code/DataManagement/mitkGroupTagProperty.cpp @@ -1,55 +1,50 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "mitkGroupTagProperty.h" mitk::GroupTagProperty::GroupTagProperty() : mitk::BaseProperty() { } -mitk::GroupTagProperty::~GroupTagProperty() -{ -} - /*! Should be implemented by subclasses to indicate whether they can accept the parameter as the right-hand-side argument of an assignment. This test will most probably include some dynamic_cast. */ bool mitk::GroupTagProperty::Assignable(const BaseProperty& other) const { try { dynamic_cast(other); // dear compiler, please don't optimize this away! return true; } catch (std::bad_cast) { } return false; } -bool mitk::GroupTagProperty::operator==(const BaseProperty& property) const +bool mitk::GroupTagProperty::IsEqual(const BaseProperty& property) const { - const Self *other = dynamic_cast(&property); - - return (other!=NULL); // if other property is also a GroupTagProperty, then it is equal to us, because tags have no value themselves + // if other property is also a GroupTagProperty, then it is equal to us, because tags have no value themselves + return true; } diff --git a/Core/Code/DataManagement/mitkGroupTagProperty.h b/Core/Code/DataManagement/mitkGroupTagProperty.h index eedccb2d77..cd97498aa5 100644 --- a/Core/Code/DataManagement/mitkGroupTagProperty.h +++ b/Core/Code/DataManagement/mitkGroupTagProperty.h @@ -1,54 +1,55 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef GROUPTAGPROPERTY_H_HEADER_INCLUDED_C1F4DF54 #define GROUPTAGPROPERTY_H_HEADER_INCLUDED_C1F4DF54 #include namespace mitk { /*! @brief Property class that has no value. @ingroup DataManagement The GroupTag property is used to tag a datatree node to show, that it is member of a group of datatree nodes. This can be used to build groups of datatreenodes without the need to contain them in a specific hiearchic order in the datatree */ class MITK_CORE_EXPORT GroupTagProperty : public BaseProperty { public: mitkClassMacro(GroupTagProperty, BaseProperty); itkNewMacro(GroupTagProperty); - - virtual ~GroupTagProperty(); - virtual bool operator==(const BaseProperty& property) const; virtual bool Assignable(const BaseProperty& other) const; virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } protected: GroupTagProperty(); + + private: + + virtual bool IsEqual(const BaseProperty& property) const; }; } // namespace mitk #endif /* GROUPTAGPROPERTY_H_HEADER_INCLUDED_C1F4DF54 */ diff --git a/Core/Code/DataManagement/mitkLevelWindowProperty.cpp b/Core/Code/DataManagement/mitkLevelWindowProperty.cpp index 9a980e4c88..9a24ab849b 100755 --- a/Core/Code/DataManagement/mitkLevelWindowProperty.cpp +++ b/Core/Code/DataManagement/mitkLevelWindowProperty.cpp @@ -1,63 +1,59 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "mitkLevelWindowProperty.h" mitk::LevelWindowProperty::LevelWindowProperty() { } mitk::LevelWindowProperty::LevelWindowProperty(const mitk::LevelWindow &levWin) { SetLevelWindow(levWin); } mitk::LevelWindowProperty::~LevelWindowProperty() { } -bool mitk::LevelWindowProperty::operator==(const BaseProperty& property) const +bool mitk::LevelWindowProperty::IsEqual(const BaseProperty& property) const { - const Self *other = dynamic_cast(&property); - - if(other==NULL) return false; - - return other->m_LevWin==m_LevWin; + return this->m_LevWin == static_cast(property).m_LevWin; } const mitk::LevelWindow & mitk::LevelWindowProperty::GetLevelWindow() const { return m_LevWin; } void mitk::LevelWindowProperty::SetLevelWindow(const mitk::LevelWindow &levWin) { if(m_LevWin != levWin) { m_LevWin = levWin; Modified(); } } std::string mitk::LevelWindowProperty::GetValueAsString() const { std::stringstream myStr; myStr << "L:" << m_LevWin.GetLevel() << " W:" << m_LevWin.GetWindow(); return myStr.str(); } diff --git a/Core/Code/DataManagement/mitkLevelWindowProperty.h b/Core/Code/DataManagement/mitkLevelWindowProperty.h index f5080b2568..a9f8c6e968 100755 --- a/Core/Code/DataManagement/mitkLevelWindowProperty.h +++ b/Core/Code/DataManagement/mitkLevelWindowProperty.h @@ -1,65 +1,67 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKLEVELWINDOWPROPERTY_H_HEADER_INCLUDED_C10EEAA8 #define MITKLEVELWINDOWPROPERTY_H_HEADER_INCLUDED_C10EEAA8 #include "mitkBaseProperty.h" #include "mitkLevelWindow.h" namespace mitk { //##Documentation //## @brief Property for level/window data //## //## @ingroup DataManagement class MITK_CORE_EXPORT LevelWindowProperty : public BaseProperty { protected: LevelWindow m_LevWin; LevelWindowProperty(); LevelWindowProperty(const mitk::LevelWindow &levWin); public: mitkClassMacro(LevelWindowProperty, BaseProperty); itkNewMacro(LevelWindowProperty); mitkNewMacro1Param(LevelWindowProperty, const mitk::LevelWindow&); virtual ~LevelWindowProperty(); virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } - virtual bool operator==(const BaseProperty& property) const; - const mitk::LevelWindow & GetLevelWindow() const; void SetLevelWindow(const LevelWindow &levWin); virtual std::string GetValueAsString() const; +private: + + virtual bool IsEqual(const BaseProperty& property) const; + }; } // namespace mitk #endif /* MITKLEVELWINDOWPROPERTY_H_HEADER_INCLUDED_C10EEAA8 */ diff --git a/Core/Code/DataManagement/mitkPropertyList.cpp b/Core/Code/DataManagement/mitkPropertyList.cpp index c464d702cf..eb2dd84d4d 100644 --- a/Core/Code/DataManagement/mitkPropertyList.cpp +++ b/Core/Code/DataManagement/mitkPropertyList.cpp @@ -1,293 +1,293 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "mitkPropertyList.h" #include "mitkProperties.h" #include "mitkStringProperty.h" #include "mitkVector.h" mitk::BaseProperty* mitk::PropertyList::GetProperty(const std::string& propertyKey) const { PropertyMap::const_iterator it; it=m_Properties.find( propertyKey ); if(it!=m_Properties.end()) return it->second; else return NULL; } void mitk::PropertyList::SetProperty(const std::string& propertyKey, BaseProperty* property) { if (!property) return; //make sure that BaseProperty*, which may have just been created and never been //assigned to a SmartPointer, is registered/unregistered properly. If we do not //do that, it will a) not deleted in case it is identical to the old one or //b) possibly deleted when temporarily added to a smartpointer somewhere below. BaseProperty::Pointer tmpSmartPointerToProperty = property; PropertyMap::iterator it( m_Properties.find( propertyKey ) ); // Is a property with key @a propertyKey contained in the list? if( it != m_Properties.end() ) { // yes //is the property contained in the list identical to the new one? - if( it->second == property) + if( it->second->operator==(*property) ) { // yes? do nothing and return. return; } // compatible? then use operator= to assign value if (it->second->Assignable( *property )) { bool changed = (it->second->GetValueAsString() != property->GetValueAsString()); *(static_cast(it->second.GetPointer())) = *property; // muellerm,20.10: added modified event if(changed) this->Modified(); return; } if ( typeid( *(it->second.GetPointer()) ) != typeid( *property ) ) { // Accept only if the two types are matching. For replacing, use // ReplaceProperty. MITK_ERROR << "In " __FILE__ ", l." << __LINE__ << ": Trying to set existing property to a property with different type." << " Use ReplaceProperty() instead." << std::endl; return; } // If types are identical, but the property has no operator= (s.a.), // overwrite the pointer. it->second = property; return; } //no? add/replace it. PropertyMapElementType newProp; newProp.first = propertyKey; newProp.second = property; m_Properties.insert ( newProp ); this->Modified(); } void mitk::PropertyList::ReplaceProperty(const std::string& propertyKey, BaseProperty* property) { if (!property) return; PropertyMap::iterator it( m_Properties.find( propertyKey ) ); // Is a property with key @a propertyKey contained in the list? if( it != m_Properties.end() ) { it->second=NULL; m_Properties.erase(it); } //no? add/replace it. PropertyMapElementType newProp; newProp.first = propertyKey; newProp.second = property; m_Properties.insert ( newProp ); Modified(); } mitk::PropertyList::PropertyList() { } mitk::PropertyList::~PropertyList() { Clear(); } /** * Consider the list as changed when any of the properties has changed recently. */ unsigned long mitk::PropertyList::GetMTime() const { for ( PropertyMap::const_iterator it = m_Properties.begin() ; it != m_Properties.end(); ++it ) { if( it->second.IsNull() ) { itkWarningMacro(<< "Property '" << it->first <<"' contains nothing (NULL)."); continue; } if( Superclass::GetMTime() < it->second->GetMTime() ) { Modified(); break; } } return Superclass::GetMTime(); } bool mitk::PropertyList::DeleteProperty(const std::string& propertyKey) { PropertyMap::iterator it; it=m_Properties.find( propertyKey ); if(it!=m_Properties.end()) { it->second=NULL; m_Properties.erase(it); Modified(); return true; } return false; } mitk::PropertyList::Pointer mitk::PropertyList::Clone() { mitk::PropertyList::Pointer newPropertyList = PropertyList::New(); // copy the map newPropertyList->m_Properties = m_Properties; return newPropertyList.GetPointer(); } void mitk::PropertyList::Clear() { PropertyMap::iterator it = m_Properties.begin(), end = m_Properties.end(); while(it!=end) { it->second = NULL; ++it; } m_Properties.clear(); } void mitk::PropertyList::ConcatenatePropertyList(PropertyList *pList, bool replace) { if (pList) { const PropertyMap* propertyMap = pList->GetMap(); for ( PropertyMap::const_iterator iter = propertyMap->begin(); // m_PropertyList is created in the constructor, so we don't check it here iter != propertyMap->end(); ++iter ) { const std::string key = iter->first; BaseProperty* value = iter->second; if (replace) { ReplaceProperty( key.c_str(), value ); } else { SetProperty( key.c_str(), value ); } } } } bool mitk::PropertyList::GetBoolProperty(const char* propertyKey, bool& boolValue) const { BoolProperty *gp = dynamic_cast( GetProperty(propertyKey) ); if ( gp != NULL ) { boolValue = gp->GetValue(); return true; } return false; // Templated Method does not work on Macs //return GetPropertyValue(propertyKey, boolValue); } bool mitk::PropertyList::GetIntProperty(const char* propertyKey, int &intValue) const { IntProperty *gp = dynamic_cast( GetProperty(propertyKey) ); if ( gp != NULL ) { intValue = gp->GetValue(); return true; } return false; // Templated Method does not work on Macs //return GetPropertyValue(propertyKey, intValue); } bool mitk::PropertyList::GetFloatProperty(const char* propertyKey, float &floatValue) const { FloatProperty *gp = dynamic_cast( GetProperty(propertyKey) ); if ( gp != NULL ) { floatValue = gp->GetValue(); return true; } return false; // Templated Method does not work on Macs //return GetPropertyValue(propertyKey, floatValue); } bool mitk::PropertyList::GetStringProperty(const char* propertyKey, std::string& stringValue) const { StringProperty* sp= dynamic_cast(GetProperty(propertyKey)); if ( sp != NULL ) { stringValue = sp->GetValue(); return true; } return false; } void mitk::PropertyList::SetIntProperty(const char* propertyKey, int intValue) { SetProperty(propertyKey, mitk::IntProperty::New(intValue)); } void mitk::PropertyList::SetBoolProperty( const char* propertyKey, bool boolValue) { SetProperty(propertyKey, mitk::BoolProperty::New(boolValue)); } void mitk::PropertyList::SetFloatProperty( const char* propertyKey, float floatValue) { SetProperty(propertyKey, mitk::FloatProperty::New(floatValue)); } void mitk::PropertyList::SetStringProperty( const char* propertyKey, const char* stringValue) { SetProperty(propertyKey, mitk::StringProperty::New(stringValue)); } diff --git a/Core/Code/DataManagement/mitkSmartPointerProperty.cpp b/Core/Code/DataManagement/mitkSmartPointerProperty.cpp index 39daf5d4c6..90a8ebfefa 100644 --- a/Core/Code/DataManagement/mitkSmartPointerProperty.cpp +++ b/Core/Code/DataManagement/mitkSmartPointerProperty.cpp @@ -1,157 +1,149 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "mitkSmartPointerProperty.h" mitk::SmartPointerProperty::ReferenceCountMapType mitk::SmartPointerProperty::m_ReferenceCount; mitk::SmartPointerProperty::ReferencesUIDMapType mitk::SmartPointerProperty::m_ReferencesUID; mitk::SmartPointerProperty::ReadInSmartPointersMapType mitk::SmartPointerProperty::m_ReadInInstances; mitk::SmartPointerProperty::ReadInTargetsMapType mitk::SmartPointerProperty::m_ReadInTargets; mitk::UIDGenerator mitk::SmartPointerProperty::m_UIDGenerator("POINTER_"); void mitk::SmartPointerProperty::PostProcessXMLReading() { for (ReadInSmartPointersMapType::iterator iter = m_ReadInInstances.begin(); iter != m_ReadInInstances.end(); ++iter) { if ( m_ReadInTargets.find(iter->second) != m_ReadInTargets.end() ) { iter->first->SetSmartPointer( m_ReadInTargets[ iter->second ] ); } } m_ReadInInstances.clear(); } /// \return The number of SmartPointerProperties that point to @param object unsigned int mitk::SmartPointerProperty::GetReferenceCountFor(itk::Object* object) { if ( m_ReferenceCount.find(object) != m_ReferenceCount.end() ) { return m_ReferenceCount[object]; } else { return 0; } } void mitk::SmartPointerProperty::RegisterPointerTarget(itk::Object* object, const std::string uid) { m_ReadInTargets[uid] = object; } std::string mitk::SmartPointerProperty::GetReferenceUIDFor(itk::Object* object) { if ( m_ReferencesUID.find(object) != m_ReferencesUID.end() ) { return m_ReferencesUID[object]; } else { return std::string("invalid"); } } -bool mitk::SmartPointerProperty::operator==(const BaseProperty& property) const +bool mitk::SmartPointerProperty::IsEqual(const BaseProperty& property) const { - const Self *other = dynamic_cast(&property); - - if(other==NULL) return false; - - return other->m_SmartPointer==m_SmartPointer; + return this->m_SmartPointer == static_cast(property).m_SmartPointer; } mitk::SmartPointerProperty::SmartPointerProperty(itk::Object* pointer) { SetSmartPointer( pointer ); } -mitk::SmartPointerProperty::~SmartPointerProperty() -{ -} - itk::Object::Pointer mitk::SmartPointerProperty::GetSmartPointer() const { return m_SmartPointer; } void mitk::SmartPointerProperty::SetSmartPointer(itk::Object* pointer) { if(m_SmartPointer.GetPointer() != pointer) { // keep track of referenced objects if ( m_SmartPointer.GetPointer() && --m_ReferenceCount[m_SmartPointer.GetPointer()] == 0 ) // if there is no reference left, delete entry { m_ReferenceCount.erase( m_SmartPointer.GetPointer() ); m_ReferencesUID.erase( m_SmartPointer.GetPointer() ); } if ( pointer && ++m_ReferenceCount[pointer] == 1 ) // first reference --> generate UID { m_ReferencesUID[pointer] = m_UIDGenerator.GetUID(); } // change pointer m_SmartPointer = pointer; Modified(); } } std::string mitk::SmartPointerProperty::GetValueAsString() const { if ( m_SmartPointer.IsNotNull() ) return m_ReferencesUID[ m_SmartPointer.GetPointer() ]; else return std::string("NULL"); } bool mitk::SmartPointerProperty::Assignable(const BaseProperty& other) const { try { dynamic_cast(other); // dear compiler, please don't optimize this away! return true; } catch (std::bad_cast) { } return false; } mitk::BaseProperty& mitk::SmartPointerProperty::operator=(const BaseProperty& other) { try { const Self& otherProp( dynamic_cast(other) ); if (this->m_SmartPointer != otherProp.m_SmartPointer) { this->m_SmartPointer = otherProp.m_SmartPointer; this->Modified(); } } catch (std::bad_cast) { // nothing to do then } return *this; } diff --git a/Core/Code/DataManagement/mitkSmartPointerProperty.h b/Core/Code/DataManagement/mitkSmartPointerProperty.h index 3a8ac8c7c2..58a1b0142e 100644 --- a/Core/Code/DataManagement/mitkSmartPointerProperty.h +++ b/Core/Code/DataManagement/mitkSmartPointerProperty.h @@ -1,93 +1,91 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKSMARTPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 #define MITKSMARTPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 #include #include "mitkBaseProperty.h" #include "mitkUIDGenerator.h" #include #include #include namespace mitk { //##Documentation //## @brief Property containing a smart-pointer //## @ingroup DataManagement class MITK_CORE_EXPORT SmartPointerProperty : public BaseProperty { public: mitkClassMacro(SmartPointerProperty, BaseProperty); itkNewMacro(SmartPointerProperty); mitkNewMacro1Param(SmartPointerProperty, itk::Object*); - - virtual bool operator==(const BaseProperty&) const; - - virtual ~SmartPointerProperty(); itk::Object::Pointer GetSmartPointer() const; void SetSmartPointer(itk::Object*); /// mainly for XML output virtual std::string GetValueAsString() const; virtual bool Assignable(const BaseProperty&) const; virtual BaseProperty& operator=(const BaseProperty& property); static void PostProcessXMLReading(); /// Return the number of SmartPointerProperties that reference the object given as parameter static unsigned int GetReferenceCountFor(itk::Object*); static std::string GetReferenceUIDFor(itk::Object*); static void RegisterPointerTarget(itk::Object*, const std::string uid); protected: SmartPointerProperty(itk::Object* = NULL); itk::Object::Pointer m_SmartPointer; private: + virtual bool IsEqual(const BaseProperty&) const; + typedef std::map ReferenceCountMapType; typedef std::map ReferencesUIDMapType; typedef std::map ReadInSmartPointersMapType; typedef std::map ReadInTargetsMapType; /// for each itk::Object* count how many SmartPointerProperties point to it static ReferenceCountMapType m_ReferenceCount; static ReferencesUIDMapType m_ReferencesUID; static ReadInSmartPointersMapType m_ReadInInstances; static ReadInTargetsMapType m_ReadInTargets; /// to generate unique IDs for the objects pointed at (during XML writing) static UIDGenerator m_UIDGenerator; }; } // namespace mitk #endif /* MITKSMARTPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 */ diff --git a/Core/Code/DataManagement/mitkStringProperty.cpp b/Core/Code/DataManagement/mitkStringProperty.cpp index bba9beefed..d47f00bdbc 100644 --- a/Core/Code/DataManagement/mitkStringProperty.cpp +++ b/Core/Code/DataManagement/mitkStringProperty.cpp @@ -1,82 +1,78 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "mitkStringProperty.h" const char* mitk::StringProperty::PATH = "path"; mitk::StringProperty::StringProperty( const char* string ) : m_Value() { if ( string ) m_Value = string; } mitk::StringProperty::StringProperty( const std::string& s ) : m_Value( s ) { } -bool mitk::StringProperty::operator==(const BaseProperty& property ) const +bool mitk::StringProperty::IsEqual(const BaseProperty& property ) const { - const Self *other = dynamic_cast(&property); - - if(other==NULL) return false; - - return other->m_Value==m_Value; + return this->m_Value == static_cast(property).m_Value; } std::string mitk::StringProperty::GetValueAsString() const { return m_Value; } bool mitk::StringProperty::Assignable(const BaseProperty& other) const { try { dynamic_cast(other); // dear compiler, please don't optimize this away! return true; } catch (std::bad_cast) { } return false; } mitk::BaseProperty& mitk::StringProperty::operator=(const BaseProperty& other) { try { const Self& otherProp( dynamic_cast(other) ); if (this->m_Value != otherProp.m_Value) { this->m_Value = otherProp.m_Value; this->Modified(); } } catch (std::bad_cast) { // nothing to do then } return *this; } diff --git a/Core/Code/DataManagement/mitkStringProperty.h b/Core/Code/DataManagement/mitkStringProperty.h index 893fcacc19..69fc3d21e7 100644 --- a/Core/Code/DataManagement/mitkStringProperty.h +++ b/Core/Code/DataManagement/mitkStringProperty.h @@ -1,66 +1,69 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKSTRINGPROPERTY_H_HEADER_INCLUDED_C1C02491 #define MITKSTRINGPROPERTY_H_HEADER_INCLUDED_C1C02491 #include #include #include "mitkBaseProperty.h" #include namespace mitk { /** * @brief Property for strings * @ingroup DataManagement */ class MITK_CORE_EXPORT StringProperty : public BaseProperty { protected: std::string m_Value; StringProperty( const char* string = 0 ); StringProperty( const std::string& s ); public: mitkClassMacro(StringProperty, BaseProperty); typedef std::string ValueType; itkNewMacro(StringProperty); mitkNewMacro1Param(StringProperty, const char*); mitkNewMacro1Param(StringProperty, const std::string&) itkGetStringMacro(Value); itkSetStringMacro(Value); - virtual bool operator==(const BaseProperty& property ) const; virtual std::string GetValueAsString() const; bool Assignable(const BaseProperty& other) const; virtual BaseProperty& operator=(const BaseProperty& other); static const char* PATH; + + private: + + virtual bool IsEqual(const BaseProperty& property ) const; }; } // namespace mitk #endif diff --git a/Core/Code/DataManagement/mitkTransferFunctionProperty.cpp b/Core/Code/DataManagement/mitkTransferFunctionProperty.cpp new file mode 100644 index 0000000000..217af15cdf --- /dev/null +++ b/Core/Code/DataManagement/mitkTransferFunctionProperty.cpp @@ -0,0 +1,49 @@ +/*========================================================================= + +Program: Medical Imaging & Interaction Toolkit +Language: C++ +Date: $Date$ +Version: $Revision$ + +Copyright (c) German Cancer Research Center, Division of Medical and +Biological Informatics. All rights reserved. +See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. + +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + + +#include "mitkTransferFunctionProperty.h" + + +namespace mitk { + +bool TransferFunctionProperty::IsEqual(const BaseProperty& property) const +{ + return *(this->m_Value) == *(static_cast(property).m_Value); +} + +BaseProperty& TransferFunctionProperty::operator=(const BaseProperty& other) +{ + return Superclass::operator=(other); +} + +std::string TransferFunctionProperty::GetValueAsString() const +{ + std::stringstream myStr; + myStr << GetValue() ; + return myStr.str(); +} + +TransferFunctionProperty::TransferFunctionProperty() + : BaseProperty() +{} + +TransferFunctionProperty::TransferFunctionProperty( mitk::TransferFunction::Pointer value ) + : BaseProperty(), m_Value( value ) +{} + +} // namespace mitk diff --git a/Core/Code/DataManagement/mitkTransferFunctionProperty.h b/Core/Code/DataManagement/mitkTransferFunctionProperty.h index e17af7b605..5ba77cb66f 100644 --- a/Core/Code/DataManagement/mitkTransferFunctionProperty.h +++ b/Core/Code/DataManagement/mitkTransferFunctionProperty.h @@ -1,81 +1,57 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKTRANFERFUNCTIONPROPERTY_H_HEADER_INCLUDED #define MITKTRANFERFUNCTIONPROPERTY_H_HEADER_INCLUDED #include "mitkBaseProperty.h" #include "mitkTransferFunction.h" namespace mitk { - class MITK_CORE_EXPORT TransferFunctionProperty : public BaseProperty - { - public: - mitkClassMacro(TransferFunctionProperty, BaseProperty); - - itkNewMacro(TransferFunctionProperty); - mitkNewMacro1Param(TransferFunctionProperty, mitk::TransferFunction::Pointer); - - itkSetMacro(Value, mitk::TransferFunction::Pointer ); - itkGetConstMacro(Value, mitk::TransferFunction::Pointer ); - - /** - * - */ - virtual bool operator==(const BaseProperty& property) const { - - const Self *other = dynamic_cast(&property); - - if(other==NULL) - return false; - else - return *(m_Value.GetPointer()) == *(other->m_Value.GetPointer()); - } - virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } - /** - * - */ - std::string GetValueAsString() const { - std::stringstream myStr; - myStr << GetValue() ; - return myStr.str(); - } - - protected: - mitk::TransferFunction::Pointer m_Value; - - TransferFunctionProperty() - : BaseProperty() - {}; - - virtual ~TransferFunctionProperty() - { - }; - - TransferFunctionProperty( mitk::TransferFunction::Pointer value ) - : BaseProperty(), m_Value( value ) - {}; - }; - - - // typedef GenericProperty TransferFunctionProperty; +class MITK_CORE_EXPORT TransferFunctionProperty : public BaseProperty +{ +public: + mitkClassMacro(TransferFunctionProperty, BaseProperty); + + itkNewMacro(TransferFunctionProperty); + mitkNewMacro1Param(TransferFunctionProperty, mitk::TransferFunction::Pointer); + + itkSetMacro(Value, mitk::TransferFunction::Pointer ); + itkGetConstMacro(Value, mitk::TransferFunction::Pointer ); + + virtual BaseProperty& operator=(const BaseProperty& other); + + std::string GetValueAsString() const; + +protected: + mitk::TransferFunction::Pointer m_Value; + + TransferFunctionProperty(); + + TransferFunctionProperty( mitk::TransferFunction::Pointer value ); + +private: + + virtual bool IsEqual(const BaseProperty& property) const; +}; + } // namespace mitk #endif /* MITKTRANFERFUNCTIONPROPERTY_H_HEADER_INCLUDED */ diff --git a/Core/Code/DataManagement/mitkWeakPointerProperty.cpp b/Core/Code/DataManagement/mitkWeakPointerProperty.cpp index 138f06211f..9f8918afaf 100644 --- a/Core/Code/DataManagement/mitkWeakPointerProperty.cpp +++ b/Core/Code/DataManagement/mitkWeakPointerProperty.cpp @@ -1,54 +1,50 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "mitkWeakPointerProperty.h" -bool mitk::WeakPointerProperty::operator==(const BaseProperty& property) const +bool mitk::WeakPointerProperty::IsEqual(const BaseProperty& property) const { - const Self *other = dynamic_cast(&property); - - if(other==NULL) return false; - - return other->m_WeakPointer==m_WeakPointer; + return this->m_WeakPointer == static_cast(property).m_WeakPointer; } mitk::WeakPointerProperty::WeakPointerProperty(itk::Object* pointer) : m_WeakPointer(pointer) { Modified(); } mitk::WeakPointerProperty::~WeakPointerProperty() { } itk::Object::Pointer mitk::WeakPointerProperty::GetWeakPointer() const { return m_WeakPointer.GetPointer(); } void mitk::WeakPointerProperty::SetWeakPointer(itk::Object* pointer) { if(m_WeakPointer.GetPointer() != pointer) { m_WeakPointer = pointer; Modified(); } } diff --git a/Core/Code/DataManagement/mitkWeakPointerProperty.h b/Core/Code/DataManagement/mitkWeakPointerProperty.h index 15c1f773cb..d7b88c2d3e 100644 --- a/Core/Code/DataManagement/mitkWeakPointerProperty.h +++ b/Core/Code/DataManagement/mitkWeakPointerProperty.h @@ -1,58 +1,59 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 #define MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 #include #include "mitkBaseProperty.h" #include "itkWeakPointer.h" namespace mitk { //##Documentation //## @brief Property containing a smart-pointer //## //## @ingroup DataManagement class MITK_CORE_EXPORT WeakPointerProperty : public BaseProperty { public: mitkClassMacro(WeakPointerProperty, BaseProperty); mitkNewMacro1Param(WeakPointerProperty, itk::Object*); - virtual bool operator==(const BaseProperty& property) const; - virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } virtual ~WeakPointerProperty(); itk::Object::Pointer GetWeakPointer() const; void SetWeakPointer(itk::Object* pointer); protected: itk::WeakPointer m_WeakPointer; WeakPointerProperty(itk::Object* pointer); + + private: + virtual bool IsEqual(const BaseProperty& property) const; }; } // namespace mitk #endif /* MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 */ diff --git a/Core/Code/IO/mitkLookupTableProperty.cpp b/Core/Code/IO/mitkLookupTableProperty.cpp index b2933ba104..c841b0df41 100755 --- a/Core/Code/IO/mitkLookupTableProperty.cpp +++ b/Core/Code/IO/mitkLookupTableProperty.cpp @@ -1,60 +1,55 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "mitkLookupTableProperty.h" mitk::LookupTableProperty::LookupTableProperty() { } mitk::LookupTableProperty::LookupTableProperty(const mitk::LookupTable::Pointer lut) { this->SetLookupTable(lut); } //mitk::LookupTableProperty::LookupTableProperty(const mitk::LookupTable &aLookupTable) //{ // SetLookupTable(aLookupTable); //} mitk::LookupTableProperty::~LookupTableProperty() { } -bool mitk::LookupTableProperty::operator==(const BaseProperty& property) const +bool mitk::LookupTableProperty::IsEqual(const BaseProperty& property) const { - const Self *other = dynamic_cast(&property); - - if(other==NULL) return false; - - return *(other->m_LookupTable.GetPointer())==*(m_LookupTable.GetPointer()); - + return *(this->m_LookupTable) == *(static_cast(property).m_LookupTable); } void mitk::LookupTableProperty::SetLookupTable(const mitk::LookupTable::Pointer aLookupTable) { // MITK_INFO << "setting LUT property ... " << std::endl; if((m_LookupTable != aLookupTable) || (*m_LookupTable != *aLookupTable)) { m_LookupTable = aLookupTable; Modified(); } // MITK_INFO << "setting LUT property OK! " << std::endl; } diff --git a/Core/Code/IO/mitkLookupTableProperty.h b/Core/Code/IO/mitkLookupTableProperty.h index 12bc89cde6..f173c6eb17 100755 --- a/Core/Code/IO/mitkLookupTableProperty.h +++ b/Core/Code/IO/mitkLookupTableProperty.h @@ -1,66 +1,68 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKLookupTablePROPERTY_H_HEADER_INCLUDED_C10EEAA8 #define MITKLookupTablePROPERTY_H_HEADER_INCLUDED_C10EEAA8 #include #include "mitkBaseProperty.h" #include "mitkLookupTable.h" namespace mitk { //##Documentation //## @brief Property for LookupTable data //## //## @ingroup DataManagement class MITK_CORE_EXPORT LookupTableProperty : public BaseProperty { protected: LookupTable::Pointer m_LookupTable; LookupTableProperty(); LookupTableProperty(const mitk::LookupTable::Pointer lut); // LookupTableProperty(const mitk::LookupTable& aLookupTable); public: mitkClassMacro(LookupTableProperty, BaseProperty); itkNewMacro(LookupTableProperty); mitkNewMacro1Param(LookupTableProperty, const mitk::LookupTable::Pointer); virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } virtual ~LookupTableProperty(); - virtual bool operator==(const BaseProperty& property) const; - itkGetObjectMacro(LookupTable, LookupTable ); void SetLookupTable(const mitk::LookupTable::Pointer aLookupTable); + private: + + virtual bool IsEqual(const BaseProperty& property) const; + }; } // namespace mitk #endif /* MITKLookupTablePROPERTY_H_HEADER_INCLUDED_C10EEAA8 */ diff --git a/Core/Code/files.cmake b/Core/Code/files.cmake index b17a9bd424..aa827dd29b 100644 --- a/Core/Code/files.cmake +++ b/Core/Code/files.cmake @@ -1,324 +1,325 @@ SET(H_FILES Algorithms/itkImportMitkImageContainer.h Algorithms/itkImportMitkImageContainer.txx Algorithms/itkLocalVariationImageFilter.h Algorithms/itkLocalVariationImageFilter.txx Algorithms/itkMITKScalarImageToHistogramGenerator.h Algorithms/itkMITKScalarImageToHistogramGenerator.txx Algorithms/itkTotalVariationDenoisingImageFilter.h Algorithms/itkTotalVariationDenoisingImageFilter.txx Algorithms/itkTotalVariationSingleIterationImageFilter.h Algorithms/itkTotalVariationSingleIterationImageFilter.txx Algorithms/mitkImageAccessByItk.h Algorithms/mitkImageCast.h Algorithms/mitkImageToItk.h Algorithms/mitkImageToItk.txx Algorithms/mitkInstantiateAccessFunctions.h Algorithms/mitkITKImageImport.h Algorithms/mitkITKImageImport.txx Algorithms/mitkPixelTypeList.h # Preprocessor macros taken from Boost Algorithms/mitkPPArithmeticDec.h Algorithms/mitkPPArgCount.h Algorithms/mitkPPCat.h Algorithms/mitkPPConfig.h Algorithms/mitkPPControlExprIIf.h Algorithms/mitkPPControlIf.h Algorithms/mitkPPControlIIf.h Algorithms/mitkPPDebugError.h Algorithms/mitkPPDetailAutoRec.h Algorithms/mitkPPDetailDMCAutoRec.h Algorithms/mitkPPExpand.h Algorithms/mitkPPFacilitiesEmpty.h Algorithms/mitkPPFacilitiesExpand.h Algorithms/mitkPPLogicalBool.h Algorithms/mitkPPRepetitionDetailDMCFor.h Algorithms/mitkPPRepetitionDetailEDGFor.h Algorithms/mitkPPRepetitionDetailFor.h Algorithms/mitkPPRepetitionDetailMSVCFor.h Algorithms/mitkPPRepetitionFor.h Algorithms/mitkPPSeqElem.h Algorithms/mitkPPSeqForEach.h Algorithms/mitkPPSeqForEachProduct.h Algorithms/mitkPPSeq.h Algorithms/mitkPPSeqEnum.h Algorithms/mitkPPSeqSize.h Algorithms/mitkPPSeqToTuple.h Algorithms/mitkPPStringize.h Algorithms/mitkPPTupleEat.h Algorithms/mitkPPTupleElem.h Algorithms/mitkPPTupleRem.h Algorithms/mitkClippedSurfaceBoundsCalculator.h DataManagement/mitkCommon.h Interactions/mitkEventMapperAddOn.h Service/mitkAny.h Service/mitkGetModuleContext.h Service/mitkItkHashMap.h Service/mitkItkHashSet.h Service/mitkItkHashTable.h Service/mitkModuleAbstractTracked.h Service/mitkModuleAbstractTracked.tpp Service/mitkModuleActivator.h Service/mitkServiceFactory.h Service/mitkServiceTracker.h Service/mitkServiceTracker.tpp Service/mitkServiceTrackerCustomizer.h Service/mitkServiceTrackerPrivate.h Service/mitkServiceTrackerPrivate.tpp Service/mitkServiceUtils.h Service/mitkSharedData.h Service/mitkStaticInit.h Service/mitkTrackedService.h Service/mitkTrackedService.tpp Service/mitkTrackedServiceListener.h ) SET(CPP_FILES Algorithms/mitkBaseDataSource.cpp Algorithms/mitkBaseProcess.cpp Algorithms/mitkCoreObjectFactoryBase.cpp Algorithms/mitkCoreObjectFactory.cpp Algorithms/mitkDataNodeFactory.cpp Algorithms/mitkDataNodeSource.cpp Algorithms/mitkGeometry2DDataToSurfaceFilter.cpp Algorithms/mitkHistogramGenerator.cpp Algorithms/mitkImageCaster.cpp Algorithms/mitkImageCastPart1.cpp Algorithms/mitkImageCastPart2.cpp Algorithms/mitkImageCastPart3.cpp Algorithms/mitkImageCastPart4.cpp Algorithms/mitkImageChannelSelector.cpp Algorithms/mitkImageSliceSelector.cpp Algorithms/mitkImageSource.cpp Algorithms/mitkImageTimeSelector.cpp Algorithms/mitkImageToImageFilter.cpp Algorithms/mitkPointSetSource.cpp Algorithms/mitkPointSetToPointSetFilter.cpp Algorithms/mitkRGBToRGBACastImageFilter.cpp Algorithms/mitkSubImageSelector.cpp Algorithms/mitkSurfaceSource.cpp Algorithms/mitkSurfaceToSurfaceFilter.cpp Algorithms/mitkUIDGenerator.cpp Algorithms/mitkVolumeCalculator.cpp Algorithms/mitkClippedSurfaceBoundsCalculator.cpp Controllers/mitkBaseController.cpp Controllers/mitkCallbackFromGUIThread.cpp Controllers/mitkCameraController.cpp Controllers/mitkCameraRotationController.cpp Controllers/mitkFocusManager.cpp Controllers/mitkLimitedLinearUndo.cpp Controllers/mitkOperationEvent.cpp Controllers/mitkProgressBar.cpp Controllers/mitkRenderingManager.cpp Controllers/mitkSliceNavigationController.cpp Controllers/mitkSlicesCoordinator.cpp Controllers/mitkSlicesRotator.cpp Controllers/mitkSlicesSwiveller.cpp Controllers/mitkStatusBar.cpp Controllers/mitkStepper.cpp Controllers/mitkTestManager.cpp Controllers/mitkUndoController.cpp Controllers/mitkVerboseLimitedLinearUndo.cpp Controllers/mitkVtkInteractorCameraController.cpp Controllers/mitkVtkLayerController.cpp DataManagement/mitkAbstractTransformGeometry.cpp DataManagement/mitkAnnotationProperty.cpp DataManagement/mitkApplicationCursor.cpp DataManagement/mitkBaseData.cpp DataManagement/mitkBaseProperty.cpp DataManagement/mitkClippingProperty.cpp DataManagement/mitkColorProperty.cpp DataManagement/mitkDataStorage.cpp #DataManagement/mitkDataTree.cpp DataManagement/mitkDataNode.cpp #DataManagement/mitkDataTreeStorage.cpp DataManagement/mitkDisplayGeometry.cpp DataManagement/mitkEnumerationProperty.cpp DataManagement/mitkGeometry2D.cpp DataManagement/mitkGeometry2DData.cpp DataManagement/mitkGeometry3D.cpp DataManagement/mitkGeometryData.cpp DataManagement/mitkGroupTagProperty.cpp DataManagement/mitkImage.cpp DataManagement/mitkImageDataItem.cpp DataManagement/mitkLandmarkBasedCurvedGeometry.cpp DataManagement/mitkLandmarkProjectorBasedCurvedGeometry.cpp DataManagement/mitkLandmarkProjector.cpp DataManagement/mitkLevelWindow.cpp DataManagement/mitkLevelWindowManager.cpp DataManagement/mitkLevelWindowPreset.cpp DataManagement/mitkLevelWindowProperty.cpp DataManagement/mitkLookupTable.cpp DataManagement/mitkLookupTables.cpp # specializations of GenericLookupTable DataManagement/mitkMemoryUtilities.cpp DataManagement/mitkModalityProperty.cpp DataManagement/mitkModeOperation.cpp DataManagement/mitkNodePredicateAnd.cpp DataManagement/mitkNodePredicateBase.cpp DataManagement/mitkNodePredicateCompositeBase.cpp DataManagement/mitkNodePredicateData.cpp DataManagement/mitkNodePredicateDataType.cpp DataManagement/mitkNodePredicateDimension.cpp DataManagement/mitkNodePredicateFirstLevel.cpp DataManagement/mitkNodePredicateNot.cpp DataManagement/mitkNodePredicateOr.cpp DataManagement/mitkNodePredicateProperty.cpp DataManagement/mitkNodePredicateSource.cpp DataManagement/mitkPlaneOrientationProperty.cpp DataManagement/mitkPlaneGeometry.cpp DataManagement/mitkPlaneOperation.cpp DataManagement/mitkPointOperation.cpp DataManagement/mitkPointSet.cpp DataManagement/mitkProperties.cpp DataManagement/mitkPropertyList.cpp DataManagement/mitkRotationOperation.cpp DataManagement/mitkSlicedData.cpp DataManagement/mitkSlicedGeometry3D.cpp DataManagement/mitkSmartPointerProperty.cpp DataManagement/mitkStandaloneDataStorage.cpp DataManagement/mitkStateTransitionOperation.cpp DataManagement/mitkStringProperty.cpp DataManagement/mitkSurface.cpp DataManagement/mitkSurfaceOperation.cpp DataManagement/mitkThinPlateSplineCurvedGeometry.cpp DataManagement/mitkTimeSlicedGeometry.cpp DataManagement/mitkTransferFunction.cpp + DataManagement/mitkTransferFunctionProperty.cpp DataManagement/mitkTransferFunctionInitializer.cpp DataManagement/mitkVector.cpp DataManagement/mitkVtkInterpolationProperty.cpp DataManagement/mitkVtkRepresentationProperty.cpp DataManagement/mitkVtkResliceInterpolationProperty.cpp DataManagement/mitkVtkScalarModeProperty.cpp DataManagement/mitkVtkVolumeRenderingProperty.cpp DataManagement/mitkWeakPointerProperty.cpp DataManagement/mitkShaderProperty.cpp DataManagement/mitkResliceMethodProperty.cpp DataManagement/mitkMaterial.cpp Interactions/mitkAction.cpp Interactions/mitkAffineInteractor.cpp Interactions/mitkCoordinateSupplier.cpp Interactions/mitkDisplayCoordinateOperation.cpp Interactions/mitkDisplayInteractor.cpp Interactions/mitkDisplayPositionEvent.cpp Interactions/mitkDisplayVectorInteractor.cpp Interactions/mitkDisplayVectorInteractorLevelWindow.cpp Interactions/mitkDisplayVectorInteractorScroll.cpp Interactions/mitkEvent.cpp Interactions/mitkEventDescription.cpp Interactions/mitkEventMapper.cpp Interactions/mitkGlobalInteraction.cpp Interactions/mitkInteractor.cpp Interactions/mitkMouseMovePointSetInteractor.cpp Interactions/mitkMoveSurfaceInteractor.cpp Interactions/mitkNodeDepententPointSetInteractor.cpp Interactions/mitkPointSetInteractor.cpp Interactions/mitkPositionEvent.cpp Interactions/mitkPositionTracker.cpp Interactions/mitkState.cpp Interactions/mitkStateEvent.cpp Interactions/mitkStateMachine.cpp Interactions/mitkStateMachineFactory.cpp Interactions/mitkTransition.cpp Interactions/mitkWheelEvent.cpp Interactions/mitkKeyEvent.cpp Interactions/mitkVtkEventAdapter.cpp Interactions/mitkCrosshairPositionEvent.cpp IO/mitkBaseDataIOFactory.cpp IO/mitkDicomSeriesReader.cpp IO/mitkFileReader.cpp IO/mitkFileSeriesReader.cpp IO/mitkFileWriter.cpp IO/mitkIpPicGet.c IO/mitkImageGenerator.cpp IO/mitkImageWriter.cpp IO/mitkImageWriterFactory.cpp IO/mitkItkImageFileIOFactory.cpp IO/mitkItkImageFileReader.cpp IO/mitkItkPictureWrite.cpp IO/mitkLookupTableProperty.cpp IO/mitkOperation.cpp IO/mitkPicFileIOFactory.cpp IO/mitkPicFileReader.cpp IO/mitkPicFileWriter.cpp IO/mitkPicHelper.cpp IO/mitkPicVolumeTimeSeriesIOFactory.cpp IO/mitkPicVolumeTimeSeriesReader.cpp IO/mitkPixelType.cpp IO/mitkPointSetIOFactory.cpp IO/mitkPointSetReader.cpp IO/mitkPointSetWriter.cpp IO/mitkPointSetWriterFactory.cpp IO/mitkRawImageFileReader.cpp IO/mitkStandardFileLocations.cpp IO/mitkSTLFileIOFactory.cpp IO/mitkSTLFileReader.cpp IO/mitkSurfaceVtkWriter.cpp IO/mitkSurfaceVtkWriterFactory.cpp IO/mitkVtiFileIOFactory.cpp IO/mitkVtiFileReader.cpp IO/mitkVtkImageIOFactory.cpp IO/mitkVtkImageReader.cpp IO/mitkVtkSurfaceIOFactory.cpp IO/mitkVtkSurfaceReader.cpp IO/vtkPointSetXMLParser.cpp IO/mitkLog.cpp Rendering/mitkBaseRenderer.cpp Rendering/mitkVtkMapper2D.cpp Rendering/mitkVtkMapper3D.cpp Rendering/mitkRenderWindowFrame.cpp Rendering/mitkGeometry2DDataMapper2D.cpp Rendering/mitkGeometry2DDataVtkMapper3D.cpp Rendering/mitkGLMapper2D.cpp Rendering/mitkGradientBackground.cpp Rendering/mitkManufacturerLogo.cpp Rendering/mitkMapper2D.cpp Rendering/mitkMapper3D.cpp Rendering/mitkMapper.cpp Rendering/mitkPointSetGLMapper2D.cpp Rendering/mitkPointSetVtkMapper3D.cpp Rendering/mitkPolyDataGLMapper2D.cpp Rendering/mitkSurfaceGLMapper2D.cpp Rendering/mitkSurfaceVtkMapper3D.cpp Rendering/mitkVolumeDataVtkMapper3D.cpp Rendering/mitkVtkPropRenderer.cpp Rendering/mitkVtkWidgetRendering.cpp Rendering/vtkMitkRectangleProp.cpp Rendering/vtkMitkRenderProp.cpp Rendering/mitkVtkEventProvider.cpp Rendering/mitkRenderWindow.cpp Rendering/mitkRenderWindowBase.cpp Rendering/mitkShaderRepository.cpp Rendering/mitkImageVtkMapper2D.cpp Rendering/vtkMitkThickSlicesFilter.cpp Rendering/vtkMitkApplyLevelWindowToRGBFilter.cpp Service/mitkAny.cpp Service/mitkAtomicInt.cpp Service/mitkCoreActivator.cpp Service/mitkCoreModuleContext.cpp Service/mitkModule.cpp Service/mitkModuleContext.cpp Service/mitkModuleEvent.cpp Service/mitkModuleInfo.cpp Service/mitkModulePrivate.cpp Service/mitkModuleRegistry.cpp Service/mitkModuleUtils.cpp Service/mitkModuleVersion.cpp Service/mitkLDAPExpr.cpp Service/mitkLDAPFilter.cpp Service/mitkServiceEvent.cpp Service/mitkServiceException.cpp Service/mitkServiceListenerEntry.cpp Service/mitkServiceListeners.cpp Service/mitkServiceProperties.cpp Service/mitkServiceReference.cpp Service/mitkServiceReferencePrivate.cpp Service/mitkServiceRegistration.cpp Service/mitkServiceRegistrationPrivate.cpp Service/mitkServiceRegistry.cpp )