Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkMultiModalTrans_default.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "mapDeploymentDLLHelper.h"
18 #include "mapDiscreteElements.h"
19 #include "mapITKTransMattesMIMultiResRegistrationAlgorithm.h"
20 #include "mapConfigure.h"
21 
23 
24 namespace mitk
25 {
26  typedef map::core::discrete::Elements<3>::InternalImageType ImageType;
27 
32  class MultiModalTranslationDefaultRegistrationAlgorithm :
33  public map::algorithm::boxed::ITKTransMattesMIMultiResRegistrationAlgorithm<ImageType, ImageType, ::map::algorithm::MITK_MultiModal_translation_defaultUIDPolicy, SealedFixedInterpolatorPolicyMacro< ::itk::LinearInterpolateImageFunction<ImageType, map::core::continuous::ScalarType> >, map::algorithm::itk::NoComponentInitializationPolicy>
34  {
35  public:
36  typedef MultiModalTranslationDefaultRegistrationAlgorithm Self;
37 
38  typedef ITKTransMattesMIMultiResRegistrationAlgorithm<ImageType, ImageType, ::map::algorithm::MITK_MultiModal_translation_defaultUIDPolicy, SealedFixedInterpolatorPolicyMacro< ::itk::LinearInterpolateImageFunction<ImageType, map::core::continuous::ScalarType> >, map::algorithm::itk::NoComponentInitializationPolicy>
39  Superclass;
40 
41  typedef ::itk::SmartPointer<Self> Pointer;
42  typedef ::itk::SmartPointer<const Self> ConstPointer;
43 
44  itkTypeMacro(MultiModalTranslationDefaultRegistrationAlgorithm,
45  ITKEuler3DMattesMIMultiResRegistrationAlgorithm);
46  mapNewAlgorithmMacro(Self);
47 
48  protected:
49  MultiModalTranslationDefaultRegistrationAlgorithm()
50  {
51  };
52 
53  virtual ~MultiModalTranslationDefaultRegistrationAlgorithm()
54  {
55  };
56 
57  void configureAlgorithm()
58  {
59  Superclass::configureAlgorithm();
60 
61  this->setResolutionLevels(3);
62  this->_preInitialize = true;
63  this->_useCenterOfGravity = false;
64 
65  //optimizer
66  ConcreteOptimizerType::ScalesType scales(3);
67  scales[0] = 1.0;
68  scales[1] = 1.0;
69  scales[2] = 1.0;
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()
87  {
88  Superclass::doInterLevelSetup();
89 
90  if (this->getCurrentLevel() != 0)
91  {
92  getConcreteMetricControl()->getConcreteMetric()->SetUseAllPixels(false);
93 
94  unsigned int nrOfSmpl = ::itk::Math::Round<unsigned int, double>
95  (this->getMovingImage()->GetLargestPossibleRegion().GetNumberOfPixels() * 0.15);
96 
97  getConcreteMetricControl()->getConcreteMetric()->SetNumberOfSpatialSamples(nrOfSmpl);
98  }
99  };
100 
101  private:
102 
103  MultiModalTranslationDefaultRegistrationAlgorithm(const Self& source); //purposely not implemented
104  void operator=(const Self&); //purposely not implemented
105  };
106 
107 }
108 
109 mapDeployAlgorithmMacro( mitk::MultiModalTranslationDefaultRegistrationAlgorithm);
mapDeployAlgorithmMacro(mitk::MultiModalTranslationDefaultRegistrationAlgorithm)
itk::SmartPointer< Self > Pointer
DataCollection - Class to facilitate loading/accessing structured data.
itkEventMacroDeclaration(FocusChangedEvent, itk::AnyEvent) class MITKCORE_EXPORT TestingRenderingManager typedef RenderingManager Superclass
itk::SmartPointer< const Self > ConstPointer
map::core::discrete::Elements< 3 >::InternalImageType ImageType