Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkExhaustiveOptimizerView.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 <itkExhaustiveOptimizer.h>
20 
22  : QmitkRigidRegistrationOptimizerGUIBase(parent, f), m_NumberTransformParameters(16)
23 {
24 }
25 
27 {
28 }
29 
31 {
33 }
34 
36 {
38  OptimizerPointer->SetStepLength(m_Controls.m_StepLengthExhaustive->text().toFloat());
39  itk::ExhaustiveOptimizer::StepsType steps(m_NumberTransformParameters);
40  for (int i = 0; i < m_NumberTransformParameters; i++)
41  {
42  steps[i] = m_Controls.m_NumberOfStepsExhaustive->text().toInt();
43  }
44  OptimizerPointer->SetNumberOfSteps(steps);
45  return OptimizerPointer.GetPointer();
46 }
47 
49 {
50  itk::Array<double> optimizerValues;
51  optimizerValues.SetSize(1);
52  optimizerValues.fill(0);
53  optimizerValues[0] = 1;
54  optimizerValues[1] = m_Controls.m_StepLengthExhaustive->text().toFloat();
55  optimizerValues[2] = m_Controls.m_NumberOfStepsExhaustive->text().toInt();
56  return optimizerValues;
57 }
58 
59 void QmitkExhaustiveOptimizerView::SetOptimizerParameters(itk::Array<double> optimizerValues)
60 {
61  // m_Controls.m_Maximize->setChecked(optimizerValues[0]);
62  m_Controls.m_StepLengthExhaustive->setText(QString::number(optimizerValues[1]));
63  m_Controls.m_NumberOfStepsExhaustive->setText(QString::number(optimizerValues[2]));
64 }
65 
67 {
68  m_NumberTransformParameters = transformParameters;
69 }
70 
72 {
73  return "Exhaustive";
74 }
75 
77 {
78  m_Controls.setupUi(parent);
79  QValidator *validatorLineEditInput = new QIntValidator(0, 20000000, this);
80  m_Controls.m_NumberOfStepsExhaustive->setValidator(validatorLineEditInput);
81  QValidator *validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
82  m_Controls.m_StepLengthExhaustive->setValidator(validatorLineEditInputFloat);
83 }
itk::SmartPointer< Self > Pointer
QmitkExhaustiveOptimizerView(QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
virtual void SetOptimizerParameters(itk::Array< double > metricValues) override
Ui::QmitkExhaustiveOptimizerControls m_Controls
virtual void SetupUI(QWidget *parent) override
virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override
virtual void SetNumberOfTransformParameters(int transformParameters) override
OptimizerType
Unique integer value for every optimizer.
virtual itk::Array< double > GetOptimizerParameters() override
virtual itk::Object::Pointer GetOptimizer() override
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.