Medical Imaging Interaction Toolkit  2016.11.0
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,
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 #ifndef mitkCreateDistanceImageFromSurfaceFilter_h_Included
18 #define mitkCreateDistanceImageFromSurfaceFilter_h_Included
19 
21 
22 #include "mitkImageSource.h"
23 #include "mitkProgressBar.h"
24 #include "mitkSurface.h"
25 
26 #include "vnl/vnl_vector_fixed.h"
27 
28 #include "itkImageBase.h"
29 
30 #include <Eigen/Dense>
31 
32 namespace mitk
33 {
69  {
70  public:
71  typedef vnl_vector_fixed<double, 3> PointType;
72 
73  typedef itk::Image<double, 3> DistanceImageType;
74  typedef DistanceImageType::IndexType IndexType;
75 
76  typedef std::vector<PointType> NormalList;
77  typedef std::vector<PointType> CenterList;
78 
79  typedef std::vector<Surface::Pointer> SurfaceList;
80 
82  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
83 
84  itkGetMacro(DistanceImageSpacing, double)
85 
86  using Superclass::SetInput;
87 
88  // Methods copied from mitkSurfaceToSurfaceFilter
89  virtual void SetInput(const mitk::Surface *surface);
90 
91  virtual void SetInput(unsigned int idx, const mitk::Surface *surface);
92 
93  virtual const mitk::Surface *GetInput();
94 
95  virtual const mitk::Surface *GetInput(unsigned int idx);
96 
97  virtual void RemoveInputs(mitk::Surface *input);
98 
104  itkSetMacro(DistanceImageVolume, unsigned int);
105 
106  void PrintEquationSystem();
107 
108  // Resets the filter, i.e. removes all inputs and outputs
109  void Reset();
110 
116  void SetUseProgressBar(bool);
117 
123  void SetProgressStepSize(unsigned int stepSize);
124 
125  void SetReferenceImage(itk::ImageBase<3>::Pointer referenceImage);
126 
127  protected:
129  virtual ~CreateDistanceImageFromSurfaceFilter();
130  virtual void GenerateData() override;
131  virtual void GenerateOutputInformation() override;
132 
133  private:
134  void CreateSolutionMatrixAndFunctionValues();
135  double CalculateDistanceValue(PointType p);
136 
137  void FillDistanceImage();
138 
153  void DetermineBounds(DistanceImageType::PointType &minPointInWorldCoordinates,
154  DistanceImageType::PointType &maxPointInWorldCoordinates,
155  DistanceImageType::IndexType &minPointInIndexCoordinates,
156  DistanceImageType::IndexType &maxPointInIndexCoordinates);
157 
158  void PreprocessContourPoints();
159  void CreateEmptyDistanceImage();
160 
161  // Datastructures for the interpolation
162  CenterList m_Centers;
163  NormalList m_Normals;
164 
165  Eigen::MatrixXd m_SolutionMatrix;
166  Eigen::VectorXd m_FunctionValues;
167  Eigen::VectorXd m_Weights;
168 
169  DistanceImageType::Pointer m_DistanceImageITK;
170  itk::ImageBase<3>::Pointer m_ReferenceImage;
171 
172  double m_DistanceImageSpacing;
173  double m_DistanceImageDefaultBufferValue;
174  unsigned int m_DistanceImageVolume;
175 
176  bool m_UseProgressBar;
177  unsigned int m_ProgressStepSize;
178  };
179 
180 } // namespace
181 
182 #endif
Superclass of all classes generating Images (instances of class Image) as output. ...
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:32
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:44
This filter interpolates the 3D surface for a segmented area. The basis for the interpolation are the...
itk::ProcessObject Superclass