Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkGradientDescentOptimizerView.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 <itkGradientDescentOptimizer.h>
20 
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->SetLearningRate(m_Controls.m_LearningRateGradientDescent->text().toFloat());
40  OptimizerPointer->SetNumberOfIterations(m_Controls.m_IterationsGradientDescent->text().toInt());
41  return OptimizerPointer.GetPointer();
42 }
43 
45 {
46  itk::Array<double> optimizerValues;
47  optimizerValues.SetSize(3);
48  optimizerValues.fill(0);
49  // optimizerValues[0] = m_Controls.m_Maximize->isChecked();
50  optimizerValues[1] = m_Controls.m_LearningRateGradientDescent->text().toFloat();
51  optimizerValues[2] = m_Controls.m_IterationsGradientDescent->text().toInt();
52  return optimizerValues;
53 }
54 
55 void QmitkGradientDescentOptimizerView::SetOptimizerParameters(itk::Array<double> optimizerValues)
56 {
57  // m_Controls.m_Maximize->setChecked(optimizerValues[0]);
58  m_Controls.m_LearningRateGradientDescent->setText(QString::number(optimizerValues[1]));
59  m_Controls.m_IterationsGradientDescent->setText(QString::number(optimizerValues[2]));
60 }
61 
63 {
64  m_NumberTransformParameters = transformParameters;
65 }
66 
68 {
69  return "GradientDescent";
70 }
71 
73 {
74  m_Controls.setupUi(parent);
75  QValidator *validatorLineEditInput = new QIntValidator(0, 20000000, this);
76  m_Controls.m_IterationsGradientDescent->setValidator(validatorLineEditInput);
77  QValidator *validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
78  m_Controls.m_LearningRateGradientDescent->setValidator(validatorLineEditInputFloat);
79 }
Ui::QmitkGradientDescentOptimizerControls m_Controls
itk::SmartPointer< Self > Pointer
virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override
virtual void SetupUI(QWidget *parent) override
virtual itk::Array< double > GetOptimizerParameters() override
virtual void SetNumberOfTransformParameters(int transformParameters) override
virtual void SetOptimizerParameters(itk::Array< double > metricValues) override
virtual itk::Object::Pointer GetOptimizer() override
QmitkGradientDescentOptimizerView(QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
OptimizerType
Unique integer value for every optimizer.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.