Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkFRPROptimizerView.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 
17 #include "QmitkFRPROptimizerView.h"
18 #include "mitkImageAccessByItk.h"
19 #include <itkFRPROptimizer.h>
20 
21 QmitkFRPROptimizerView::QmitkFRPROptimizerView(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_StepLengthFRPR->text().toFloat());
40  if (m_Controls.m_FletchReevesFRPR->isChecked())
41  {
42  OptimizerPointer->SetToFletchReeves();
43  }
44  else
45  {
46  OptimizerPointer->SetToPolakRibiere();
47  }
48  OptimizerPointer->SetMaximumIteration(m_Controls.m_IterationsFRPR->text().toInt());
49  return OptimizerPointer.GetPointer();
50 }
51 
53 {
54  itk::Array<double> optimizerValues;
55  optimizerValues.SetSize(4);
56  optimizerValues.fill(0);
57  optimizerValues[0] = m_Controls.m_Maximize->isChecked();
58  optimizerValues[1] = m_Controls.m_FletchReevesFRPR->isChecked();
59  optimizerValues[2] = m_Controls.m_StepLengthFRPR->text().toFloat();
60  optimizerValues[3] = m_Controls.m_IterationsFRPR->text().toInt();
61  return optimizerValues;
62 }
63 
64 void QmitkFRPROptimizerView::SetOptimizerParameters(itk::Array<double> optimizerValues)
65 {
66  m_Controls.m_Maximize->setChecked(optimizerValues[0]);
67  m_Controls.m_FletchReevesFRPR->setChecked(optimizerValues[1]);
68  m_Controls.m_PolakRibiereFRPR->setChecked(!optimizerValues[1]);
69  m_Controls.m_StepLengthFRPR->setText(QString::number(optimizerValues[2]));
70  m_Controls.m_IterationsFRPR->setText(QString::number(optimizerValues[3]));
71 }
72 
74 {
75  m_NumberTransformParameters = transformParameters;
76 }
77 
79 {
80  return "FRPR";
81 }
82 
83 void QmitkFRPROptimizerView::SetupUI(QWidget *parent)
84 {
85  m_Controls.setupUi(parent);
86  QValidator *validatorLineEditInput = new QIntValidator(0, 20000000, this);
87  m_Controls.m_IterationsFRPR->setValidator(validatorLineEditInput);
88  QValidator *validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
89  m_Controls.m_StepLengthFRPR->setValidator(validatorLineEditInputFloat);
90 }
QmitkFRPROptimizerView(QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
virtual QString GetName() override
virtual itk::Object::Pointer GetOptimizer() override
itk::SmartPointer< Self > Pointer
virtual itk::Array< double > GetOptimizerParameters() override
virtual void SetupUI(QWidget *parent) override
virtual void SetNumberOfTransformParameters(int transformParameters) override
Ui::QmitkFRPROptimizerControls m_Controls
virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override
OptimizerType
Unique integer value for every optimizer.
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.