Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
mitkMultiModalRigidDefaultRegistrationAlgorithm.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkMultiModalRigidDefaultRegistrationAlgorithm_h
14 #define mitkMultiModalRigidDefaultRegistrationAlgorithm_h
15 
16 #include "mapDiscreteElements.h"
17 #include "mapITKEuler3DMattesMIMultiResRegistrationAlgorithmTemplate.h"
18 #include "mapConfigure.h"
19 
21 
22 namespace mitk
23 {
28  template<class TImageType>
30  public ::map::algorithm::boxed::ITKEuler3DMattesMIMultiResRegistrationAlgorithm<TImageType, TImageType, ::map::algorithm::mitkMultiModalRigidDefaultRegistrationAlgorithmUIDPolicy, SealedFixedInterpolatorPolicyMacro< ::itk::LinearInterpolateImageFunction<TImageType, ::map::core::continuous::ScalarType> >, ::map::algorithm::itk::NoComponentInitializationPolicy>
31  {
32  public:
34 
35  typedef ::map::algorithm::boxed::ITKEuler3DMattesMIMultiResRegistrationAlgorithm<TImageType, TImageType, ::map::algorithm::mitkMultiModalRigidDefaultRegistrationAlgorithmUIDPolicy, SealedFixedInterpolatorPolicyMacro< ::itk::LinearInterpolateImageFunction<TImageType, ::map::core::continuous::ScalarType> >, ::map::algorithm::itk::NoComponentInitializationPolicy>
37 
38  typedef ::itk::SmartPointer<Self> Pointer;
39  typedef ::itk::SmartPointer<const Self> ConstPointer;
40 
42  ITKEuler3DMattesMIMultiResRegistrationAlgorithm);
44 
45  protected:
47  {
48  };
49 
51  {
52  };
53 
54  void configureAlgorithm() override
55  {
56  Superclass::configureAlgorithm();
57 
58  this->setResolutionLevels(3);
59  this->_preInitialize = true;
60  this->_useCenterOfGravity = false;
61 
62  //optimizer
63  typename Superclass::ConcreteOptimizerType::ScalesType scales(6);
64  scales[0] = 1.0;
65  scales[1] = 1.0;
66  scales[2] = 1.0;
67  scales[3] = 1.0 / 1000;
68  scales[4] = 1.0 / 1000;
69  scales[5] = 1.0 / 1000;
70 
71  this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetScales(scales);
72  this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetMaximumStepLength(3.00);
73  this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetMinimumStepLength(0.5);
74  this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetNumberOfIterations(200);
75  this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetRelaxationFactor(0.8);
76  this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetGradientMagnitudeTolerance(1e-4);
77 
78  //metric
79  this->getConcreteMetricControl()->getConcreteMetric()->SetNumberOfHistogramBins(30);
80  this->getConcreteMetricControl()->getConcreteMetric()->SetUseAllPixels(true);
81  this->getConcreteMetricControl()->getConcreteMetric()->ReinitializeSeed();
82  this->getConcreteMetricControl()->getConcreteMetric()->UseExplicitPDFDerivativesOn();
83  }
84 
85  void
86  doInterLevelSetup() override
87  {
88  Superclass::doInterLevelSetup();
89 
90  if (this->getCurrentLevel() == 0)
91  {
92  typename Superclass::OptimizerBaseType::SVNLOptimizerBaseType::ScalesType scales(6);
93  scales[0] = 10.0;
94  scales[1] = 10.0;
95  scales[2] = 10.0;
96  scales[3] = 1.0 / 10000;
97  scales[4] = 1.0 / 10000;
98  scales[5] = 1.0 / 10000;
99  this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetScales(scales);
100  }
101  else
102  {
103  this->getConcreteMetricControl()->getConcreteMetric()->SetUseAllPixels(false);
104 
105  typename Superclass::OptimizerBaseType::SVNLOptimizerBaseType::ScalesType scales(6);
106  scales[0] = 1.0;
107  scales[1] = 1.0;
108  scales[2] = 1.0;
109  scales[3] = 1.0 / 1000;
110  scales[4] = 1.0 / 1000;
111  scales[5] = 1.0 / 1000;
112 
113  this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetScales(scales);
114 
115  unsigned int nrOfSmpl = ::itk::Math::Round<unsigned int, double>
116  (this->getMovingImage()->GetLargestPossibleRegion().GetNumberOfPixels() * 0.15);
117 
118  this->getConcreteMetricControl()->getConcreteMetric()->SetNumberOfSpatialSamples(nrOfSmpl);
119  }
120  };
121 
122  private:
123 
124  MultiModalRigidDefaultRegistrationAlgorithm(const Self& source); //purposely not implemented
125  void operator=(const Self&); //purposely not implemented
126  };
127 
128 }
129 
130 #endif
mitk::MultiModalRigidDefaultRegistrationAlgorithm::doInterLevelSetup
void doInterLevelSetup() override
Definition: mitkMultiModalRigidDefaultRegistrationAlgorithm.h:86
mitk::MultiModalRigidDefaultRegistrationAlgorithm
Definition: mitkMultiModalRigidDefaultRegistrationAlgorithm.h:29
mitk::MultiModalRigidDefaultRegistrationAlgorithm::Self
MultiModalRigidDefaultRegistrationAlgorithm Self
Definition: mitkMultiModalRigidDefaultRegistrationAlgorithm.h:33
mitk::MultiModalRigidDefaultRegistrationAlgorithm::~MultiModalRigidDefaultRegistrationAlgorithm
~MultiModalRigidDefaultRegistrationAlgorithm() override
Definition: mitkMultiModalRigidDefaultRegistrationAlgorithm.h:50
mitkMultiModalRigidDefaultRegistrationAlgorithm_ProfileResource.h
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::MultiModalRigidDefaultRegistrationAlgorithm::Superclass
::map::algorithm::boxed::ITKEuler3DMattesMIMultiResRegistrationAlgorithm< TImageType, TImageType, ::map::algorithm::mitkMultiModalRigidDefaultRegistrationAlgorithmUIDPolicy, SealedFixedInterpolatorPolicyMacro< ::itk::LinearInterpolateImageFunction< TImageType, ::map::core::continuous::ScalarType > >, ::map::algorithm::itk::NoComponentInitializationPolicy > Superclass
Definition: mitkMultiModalRigidDefaultRegistrationAlgorithm.h:36
mitk::MultiModalRigidDefaultRegistrationAlgorithm::ConstPointer
::itk::SmartPointer< const Self > ConstPointer
Definition: mitkMultiModalRigidDefaultRegistrationAlgorithm.h:39
mitk::MultiModalRigidDefaultRegistrationAlgorithm::MultiModalRigidDefaultRegistrationAlgorithm
MultiModalRigidDefaultRegistrationAlgorithm()
Definition: mitkMultiModalRigidDefaultRegistrationAlgorithm.h:46
mitk::MultiModalRigidDefaultRegistrationAlgorithm::Pointer
::itk::SmartPointer< Self > Pointer
Definition: mitkMultiModalRigidDefaultRegistrationAlgorithm.h:38
mitk::MultiModalRigidDefaultRegistrationAlgorithm::configureAlgorithm
void configureAlgorithm() override
Definition: mitkMultiModalRigidDefaultRegistrationAlgorithm.h:54
mitk::MultiModalRigidDefaultRegistrationAlgorithm::mapNewAlgorithmMacro
mapNewAlgorithmMacro(Self)