diff --git a/Modules/DiffusionImaging/CMakeLists.txt b/Modules/DiffusionImaging/CMakeLists.txt index 3eda59963a..e9c04e34fd 100644 --- a/Modules/DiffusionImaging/CMakeLists.txt +++ b/Modules/DiffusionImaging/CMakeLists.txt @@ -1,20 +1,20 @@ FIND_PACKAGE(ITK) IF(ITK_GDCM_DIR) INCLUDE(${ITK_GDCM_DIR}/GDCMConfig.cmake) IF(GDCM_MAJOR_VERSION EQUAL 2) ADD_DEFINITIONS(-DGDCM2) SET(ITK_USES_GDCM2 1) ENDIF(GDCM_MAJOR_VERSION EQUAL 2) ENDIF(ITK_GDCM_DIR) MITK_CREATE_MODULE( MitkDiffusionImaging SUBPROJECTS MITK-DTI INCLUDE_DIRS Algorithms DicomImport IODataStructures/DiffusionWeightedImages IODataStructures/QBallImages IODataStructures/TensorImages IODataStructures Reconstruction Tractography Rendering ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS MitkExt + DEPENDS MitkExt SceneSerializationBase PACKAGE_DEPENDS Boost ) ADD_SUBDIRECTORY(Testing) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mitkDiffusionImagingConfigure.h.in ${CMAKE_CURRENT_BINARY_DIR}/mitkDiffusionImagingConfigure.h) diff --git a/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.h b/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.h index b9a58bb10e..c8a9a1c21a 100644 --- a/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.h +++ b/Modules/DiffusionImaging/Rendering/mitkOdfNormalizationMethodProperty.h @@ -1,109 +1,160 @@ /*========================================================================= 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" + 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.h b/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.h index 017f353ac7..a552d579b7 100644 --- a/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.h +++ b/Modules/DiffusionImaging/Rendering/mitkOdfScaleByProperty.h @@ -1,92 +1,143 @@ /*========================================================================= 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 "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 +{ + public: + + mitkClassMacro( OdfScaleByPropertySerializer, BasePropertySerializer ); + 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