diff --git a/Code/Algorithms/ITK/CMakeLists.txt b/Code/Algorithms/ITK/CMakeLists.txt index 1d41129..9165df0 100644 --- a/Code/Algorithms/ITK/CMakeLists.txt +++ b/Code/Algorithms/ITK/CMakeLists.txt @@ -1,26 +1,28 @@ MAP_CREATE_MODULE(MAPAlgorithmsITK DEPENDS MAPAlgorithms MAPITK MAPUtilities) MAP_CREATE_MODULE_TESTS(MAPAlgorithmsITK PACKAGE_DEPENDS Litmus HEADER_TESTS) MAP_DEFINE_DEPLOYED_ALGORITHM(ITKEuler3DMattesMI PROFILE "deployed/ITKEuler3DMattesMI.profile" FILES "deployed/mapITKEuler3DMattesMI.cpp" MODULE_DEPENDS MAPCore MAPAlgorithms MAPAlgorithmsITK MAPDeployment) MAP_DEFINE_DEPLOYED_ALGORITHM(ITKEuler3DMattesMIMultiRes PROFILE "deployed/ITKEuler3DMattesMIMultiRes.profile" FILES "deployed/mapITKEuler3DMattesMIMultiRes.cpp" MODULE_DEPENDS MAPCore MAPAlgorithms MAPAlgorithmsITK MAPDeployment) MAP_DEFINE_DEPLOYED_ALGORITHM(ITKEuler3DMS PROFILE "deployed/ITKEuler3DMS.profile" FILES "deployed/mapITKEuler3DMS.cpp" MODULE_DEPENDS MAPCore MAPAlgorithms MAPAlgorithmsITK MAPDeployment) MAP_DEFINE_DEPLOYED_ALGORITHM(ITKRigid2DMattesMI PROFILE "deployed/ITKRigid2DMattesMI.profile" FILES "deployed/mapITKRigid2DMattesMI.cpp" MODULE_DEPENDS MAPCore MAPAlgorithms MAPAlgorithmsITK MAPDeployment) MAP_DEFINE_DEPLOYED_ALGORITHM(ITKRigid3DClosedForm PROFILE "deployed/ITKRigid3DClosedForm.profile" FILES "deployed/mapITKRigid3DClosedForm.cpp" MODULE_DEPENDS MAPCore MAPAlgorithms MAPAlgorithmsITK MAPDeployment) MAP_DEFINE_DEPLOYED_ALGORITHM(ITKPDEDemons3D PROFILE "deployed/ITKPDEDemons3D.profile" FILES "deployed/mapITKPDEDemons3D.cpp" MODULE_DEPENDS MAPCore MAPAlgorithms MAPAlgorithmsITK MAPDeployment) MAP_DEFINE_DEPLOYED_ALGORITHM(ITKLevelSetMotion3D PROFILE "deployed/ITKLevelSetMotion3D.profile" FILES "deployed/mapITKLevelSetMotion3D.cpp" MODULE_DEPENDS MAPCore MAPAlgorithms MAPAlgorithmsITK MAPDeployment) MAP_DEFINE_DEPLOYED_ALGORITHM(ITKSymmetricForcesDemons3D PROFILE "deployed/ITKSymmetricForcesDemons3D.profile" FILES "deployed/mapITKSymmetricForcesDemons3D.cpp" MODULE_DEPENDS MAPCore MAPAlgorithms MAPAlgorithmsITK MAPDeployment) MAP_DEFINE_DEPLOYED_ALGORITHM(ITKLevelSetMotion3DMultiRes PROFILE "deployed/ITKLevelSetMotion3DMultiRes.profile" FILES "deployed/mapITKLevelSetMotion3DMultiRes.cpp" MODULE_DEPENDS MAPCore MAPAlgorithms MAPAlgorithmsITK MAPDeployment) MAP_DEFINE_DEPLOYED_ALGORITHM(ITKTranslation3DMattesMIMultiRes PROFILE "deployed/ITKTranslation3DMattesMIMultiRes.profile" FILES "deployed/mapITKTranslation3DMattesMIMultiRes.cpp" MODULE_DEPENDS MAPCore MAPAlgorithms MAPAlgorithmsITK MAPDeployment) MAP_DEFINE_DEPLOYED_ALGORITHM(ITKAffine3DMattesMIMultiRes PROFILE "deployed/ITKAffine3DMattesMIMultiRes.profile" FILES "deployed/mapITKAffine3DMattesMIMultiRes.cpp" MODULE_DEPENDS MAPCore MAPAlgorithms MAPAlgorithmsITK MAPDeployment) +MAP_DEFINE_DEPLOYED_ALGORITHM(ITKRigidHeadNeck PROFILE "deployed/ITKRigidHeadNeck.profile" FILES "deployed/mapITKRigidHeadNeck.cpp" MODULE_DEPENDS MAPCore MAPAlgorithms MAPAlgorithmsITK MAPDeployment) +MAP_DEFINE_DEPLOYED_ALGORITHM(ITKRigidSlabbedHead PROFILE "deployed/ITKRigidSlabbedHead.profile" FILES "deployed/mapITKRigidSlabbedHead.cpp" MODULE_DEPENDS MAPCore MAPAlgorithms MAPAlgorithmsITK MAPDeployment) SET(_MAP_ITK_REVIEW_ACTIVE "OFF") MAP_CHECK_ITK_REVIEW_ACTIVE(_MAP_ITK_REVIEW_ACTIVE) IF (${_MAP_ITK_REVIEW_ACTIVE}) MAP_DEFINE_DEPLOYED_ALGORITHM(ITKFastSymmetricForcesDemons3D PROFILE "deployed/ITKFastSymmetricForcesDemons3D.profile" FILES "deployed/mapITKFastSymmetricForcesDemons3D.cpp" MODULE_DEPENDS MAPCore MAPAlgorithms MAPAlgorithmsITK MAPDeployment) MAP_DEFINE_DEPLOYED_ALGORITHM(ITKFastSymmetricForcesDemons3DMultiRes PROFILE "deployed/ITKFastSymmetricForcesDemons3DMultiRes.profile" FILES "deployed/mapITKFastSymmetricForcesDemons3DMultiRes.cpp" MODULE_DEPENDS MAPCore MAPAlgorithms MAPAlgorithmsITK MAPDeployment) ELSE (${_MAP_ITK_REVIEW_ACTIVE}) MESSAGE(WARNING "ITKReview Module is not activated. Following algorithms will not be deployed:\n - ITKFastSymmetricForcesDemons3D\n - ITKFastSymmetricForcesDemons3DMultiRes") ENDIF (${_MAP_ITK_REVIEW_ACTIVE}) \ No newline at end of file diff --git a/Code/Algorithms/ITK/boxed/mapITKRigid3DMattesMIHeadNeckRegistrationAlgorithmTemplate.h b/Code/Algorithms/ITK/boxed/mapITKRigid3DMattesMIHeadNeckRegistrationAlgorithmTemplate.h new file mode 100644 index 0000000..f94865e --- /dev/null +++ b/Code/Algorithms/ITK/boxed/mapITKRigid3DMattesMIHeadNeckRegistrationAlgorithmTemplate.h @@ -0,0 +1,83 @@ +// ----------------------------------------------------------------------- +// MatchPoint - DKFZ translational registration framework +// +// Copyright (c) German Cancer Research Center (DKFZ), +// Software development for Integrated Diagnostics and Therapy (SIDT). +// ALL RIGHTS RESERVED. +// See mapCopyright.txt or +// http://www.dkfz.de/en/sidt/projects/MatchPoint/copyright.html +// +// 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. +// +//------------------------------------------------------------------------ +/*! +// @file +// @version $Revision$ (last changed revision) +// @date $Date$ (last change date) +// @author $Author$ (last changed by) +// Subversion HeadURL: $HeadURL$ +*/ + + +#ifndef __MAP_ITK_RIGID_MMI_HEADNECK_REGISTRATION_ALGORITHM_H +#define __MAP_ITK_RIGID_MMI_HEADNECK_REGISTRATION_ALGORITHM_H + +#include "mapITKEuler3DMattesMIMultiResRegistrationAlgorithmTemplate.h" + +namespace map +{ + namespace algorithm + { + namespace boxed + { + /** \class MultiModalRigidHeadNeckRegistrationAlgorithm + * \ingroup Data_image MetaProperty Model_rigid Det_comp_iterative Det_stochastic Det_res_multi Dim_3D_3D Mod_multi PreInit_Geo + * Algorithm is used for special cases where a head image should be registered onto a head/neck image (target image). It skips the lower part of + * the target image if a preinitialization (via geometric center or centroid) is used, to establish a better initialization. By default initializes via geometric centers. + */ + template >, + class TPyramideInitializationPolicy = algorithm::itk::NoComponentInitializationPolicy> + class MultiModalRigidHeadNeckRegistrationAlgorithm : + public map::algorithm::boxed::ITKEuler3DMattesMIMultiResRegistrationAlgorithm + { + public: + typedef MultiModalRigidHeadNeckRegistrationAlgorithm Self; + + typedef typename ITKEuler3DMattesMIMultiResRegistrationAlgorithm + Superclass; + + typedef ::itk::SmartPointer Pointer; + typedef ::itk::SmartPointer ConstPointer; + + itkTypeMacro(MultiModalRigidHeadNeckRegistrationAlgorithm, + ITKEuler3DMattesMIMultiResRegistrationAlgorithm); + mapNewAlgorithmMacro(Self); + + protected: + MultiModalRigidHeadNeckRegistrationAlgorithm(); + virtual ~MultiModalRigidHeadNeckRegistrationAlgorithm(); + + void configureAlgorithm(); + void doInterLevelSetup(); + void prepInitializeTransformation(); + + private: + + MultiModalRigidHeadNeckRegistrationAlgorithm(const Self& source); //purposely not implemented + void operator=(const Self&); //purposely not implemented + }; + } + } +} + +#ifndef MatchPoint_MANUAL_TPP +#include "mapITKRigid3DMattesMIHeadNeckRegistrationAlgorithmTemplate.tpp" +#endif + + +#endif diff --git a/Code/Algorithms/ITK/boxed/mapITKRigid3DMattesMIHeadNeckRegistrationAlgorithmTemplate.tpp b/Code/Algorithms/ITK/boxed/mapITKRigid3DMattesMIHeadNeckRegistrationAlgorithmTemplate.tpp new file mode 100644 index 0000000..47a18ff --- /dev/null +++ b/Code/Algorithms/ITK/boxed/mapITKRigid3DMattesMIHeadNeckRegistrationAlgorithmTemplate.tpp @@ -0,0 +1,174 @@ +// ----------------------------------------------------------------------- +// MatchPoint - DKFZ translational registration framework +// +// Copyright (c) German Cancer Research Center (DKFZ), +// Software development for Integrated Diagnostics and Therapy (SIDT). +// ALL RIGHTS RESERVED. +// See mapCopyright.txt or +// http://www.dkfz.de/en/sidt/projects/MatchPoint/copyright.html +// +// 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 __ITK_RIGID_3D_MATTESMI_HEADNECK_REGISTRATION_ALGORITHM_TPP +#define __ITK_RIGID_3D_MATTESMI_HEADNECK_REGISTRATION_ALGORITHM_TPP + +#include "itkRegionOfInterestImageFilter.h" + +namespace map +{ + namespace algorithm + { + namespace boxed + { + template < class TImageType, class TIdentificationPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy> + MultiModalRigidHeadNeckRegistrationAlgorithm:: + MultiModalRigidHeadNeckRegistrationAlgorithm() + { + }; + + template < class TImageType, class TIdentificationPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy> + MultiModalRigidHeadNeckRegistrationAlgorithm:: + ~MultiModalRigidHeadNeckRegistrationAlgorithm() + { + }; + + template < class TImageType, class TIdentificationPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy> + void + MultiModalRigidHeadNeckRegistrationAlgorithm:: + configureAlgorithm() + { + Superclass::configureAlgorithm(); + + this->setResolutionLevels(3); + this->_preInitialize = true; + this->_useCenterOfGravity = false; + + //optimizer + ConcreteOptimizerType::ScalesType scales(6); + scales[0] = 10.0; + scales[1] = 10.0; + scales[2] = 10.0; + scales[3] = 1.0 / 10000; + scales[4] = 1.0 / 10000; + scales[5] = 1.0 / 10000; + + this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetScales(scales); + this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetMaximumStepLength(3.00); + this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetMinimumStepLength(0.5); + this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetNumberOfIterations(200); + this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetRelaxationFactor(0.8); + this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetGradientMagnitudeTolerance(1e-4); + + //metric + this->getConcreteMetricControl()->getConcreteMetric()->SetNumberOfHistogramBins(30); + this->getConcreteMetricControl()->getConcreteMetric()->SetUseAllPixels(true); + this->getConcreteMetricControl()->getConcreteMetric()->ReinitializeSeed(); + this->getConcreteMetricControl()->getConcreteMetric()->UseExplicitPDFDerivativesOn(); + } + + template < class TImageType, class TIdentificationPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy> + void + MultiModalRigidHeadNeckRegistrationAlgorithm:: + doInterLevelSetup(){ + Superclass::doInterLevelSetup(); + + if (this->getCurrentLevel() != 0) + { + getConcreteMetricControl()->getConcreteMetric()->SetUseAllPixels(false); + + OptimizerBaseType::SVNLOptimizerBaseType::ScalesType scales(6); + scales[0] = 1.0; + scales[1] = 1.0; + scales[2] = 1.0; + scales[3] = 1.0 / 1000; + scales[4] = 1.0 / 1000; + scales[5] = 1.0 / 1000; + + getConcreteOptimizerControl()->getConcreteOptimizer()->SetScales(scales); + + unsigned int nrOfSmpl = ::itk::Math::Round + (this->getMovingImage()->GetLargestPossibleRegion().GetNumberOfPixels() * 0.15); + + getConcreteMetricControl()->getConcreteMetric()->SetNumberOfSpatialSamples(nrOfSmpl); + + //optimizer adjustment + getConcreteOptimizerControl()->getConcreteOptimizer()->SetMaximumStepLength( + getConcreteOptimizerControl()->getConcreteOptimizer()->GetCurrentStepLength() * 2.0); + getConcreteOptimizerControl()->getConcreteOptimizer()->SetMinimumStepLength( + getConcreteOptimizerControl()->getConcreteOptimizer()->GetMinimumStepLength() * 0.5); + } + } + + template < class TImageType, class TIdentificationPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy> + void + MultiModalRigidHeadNeckRegistrationAlgorithm:: + prepInitializeTransformation(){ + Superclass::Superclass::prepInitializeTransformation(); + + if (this->_preInitialize) + { + this->InvokeEvent(events::AlgorithmEvent(this, "Preinitialize transform.")); + + typedef ::itk::CenteredTransformInitializer + InitializerType; + typedef ::itk::RegionOfInterestImageFilter + ROIFilterType; + + InitializerType::Pointer spInitializer = InitializerType::New(); + + ROIFilterType::Pointer spROIFilter = ROIFilterType::New(); + spROIFilter->SetInput(this->getInternalTargetImage()); + ROIFilterType::RegionType region = this->getInternalTargetImage()->GetLargestPossibleRegion(); + ROIFilterType::RegionType::SizeValueType zSize = region.GetSize(2); + region.SetIndex(2, zSize / 3); + region.SetSize(2, 2 * zSize / 3); + spROIFilter->SetRegionOfInterest(region); + + core::OStringStream stream; + stream << region; + this->InvokeEvent(events::AlgorithmEvent(this, + "Prepare target region of interest. region: " + stream.str())); + + spROIFilter->Update(); + + spInitializer->SetMovingImage(this->getInternalMovingImage()); + spInitializer->SetFixedImage(spROIFilter->GetOutput()); + spInitializer->SetTransform(this->getConcreteTransformModel()); + + if (this->_useCenterOfGravity) + { + this->InvokeEvent(events::AlgorithmEvent(this, "Preinitialize by moments.")); + spInitializer->MomentsOn(); + } + else + { + this->InvokeEvent(events::AlgorithmEvent(this, "Preinitialize by image geometry.")); + spInitializer->GeometryOn(); + } + + spInitializer->InitializeTransform(); + } + + core::OStringStream os; + + os << "Preinitialized transform to: " << this->getConcreteTransformModel()->GetParameters(); + //set the parameter of the transform model to the current transform parameters of the algorithm + this->setCurrentTransformParameters( + this->getConcreteTransformModel()->GetParameters()); + this->getInternalRegistrationMethod().SetInitialTransformParameters( + this->getConcreteTransformModel()->GetParameters()); + + this->InvokeEvent(events::AlgorithmEvent(this, os.str())); + } + + + } // end namespace itk + } // end namespace algorithm +} // end namespace map + +#endif diff --git a/Code/Algorithms/ITK/boxed/mapITKRigid3DMattesMISlabbedHeadRegistrationAlgorithmTemplate.h b/Code/Algorithms/ITK/boxed/mapITKRigid3DMattesMISlabbedHeadRegistrationAlgorithmTemplate.h new file mode 100644 index 0000000..26e28c1 --- /dev/null +++ b/Code/Algorithms/ITK/boxed/mapITKRigid3DMattesMISlabbedHeadRegistrationAlgorithmTemplate.h @@ -0,0 +1,75 @@ +// ----------------------------------------------------------------------- +// MatchPoint - DKFZ translational registration framework +// +// Copyright (c) German Cancer Research Center (DKFZ), +// Software development for Integrated Diagnostics and Therapy (SIDT). +// ALL RIGHTS RESERVED. +// See mapCopyright.txt or +// http://www.dkfz.de/en/sidt/projects/MatchPoint/copyright.html +// +// 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 __MAP_ITK_RIGID_MMI_SLABBED_HEAD_REGISTRATION_ALGORITHM_H +#define __MAP_ITK_RIGID_MMI_SLABBED_HEAD_REGISTRATION_ALGORITHM_H + +#include "mapITKEuler3DMattesMIMultiResRegistrationAlgorithmTemplate.h" + +namespace map +{ + namespace algorithm + { + namespace boxed + { + /** \class MultiModalRigidSlabbedHeadRegistrationAlgorithm + * \ingroup Data_image MetaProperty Model_rigid Det_comp_iterative Det_stochastic Det_res_multi Dim_3D_3D Mod_multi PreInit_Geo + * Algorithm is used to solve a special case of head registration problems. + * It is configured to register the slabbed MRI head data (thus date where only a part of the head is visible) onto whole Head images + * (e.g.CT planning data). + * Uses 3 Resolution levels. By default initializes via image centers + */ + template >, + class TPyramideInitializationPolicy = algorithm::itk::NoComponentInitializationPolicy> + class MultiModalRigidSlabbedHeadRegistrationAlgorithm : + public map::algorithm::boxed::ITKEuler3DMattesMIMultiResRegistrationAlgorithm + { + public: + typedef MultiModalRigidSlabbedHeadRegistrationAlgorithm Self; + + typedef typename ITKEuler3DMattesMIMultiResRegistrationAlgorithm + Superclass; + + typedef ::itk::SmartPointer Pointer; + typedef ::itk::SmartPointer ConstPointer; + + itkTypeMacro(MultiModalRigidSlabbedHeadRegistrationAlgorithm, + ITKEuler3DMattesMIMultiResRegistrationAlgorithm); + mapNewAlgorithmMacro(Self); + + protected: + MultiModalRigidSlabbedHeadRegistrationAlgorithm(); + virtual ~MultiModalRigidSlabbedHeadRegistrationAlgorithm(); + + void configureAlgorithm(); + void doInterLevelSetup(); + + private: + + MultiModalRigidSlabbedHeadRegistrationAlgorithm(const Self& source); //purposely not implemented + void operator=(const Self&); //purposely not implemented + }; + } + } +} + +#ifndef MatchPoint_MANUAL_TPP +#include "mapITKRigid3DMattesMISlabbedHeadRegistrationAlgorithmTemplate.tpp" +#endif + +#endif diff --git a/Code/Algorithms/ITK/boxed/mapITKRigid3DMattesMISlabbedHeadRegistrationAlgorithmTemplate.tpp b/Code/Algorithms/ITK/boxed/mapITKRigid3DMattesMISlabbedHeadRegistrationAlgorithmTemplate.tpp new file mode 100644 index 0000000..5315b24 --- /dev/null +++ b/Code/Algorithms/ITK/boxed/mapITKRigid3DMattesMISlabbedHeadRegistrationAlgorithmTemplate.tpp @@ -0,0 +1,110 @@ +// ----------------------------------------------------------------------- +// MatchPoint - DKFZ translational registration framework +// +// Copyright (c) German Cancer Research Center (DKFZ), +// Software development for Integrated Diagnostics and Therapy (SIDT). +// ALL RIGHTS RESERVED. +// See mapCopyright.txt or +// http://www.dkfz.de/en/sidt/projects/MatchPoint/copyright.html +// +// 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 __ITK_RIGID_3D_MATTESMI_SLABBEDHEAD_REGISTRATION_ALGORITHM_TPP +#define __ITK_RIGID_3D_MATTESMI_SLABBEDHEAD_REGISTRATION_ALGORITHM_TPP + +namespace map +{ + namespace algorithm + { + namespace boxed + { + template < class TImageType, class TIdentificationPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy> + MultiModalRigidSlabbedHeadRegistrationAlgorithm:: + MultiModalRigidSlabbedHeadRegistrationAlgorithm() + { + } + + template < class TImageType, class TIdentificationPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy> + MultiModalRigidSlabbedHeadRegistrationAlgorithm:: + ~MultiModalRigidSlabbedHeadRegistrationAlgorithm() + { + } + + template < class TImageType, class TIdentificationPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy> + void + MultiModalRigidSlabbedHeadRegistrationAlgorithm:: + configureAlgorithm() + { + Superclass::configureAlgorithm(); + + this->setResolutionLevels(3); + this->_preInitialize = true; + this->_useCenterOfGravity = false; + + //optimizer + ConcreteOptimizerType::ScalesType scales(6); + scales[0] = 10.0; + scales[1] = 10.0; + scales[2] = 10.0; + scales[3] = 1.0 / 10000; + scales[4] = 1.0 / 10000; + scales[5] = 1.0 / 10000; + + this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetScales(scales); + this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetMaximumStepLength(3.00); + this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetMinimumStepLength(0.5); + this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetNumberOfIterations(200); + this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetRelaxationFactor(0.8); + this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetGradientMagnitudeTolerance(1e-4); + + //metric + this->getConcreteMetricControl()->getConcreteMetric()->SetNumberOfHistogramBins(30); + this->getConcreteMetricControl()->getConcreteMetric()->SetUseAllPixels(true); + this->getConcreteMetricControl()->getConcreteMetric()->ReinitializeSeed(); + this->getConcreteMetricControl()->getConcreteMetric()->UseExplicitPDFDerivativesOn(); + } + + template < class TImageType, class TIdentificationPolicy, class TInterpolatorPolicy, class TPyramideInitializationPolicy> + void + MultiModalRigidSlabbedHeadRegistrationAlgorithm:: + doInterLevelSetup(){ + Superclass::doInterLevelSetup(); + + if (this->getCurrentLevel() != 0) + { + getConcreteMetricControl()->getConcreteMetric()->SetUseAllPixels(false); + + OptimizerBaseType::SVNLOptimizerBaseType::ScalesType scales(6); + scales[0] = 1.0; + scales[1] = 1.0; + scales[2] = 1.0; + scales[3] = 1.0 / 1000; + scales[4] = 1.0 / 1000; + scales[5] = 1.0 / 1000; + + getConcreteOptimizerControl()->getConcreteOptimizer()->SetScales(scales); + + unsigned int nrOfSmpl = ::itk::Math::Round + (this->getMovingImage()->GetLargestPossibleRegion().GetNumberOfPixels() * 0.15); + + getConcreteMetricControl()->getConcreteMetric()->SetNumberOfSpatialSamples(nrOfSmpl); + + //optimizer adjustment + getConcreteOptimizerControl()->getConcreteOptimizer()->SetMaximumStepLength( + getConcreteOptimizerControl()->getConcreteOptimizer()->GetCurrentStepLength() * 2.0); + getConcreteOptimizerControl()->getConcreteOptimizer()->SetMinimumStepLength( + getConcreteOptimizerControl()->getConcreteOptimizer()->GetMinimumStepLength() * 0.5); + + } + } + + } // end namespace itk + } // end namespace algorithm +} // end namespace map + +#endif diff --git a/Code/Algorithms/ITK/deployed/ITKRigidHeadNeck.profile b/Code/Algorithms/ITK/deployed/ITKRigidHeadNeck.profile new file mode 100644 index 0000000..15d15dd --- /dev/null +++ b/Code/Algorithms/ITK/deployed/ITKRigidHeadNeck.profile @@ -0,0 +1,20 @@ +SET(ALGORITHM_PROFILE_UID_Namespace "de.dkfz.matchpoint.common") +SET(ALGORITHM_PROFILE_UID_Name "Rigid3DMattesMIAlgorithm.3D.Head2HeadNeck") +SET(ALGORITHM_PROFILE_UID_Version "1.0.2") + +SET(ALGORITHM_PROFILE_Description "Algorithm is used for special cases where a head image should be registered onto a head/neck image (target image). It skips the lower part of the target image if a preinitialization (via geometric center or centroid) is used, to establish a better initialization. By default initializes via geometric centers.") +SET(ALGORITHM_PROFILE_Contact "Ralf Floca\; sbr@dkfz-heidelberg.de") + +SET(ALGORITHM_PROFILE_DataType "Image") +SET(ALGORITHM_PROFILE_ResolutionStyle "3 (multi res)") +SET(ALGORITHM_PROFILE_DimMoving "3") +SET(ALGORITHM_PROFILE_ModalityMoving "MR" "any") +SET(ALGORITHM_PROFILE_DimTarget "3") +SET(ALGORITHM_PROFILE_ModalityTarget "MR" "any") +SET(ALGORITHM_PROFILE_Subject "any") +SET(ALGORITHM_PROFILE_Object "Head" "Head/Neck") +SET(ALGORITHM_PROFILE_TransformModel "rigid") +SET(ALGORITHM_PROFILE_Metric "Mattes mutual information") +SET(ALGORITHM_PROFILE_TransformDomain "global") +SET(ALGORITHM_PROFILE_Optimization "Regular Step Gradient Descent") +SET(ALGORITHM_PROFILE_Keywords "basic" "pre initialization" "Head/Neck" "HeadNeck" "multimodal" "rigid") diff --git a/Code/Algorithms/ITK/deployed/ITKRigidSlabbedHead.profile b/Code/Algorithms/ITK/deployed/ITKRigidSlabbedHead.profile new file mode 100644 index 0000000..95aee64 --- /dev/null +++ b/Code/Algorithms/ITK/deployed/ITKRigidSlabbedHead.profile @@ -0,0 +1,20 @@ +SET(ALGORITHM_PROFILE_UID_Namespace "de.dkfz.matchpoint.common") +SET(ALGORITHM_PROFILE_UID_Name "Rigid3DMattesMIAlgorithm.3D.slabbedHead") +SET(ALGORITHM_PROFILE_UID_Version "1.0.1") + +SET(ALGORITHM_PROFILE_Description "Algorithm is used to solve a special case of head registration problems. It is configured to register the slabbed MRI head data (thus data where only a part of the head is visible) onto whole Head images (e.g.CT planning data). Uses 3 Resolution levels. By default initializes via image centers.") +SET(ALGORITHM_PROFILE_Contact "Ralf Floca\; sbr@dkfz-heidelberg.de") + +SET(ALGORITHM_PROFILE_DataType "Image") +SET(ALGORITHM_PROFILE_ResolutionStyle "3 (multi res)") +SET(ALGORITHM_PROFILE_DimMoving "3") +SET(ALGORITHM_PROFILE_ModalityMoving "MR" "any") +SET(ALGORITHM_PROFILE_DimTarget "3") +SET(ALGORITHM_PROFILE_ModalityTarget "MR" "any") +SET(ALGORITHM_PROFILE_Subject "any") +SET(ALGORITHM_PROFILE_Object "Head") +SET(ALGORITHM_PROFILE_TransformModel "rigid") +SET(ALGORITHM_PROFILE_Metric "Mattes mutual information") +SET(ALGORITHM_PROFILE_TransformDomain "global") +SET(ALGORITHM_PROFILE_Optimization "Regular Step Gradient Descent") +SET(ALGORITHM_PROFILE_Keywords "basic" "pre initialization" "Head" "slabbed" "partial" "multimodal" "rigid") diff --git a/Code/Algorithms/ITK/deployed/mapITKRigidHeadNeck.cpp b/Code/Algorithms/ITK/deployed/mapITKRigidHeadNeck.cpp new file mode 100644 index 0000000..e91b2f0 --- /dev/null +++ b/Code/Algorithms/ITK/deployed/mapITKRigidHeadNeck.cpp @@ -0,0 +1,25 @@ +// ----------------------------------------------------------------------- +// MatchPoint - DKFZ translational registration framework +// +// Copyright (c) German Cancer Research Center (DKFZ), +// Software development for Integrated Diagnostics and Therapy (SIDT). +// ALL RIGHTS RESERVED. +// See mapCopyright.txt or +// http://www.dkfz.de/en/sidt/projects/MatchPoint/copyright.html +// +// 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 "mapDeploymentDLLHelper.h" +#include "mapDiscreteElements.h" +#include "mapITKRigid3DMattesMIHeadNeckRegistrationAlgorithmTemplate.h" + +#include "ITKRigidHeadNeck_ProfileResource.h" + +typedef map::core::discrete::Elements<3>::InternalImageType ImageType; +typedef map::algorithm::boxed::MultiModalRigidHeadNeckRegistrationAlgorithm +AlgorithmType; +mapDeployAlgorithmMacro(AlgorithmType); diff --git a/Code/Algorithms/ITK/deployed/mapITKRigidSlabbedHead.cpp b/Code/Algorithms/ITK/deployed/mapITKRigidSlabbedHead.cpp new file mode 100644 index 0000000..9192fe3 --- /dev/null +++ b/Code/Algorithms/ITK/deployed/mapITKRigidSlabbedHead.cpp @@ -0,0 +1,25 @@ +// ----------------------------------------------------------------------- +// MatchPoint - DKFZ translational registration framework +// +// Copyright (c) German Cancer Research Center (DKFZ), +// Software development for Integrated Diagnostics and Therapy (SIDT). +// ALL RIGHTS RESERVED. +// See mapCopyright.txt or +// http://www.dkfz.de/en/sidt/projects/MatchPoint/copyright.html +// +// 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 "mapDeploymentDLLHelper.h" +#include "mapDiscreteElements.h" +#include "mapITKRigid3DMattesMISlabbedHeadRegistrationAlgorithmTemplate.h" + +#include "ITKRigidSlabbedHead_ProfileResource.h" + +typedef map::core::discrete::Elements<3>::InternalImageType ImageType; +typedef map::algorithm::boxed::MultiModalRigidSlabbedHeadRegistrationAlgorithm +AlgorithmType; +mapDeployAlgorithmMacro(AlgorithmType); diff --git a/Code/Algorithms/ITK/files.cmake b/Code/Algorithms/ITK/files.cmake index 7a4f549..9c824f5 100644 --- a/Code/Algorithms/ITK/files.cmake +++ b/Code/Algorithms/ITK/files.cmake @@ -1,241 +1,245 @@ SET(CPP_FILES source/mapITKOptimizerControlInterface.cpp source/mapITKSVNLOptimizerControlInterface.cpp source/mapArbitrarySVNLOptimizerPolicy.cpp source/mapITKMetricControlInterface.cpp source/mapITKSVMetricControlInterface.cpp source/mapITKMVNLOptimizerControlInterface.cpp source/mapITKMVMetricControlInterface.cpp source/mapArbitraryMVNLOptimizerPolicy.cpp ) SET(H_FILES include/mapArbitraryInterpolatorPolicy.h include/mapArbitrarySVNLOptimizerPolicy.h include/mapFixedInterpolatorPolicy.h include/mapFixedSVNLOptimizerPolicy.h include/mapITKImageRegistrationAlgorithm.h include/mapITKImageRegistrationAlgorithmInterface.h include/mapITKInterpolatorSetterInterface.h include/mapITKImageToImageMetricSetterInterface.h include/mapITKSVNLOptimizerControlBase.h include/mapDefaultITKOptimizerControls.h include/mapITKOptimizerControlInterface.h include/mapITKSVNLOptimizerControlInterface.h include/mapITKSVNLOptimizerSetterInterface.h include/mapITKTransformSetterInterface.h include/mapArbitraryImageToImageMetricPolicy.h include/mapArbitraryTransformPolicy.h include/mapFixedImageToImageMetricPolicy.h include/mapFixedTransformPolicy.h include/mapITKMetricControlInterface.h include/mapITKSVMetricControlInterface.h include/mapITKImageToImageMetricControlInterface.h include/mapITKMetricControl.h include/mapITKImageToImageMetricControlBase.h include/mapITKMeanSquaresImageToImageMetric.h include/mapITKMattesMutualInformationImageToImageMetric.h include/mapITKCompareHistogramImageToImageMetric.h include/mapITKCorrelationCoefficientHistogramImageToImageMetric.h include/mapITKKappaStatisticImageToImageMetric.h include/mapITKGradientDifferenceImageToImageMetric.h include/mapITKMatchCardinalityImageToImageMetric.h include/mapITKMeanSquaresHistogramImageToImageMetric.h include/mapITKMutualInformationHistogramImageToImageMetric.h include/mapITKMutualInformationImageToImageMetric.h include/mapITKNormalizedCorrelationImageToImageMetric.h include/mapITKNormalizedMutualInformationHistogramImageToImageMetric.h include/mapITKAmoebaOptimizer.h include/mapITKPowellOptimizer.h include/mapITKRegularStepGradientDescentOptimizer.h include/mapITKConjugateGradientOptimizer.h include/mapITKFRPROptimizer.h include/mapITKGradientDescentOptimizer.h include/mapITKLBFGSBOptimizer.h include/mapITKLBFGSOptimizer.h include/mapITKOnePlusOneEvolutionaryOptimizer.h include/mapITKQuaternionRgidTransformGradientDescentOptimizer.h include/mapITKSPSAOptimizer.h include/mapITKVersorRigid3DTransformOptimizer.h include/mapITKVersorTransformOptimizer.h include/mapSealedInterpolatorPolicy.h include/mapSealedOptimizerPolicy.h include/mapSealedImageToImageMetricPolicy.h include/mapSealedTransformPolicy.h include/mapITKSVNLOptimizerGetterInterface.h include/mapITKInterpolatorGetterInterface.h include/mapITKImageToImageMetricGetterInterface.h include/mapITKTransformGetterInterface.h include/mapITKExhaustiveOptimizer.h include/mapITKLinearInterpolateImageFunction.h include/mapITKNearestNeighborInterpolateImageFunction.h include/mapITKBSplineInterpolateImageFunction.h include/mapITKWindowedSincInterpolateImageFunction.h include/mapITKMVNLOptimizerControlInterface.h include/mapITKPointSetToPointSetMetricControlBase.h include/mapITKPointSetToPointSetMetricControlInterface.h include/mapITKMVMetricControlInterface.h include/mapITKPointSetToPointSetMetricSetterInterface.h include/mapITKPointSetToPointSetMetricGetterInterface.h include/mapITKMVNLOptimizerSetterInterface.h include/mapITKMVNLOptimizerGetterInterface.h include/mapITKMVNLOptimizerControlBase.h include/mapArbitraryMVNLOptimizerPolicy.h include/mapFixedMVNLOptimizerPolicy.h include/mapArbitraryPointSetToPointSetMetricPolicy.h include/mapFixedPointSetToPointSetMetricPolicy.h include/mapSealedPointSetToPointSetMetricPolicy.h include/mapITKEuclideanDistancePointMetric.h include/mapITKEuclideanPairDistancePointMetric.h include/mapITKLevenbergMarquardtOptimizer.h include/mapITKMultiResImageRegistrationAlgorithm.h include/mapITKClosedFormRegistrationAlgorithm.h include/mapITKLandmarkKernelRegistrationAlgorithm.h include/mapITKPointSetRegistrationAlgorithm.h include/mapITKPDEDeformableRegistrationAlgorithmBase.h include/mapITKPDEDeformableRegistrationAlgorithm.h include/mapITKMultiResPDEDeformableRegistrationAlgorithm.h include/mapITKTranslationTransform.h include/mapITKScaleTransform.h include/mapITKAffineTransform.h include/mapITKAzimuthElevationToCartesianTransform.h include/mapITKCenteredAffineTransform.h include/mapITKElasticBodyReciprocalSplineKernelTransform.h include/mapITKElasticBodySplineKernelTransform.h include/mapITKFixedCenterOfRotationAffineTransform.h include/mapITKIdentityTransform.h include/mapITKKernelTransform.h include/mapITKScalableAffineTransform.h include/mapITKScaleLogarithmicTransform.h include/mapITKThinPlateR2LogRSplineKernelTransform.h include/mapITKThinPlateSplineKernelTransform.h include/mapITKVolumeSplineKernelTransform.h include/mapITKCenteredEuler3DTransform.h include/mapITKCenteredRigid2DTransform.h include/mapITKCenteredSimilarity2DTransform.h include/mapITKEuler2DTransform.h include/mapITKEuler3DTransform.h include/mapITKQuaternionRigidTransform.h include/mapITKRigid2DTransform.h include/mapITKRigid3DTransform.h include/mapITKRigid3DPerspectiveTransform.h include/mapITKScaleVersor3DTransform.h include/mapITKSimilarity2DTransform.h include/mapITKSimilarity3DTransform.h include/mapITKVersorRigid3DTransform.h include/mapITKVersorTransform.h include/mapITKBSplineDeformableTransform.h boxed/mapITKAffineMattesMIMultiResRegistrationAlgorithmTemplate.h boxed/mapITKDemonsRegistrationAlgorithm.h boxed/mapITKEuler3DICPRegistrationAlgorithmTemplate.h boxed/mapITKEuler3DMattesMIMultiResRegistrationAlgorithmTemplate.h boxed/mapITKEuler3DMattesMIRegistrationAlgorithmTemplate.h boxed/mapITKEuler3DMSRegistrationAlgorithmTemplate.h boxed/mapITKInitializedImageRegistrationAlgorithm.h boxed/mapITKInitializedMultiResImageRegistrationAlgorithm.h boxed/mapITKRigid2DClosedFormRegistrationAlgorithmTemplate.h boxed/mapITKRigid2DICPRegistrationAlgorithmTemplate.h boxed/mapITKRigid3DICPRegistrationAlgorithmTemplate.h boxed/mapITKRigid2DMattesMIRegistrationAlgorithmTemplate.h boxed/mapITKRigid3DClosedFormRegistrationAlgorithmTemplate.h boxed/mapTransMSRegistrationAlgorithmTemplate.h boxed/mapTransMattesMIRegistrationAlgorithmTemplate.h boxed/mapITKTransMattesMIMultiResRegistrationAlgorithm.h boxed/mapITKPDEDemonsRegistrationAlgorithm.h boxed/mapITKLevelSetMotionRegistrationAlgorithm.h boxed/mapITKSymmetricForcesDemonsRegistrationAlgorithm.h boxed/mapITKLevelSetMotionMultiResRegistrationAlgorithm.h +boxed/mapITKRigid3DMattesMIHeadNeckRegistrationAlgorithmTemplate.h +boxed/mapITKRigid3DMattesMISlabbedHeadRegistrationAlgorithmTemplate.h ) SET(TPP_FILES include/mapITKImageRegistrationAlgorithm.tpp include/mapITKImageRegistrationAlgorithmInterface.tpp include/mapITKSVNLOptimizerControlBase.tpp include/mapITKMVNLOptimizerControlBase.tpp include/mapArbitraryInterpolatorPolicy.tpp include/mapArbitraryImageToImageMetricPolicy.tpp include/mapArbitraryTransformPolicy.tpp include/mapFixedInterpolatorPolicy.tpp include/mapFixedImageToImageMetricPolicy.tpp include/mapFixedSVNLOptimizerPolicy.tpp include/mapFixedTransformPolicy.tpp include/mapITKImageToImageMetricControlBase.tpp include/mapSealedInterpolatorPolicy.tpp include/mapSealedOptimizerPolicy.tpp include/mapSealedImageToImageMetricPolicy.tpp include/mapSealedTransformPolicy.tpp include/mapITKPointSetToPointSetMetricControlBase.tpp include/mapFixedMVNLOptimizerPolicy.tpp include/mapArbitraryPointSetToPointSetMetricPolicy.tpp include/mapFixedPointSetToPointSetMetricPolicy.tpp include/mapSealedPointSetToPointSetMetricPolicy.tpp include/mapITKPointSetRegistrationAlgorithm.tpp include/mapITKPointSetRegistrationAlgorithmInterface.tpp include/mapITKMultiResImageRegistrationAlgorithm.tpp include/mapITKClosedFormRegistrationAlgorithm.tpp include/mapITKLandmarkKernelRegistrationAlgorithm.tpp include/mapITKPointSetRegistrationAlgorithm.tpp include/mapITKPDEDeformableRegistrationAlgorithmBase.tpp include/mapITKPDEDeformableRegistrationAlgorithm.tpp include/mapITKMultiResPDEDeformableRegistrationAlgorithm.tpp boxed/mapITKAffineMattesMIMultiResRegistrationAlgorithmTemplate.tpp boxed/mapITKDemonsRegistrationAlgorithm.tpp boxed/mapITKEuler3DMattesMIMultiResRegistrationAlgorithmTemplate.tpp boxed/mapITKEuler3DMattesMIRegistrationAlgorithmTemplate.tpp boxed/mapITKEuler3DMSRegistrationAlgorithmTemplate.tpp boxed/mapITKTransMattesMIMultiResRegistrationAlgorithm.tpp boxed/mapITKInitializedImageRegistrationAlgorithm.tpp boxed/mapITKInitializedMultiResImageRegistrationAlgorithm.tpp boxed/mapITKRigid2DMattesMIRegistrationAlgorithmTemplate.tpp boxed/mapITKPDEDemonsRegistrationAlgorithm.tpp boxed/mapITKLevelSetMotionRegistrationAlgorithm.tpp boxed/mapITKSymmetricForcesDemonsRegistrationAlgorithm.tpp boxed/mapITKLevelSetMotionMultiResRegistrationAlgorithm.tpp +boxed/mapITKRigid3DMattesMIHeadNeckRegistrationAlgorithmTemplate.tpp +boxed/mapITKRigid3DMattesMISlabbedHeadRegistrationAlgorithmTemplate.tpp ) SET(TEST_CPP_FILES test/mapAlgorithmsITKTests.cpp test/mapITKOptimizerControlInterfaceTest.cpp test/mapITKOptimizerControlTest.cpp test/mapFixedSVNLOptimizerPolicyTest.cpp test/mapArbitrarySVNLOptimizerPolicyTest.cpp test/mapFixedInterpolatorPolicyTest.cpp test/mapArbitraryInterpolatorPolicyTest.cpp test/mapFixedImageToImageMetricPolicyTest.cpp test/mapArbitraryImageToImageMetricPolicyTest.cpp test/mapFixedTransformPolicyTest.cpp test/mapArbitraryTransformPolicyTest.cpp test/mapITKImageRegistrationAlgorithmTest.cpp test/mapFixedITKImageRegistrationAlgorithmTest.cpp test/mapArbitraryMVNLOptimizerPolicyTest.cpp test/mapFixedMVNLOptimizerPolicyTest.cpp test/mapArbitraryPointSetToPointSetMetricPolicyTest.cpp test/mapFixedPointSetToPointSetMetricPolicyTest.cpp test/mapITKPointSetRegistrationAlgorithmTest.cpp test/mapITKRigid2DICPRegistrationAlgorithmTemplateTest.cpp test/mapITKEuler3DICPRegistrationAlgorithmTemplateTest.cpp test/mapITKRigid2DClosedFormRegistrationAlgorithmTemplateTest.cpp test/mapITKRigid3DClosedFormRegistrationAlgorithmTemplateTest.cpp test/mapITKLandmarkKernelRegistrationAlgorithmTest.cpp test/mapITKEuler3DMattesMIRegistrationAlgorithmTemplateTest.cpp test/mapITKTransMattesMIMultiResRegistrationAlgorithmTest.cpp ) SET(_MAP_ITK_REVIEW_ACTIVE "OFF") MAP_CHECK_ITK_REVIEW_ACTIVE(_MAP_ITK_REVIEW_ACTIVE) IF (${_MAP_ITK_REVIEW_ACTIVE}) SET(H_FILES ${H_FILES} include/mapITKComplexBSplineInterpolateImageFunction.h boxed/mapITKFastSymmetricForcesDemonsRegistrationAlgorithm.h boxed/mapITKFastSymmetricForcesDemonsMultiResRegistrationAlgorithm.h) SET(TPP_FILES ${TPP_FILES} boxed/mapITKFastSymmetricForcesDemonsMultiResRegistrationAlgorithm.tpp boxed/mapITKFastSymmetricForcesDemonsRegistrationAlgorithm.tpp) ELSE (${_MAP_ITK_REVIEW_ACTIVE}) MESSAGE(WARNING "ITKReview Module is not activated. Dependend resources will be deactivated:\n - mapITKComplexBSplineInterpolateImageFunction.h\n - mapITKFastSymmetricForcesDemonsRegistrationAlgorithm\n - mapITKFastSymmetricForcesDemonsMultiResRegistrationAlgorithm") ENDIF (${_MAP_ITK_REVIEW_ACTIVE}) \ No newline at end of file diff --git a/Code/Algorithms/Plastimatch/CMakeLists.txt b/Code/Algorithms/Plastimatch/CMakeLists.txt index b89f3ba..dec557a 100644 --- a/Code/Algorithms/Plastimatch/CMakeLists.txt +++ b/Code/Algorithms/Plastimatch/CMakeLists.txt @@ -1,13 +1,14 @@ MAP_CREATE_MODULE(MAPAlgorithmsPlastimatch DEPENDS MAPAlgorithms MAPUtilities MAPIO) MAP_CREATE_MODULE_TESTS(MAPAlgorithmsPlastimatch DEPENDS MAPAlgorithmsITK PACKAGE_DEPENDS Litmus HEADER_TESTS) IF (BUILD_TESTING) ADD_EXECUTABLE(mapDummyPlastimatch "test/mapDummyPlastimatch.cpp") SET_TARGET_PROPERTIES(mapDummyPlastimatch PROPERTIES OUTPUT_NAME "plastimatch") TARGET_LINK_LIBRARIES(mapDummyPlastimatch MAPCore MAPAlgorithmsPlastimatch LitmusCommon) ENDIF (BUILD_TESTING) MAP_DEFINE_DEPLOYED_ALGORITHM(PlmParameterFileCLI2DRegistration PROFILE "deployed/PlmParameterFileCLI2DRegistration.profile" FILES "deployed/mapPlmParameterFileCLI2DRegistration.cpp" MODULE_DEPENDS MAPAlgorithmsPlastimatch MAPDeployment) MAP_DEFINE_DEPLOYED_ALGORITHM(PlmParameterFileCLI3DRegistration PROFILE "deployed/PlmParameterFileCLI3DRegistration.profile" FILES "deployed/mapPlmParameterFileCLI3DRegistration.cpp" MODULE_DEPENDS MAPAlgorithmsPlastimatch MAPDeployment) MAP_DEFINE_DEPLOYED_ALGORITHM(PlmBSplineCLI2DRegistration PROFILE "deployed/PlmBSplineCLI2DRegistration.profile" FILES "deployed/mapPlmBSplineCLI2DRegistration.cpp" MODULE_DEPENDS MAPAlgorithmsPlastimatch MAPDeployment) MAP_DEFINE_DEPLOYED_ALGORITHM(PlmBSplineCLI3DRegistration PROFILE "deployed/PlmBSplineCLI3DRegistration.profile" FILES "deployed/mapPlmBSplineCLI3DRegistration.cpp" MODULE_DEPENDS MAPAlgorithmsPlastimatch MAPDeployment) +MAP_DEFINE_DEPLOYED_ALGORITHM(PlmJOMBSplineCLI3DRegistration PROFILE "deployed/PlmJOMBSplineCLI3DRegistration.profile" FILES "deployed/mapJOMPlmBSplineCLI3DRegistration.cpp" MODULE_DEPENDS MAPAlgorithmsPlastimatch MAPDeployment) diff --git a/Code/Algorithms/Plastimatch/boxed/mapJOMPlmBSplineCLIRegistrationAlgorithm.h b/Code/Algorithms/Plastimatch/boxed/mapJOMPlmBSplineCLIRegistrationAlgorithm.h new file mode 100644 index 0000000..0f14a32 --- /dev/null +++ b/Code/Algorithms/Plastimatch/boxed/mapJOMPlmBSplineCLIRegistrationAlgorithm.h @@ -0,0 +1,119 @@ +// ----------------------------------------------------------------------- +// MatchPoint - DKFZ translational registration framework +// +// Copyright (c) German Cancer Research Center (DKFZ), +// Software development for Integrated Diagnostics and Therapy (SIDT). +// ALL RIGHTS RESERVED. +// See mapCopyright.txt or +// http://www.dkfz.de/en/sidt/projects/MatchPoint/copyright.html +// +// 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 __JOM_PLM_BSPLINE_CLI_REGISTRATION_ALGORITHM_H +#define __JOM_PLM_BSPLINE_CLI_REGISTRATION_ALGORITHM_H + +//MatchPoint +#include "mapContinuous.h" + +#include "mapPlmCLIRegistrationAlgorithmBase.h" +#include "mapClassMacros.h" + +namespace map +{ + namespace algorithm + { + namespace boxed + { + + /*! @class JOMPlmBSplineCLIRegistrationAlgorithm + @brief The class is a boxed plastimatch BSpline registration algorithm (using CLI, in many aspects similar to the SLICER PLastimatch BSpline plugin). + The algorithm has three stages (1. rigid registration, 2./3. BSpline registration). It uses plastimatch via CLI and uses auto + generated parameter files. + @ingroup Algorithms + @ingroup Plastimatch + @ingroup Boxed + */ + template + class JOMPlmBSplineCLIRegistrationAlgorithm : public + plastimatch::CLIRegistrationAlgorithmBase + { + public: + typedef JOMPlmBSplineCLIRegistrationAlgorithm Self; + typedef plastimatch::CLIRegistrationAlgorithmBase + Superclass; + + typedef ::itk::SmartPointer Pointer; + typedef ::itk::SmartPointer ConstPointer; + itkTypeMacro(JOMPlmBSplineCLIRegistrationAlgorithm, CLIRegistrationAlgorithmBase); + mapNewAlgorithmMacro(Self); + + typedef typename Superclass::UIDType UIDType; + typedef typename Superclass::UIDPointer UIDPointer; + + typedef typename Superclass::TargetImageType TargetImageType; + typedef typename Superclass::MovingImageType MovingImageType; + typedef typename Superclass::MovingRepresentationDescriptorType MovingRepresentationDescriptorType; + typedef typename Superclass::TargetRepresentationDescriptorType TargetRepresentationDescriptorType; + + typedef typename Superclass::RegistrationPointer RegistrationPointer; + typedef typename Superclass::RegistrationType RegistrationType; + typedef typename Superclass::FieldRepRequirement FieldRepRequirement; + + typedef typename Superclass::MetaPropertyType MetaPropertyType; + typedef typename Superclass::MetaPropertyPointer MetaPropertyPointer; + typedef typename Superclass::MetaPropertyNameType MetaPropertyNameType; + typedef typename Superclass::MetaPropertyVectorType MetaPropertyVectorType; + + protected: + JOMPlmBSplineCLIRegistrationAlgorithm(); + virtual ~JOMPlmBSplineCLIRegistrationAlgorithm(); + + /*! @reimplemented*/ + virtual void configureAlgorithm(); + + /*! @reimplemented */ + virtual void prepConfigurationPLM(); + + // MetaPropertyAlgorithmBase + /*! @reimplemented*/ + virtual void compileInfos(MetaPropertyVectorType& infos) const; + + /*! @reimplemented*/ + virtual MetaPropertyPointer doGetProperty(const MetaPropertyNameType& name) const; + + /*! @reimplemented*/ + virtual void doSetProperty(const MetaPropertyNameType& name, const MetaPropertyType* pProperty); + + bool _alignCenter; + unsigned int _s1_maxIterations; + ::map::core::String _s1_subsampling; + unsigned int _s2_maxIterations; + ::map::core::String _s2_subsampling; + ::map::core::String _s2_gridSpacing; + double _s2_regularization; + bool _doStage3; + unsigned int _s3_maxIterations; + ::map::core::String _s3_subsampling; + ::map::core::String _s3_gridSpacing; + double _s3_regularization; + + private: + + JOMPlmBSplineCLIRegistrationAlgorithm(const Self& source); //purposely not implemented + void operator=(const Self&); //purposely not implemented + }; + + } + } +} + +#ifndef MatchPoint_MANUAL_TPP +#include "mapJOMPlmBSplineCLIRegistrationAlgorithm.tpp" +#endif + +#endif diff --git a/Code/Algorithms/Plastimatch/boxed/mapJOMPlmBSplineCLIRegistrationAlgorithm.tpp b/Code/Algorithms/Plastimatch/boxed/mapJOMPlmBSplineCLIRegistrationAlgorithm.tpp new file mode 100644 index 0000000..7b88605 --- /dev/null +++ b/Code/Algorithms/Plastimatch/boxed/mapJOMPlmBSplineCLIRegistrationAlgorithm.tpp @@ -0,0 +1,306 @@ +// ----------------------------------------------------------------------- +// MatchPoint - DKFZ translational registration framework +// +// Copyright (c) German Cancer Research Center (DKFZ), +// Software development for Integrated Diagnostics and Therapy (SIDT). +// ALL RIGHTS RESERVED. +// See mapCopyright.txt or +// http://www.dkfz.de/en/sidt/projects/MatchPoint/copyright.html +// +// 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 __JOM_PLM_BSPLINE_CLI_REGISTRATION_ALGORITHM_TPP +#define __JOM_PLM_BSPLINE_CLI_REGISTRATION_ALGORITHM_TPP + +namespace map +{ + namespace algorithm + { + namespace boxed + { + + template + JOMPlmBSplineCLIRegistrationAlgorithm:: + JOMPlmBSplineCLIRegistrationAlgorithm() + { + }; + + template + JOMPlmBSplineCLIRegistrationAlgorithm:: + ~JOMPlmBSplineCLIRegistrationAlgorithm() + { + }; + + template + void + JOMPlmBSplineCLIRegistrationAlgorithm:: + configureAlgorithm() + { + Superclass::configureAlgorithm(); + if (this->isFirstConfiguration()) + { + _alignCenter = true; + _s1_maxIterations = 30; + _s1_subsampling = "4 4 2"; + _s2_maxIterations = 50; + _s2_subsampling = "4 4 4"; + _s2_gridSpacing = "35 35 35"; + _s2_regularization = 0.005; + _doStage3 = true; + _s3_maxIterations = 100; + _s3_subsampling = "2 2 2"; + _s3_gridSpacing = "11 11 11"; + _s3_regularization = 0.005; + } + }; + + template + void + JOMPlmBSplineCLIRegistrationAlgorithm:: + compileInfos(MetaPropertyVectorType& infos) const + { + Superclass::compileInfos(infos); + +#ifndef MAP_SEAL_ALGORITHMS + infos.push_back(map::algorithm::MetaPropertyInfo::New("EnableStage_0", typeid(bool), true, + true)); + infos.push_back(map::algorithm::MetaPropertyInfo::New("Stage1.MaxIterations", typeid(unsigned int), true, + true)); + infos.push_back(map::algorithm::MetaPropertyInfo::New("Stage1.SubsamplingFactor", typeid(map::core::String), + true, true)); + infos.push_back(map::algorithm::MetaPropertyInfo::New("Stage2.MaxIterations", typeid(unsigned int), true, + true)); + infos.push_back(map::algorithm::MetaPropertyInfo::New("Stage2.SubsamplingFactor", typeid(map::core::String), + true, true)); + infos.push_back(map::algorithm::MetaPropertyInfo::New("Stage2.GridSpacing", typeid(map::core::String), + true, true)); + infos.push_back(map::algorithm::MetaPropertyInfo::New("Stage2.RegularizationLambda", typeid(double), + true, true)); + infos.push_back(map::algorithm::MetaPropertyInfo::New("EnableStage_3", typeid(bool), true, + true)); + infos.push_back(map::algorithm::MetaPropertyInfo::New("Stage3.MaxIterations", typeid(unsigned int), true, + true)); + infos.push_back(map::algorithm::MetaPropertyInfo::New("Stage3.SubsamplingFactor", typeid(map::core::String), + true, true)); + infos.push_back(map::algorithm::MetaPropertyInfo::New("Stage3.GridSpacing", typeid(map::core::String), + true, true)); + infos.push_back(map::algorithm::MetaPropertyInfo::New("Stage3.RegularizationLambda", typeid(double), + true, true)); +#endif + }; + + template + typename JOMPlmBSplineCLIRegistrationAlgorithm::MetaPropertyPointer + JOMPlmBSplineCLIRegistrationAlgorithm:: + doGetProperty(const MetaPropertyNameType& name) const + { + MetaPropertyPointer spResult; + + if (name == "EnableStage_0") + { + spResult = map::core::MetaProperty::New(this->_alignCenter); + } + else if (name == "Stage1.MaxIterations") + { + spResult = map::core::MetaProperty::New(this->_s1_maxIterations); + } + else if (name == "Stage1.SubsamplingFactor") + { + spResult = map::core::MetaProperty::New(this->_s1_subsampling); + } + else if (name == "Stage2.MaxIterations") + { + spResult = map::core::MetaProperty::New(this->_s2_maxIterations); + } + else if (name == "Stage2.SubsamplingFactor") + { + spResult = map::core::MetaProperty::New(this->_s2_subsampling); + } + else if (name == "Stage2.GridSpacing") + { + spResult = map::core::MetaProperty::New(this->_s2_gridSpacing); + } + else if (name == "Stage2.RegularizationLambda") + { + spResult = map::core::MetaProperty::New(this->_s2_regularization); + } + else if (name == "EnableStage_3") + { + spResult = map::core::MetaProperty::New(this->_doStage3); + } + else if (name == "Stage3.MaxIterations") + { + spResult = map::core::MetaProperty::New(this->_s3_maxIterations); + } + else if (name == "Stage3.SubsamplingFactor") + { + spResult = map::core::MetaProperty::New(this->_s3_subsampling); + } + else if (name == "Stage3.GridSpacing") + { + spResult = map::core::MetaProperty::New(this->_s3_gridSpacing); + } + else if (name == "Stage3.RegularizationLambda") + { + spResult = map::core::MetaProperty::New(this->_s3_regularization); + } + else + { + spResult = Superclass::doGetProperty(name); + } + + return spResult; + }; + + template + void + JOMPlmBSplineCLIRegistrationAlgorithm:: + doSetProperty(const MetaPropertyNameType& name, const MetaPropertyType* pProperty) + { + if (name == "EnableStage_0") + { + bool enable; + map::core::unwrapMetaProperty(pProperty, enable); + this->_alignCenter = enable; + } + else if (name == "Stage1.MaxIterations") + { + unsigned int iterations; + map::core::unwrapMetaProperty(pProperty, iterations); + this->_s1_maxIterations = iterations; + } + else if (name == "Stage1.SubsamplingFactor") + { + core::String factorStr; + map::core::unwrapMetaProperty(pProperty, factorStr); + this->_s1_subsampling = factorStr; + } + else if (name == "Stage2.MaxIterations") + { + unsigned int iterations; + map::core::unwrapMetaProperty(pProperty, iterations); + this->_s2_maxIterations = iterations; + } + else if (name == "Stage2.SubsamplingFactor") + { + core::String factorStr; + map::core::unwrapMetaProperty(pProperty, factorStr); + this->_s2_subsampling = factorStr; + } + else if (name == "Stage2.GridSpacing") + { + core::String gridStr; + map::core::unwrapMetaProperty(pProperty, gridStr); + this->_s2_gridSpacing = gridStr; + } + else if (name == "Stage2.RegularizationLambda") + { + double lambda; + map::core::unwrapMetaProperty(pProperty, lambda); + this->_s2_regularization = lambda; + } + else if (name == "EnableStage_3") + { + bool enable; + map::core::unwrapMetaProperty(pProperty, enable); + this->_doStage3 = enable; + } + else if (name == "Stage3.MaxIterations") + { + unsigned int iterations; + map::core::unwrapMetaProperty(pProperty, iterations); + this->_s2_maxIterations = iterations; + } + else if (name == "Stage3.SubsamplingFactor") + { + core::String factorStr; + map::core::unwrapMetaProperty(pProperty, factorStr); + this->_s3_subsampling = factorStr; + } + else if (name == "Stage3.GridSpacing") + { + core::String gridStr; + map::core::unwrapMetaProperty(pProperty, gridStr); + this->_s3_gridSpacing = gridStr; + } + else if (name == "Stage3.RegularizationLambda") + { + double lambda; + map::core::unwrapMetaProperty(pProperty, lambda); + this->_s3_regularization = lambda; + } + else + { + Superclass::doSetProperty(name,pProperty); + } + } + + template + void + JOMPlmBSplineCLIRegistrationAlgorithm:: + prepConfigurationPLM() + { + this->_configurationPLM.clear(); + this->_configurationPLM.push_back( + algorithm::plastimatch::ParameterStageType()); //add global section, will be filled by base class + + algorithm::plastimatch::ParameterStageType map; + ///////////////////////////////// + //Setup Stage 0: align center + ///////////////////////////////// + if (this->_alignCenter) + { + map["xform"] = plastimatch::ParamGenerator().add("align_center"); + this->_configurationPLM.push_back(map); + } + ///////////////////////////////// + //Setup Stage 1: rigid + ///////////////////////////////// + map.clear(); + map["metric"] = plastimatch::ParamGenerator().add("mse"); + map["xform"] = plastimatch::ParamGenerator().add("rigid"); + map["optim"] = plastimatch::ParamGenerator().add("versor"); + map["impl"] = plastimatch::ParamGenerator().add("itk"); + map["max_its"] = plastimatch::ParamGenerator().add(this->_s1_maxIterations); + map["res"] = plastimatch::ParamGenerator().add(this->_s1_subsampling); + this->_configurationPLM.push_back(map); + + ///////////////////////////////// + //Setup Stage 2: BSpline + ///////////////////////////////// + map.clear(); + map["xform"] = plastimatch::ParamGenerator().add("bspline"); + map["optim"] = plastimatch::ParamGenerator().add("lbfgsb"); + map["impl"] = plastimatch::ParamGenerator().add("plastimatch"); + map["threading"] = plastimatch::ParamGenerator().add("openmp"); + map["metric"] = plastimatch::ParamGenerator().add("mse"); + map["max_its"] = plastimatch::ParamGenerator().add(this->_s2_maxIterations); + map["regularization_lambda"] = plastimatch::ParamGenerator().add(this->_s2_regularization); + map["res"] = plastimatch::ParamGenerator().add(this->_s2_subsampling); + map["grid_spac"] = plastimatch::ParamGenerator().add(this->_s2_gridSpacing); + this->_configurationPLM.push_back(map); + + ///////////////////////////////// + //Setup Stage 3: BSpline 2 + ///////////////////////////////// + if(this->_doStage3) + { + map.clear(); + map["max_its"] = plastimatch::ParamGenerator().add(this->_s3_maxIterations); + map["regularization_lambda"] = plastimatch::ParamGenerator().add(this->_s3_regularization); + map["res"] = plastimatch::ParamGenerator().add(this->_s3_subsampling); + map["grid_spac"] = plastimatch::ParamGenerator().add(this->_s3_gridSpacing); + this->_configurationPLM.push_back(map); + } + } + + } // end namespace boxed + } // end namespace algorithm +} // end namespace map + +#endif diff --git a/Code/Algorithms/Plastimatch/deployed/PlmJOMBSplineCLI3DRegistration.profile b/Code/Algorithms/Plastimatch/deployed/PlmJOMBSplineCLI3DRegistration.profile new file mode 100644 index 0000000..6291e11 --- /dev/null +++ b/Code/Algorithms/Plastimatch/deployed/PlmJOMBSplineCLI3DRegistration.profile @@ -0,0 +1,16 @@ +SET(ALGORITHM_PROFILE_UID_Namespace "de.dkfz.matchpoint.plastimatch.cli.jom") +SET(ALGORITHM_PROFILE_UID_Name "JOM.Plastimatch.BSpline.3D") +SET(ALGORITHM_PROFILE_UID_Version "1.0.0") + +SET(ALGORITHM_PROFILE_Description "This is a MatchPoint wrapper for the registration tool Plastimatch for 3D images for the joint organ motion meeting. The algorithm is in many aspects similar to the SLICER PLastimatch BSpline plugin. The algorithm has four stages (0. center alignment, 1. rigid registration, 2./3. BSpline registration) It is configured to preform a B-Spline registration on the image. REMARK: You need the plastimatch command line tool installed on this computer to run this algorithm. You can specify the plastimatch location 1) via the algorithm property PlastimatchDirectory or 2) via setting the environment variable MAP_PLASTIMATCH_PATH..") +SET(ALGORITHM_PROFILE_Contact "Ralf Floca (MatchPoint wrapper)\; sbr@dkfz-heidelberg.de") +SET(ALGORITHM_PROFILE_Contact "Plastimatch project homepage: www.plastimatch.org") + +SET(ALGORITHM_PROFILE_DataType "Image") +SET(ALGORITHM_PROFILE_DimMoving "3") +SET(ALGORITHM_PROFILE_ModalityMoving "any (mono modal)") +SET(ALGORITHM_PROFILE_DimTarget "3") +SET(ALGORITHM_PROFILE_ModalityTarget "any (mono modal)") +SET(ALGORITHM_PROFILE_TransformModel "B-Spline") +SET(ALGORITHM_PROFILE_TransformDomain "local") +SET(ALGORITHM_PROFILE_Keywords "plastimatch" "wrapper" "mono modal" "bspline") \ No newline at end of file diff --git a/Code/Algorithms/Plastimatch/deployed/mapJOMPlmBSplineCLI3DRegistration.cpp b/Code/Algorithms/Plastimatch/deployed/mapJOMPlmBSplineCLI3DRegistration.cpp new file mode 100644 index 0000000..b772f3f --- /dev/null +++ b/Code/Algorithms/Plastimatch/deployed/mapJOMPlmBSplineCLI3DRegistration.cpp @@ -0,0 +1,30 @@ +// ----------------------------------------------------------------------- +// MatchPoint - DKFZ translational registration framework +// +// Copyright (c) German Cancer Research Center (DKFZ), +// Software development for Integrated Diagnostics and Therapy (SIDT). +// ALL RIGHTS RESERVED. +// See mapCopyright.txt or +// http://www.dkfz.de/en/sidt/projects/MatchPoint/copyright.html +// +// 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 "mapDeploymentDLLHelper.h" +#include "mapDiscreteElements.h" +#include "mapContinuousElements.h" +#include "mapConfigure.h" + +#include "mapJOMPlmBSplineCLIRegistrationAlgorithm.h" + +#include "PlmJOMBSplineCLI3DRegistration_ProfileResource.h" + +typedef map::core::discrete::Elements<3>::InternalImageType ImageType; +typedef map::core::continuous::Elements<3>::InternalPointSetType PointSetType; +typedef map::algorithm::boxed::JOMPlmBSplineCLIRegistrationAlgorithm +AlgorithmType; + +mapDeployAlgorithmMacro(AlgorithmType); \ No newline at end of file diff --git a/Code/Algorithms/Plastimatch/files.cmake b/Code/Algorithms/Plastimatch/files.cmake index 192b4f2..a69a7aa 100644 --- a/Code/Algorithms/Plastimatch/files.cmake +++ b/Code/Algorithms/Plastimatch/files.cmake @@ -1,21 +1,23 @@ SET(CPP_FILES source/mapPlmAlgorithmHelper.cpp ) SET(H_FILES include/mapPlmCLIRegistrationAlgorithmBase.h include/mapPlmParameterFileRegistrationAlgorithm.h include/mapPlmAlgorithmHelper.h boxed/mapPlmBSplineCLIRegistrationAlgorithm.h +boxed/mapJOMPlmBSplineCLIRegistrationAlgorithm.h ) SET(TPP_FILES include/mapPlmCLIRegistrationAlgorithmBase.tpp include/mapPlmParameterFileRegistrationAlgorithm.tpp boxed/mapPlmBSplineCLIRegistrationAlgorithm.tpp +boxed/mapJOMPlmBSplineCLIRegistrationAlgorithm.tpp ) SET(TEST_CPP_FILES test/mapAlgorithmsPlastimatchTests.cpp test/mapPlmParameterFileRegistrationAlgorithmTest.cpp ) \ No newline at end of file