Medical Imaging Interaction Toolkit  2018.4.99-064ad45c
Medical Imaging Interaction Toolkit
mitkCreateDistanceImageFromSurfaceFilter.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 mitkCreateDistanceImageFromSurfaceFilter_h_Included
14 #define mitkCreateDistanceImageFromSurfaceFilter_h_Included
15 
17 
18 #include "mitkImageSource.h"
19 #include "mitkProgressBar.h"
20 #include "mitkSurface.h"
21 
22 #include "vnl/vnl_vector_fixed.h"
23 
24 #include "itkImageBase.h"
25 
26 #include <Eigen/Dense>
27 
28 namespace mitk
29 {
65  {
66  public:
67  typedef vnl_vector_fixed<double, 3> PointType;
68 
69  typedef itk::Image<double, 3> DistanceImageType;
70  typedef DistanceImageType::IndexType IndexType;
71 
72  typedef std::vector<PointType> NormalList;
73  typedef std::vector<PointType> CenterList;
74 
75  typedef std::vector<Surface::Pointer> SurfaceList;
76 
78  itkFactorylessNewMacro(Self);
79  itkCloneMacro(Self);
80  itkGetMacro(DistanceImageSpacing, double);
81 
82  using Superclass::SetInput;
83 
84  // Methods copied from mitkSurfaceToSurfaceFilter
85  virtual void SetInput(const mitk::Surface *surface);
86 
87  virtual void SetInput(unsigned int idx, const mitk::Surface *surface);
88 
89  virtual const mitk::Surface *GetInput();
90 
91  virtual const mitk::Surface *GetInput(unsigned int idx);
92 
93  virtual void RemoveInputs(mitk::Surface *input);
94 
100  itkSetMacro(DistanceImageVolume, unsigned int);
101 
102  void PrintEquationSystem();
103 
104  // Resets the filter, i.e. removes all inputs and outputs
105  void Reset();
106 
112  void SetUseProgressBar(bool);
113 
119  void SetProgressStepSize(unsigned int stepSize);
120 
121  void SetReferenceImage(itk::ImageBase<3>::Pointer referenceImage);
122 
123  protected:
126  void GenerateData() override;
127  void GenerateOutputInformation() override;
128 
129  private:
130  void CreateSolutionMatrixAndFunctionValues();
131  double CalculateDistanceValue(PointType p);
132 
133  void FillDistanceImage();
134 
149  void DetermineBounds(DistanceImageType::PointType &minPointInWorldCoordinates,
150  DistanceImageType::PointType &maxPointInWorldCoordinates,
151  DistanceImageType::IndexType &minPointInIndexCoordinates,
152  DistanceImageType::IndexType &maxPointInIndexCoordinates);
153 
154  void PreprocessContourPoints();
155  void CreateEmptyDistanceImage();
156 
157  // Datastructures for the interpolation
158  CenterList m_Centers;
159  NormalList m_Normals;
160 
161  Eigen::MatrixXd m_SolutionMatrix;
162  Eigen::VectorXd m_FunctionValues;
163  Eigen::VectorXd m_Weights;
164 
165  DistanceImageType::Pointer m_DistanceImageITK;
166  itk::ImageBase<3>::Pointer m_ReferenceImage;
167 
168  double m_DistanceImageSpacing;
169  double m_DistanceImageDefaultBufferValue;
170  unsigned int m_DistanceImageVolume;
171 
172  bool m_UseProgressBar;
173  unsigned int m_ProgressStepSize;
174  };
175 
176 } // namespace
177 
178 #endif
Superclass of all classes generating Images (instances of class Image) as output. ...
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:28
Superclass of all classes generating some kind of mitk::BaseData.
DataCollection - Class to facilitate loading/accessing structured data.
#define MITKSURFACEINTERPOLATION_EXPORT
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
This filter interpolates the 3D surface for a segmented area. The basis for the interpolation are the...