VMTK
vtkvmtkPolyDataNetworkExtraction.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: VMTK
4 Module: $RCSfile: vtkvmtkPolyDataNetworkExtraction.h,v $
5 Language: C++
6 
7  Copyright (c) Luca Antiga, David Steinman. All rights reserved.
8  See LICENSE file for details.
9 
10  Portions of this code are covered under the VTK copyright.
11  See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm
12  for details.
13 
14  This software is distributed WITHOUT ANY WARRANTY; without even
15  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16  PURPOSE. See the above copyright notices for more information.
17 
18 =========================================================================*/
28 #ifndef __vtkvmtkPolyDataNetworkExtraction_h
29 #define __vtkvmtkPolyDataNetworkExtraction_h
30 
31 #include "vtkPolyDataAlgorithm.h"
32 #include "vtkvmtkWin32Header.h"
33 
34 class vtkPolyData;
35 class vtkPolyDataCollection;
36 class vtkIdTypeArray;
37 class vtkCollection;
38 class vtkPoints;
39 
40 class VTK_VMTK_MISC_EXPORT vtkvmtkPolyDataNetworkExtraction : public vtkPolyDataAlgorithm
41 {
42  public:
43  vtkTypeMacro(vtkvmtkPolyDataNetworkExtraction,vtkPolyDataAlgorithm);
44  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
45 
47 
48  vtkSetStringMacro(MarksArrayName);
49  vtkGetStringMacro(MarksArrayName);
50 
51  vtkSetStringMacro(RadiusArrayName);
52  vtkGetStringMacro(RadiusArrayName);
53 
54  vtkSetStringMacro(TopologyArrayName);
55  vtkGetStringMacro(TopologyArrayName);
56 
57  vtkSetMacro(AdvancementRatio,double);
58  vtkGetMacro(AdvancementRatio,double);
59 
60  vtkGetMacro(TotalMarkedPoints,int);
61 
62  vtkGetMacro(MinimumStep,double);
63 
64  vtkGetObjectMacro(GraphLayout,vtkPolyData);
65 
66 //BTX
67  enum
68  {
73  STEP_ITERATION_STOP_CLOSED
74  };
75 //ETX
76 
77 //BTX
78  enum
79  {
82  GLOBAL
83  };
84 //ETX
85 
86 protected:
89 
90  void BoundaryExtractor (vtkPolyData* polyInput, vtkPolyData* boundary);
91  void BoundarySeparator(vtkPolyData* appendedBoundaries, vtkPolyDataCollection* boundaries);
92  void InsertInEdgeTable(vtkIdTypeArray* edgeTable, vtkIdType pointId0, vtkIdType pointId1);
93  bool InsertUniqueInEdgeTable(vtkIdTypeArray* edgeTable, vtkIdType pointId0, vtkIdType pointId1);
94  void GetFromEdgeTable(vtkIdTypeArray* edgeTable, vtkIdType position, vtkIdType edge[2]);
95  void UpdateEdgeTableCollectionReal(vtkPolyData* model,vtkPolyDataCollection* profiles,vtkCollection* edgeTables);
96  double Distance(double point1[3], double point2[3]);
97  double GetFurthestDistance (vtkPolyDataCollection* polyDataCollection, double fromPoint[3]);
98  void Barycenter (vtkPoints* points, double barycenter[3]);
99  void ProfileBarycenter (vtkPoints* points, double barycenter[3]);
100  void DefineVirtualSphere(vtkPolyDataCollection* baseProfiles, double center[3], double &radius, double ratio);
101  vtkIdType CurrentPointId(vtkPolyData* model,vtkIdType currentEdge[2]);
102  void InsertEdgeForNewProfiles(vtkPolyData* model, vtkIdType* edge, vtkIdTypeArray* edgeTable, vtkIdTypeArray* cellPairs, vtkIdList* pointIds);
103  bool LookForNeighbors(vtkPolyData* model, vtkIdType pointId, vtkIdList* notVisitedIds, vtkIdTypeArray* edgeTableForIncludedGlobalProfiles);
104  void PropagateFromBaseProfilePoint(vtkPolyData* model, vtkIdList* toVisitPointIds, double center[3], double radius, vtkIdTypeArray* edgeTableForNewProfiles, vtkIdTypeArray* cellPairsForNewProfiles, vtkIdList* pointIdsForNewProfiles, vtkPoints* markedPoints, vtkIdList* markedPointIds, vtkIdTypeArray* edgeTableForIncludedGlobalProfiles);
105  void LocateVirtualPoint(vtkIdType edge[2], double center[3], double radius, vtkIdList* pointIdsForNewProfiles, vtkPoints* pointsForNewProfiles, vtkDoubleArray* pointDistancesForNewProfiles, double virtualPoint[3]);
106  void ReconstructNewProfiles(vtkPoints* virtualPoints, vtkIdTypeArray* edgeTable, vtkIdTypeArray* cellPairs, vtkPolyDataCollection* newProfiles, vtkCollection* newProfilesEdgeTables);
107  void GenerateNewProfiles(vtkPolyData* model, double center[3], double radius, vtkIdTypeArray* edgeTableForNewProfiles, vtkIdTypeArray* cellPairsForNewProfiles, vtkIdList* pointIdsForNewProfiles, vtkPolyDataCollection* newProfiles, vtkCollection* newProfilesEdgeTables);
108  void UnmarkPoints(vtkPolyData* model, vtkIdList* markedPointIds);
109  double ComputeStepRadius(vtkPoints* points, double point1[3], double point2[3]);
110  double ComputeMeanRadius(vtkPoints* points, double point1[3]);
111  void PointsForRadius(vtkPoints *markedPoints, vtkPolyDataCollection *baseProfiles, vtkPolyDataCollection *newProfiles, vtkPoints *pointsForRadius);
112  void LookForIntersectingPoint(vtkPoints* segmentPoints, double center[3], double radius, vtkIdType &intersectingPointId);
113  vtkIdType StepIteration(vtkPolyData* model, vtkPolyDataCollection* baseProfiles, vtkCollection* baseProfilesEdgeTables, vtkPolyDataCollection* globalProfiles, vtkCollection* globalProfilesEdgeTables, vtkPolyDataCollection* newProfiles, vtkCollection* newProfilesEdgeTables, vtkPoints* segmentPoints, vtkDoubleArray* segmentRadii, vtkPoints* bifurcationPoints, vtkDoubleArray* bifurcationRadii, double oldCenter[3], double &oldRadius, double advancementRatio);
114  void MarkModelGlobalProfile(vtkPolyData* model, vtkIdTypeArray* newGlobalProfileEdgeTable);
115  void SegmentTopology(vtkCollection* bifurcations, vtkCollection* bifurcationsRadii, double firstSegmentPoint[3], double lastSegmentPoint[3], double firstPoint[3], double &firstRadius, double lastPoint[3], double &lastRadius, vtkIdType segmentTopology[2]);
116  void BuildSegment(vtkPoints* segmentPoints, vtkDoubleArray* segmentRadii, vtkIdType segmentTopology[2], double firstPoint[3], double firstRadius, double lastPoint[3], double lastRadius, const double* centralPoint, vtkPolyData* segment);
117  void InsertNewBifurcation(vtkCollection* bifurcations, vtkCollection* bifurcationsRadii, vtkPoints* bifurcationPoints, vtkDoubleArray* bifurcationRadii, vtkPolyDataCollection* additionalSegments);
118  void SegmentIteration(vtkPolyData* model, vtkPolyData* initialProfile, vtkIdTypeArray* initialProfileEdgeTable, vtkPolyDataCollection* globalProfiles, vtkCollection* globalProfilesEdgeTables, vtkCollection* bifurcations, vtkCollection* bifurcationsRadii, vtkPolyDataCollection* segments, double advancementRatio);
119  void JoinSegments (vtkPolyData* segment0, vtkPolyData* segment1, bool first0, bool first1, vtkPolyData* segment);
120  void RemoveDegenerateBifurcations(vtkPolyDataCollection* segments,vtkCollection* bifurcations);
121  void GlobalIteration(vtkPolyData* model, vtkPolyDataCollection* globalProfiles, vtkPolyData* network, double advancementRatio);
122  void MarkModelRealBoundary(vtkPolyData* model, vtkPolyData* modelBoundary);
123  void Graph(vtkPolyData* network, vtkPolyData* graphLayout);
124 
125  virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
126 
127  vtkPolyData* GraphLayout;
128 
132 
133  double MinimumStep;
134 
136 
137  vtkIdType TotalMarkedPoints;
138 
139  private:
141  void operator=(const vtkvmtkPolyDataNetworkExtraction&); // Not implemented.
142 };
143 
144 #endif
create an approximated network graph (preliminary to centerline) from an input surface with atleast o...