Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkOnePlusOneEvolutionaryOptimizerView.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 
18 #include "mitkImageAccessByItk.h"
19 #include <itkNormalVariateGenerator.h>
20 #include <itkOnePlusOneEvolutionaryOptimizer.h>
21 
23  : QmitkRigidRegistrationOptimizerGUIBase(parent, f), m_NumberTransformParameters(16)
24 {
25 }
26 
28 {
29 }
30 
32 {
34 }
35 
37 {
39  // OptimizerPointer->SetMaximize( m_Controls.m_Maximize->isChecked() );
41  generator->Initialize(12345);
42  OptimizerPointer->SetNormalVariateGenerator(generator);
43  OptimizerPointer->SetShrinkFactor(m_Controls.m_ShrinkFactorOnePlusOneEvolutionary->text().toFloat());
44  OptimizerPointer->SetGrowthFactor(m_Controls.m_GrowthFactorOnePlusOneEvolutionary->text().toFloat());
45  OptimizerPointer->SetEpsilon(m_Controls.m_EpsilonOnePlusOneEvolutionary->text().toFloat());
46  OptimizerPointer->SetInitialRadius(m_Controls.m_InitialRadiusOnePlusOneEvolutionary->text().toFloat());
47  OptimizerPointer->SetMaximumIteration(m_Controls.m_IterationsOnePlusOneEvolutionary->text().toInt());
48  return OptimizerPointer.GetPointer();
49 }
50 
52 {
53  itk::Array<double> optimizerValues;
54  optimizerValues.SetSize(6);
55  optimizerValues.fill(0);
56  // optimizerValues[0] = m_Controls.m_Maximize->isChecked();
57  optimizerValues[1] = m_Controls.m_ShrinkFactorOnePlusOneEvolutionary->text().toFloat();
58  optimizerValues[2] = m_Controls.m_GrowthFactorOnePlusOneEvolutionary->text().toFloat();
59  optimizerValues[3] = m_Controls.m_EpsilonOnePlusOneEvolutionary->text().toFloat();
60  optimizerValues[4] = m_Controls.m_InitialRadiusOnePlusOneEvolutionary->text().toFloat();
61  optimizerValues[5] = m_Controls.m_IterationsOnePlusOneEvolutionary->text().toInt();
62  return optimizerValues;
63 }
64 
66 {
67  // m_Controls.m_Maximize->setChecked(optimizerValues[0]);
68  m_Controls.m_ShrinkFactorOnePlusOneEvolutionary->setText(QString::number(optimizerValues[1]));
69  m_Controls.m_GrowthFactorOnePlusOneEvolutionary->setText(QString::number(optimizerValues[2]));
70  m_Controls.m_EpsilonOnePlusOneEvolutionary->setText(QString::number(optimizerValues[3]));
71  m_Controls.m_InitialRadiusOnePlusOneEvolutionary->setText(QString::number(optimizerValues[4]));
72  m_Controls.m_IterationsOnePlusOneEvolutionary->setText(QString::number(optimizerValues[5]));
73 }
74 
76 {
77  m_NumberTransformParameters = transformParameters;
78 }
79 
81 {
82  return "OnePlusOneEvolutionary";
83 }
84 
86 {
87  m_Controls.setupUi(parent);
88  QValidator *validatorLineEditInput = new QIntValidator(0, 20000000, this);
89  m_Controls.m_EpsilonOnePlusOneEvolutionary->setValidator(validatorLineEditInput);
90  m_Controls.m_InitialRadiusOnePlusOneEvolutionary->setValidator(validatorLineEditInput);
91  m_Controls.m_IterationsOnePlusOneEvolutionary->setValidator(validatorLineEditInput);
92  QValidator *validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
93  m_Controls.m_ShrinkFactorOnePlusOneEvolutionary->setValidator(validatorLineEditInputFloat);
94  m_Controls.m_GrowthFactorOnePlusOneEvolutionary->setValidator(validatorLineEditInputFloat);
95  m_Controls.m_EpsilonOnePlusOneEvolutionary->setValidator(validatorLineEditInputFloat);
96  m_Controls.m_InitialRadiusOnePlusOneEvolutionary->setValidator(validatorLineEditInputFloat);
97  m_Controls.m_IterationsOnePlusOneEvolutionary->setValidator(validatorLineEditInputFloat);
98 }
Ui::QmitkOnePlusOneEvolutionaryOptimizerControls m_Controls
itk::SmartPointer< Self > Pointer
QmitkOnePlusOneEvolutionaryOptimizerView(QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
virtual itk::Array< double > GetOptimizerParameters() override
virtual void SetOptimizerParameters(itk::Array< double > metricValues) override
virtual void SetNumberOfTransformParameters(int transformParameters) override
virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override
OptimizerType
Unique integer value for every optimizer.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.