Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkLBFGSBOptimizerView.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 <itkLBFGSBOptimizer.h>
20 
21 QmitkLBFGSBOptimizerView::QmitkLBFGSBOptimizerView(QWidget *parent, Qt::WindowFlags f)
22  : QmitkRigidRegistrationOptimizerGUIBase(parent, f), m_NumberTransformParameters(16)
23 {
24 }
25 
27 {
28 }
29 
31 {
33 }
34 
36 {
38  // Set up boundary conditions
39  itk::LBFGSBOptimizer::BoundValueType lower(12);
40  itk::LBFGSBOptimizer::BoundValueType upper(12);
41  itk::LBFGSBOptimizer::BoundSelectionType select(12);
42 
43  lower.Fill(-1);
44  upper.Fill(10);
45  select.Fill(2);
46 
47  OptimizerPointer->SetLowerBound(lower);
48  OptimizerPointer->SetUpperBound(upper);
49  OptimizerPointer->SetBoundSelection(select);
50  OptimizerPointer->SetCostFunctionConvergenceFactor(1e+1);
51  OptimizerPointer->SetMaximumNumberOfCorrections(5);
52  OptimizerPointer->SetProjectedGradientTolerance(1e-5);
53  OptimizerPointer->SetMaximumNumberOfEvaluations(500);
54  OptimizerPointer->SetMaximumNumberOfIterations(200);
55  return OptimizerPointer.GetPointer();
56 }
57 
59 {
60  itk::Array<double> optimizerValues;
61  optimizerValues.SetSize(1);
62  optimizerValues.fill(0);
63  optimizerValues[0] = m_Controls.m_Maximize->isChecked();
64  return optimizerValues;
65 }
66 
67 void QmitkLBFGSBOptimizerView::SetOptimizerParameters(itk::Array<double> optimizerValues)
68 {
69  m_Controls.m_Maximize->setChecked(optimizerValues[0]);
70 }
71 
73 {
74  m_NumberTransformParameters = transformParameters;
75 }
76 
78 {
79  return "LBFGSB";
80 }
81 
82 void QmitkLBFGSBOptimizerView::SetupUI(QWidget *parent)
83 {
84  m_Controls.setupUi(parent);
85  /*QValidator* validatorLineEditInput = */ new QIntValidator(0, 20000000, this);
86  /*QValidator* validatorLineEditInputFloat = */ new QDoubleValidator(0, 20000000, 8, this);
87 }
itk::SmartPointer< Self > Pointer
virtual QString GetName() override
virtual void SetupUI(QWidget *parent) override
virtual itk::Array< double > GetOptimizerParameters() override
QmitkLBFGSBOptimizerView(QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
Ui::QmitkLBFGSBOptimizerControls m_Controls
virtual itk::Object::Pointer GetOptimizer() override
virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override
OptimizerType
Unique integer value for every optimizer.
virtual void SetNumberOfTransformParameters(int transformParameters) override
virtual void SetOptimizerParameters(itk::Array< double > metricValues) override
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.