Medical Imaging Interaction Toolkit  2026.06.00
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
14 #define mitkCreateDistanceImageFromSurfaceFilter_h
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 <itkeigen/Eigen/Dense>
27 
28 namespace mitk
29 {
53  {
54  public:
55  typedef vnl_vector_fixed<double, 3> PointType;
56 
57  typedef itk::Image<double, 3> DistanceImageType;
58  typedef DistanceImageType::IndexType IndexType;
59 
60  typedef std::vector<PointType> NormalList;
61  typedef std::vector<PointType> CenterList;
62 
63  typedef std::vector<Surface::Pointer> SurfaceList;
64 
66  itkFactorylessNewMacro(Self);
67  itkCloneMacro(Self);
68  itkGetMacro(DistanceImageSpacing, double);
69 
70  using Superclass::SetInput;
71 
72  // Methods copied from mitkSurfaceToSurfaceFilter
73  virtual void SetInput(const mitk::Surface *surface);
74 
75  virtual void SetInput(unsigned int idx, const mitk::Surface *surface);
76 
77  virtual const mitk::Surface *GetInput();
78 
79  virtual const mitk::Surface *GetInput(unsigned int idx);
80 
81  virtual void RemoveInputs(mitk::Surface *input);
82 
88  itkSetMacro(DistanceImageVolume, unsigned int);
89 
91 
92  // Resets the filter, i.e. removes all inputs and outputs
93  void Reset();
94 
100  void SetUseProgressBar(bool);
101 
107  void SetProgressStepSize(unsigned int stepSize);
108 
109  void SetReferenceImage(itk::ImageBase<3>::Pointer referenceImage);
110 
111  protected:
114  void GenerateData() override;
115  void GenerateOutputInformation() override;
116 
117  private:
118  void CreateSolutionMatrixAndFunctionValues();
119  double CalculateDistanceValue(PointType p);
120 
121  void FillDistanceImage();
122 
137  void DetermineBounds(DistanceImageType::PointType &minPointInWorldCoordinates,
138  DistanceImageType::PointType &maxPointInWorldCoordinates,
139  DistanceImageType::IndexType &minPointInIndexCoordinates,
140  DistanceImageType::IndexType &maxPointInIndexCoordinates);
141 
142  void PreprocessContourPoints();
143  void CreateEmptyDistanceImage();
144 
145  // Datastructures for the interpolation
146  CenterList m_Centers;
147  NormalList m_Normals;
148 
149  Eigen::MatrixXd m_SolutionMatrix;
150  Eigen::VectorXd m_FunctionValues;
151  Eigen::VectorXd m_Weights;
152 
153  DistanceImageType::Pointer m_DistanceImageITK;
154  itk::ImageBase<3>::Pointer m_ReferenceImage;
155 
156  double m_DistanceImageSpacing;
157  double m_DistanceImageDefaultBufferValue;
158  unsigned int m_DistanceImageVolume;
159 
160  bool m_UseProgressBar;
161  unsigned int m_ProgressStepSize;
162  };
163 
164 } // namespace
165 
166 #endif
#define MITKSURFACEINTERPOLATION_EXPORT
Filter that creates a distance image from contour surface points using Radial Basis Function interpol...
virtual void SetInput(unsigned int idx, const mitk::Surface *surface)
virtual const mitk::Surface * GetInput(unsigned int idx)
mitkClassMacro(CreateDistanceImageFromSurfaceFilter, ImageSource)
virtual void RemoveInputs(mitk::Surface *input)
virtual const mitk::Surface * GetInput()
void SetReferenceImage(itk::ImageBase< 3 >::Pointer referenceImage)
virtual void SetInput(const mitk::Surface *surface)
void SetProgressStepSize(unsigned int stepSize)
Set the stepsize which the progress bar should proceed.
void SetUseProgressBar(bool)
Set whether the mitkProgressBar should be used.
Superclass of all classes generating Images (instances of class Image) as output.
Data class for storing polygonal surfaces (vtkPolyData).
Definition: mitkSurface.h:37
Find image slices visible on a given plane.