Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkVersorTransformOptimizerView.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 <itkVersorTransformOptimizer.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->SetGradientMagnitudeTolerance(
40  m_Controls.m_GradientMagnitudeToleranceVersorTransform->text().toFloat());
41  OptimizerPointer->SetMinimumStepLength(m_Controls.m_MinimumStepLengthVersorTransform->text().toFloat());
42  OptimizerPointer->SetMaximumStepLength(m_Controls.m_MaximumStepLengthVersorTransform->text().toFloat());
43  OptimizerPointer->SetNumberOfIterations(m_Controls.m_IterationsVersorTransform->text().toInt());
44  return OptimizerPointer.GetPointer();
45 }
46 
48 {
49  itk::Array<double> optimizerValues;
50  optimizerValues.SetSize(5);
51  optimizerValues.fill(0);
52  optimizerValues[0] = m_Controls.m_Maximize->isChecked();
53  optimizerValues[1] = m_Controls.m_GradientMagnitudeToleranceVersorTransform->text().toFloat();
54  optimizerValues[2] = m_Controls.m_MinimumStepLengthVersorTransform->text().toFloat();
55  optimizerValues[3] = m_Controls.m_MaximumStepLengthVersorTransform->text().toFloat();
56  optimizerValues[4] = m_Controls.m_IterationsVersorTransform->text().toInt();
57  return optimizerValues;
58 }
59 
60 void QmitkVersorTransformOptimizerView::SetOptimizerParameters(itk::Array<double> optimizerValues)
61 {
62  m_Controls.m_Maximize->setChecked(optimizerValues[0]);
63  m_Controls.m_GradientMagnitudeToleranceVersorTransform->setText(QString::number(optimizerValues[1]));
64  m_Controls.m_MinimumStepLengthVersorTransform->setText(QString::number(optimizerValues[2]));
65  m_Controls.m_MaximumStepLengthVersorTransform->setText(QString::number(optimizerValues[3]));
66  m_Controls.m_IterationsVersorTransform->setText(QString::number(optimizerValues[4]));
67 }
68 
70 {
71  m_NumberTransformParameters = transformParameters;
72 }
73 
75 {
76  return "VersorTransform";
77 }
78 
80 {
81  m_Controls.setupUi(parent);
82  QValidator *validatorLineEditInput = new QIntValidator(0, 20000000, this);
83  m_Controls.m_IterationsVersorTransform->setValidator(validatorLineEditInput);
84  QValidator *validatorLineEditInputFloat = new QDoubleValidator(0, 20000000, 8, this);
85  m_Controls.m_GradientMagnitudeToleranceVersorTransform->setValidator(validatorLineEditInputFloat);
86  m_Controls.m_MinimumStepLengthVersorTransform->setValidator(validatorLineEditInputFloat);
87  m_Controls.m_MaximumStepLengthVersorTransform->setValidator(validatorLineEditInputFloat);
88 }
virtual itk::Array< double > GetOptimizerParameters() override
virtual void SetNumberOfTransformParameters(int transformParameters) override
itk::SmartPointer< Self > Pointer
QmitkVersorTransformOptimizerView(QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
virtual void SetupUI(QWidget *parent) override
virtual void SetOptimizerParameters(itk::Array< double > metricValues) override
virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override
virtual itk::Object::Pointer GetOptimizer() override
Ui::QmitkVersorTransformOptimizerControls m_Controls
OptimizerType
Unique integer value for every optimizer.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.