Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkPowellOptimizerView.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 <itkPowellOptimizer.h>
20 
21 QmitkPowellOptimizerView::QmitkPowellOptimizerView(QWidget *parent, Qt::WindowFlags f)
22  : QmitkRigidRegistrationOptimizerGUIBase(parent, f), m_NumberTransformParameters(16)
23 {
24 }
25 
27 {
28 }
29 
31 {
33 }
34 
36 {
38  OptimizerPointer->SetMaximize(m_Controls.m_Maximize->isChecked());
39  OptimizerPointer->SetStepLength(m_Controls.m_StepLengthPowell->text().toFloat());
40  OptimizerPointer->SetStepTolerance(m_Controls.m_StepTolerancePowell->text().toFloat());
41  OptimizerPointer->SetValueTolerance(m_Controls.m_ValueTolerancePowell->text().toFloat());
42  OptimizerPointer->SetMaximumIteration(m_Controls.m_IterationsPowell->text().toInt());
43  return OptimizerPointer.GetPointer();
44 }
45 
47 {
48  itk::Array<double> optimizerValues;
49  optimizerValues.SetSize(5);
50  optimizerValues.fill(0);
51  optimizerValues[0] = m_Controls.m_Maximize->isChecked();
52  optimizerValues[1] = m_Controls.m_StepLengthPowell->text().toFloat();
53  optimizerValues[2] = m_Controls.m_StepTolerancePowell->text().toFloat();
54  optimizerValues[3] = m_Controls.m_ValueTolerancePowell->text().toFloat();
55  optimizerValues[4] = m_Controls.m_IterationsPowell->text().toInt();
56  return optimizerValues;
57 }
58 
59 void QmitkPowellOptimizerView::SetOptimizerParameters(itk::Array<double> optimizerValues)
60 {
61  m_Controls.m_Maximize->setChecked(optimizerValues[0]);
62  m_Controls.m_StepLengthPowell->setText(QString::number(optimizerValues[1]));
63  m_Controls.m_StepTolerancePowell->setText(QString::number(optimizerValues[2]));
64  m_Controls.m_ValueTolerancePowell->setText(QString::number(optimizerValues[3]));
65  m_Controls.m_IterationsPowell->setText(QString::number(optimizerValues[4]));
66 }
67 
69 {
70  m_NumberTransformParameters = transformParameters;
71 }
72 
74 {
75  return "Powell";
76 }
77 
78 void QmitkPowellOptimizerView::SetupUI(QWidget *parent)
79 {
80  m_Controls.setupUi(parent);
81  QValidator *validatorLineEditInput = new QIntValidator(0, 20000000, this);
82  m_Controls.m_IterationsPowell->setValidator(validatorLineEditInput);
83  QValidator *validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
84  m_Controls.m_StepLengthPowell->setValidator(validatorLineEditInputFloat);
85  m_Controls.m_StepTolerancePowell->setValidator(validatorLineEditInputFloat);
86  m_Controls.m_ValueTolerancePowell->setValidator(validatorLineEditInputFloat);
87 }
Ui::QmitkPowellOptimizerControls m_Controls
itk::SmartPointer< Self > Pointer
virtual void SetNumberOfTransformParameters(int transformParameters) override
virtual itk::Array< double > GetOptimizerParameters() override
virtual void SetupUI(QWidget *parent) override
virtual void SetOptimizerParameters(itk::Array< double > metricValues) override
virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override
virtual QString GetName() override
QmitkPowellOptimizerView(QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
virtual itk::Object::Pointer GetOptimizer() 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.