diff --git a/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.cpp b/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.cpp index e3f924dd41..ab0c53167e 100644 --- a/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.cpp +++ b/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.cpp @@ -1,98 +1,100 @@ /*========================================================================= 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 ) diff --git a/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.h b/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.h index c8a9a1c21a..efa3c1911f 100644 --- a/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.h +++ b/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.h @@ -1,160 +1,163 @@ /*========================================================================= 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 "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 { public: mitkClassMacro( OdfNormalizationMethodPropertySerializer, BasePropertySerializer ); 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 564fe6e9a9..b117b9134f 100644 --- a/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.cpp +++ b/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.cpp @@ -1,86 +1,88 @@ /*========================================================================= 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 )