Medical Imaging Interaction Toolkit  2018.4.99-1bab67a2
Medical Imaging Interaction Toolkit
mitkPhotoacousticMotionCorrectionFilter.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef _MITKPHOTOACOUSTICSMOTIONCORRECTIONFILTER_H_
14 #define _MITKPHOTOACOUSTICSMOTIONCORRECTIONFILTER_H_
15 
16 #include "mitkImageToImageFilter.h"
17 #include <itkObject.h>
18 
19 #include "opencv2/imgproc.hpp"
20 // TODO: Find out why build fails with this option or replace with something
21 // else
22 /* #include "opencv2/opencv.hpp" */
23 #include "opencv2/video/tracking.hpp"
24 
25 #include "itkOpenCVImageBridge.h"
26 
28 
29 #include "mitkImageCast.h"
33 
34 #define IMAGE_DIMENSION 3
35 #define MAX_MATRIX 255.0
37 namespace mitk
38 {
53  {
54  public:
56 
57  itkFactorylessNewMacro(Self);
58 
59  // Setters and Getters for the class variables
60  itkSetMacro(BatchSize, unsigned int);
61  itkSetMacro(PyrScale, double);
62  itkSetMacro(Levels, unsigned int);
63  itkSetMacro(WinSize, unsigned int);
64  itkSetMacro(Iterations, unsigned int);
65  itkSetMacro(PolyN, unsigned int);
66  itkSetMacro(PolySigma, double);
67  itkSetMacro(Flags, unsigned int);
68  itkGetConstMacro(BatchSize, unsigned int);
69  itkGetConstMacro(PyrScale, double);
70  itkGetConstMacro(Levels, unsigned int);
71  itkGetConstMacro(WinSize, unsigned int);
72  itkGetConstMacro(Iterations, unsigned int);
73  itkGetConstMacro(PolyN, unsigned int);
74  itkGetConstMacro(PolySigma, double);
75  itkGetConstMacro(Flags, unsigned int);
76 
77  // Wrapper for SetInput, GetInput and GetOutput
87  void SetPaInput(mitk::Image::Pointer);
97  mitk::Image::Pointer GetPaInput();
107  void SetUsInput(mitk::Image::Pointer);
117  mitk::Image::Pointer GetUsInput();
127  mitk::Image::Pointer GetPaOutput();
137  mitk::Image::Pointer GetUsOutput();
138 
139  protected:
141 
143 
161  void GenerateData() override;
175  void CheckInput(mitk::Image::Pointer paImage, mitk::Image::Pointer usImage);
191  void InitializeOutputIfNecessary(mitk::Image::Pointer paInput,
192  mitk::Image::Pointer usInput,
193  mitk::Image::Pointer paOutput,
194  mitk::Image::Pointer usOutput);
204  void InitializeOutput(mitk::Image::Pointer input, mitk::Image::Pointer output);
219  void PerformCorrection(mitk::Image::Pointer paInput,
220  mitk::Image::Pointer usInput,
221  mitk::Image::Pointer paOutput,
222  mitk::Image::Pointer usOutput);
235  cv::Mat GetMatrix(const mitk::Image::Pointer input, unsigned int i);
236 
247  cv::Mat FitMatrixToChar(cv::Mat mat);
248 
260  void InsertMatrixAsSlice(cv::Mat mat, mitk::Image::Pointer output, unsigned int i);
261 
270  cv::Mat ComputeFlowMap(cv::Mat);
271 
272  private:
273  // Parameters
274  double m_PyrScale;
276  double m_PolySigma;
278  unsigned int m_Levels;
279  unsigned int m_WinSize;
280  unsigned int m_Iterations;
281  unsigned int m_PolyN;
282  unsigned int m_Flags;
283  unsigned int m_BatchSize;
287  float m_MaxValue;
288  float m_MinValue;
290  // Stuff that OpenCV needs
291  cv::Mat m_UsRef;
293  cv::Mat m_Flow;
294  cv::Mat m_PaRes;
295  cv::Mat m_UsRes;
296  cv::Mat m_PaMat;
297  cv::Mat m_UsMat;
299  cv::Mat m_Map;
301  mitk::OpenCVToMitkImageFilter::Pointer m_OpenCVToImageFilter =
303  mitk::ImageToOpenCVImageFilter::Pointer m_ImageToOpenCVFilter =
305  };
306 }
307 #endif
Superclass of all classes generating some kind of mitk::BaseData.
#define MITKPHOTOACOUSTICSALGORITHMS_EXPORT
void GenerateData() override
A version of GenerateData() specific for image processing filters.
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
Class implementing a mitk::ImageToImageFilter for PAUS motion correction.
Superclass of all classes having one or more Images as input and generating Images as output...