Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
mitkMultiModalAffineDefaultRegistrationAlgorithm.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 mitkMultiModalAffineDefaultRegistrationAlgorithm_h
14 #define mitkMultiModalAffineDefaultRegistrationAlgorithm_h
15 
16 #include "mapDiscreteElements.h"
17 #include "mapITKAffineMattesMIMultiResRegistrationAlgorithmTemplate.h"
18 #include "mapConfigure.h"
19 
21 
22 namespace mitk
23 {
24 
29  template <class TImageType>
31  public map::algorithm::boxed::ITKAffineMattesMIMultiResRegistrationAlgorithm<TImageType, TImageType, ::map::algorithm::mitkMultiModalAffineDefaultRegistrationAlgorithmUIDPolicy, SealedFixedInterpolatorPolicyMacro< ::itk::LinearInterpolateImageFunction<TImageType, map::core::continuous::ScalarType> >, map::algorithm::itk::NoComponentInitializationPolicy>
32  {
33  public:
35 
36  typedef map::algorithm::boxed::ITKAffineMattesMIMultiResRegistrationAlgorithm<TImageType, TImageType, ::map::algorithm::mitkMultiModalAffineDefaultRegistrationAlgorithmUIDPolicy, SealedFixedInterpolatorPolicyMacro< ::itk::LinearInterpolateImageFunction<TImageType, map::core::continuous::ScalarType> >, map::algorithm::itk::NoComponentInitializationPolicy>
38 
39  typedef ::itk::SmartPointer<Self> Pointer;
40  typedef ::itk::SmartPointer<const Self> ConstPointer;
41 
43  ITKAffineMattesMIMultiResRegistrationAlgorithm);
45 
46  protected:
48  {
49  };
50 
52  {
53  };
54 
55  void configureAlgorithm() override
56  {
57  Superclass::configureAlgorithm();
58 
59  this->setResolutionLevels(3);
60  this->_preInitialize = true;
61  this->_useCenterOfGravity = false;
62 
63  this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetMaximumStepLength(3.00);
64  this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetMinimumStepLength(0.5);
65  this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetNumberOfIterations(200);
66  this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetRelaxationFactor(0.8);
67  this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetGradientMagnitudeTolerance(1e-4);
68 
69  //metric
70  this->getConcreteMetricControl()->getConcreteMetric()->SetNumberOfHistogramBins(30);
71  this->getConcreteMetricControl()->getConcreteMetric()->SetUseAllPixels(true);
72  this->getConcreteMetricControl()->getConcreteMetric()->ReinitializeSeed();
73  this->getConcreteMetricControl()->getConcreteMetric()->UseExplicitPDFDerivativesOn();
74  }
75 
76  void
77  doInterLevelSetup() override
78  {
79  Superclass::doInterLevelSetup();
80 
81  //scale setting
82  int dimCount = TImageType::ImageDimension*TImageType::ImageDimension + TImageType::ImageDimension;
83  int matrixEnd = TImageType::ImageDimension*TImageType::ImageDimension;
84  typename Superclass::ConcreteOptimizerType::ScalesType scales(dimCount);
85  double matrixScale = 1.0;
86  double transScale = 1.0;
87 
88  if (this->getCurrentLevel() == 0)
89  {
90  matrixScale = 10.0;
91  transScale = 1.0 / 10000;
92  }
93  else
94  {
95  matrixScale = 1.0;
96  transScale = 1.0 / 1000;
97  }
98 
99  for (int i = 0; i < dimCount; ++i)
100  {
101  if (i < matrixEnd)
102  {
103  scales[i] = matrixScale;
104 
105  }
106  else
107  {
108  scales[i] = transScale;
109  }
110  }
111 
112  this->getConcreteOptimizerControl()->getConcreteOptimizer()->SetScales(scales);
113 
114  //spatial samples setting
115  if (this->getCurrentLevel() != 0)
116  {
117  this->getConcreteMetricControl()->getConcreteMetric()->SetUseAllPixels(false);
118 
119  unsigned int nrOfSmpl = ::itk::Math::Round<unsigned int, double>
120  (this->getMovingImage()->GetLargestPossibleRegion().GetNumberOfPixels() * 0.30);
121 
122  this->getConcreteMetricControl()->getConcreteMetric()->SetNumberOfSpatialSamples(nrOfSmpl);
123  }
124  };
125 
126  private:
127 
128  MultiModalAffineDefaultRegistrationAlgorithm(const Self& source); //purposely not implemented
129  void operator=(const Self&); //purposely not implemented
130  };
131 
132 }
133 
134 #endif
mitk::MultiModalAffineDefaultRegistrationAlgorithm::configureAlgorithm
void configureAlgorithm() override
Definition: mitkMultiModalAffineDefaultRegistrationAlgorithm.h:55
mitk::MultiModalAffineDefaultRegistrationAlgorithm::doInterLevelSetup
void doInterLevelSetup() override
Definition: mitkMultiModalAffineDefaultRegistrationAlgorithm.h:77
mitk::MultiModalAffineDefaultRegistrationAlgorithm
Definition: mitkMultiModalAffineDefaultRegistrationAlgorithm.h:30
mitk::MultiModalAffineDefaultRegistrationAlgorithm::Superclass
map::algorithm::boxed::ITKAffineMattesMIMultiResRegistrationAlgorithm< TImageType, TImageType, ::map::algorithm::mitkMultiModalAffineDefaultRegistrationAlgorithmUIDPolicy, SealedFixedInterpolatorPolicyMacro< ::itk::LinearInterpolateImageFunction< TImageType, map::core::continuous::ScalarType > >, map::algorithm::itk::NoComponentInitializationPolicy > Superclass
Definition: mitkMultiModalAffineDefaultRegistrationAlgorithm.h:37
mitk::MultiModalAffineDefaultRegistrationAlgorithm::mapNewAlgorithmMacro
mapNewAlgorithmMacro(Self)
mitk::MultiModalAffineDefaultRegistrationAlgorithm::ConstPointer
::itk::SmartPointer< const Self > ConstPointer
Definition: mitkMultiModalAffineDefaultRegistrationAlgorithm.h:40
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::MultiModalAffineDefaultRegistrationAlgorithm::Pointer
::itk::SmartPointer< Self > Pointer
Definition: mitkMultiModalAffineDefaultRegistrationAlgorithm.h:39
mitk::MultiModalAffineDefaultRegistrationAlgorithm::~MultiModalAffineDefaultRegistrationAlgorithm
~MultiModalAffineDefaultRegistrationAlgorithm() override
Definition: mitkMultiModalAffineDefaultRegistrationAlgorithm.h:51
mitkMultiModalAffineDefaultRegistrationAlgorithm_ProfileResource.h
mitk::MultiModalAffineDefaultRegistrationAlgorithm::Self
MultiModalAffineDefaultRegistrationAlgorithm Self
Definition: mitkMultiModalAffineDefaultRegistrationAlgorithm.h:34
mitk::MultiModalAffineDefaultRegistrationAlgorithm::MultiModalAffineDefaultRegistrationAlgorithm
MultiModalAffineDefaultRegistrationAlgorithm()
Definition: mitkMultiModalAffineDefaultRegistrationAlgorithm.h:47