diff --git a/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.cpp b/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.cpp index ab0c53167e..f997a425de 100644 --- a/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.cpp +++ b/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.cpp @@ -1,100 +1,101 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-12 19:31:16 +0200 (Di, 12 Mai 2009) $ 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 "mitkOdfNormalizationMethodProperty.h" // ODFN_MINMAX, ODFN_MAX, ODFN_NONE ODFN_GLOBAL_MAX mitk::OdfNormalizationMethodProperty::OdfNormalizationMethodProperty( ) { this->AddInterpolationTypes(); this->SetValue( static_cast( ODFN_MINMAX ) ); } mitk::OdfNormalizationMethodProperty::OdfNormalizationMethodProperty( const IdType& value ) { this->AddInterpolationTypes(); if ( IsValidEnumerationValue( value ) ) { this->SetValue( value ) ; } else { this->SetValue( static_cast( ODFN_MINMAX ) ); } } mitk::OdfNormalizationMethodProperty::OdfNormalizationMethodProperty( const std::string& value ) { this->AddInterpolationTypes(); if ( IsValidEnumerationValue( value ) ) { this->SetValue( value ); } else { this->SetValue( static_cast( ODFN_MINMAX ) ); } } int mitk::OdfNormalizationMethodProperty::GetNormalization() { return static_cast( this->GetValueAsId() ); } void mitk::OdfNormalizationMethodProperty::SetNormalizationToMinMax() { this->SetValue( static_cast( ODFN_MINMAX ) ); } void mitk::OdfNormalizationMethodProperty::SetNormalizationToMax() { this->SetValue( static_cast( ODFN_MAX ) ); } void mitk::OdfNormalizationMethodProperty::SetNormalizationToNone() { this->SetValue( static_cast( ODFN_NONE ) ); } void mitk::OdfNormalizationMethodProperty::SetNormalizationToGlobalMax() { this->SetValue( static_cast( ODFN_GLOBAL_MAX ) ); } void mitk::OdfNormalizationMethodProperty::AddInterpolationTypes() { AddEnum( "Min-Max", static_cast( ODFN_MINMAX ) ); AddEnum( "Maximum", static_cast( ODFN_MAX ) ); AddEnum( "None", static_cast( ODFN_NONE ) ); AddEnum( "Global Maximum", static_cast( ODFN_GLOBAL_MAX ) ); } bool mitk::OdfNormalizationMethodProperty::AddEnum( const std::string& name, const IdType& id ) { return Superclass::AddEnum( name, id ); } MITK_REGISTER_SERIALIZER( OdfNormalizationMethodPropertySerializer ) +MITK_REGISTER_SERIALIZER( OdfNormalizationMethodPropertyDeserializer ) diff --git a/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.h b/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.h index efa3c1911f..296222b138 100644 --- a/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.h +++ b/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.h @@ -1,163 +1,153 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-12 19:31:16 +0200 (Di, 12 Mai 2009) $ 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_OdfNormalizationMethodProperty__H_ #define _MITK_OdfNormalizationMethodProperty__H_ #include "mitkEnumerationProperty.h" +#include "mitkEnumerationPropertySerializer.h" #include "MitkDiffusionImagingExports.h" #include "mitkBasePropertyDeserializer.h" #include "mitkBasePropertySerializer.h" #include "mitkSerializerMacros.h" namespace mitk { enum OdfNormalizationMethod { ODFN_MINMAX, ODFN_MAX, ODFN_NONE, ODFN_GLOBAL_MAX }; /** * Encapsulates the enumeration for ODF normalization. Valid values are * ODFN_MINMAX, ODFN_MAX, ODFN_NONE ODFN_GLOBAL_MAX * Default is ODFN_MINMAX */ class MitkDiffusionImaging_EXPORT OdfNormalizationMethodProperty : public EnumerationProperty { public: mitkClassMacro( OdfNormalizationMethodProperty, EnumerationProperty ); itkNewMacro(OdfNormalizationMethodProperty); mitkNewMacro1Param(OdfNormalizationMethodProperty, const IdType&); mitkNewMacro1Param(OdfNormalizationMethodProperty, const std::string&); /** * Returns the current interpolation value as defined by VTK constants. */ virtual int GetNormalization(); /** * Sets the interpolation type to ODFN_MINMAX. */ virtual void SetNormalizationToMinMax(); /** * Sets the interpolation type to ODFN_MAX. */ virtual void SetNormalizationToMax(); /** * Sets the interpolation type to ODFN_NONE. */ virtual void SetNormalizationToNone(); /** * Sets the interpolation type to ODFN_GLOBAL_MAX. */ virtual void SetNormalizationToGlobalMax(); protected: /** Sets reslice interpolation mode to default (VTK_RESLICE_NEAREST). */ OdfNormalizationMethodProperty( ); /** * Constructor. Sets reslice interpolation to the given value. */ OdfNormalizationMethodProperty( const IdType& value ); /** * Constructor. Sets reslice interpolation to the given value. */ OdfNormalizationMethodProperty( const std::string& value ); /** * this function is overridden as protected, so that the user may not add * additional invalid interpolation types. */ virtual bool AddEnum( const std::string& name, const IdType& id ); /** * Adds the enumeration types as defined by vtk to the list of known * enumeration values. */ virtual void AddInterpolationTypes(); }; class MitkDiffusionImaging_EXPORT OdfNormalizationMethodPropertyDeserializer : public BasePropertyDeserializer { public: mitkClassMacro( OdfNormalizationMethodPropertyDeserializer, BasePropertyDeserializer ); itkNewMacro(Self); virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) { if (!element) return NULL; const char* sa( element->Attribute("value") ); std::string s(sa?sa:""); OdfNormalizationMethodProperty::Pointer property = OdfNormalizationMethodProperty::New(); property->SetValue( s ); return property.GetPointer(); } protected: OdfNormalizationMethodPropertyDeserializer () {} virtual ~OdfNormalizationMethodPropertyDeserializer () {} }; -class MitkDiffusionImaging_EXPORT OdfNormalizationMethodPropertySerializer : public BasePropertySerializer +class MitkDiffusionImaging_EXPORT OdfNormalizationMethodPropertySerializer : public EnumerationPropertySerializer { public: - mitkClassMacro( OdfNormalizationMethodPropertySerializer, BasePropertySerializer ); + mitkClassMacro( OdfNormalizationMethodPropertySerializer, EnumerationPropertySerializer ); itkNewMacro(Self); - virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) - { - if (!element) return NULL; - const char* sa( element->Attribute("value") ); - std::string s(sa?sa:""); - OdfNormalizationMethodProperty::Pointer property = OdfNormalizationMethodProperty::New(); - property->SetValue( s ); - return property.GetPointer(); - } - - protected: OdfNormalizationMethodPropertySerializer () {} virtual ~OdfNormalizationMethodPropertySerializer () {} }; } // end of namespace mitk #endif diff --git a/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.cpp b/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.cpp index b117b9134f..172bcd76f5 100644 --- a/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.cpp +++ b/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.cpp @@ -1,88 +1,89 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-12 19:31:16 +0200 (Di, 12 Mai 2009) $ 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 "mitkOdfScaleByProperty.h" // ODFN_NONE, ODFN_GFA, ODFN_PC mitk::OdfScaleByProperty::OdfScaleByProperty( ) { this->AddInterpolationTypes(); this->SetValue( static_cast( ODFSB_NONE ) ); } mitk::OdfScaleByProperty::OdfScaleByProperty( const IdType& value ) { this->AddInterpolationTypes(); if ( IsValidEnumerationValue( value ) ) { this->SetValue( value ) ; } else { this->SetValue( static_cast( ODFSB_NONE ) ); } } mitk::OdfScaleByProperty::OdfScaleByProperty( const std::string& value ) { this->AddInterpolationTypes(); if ( IsValidEnumerationValue( value ) ) { this->SetValue( value ); } else { this->SetValue( static_cast( ODFSB_NONE ) ); } } int mitk::OdfScaleByProperty::GetScaleBy() { return static_cast( this->GetValueAsId() ); } void mitk::OdfScaleByProperty::AddInterpolationTypes() { AddEnum( "None", static_cast( ODFSB_NONE ) ); AddEnum( "GFA", static_cast( ODFSB_GFA ) ); AddEnum( "Principal Curvature", static_cast( ODFSB_PC ) ); } void mitk::OdfScaleByProperty::SetScaleByNothing() { SetValue(ODFSB_NONE); } void mitk::OdfScaleByProperty::SetScaleByGFA() { SetValue(ODFSB_GFA); } void mitk::OdfScaleByProperty::SetScaleByPrincipalCurvature() { SetValue(ODFSB_PC); } bool mitk::OdfScaleByProperty::AddEnum( const std::string& name, const IdType& id ) { return Superclass::AddEnum( name, id ); } MITK_REGISTER_SERIALIZER( OdfScaleByPropertySerializer ) +MITK_REGISTER_SERIALIZER( OdfScaleByPropertyDeserializer ) diff --git a/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.h b/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.h index a552d579b7..985cee527d 100644 --- a/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.h +++ b/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.h @@ -1,143 +1,133 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-12 19:31:16 +0200 (Di, 12 Mai 2009) $ 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_OdfScaleByProperty__H_ #define _MITK_OdfScaleByProperty__H_ #include "MitkDiffusionImagingExports.h" #include "mitkEnumerationProperty.h" +#include "mitkEnumerationPropertySerializer.h" #include "mitkBasePropertyDeserializer.h" #include "mitkBasePropertySerializer.h" namespace mitk { enum OdfScaleBy { ODFSB_NONE, ODFSB_GFA, ODFSB_PC }; /** * Encapsulates the enumeration for ODF normalization. Valid values are * ODFSB_NONE, ODFSB_GFA, ODFSB_PC * Default is ODFSB_NONE */ class MitkDiffusionImaging_EXPORT OdfScaleByProperty : public EnumerationProperty { public: mitkClassMacro( OdfScaleByProperty, EnumerationProperty ); itkNewMacro(OdfScaleByProperty); mitkNewMacro1Param(OdfScaleByProperty, const IdType&); mitkNewMacro1Param(OdfScaleByProperty, const std::string&); /** * Returns the current interpolation value as defined by VTK constants. */ virtual int GetScaleBy(); virtual void SetScaleByNothing(); virtual void SetScaleByGFA(); virtual void SetScaleByPrincipalCurvature(); protected: /** Sets reslice interpolation mode to default (ODFSB_NONE). */ OdfScaleByProperty( ); /** * Constructor. Sets reslice interpolation to the given value. */ OdfScaleByProperty( const IdType& value ); /** * Constructor. Sets reslice interpolation to the given value. */ OdfScaleByProperty( const std::string& value ); /** * this function is overridden as protected, so that the user may not add * additional invalid interpolation types. */ virtual bool AddEnum( const std::string& name, const IdType& id ); /** * Adds the enumeration types as defined by vtk to the list of known * enumeration values. */ virtual void AddInterpolationTypes(); }; class MitkDiffusionImaging_EXPORT OdfScaleByPropertyDeserializer : public BasePropertyDeserializer { public: mitkClassMacro( OdfScaleByPropertyDeserializer, BasePropertyDeserializer ); itkNewMacro(Self); virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) { if (!element) return NULL; const char* sa( element->Attribute("value") ); std::string s(sa?sa:""); OdfScaleByProperty::Pointer property = OdfScaleByProperty::New(); property->SetValue( s ); return property.GetPointer(); } protected: OdfScaleByPropertyDeserializer () {} virtual ~OdfScaleByPropertyDeserializer () {} }; -class MitkDiffusionImaging_EXPORT OdfScaleByPropertySerializer : public BasePropertySerializer +class MitkDiffusionImaging_EXPORT OdfScaleByPropertySerializer : public EnumerationPropertySerializer { public: - mitkClassMacro( OdfScaleByPropertySerializer, BasePropertySerializer ); + mitkClassMacro( OdfScaleByPropertySerializer, EnumerationPropertySerializer ); itkNewMacro(Self); - virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) - { - if (!element) return NULL; - const char* sa( element->Attribute("value") ); - std::string s(sa?sa:""); - OdfScaleByProperty::Pointer property = OdfScaleByProperty::New(); - property->SetValue( s ); - return property.GetPointer(); - } - - protected: OdfScaleByPropertySerializer () {} virtual ~OdfScaleByPropertySerializer () {} }; } // end of namespace mitk #endif