Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkGradientDifferenceMetricView.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 <itkGradientDifferenceImageToImageMetric.h>
20 
21 #include "QValidator"
22 
25 {
26 }
27 
29 {
30 }
31 
33 {
35 }
36 
38 {
39  if (m_MovingImage.IsNotNull())
40  {
41  AccessByItk(m_MovingImage, GetMetric2);
42  return m_MetricObject;
43  }
44  return nullptr;
45 }
46 
47 template <class TPixelType, unsigned int VImageDimension>
48 itk::Object::Pointer QmitkGradientDifferenceMetricView::GetMetric2(
49  itk::Image<TPixelType, VImageDimension> * /*itkImage1*/)
50 {
51  typedef typename itk::Image<TPixelType, VImageDimension> FixedImageType;
52  typedef typename itk::Image<TPixelType, VImageDimension> MovingImageType;
55  MetricPointer->SetComputeGradient(m_Controls.m_ComputeGradient->isChecked());
56  m_MetricObject = MetricPointer.GetPointer();
57  return MetricPointer.GetPointer();
58 }
59 
61 {
62  itk::Array<double> metricValues;
63  metricValues.SetSize(1);
64  metricValues.fill(0);
65  metricValues[0] = m_Controls.m_ComputeGradient->isChecked();
66  return metricValues;
67 }
68 
69 void QmitkGradientDifferenceMetricView::SetMetricParameters(itk::Array<double> metricValues)
70 {
71  m_Controls.m_ComputeGradient->setChecked(metricValues[0]);
72 }
73 
75 {
76  return "GradientDifference";
77 }
78 
80 {
81  m_Controls.setupUi(parent);
82 }
83 
85 {
86  return false;
87 }
QmitkGradientDifferenceMetricView(QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
itk::SmartPointer< Self > Pointer
Ui::QmitkGradientDifferenceMetricControls m_Controls
#define AccessByItk(mitkImage, itkImageTypeFunction)
Access a MITK image by an ITK image.
MetricType
Unique integer value for every metric.
virtual mitk::MetricParameters::MetricType GetMetricType() override
virtual itk::Array< double > GetMetricParameters() override
virtual void SetupUI(QWidget *parent) override
virtual void SetMetricParameters(itk::Array< double > metricValues) override
virtual itk::Object::Pointer GetMetric() override
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.