File: vtkvmtkSteepestDescentLineTracer.h

package info (click to toggle)
vmtk 1.0.1-1
  • links: PTS, VCS
  • area: non-free
  • in suites: wheezy
  • size: 8,612 kB
  • sloc: cpp: 79,872; ansic: 31,817; python: 18,860; perl: 381; makefile: 118; sh: 15; tcl: 1
file content (148 lines) | stat: -rw-r--r-- 6,350 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*=========================================================================

Program:   VMTK
Module:    $RCSfile: vtkvmtkSteepestDescentLineTracer.h,v $
Language:  C++
Date:      $Date: 2006/04/06 16:46:43 $
Version:   $Revision: 1.4 $

  Copyright (c) Luca Antiga, David Steinman. All rights reserved.
  See LICENCE file for details.

  Portions of this code are covered under the VTK copyright.
  See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm 
  for details.

     This software is distributed WITHOUT ANY WARRANTY; without even 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
  // .NAME vtkvmtkSteepestDescentLineTracer - Trace the steepest descent line over a polygonal non-manifold.
  // .SECTION Description
  // This class takes in input a non-manifold surface made of convex polygons (such as a Voronoi diagram) on which a scalar field is defined (as a point data array) and produces steepest descent paths from an id list of seeds to a target, basically solving the ordinary differential equation
  // \f[\frac{d\gamma(\tau)}{d\tau}=-\nabla T(\mathbf{x})\f]
  // where \f$\gamma(\tau)\f$ is a path and T(x) is a scalar field defined over the polygonal non-manifold domain.
  //
  // The class uses the members of its base class vtkNonManifoldSteepestDescent to compute the steepest descent point at each step.
  // The computed paths are polylines whose points always lie on input polygon edges.
  //
  // This class is meant to be used for backtracing centerlines after solving the Eikonal equation on the Voronoi diagram of a shape (by means of vtkNonManifoldFastMarching). If MergePaths is off, one polyline for each seed point is produced (the cell id of each polyline corresponds to the list id of input seeds). If MergePaths is on, polylines are merged if they intersect the same Voronoi diagram edge and their distance is below a user-defined tolerance. Actually, if a path visits an edge which has already been visited by a previous path, its endpoint is set to the previous path point, so that a T junction is produced. 
  //
  // The user can specify a point data array whose values are interpolated on path points and presented in output as point data. 
  //
  // If 1) EdgeArrayName and/or 2) EdgePCoordArrayName are provided, the output will contain 1) a 2-component vtkIntArray in which the point ids of the edges intersected by the paths are stored and 2) a 1-component vtkDoubleArray in which the parametric coordinate of the intersection is stored.
  //
  // .SECTION See Also
  // vtkNonManifoldFastMarching vtkVoronoiDiagram3D

#ifndef __vtkvmtkSteepestDescentLineTracer_h
#define __vtkvmtkSteepestDescentLineTracer_h

#include "vtkvmtkNonManifoldSteepestDescent.h"
#include "vtkIntArray.h"
#include "vtkDoubleArray.h"
#include "vtkIdList.h"
//#include "vtkvmtkComputationalGeometryWin32Header.h"
#include "vtkvmtkWin32Header.h"

class VTK_VMTK_COMPUTATIONAL_GEOMETRY_EXPORT vtkvmtkSteepestDescentLineTracer : public vtkvmtkNonManifoldSteepestDescent
{
public:
  vtkTypeRevisionMacro(vtkvmtkSteepestDescentLineTracer,vtkvmtkNonManifoldSteepestDescent);
  void PrintSelf(ostream& os, vtkIndent indent); 

  static vtkvmtkSteepestDescentLineTracer *New();

  // Description:
  // Set/Get the id of the seeds from which steepest descent starts.
  vtkSetObjectMacro(Seeds,vtkIdList);
  vtkGetObjectMacro(Seeds,vtkIdList);

  // Description:
  // Set/Get the id of the point on which steepest descent must terminate.
  vtkSetObjectMacro(Targets,vtkIdList);
  vtkGetObjectMacro(Targets,vtkIdList);

  // Description:
  // Set/Get the id of the point on which steepest descent has terminated for each seed point.
  vtkGetObjectMacro(HitTargets,vtkIdList);

  vtkSetMacro(StopOnTargets,int)
  vtkGetMacro(StopOnTargets,int)
  vtkBooleanMacro(StopOnTargets,int)

  // Description:
  // Set/Get the name of the point data array from which path point data is generated.
  vtkSetStringMacro(DataArrayName);
  vtkGetStringMacro(DataArrayName);

  // Description:
  // Set/Get the name of output point data array where the point ids of the edges intersected by the paths are going to be stored.
  vtkSetStringMacro(EdgeArrayName);
  vtkGetStringMacro(EdgeArrayName);

  // Description:
  // Set/Get the name of output point data array where the parametric coordinate of the intersection point with input edges are going to be stored.
  vtkSetStringMacro(EdgePCoordArrayName);
  vtkGetStringMacro(EdgePCoordArrayName);

  // Description:
  // Turn on/off merging paths if they intersect the same Voronoi edge. Paths are merged with T junctions in the same order as defined in the seed list.
  vtkSetMacro(MergePaths,int);
  vtkGetMacro(MergePaths,int);
  vtkBooleanMacro(MergePaths,int);

  // Description:
  // Set/Get the (absolute) tolerance with which two points intersecting the same Voronoi diagram edge are considered coincident. If set to a large value, two paths are merged if they intersect the same Voronoi diagram edge (default behaviour).
  vtkSetMacro(MergeTolerance,double);
  vtkGetMacro(MergeTolerance,double);

protected:
  vtkvmtkSteepestDescentLineTracer();
  ~vtkvmtkSteepestDescentLineTracer();

  virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);

  void Backtrace(vtkPolyData* input, vtkIdType seedId);

  vtkIdList* Seeds;
  vtkIdList* Targets;

  vtkIdList* HitTargets;

  int StopOnTargets;

  char* DataArrayName;

  char* EdgeArrayName;
  char* EdgePCoordArrayName;
  char* MinDistanceArrayName;

  int MergePaths;
  double MergeTolerance;

  vtkIntArray* Edges;
  vtkDoubleArray* EdgeParCoords;

  vtkIdList* EdgePointIds;
  vtkIntArray* CellIdsArray;
  vtkDoubleArray* PCoordsArray;
  vtkDoubleArray* MinDistanceArray;

  vtkDataArray* LineDataArray;

  int MergeWithExistingPaths;
  vtkPolyData* ExistingPaths;
  char* ExistingPathsEdgeArrayName;
  char* ExistingPathsEdgePCoordArrayName;
  vtkIntArray* ExistingPathsEdges;
  vtkDoubleArray* ExistingPathsEdgeParCoords;

  private:
  vtkvmtkSteepestDescentLineTracer(const vtkvmtkSteepestDescentLineTracer&);  // Not implemented.
  void operator=(const vtkvmtkSteepestDescentLineTracer&);  // Not implemented.
};

#endif