Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
vtkProjectMarkupsCurvePointsFilter.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Kitware Inc.
6
7 See COPYRIGHT.txt
8 or http://www.slicer.org/copyright/copyright.txt for details.
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16==============================================================================*/
17
18#ifndef __vtkProjectMarkupsCurvePointsFilter_h
19#define __vtkProjectMarkupsCurvePointsFilter_h
20
21#include "vtkMRMLExport.h"
22
23#include <vtkInformation.h>
24#include <vtkPolyDataAlgorithm.h>
25#include <vtkWeakPointer.h>
26
27class vtkDoubleArray;
28class vtkOBBTree;
29class vtkPointLocator;
30class vtkPoints;
31class vtkPolyData;
32
35
46class VTK_MRML_EXPORT vtkProjectMarkupsCurvePointsFilter : public vtkPolyDataAlgorithm
47{
48public:
49 vtkTypeMacro(vtkProjectMarkupsCurvePointsFilter, vtkPolyDataAlgorithm);
51
65
74 using vtkPolyDataAlgorithm::SetInputData;
75 using vtkPolyDataAlgorithm::SetInputConnection;
77
89 static bool ConstrainPointsToSurface(vtkPoints* originalPoints, vtkDoubleArray* normalVectors, vtkPolyData* surfacePolydata,
90 vtkPoints* surfacePoints, double maximumSearchRadiusTolerance);
91
99 void SetMaximumSearchRadiusTolerance(double maximumSearchRadiusTolerance);
102
103protected:
104 int FillInputPortInformation(int port, vtkInformation* info) override;
105 int RequestData(vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector) override;
106
108private:
109 vtkWeakPointer<vtkMRMLMarkupsCurveNode> InputCurveNode;
110 double MaximumSearchRadiusTolerance;
111
112 bool ProjectPointsToSurface(vtkMRMLModelNode* modelNode, double maximumSearchRadiusTolerance, vtkPoints* interpolatedPoints, vtkPoints* outputPoints);
113 static bool ConstrainPointsToSurfaceImpl(vtkOBBTree* surfaceObbTree, vtkPointLocator* pointLocator,
114 vtkPoints* originalPoints, vtkDoubleArray* normalVectors, vtkPolyData* surfacePolydata,
115 vtkPoints* surfacePoints, double maximumSearchRadius=.25);
116
117 class PointProjectionHelper
118 {
119 public:
120 PointProjectionHelper();
121 void SetModel(vtkMRMLModelNode* model);
124 vtkSmartPointer<vtkDoubleArray> GetPointNormals(vtkPoints* points, vtkPoints* controlPoints);
125 vtkPointLocator* GetPointLocator();
126 vtkOBBTree* GetObbTree();
127 vtkPolyData* GetSurfacePolyData();
128
129 private:
130 vtkMRMLModelNode* Model;
131 vtkMTimeType LastModelModifiedTime;
132 vtkMTimeType LastTransformModifiedTime;
133 vtkSmartPointer<vtkDataArray> ModelNormalVectorArray;
134 vtkSmartPointer<vtkPointLocator> ModelPointLocator;
135 vtkSmartPointer<vtkOBBTree> ModelObbTree;
136 vtkSmartPointer<vtkPolyData> SurfacePolyData;
137
138 bool UpdateAll();
139 static vtkIdType GetClosestControlPointIndex(const double point[3], vtkPoints* controlPoints);
140 };
141
142 PointProjectionHelper PointProjection;
143};
144
145#endif
MRML node to represent a curve markup Curve Markups nodes contain N control points....
MRML node to represent a 3D surface model.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
double GetMaximumSearchRadiusTolerance() const
static vtkProjectMarkupsCurvePointsFilter * New()
void SetMaximumSearchRadiusTolerance(double maximumSearchRadiusTolerance)
void SetInputCurveNode(vtkMRMLMarkupsCurveNode *inputCurveNode)
int FillInputPortInformation(int port, vtkInformation *info) override
static bool ConstrainPointsToSurface(vtkPoints *originalPoints, vtkDoubleArray *normalVectors, vtkPolyData *surfacePolydata, vtkPoints *surfacePoints, double maximumSearchRadiusTolerance)