Plotting Over Curves: Difference between revisions

From ParaQ Wiki
Jump to navigationJump to search
No edit summary
(→‎How to use: Add the tests names)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Use Case=
=Presentation=
The <b>Plot Edges</b> filter sort and order polylines for graph visualization. The filter split and merge any set of polylines to generate a more coherent set of <i>point-ordered smoothed polylines</i>. The points and cells of the output polylines are ordered in order to have an easy to read graph visualization of the point attributes.<br>
*Ordering
If an input polyline has a set of points like <i>1,3,5,7,...29,31,30,28...4,2,0</i>, jumps would occurs in the graph. This is why the filter sorts the points along the lines.
<center>
{|
|[[Image:ParaView-PlotEdges-RectPolyLine-PointsNotOrdered.png|thumb|500px|Rectangle shaped polyline with points not ordered]]
|[[Image:ParaView-PlotEdges-RectPolyLine-PointsOrdered.png|thumb|500px|Rectangle shaped polyline with points ordered]]
|}
</center>
*Branching
The previous example was trivial, the input polydata was simple polylines with no branching. In some other cases, input polydata contains loops and branches. The <b>Plot Edges</b> filter tries to overcome the problem by merging the <i>best</i> branches together. It infers that a polyline is smooth and regular: no abrupt change in direction and points spacing is homogeneous. For each nodes in the polydata, a score is computed between the node's polylines. The polylines that make the best pair (highest score) are merged together.
<center>
{|
|[[Image:ParaView-PlotEdges-Intersect.png|thumb|500px|Intersection of polylines. The polylines are inferred to be smoothed and regular.]]
|}
</center>


[[Image:PlotOverCurvesFigure1.png|300px|thumb|Figure 1: Line Loop]]
*Limitations
Here's a possible use-case
The branch merging algorithm may not be optimum for all the cases. Sometimes the choice of merging would require more high-level information.
* Open disk_out_ref.ex2, load all variables
<center>
* Apply "Extract Surface" filter to disk_out_ref
{|
* Apply "Slice" filter to "Extract Surface"
|[[Image:ParaView-PlotEdges-IntersectProblem1.png|thumb|500px|What should be the result? 1 long polyline or 2 polylines with circle shape?]]
We get a nice line loop as shown in Figure 1. Now the user wants to create a plot of the data values along this curve.
|[[Image:Paraview-PlotEdges-IntersectProblem2.png|thumb|500px|What should be the result? 1 long polyline or 2 polylines with circle shape?]]
|}
</center>
Suggestion: different merging algorithms can be designed, the user could choose what algorithm would process the best his data...


=Design=
=How to use=
The <b>Plot Edge</b> filter can only be connected to 2D lines. The typical workflow would be:
*Apply the <b>Extract Surface</b> filter to the  object
*Apply the <b>Slice</b> filter (plane cut) to <b>Extract Surface</b>.
*Apply the <b>Plot Edges</b> filter to <b>Slice</b>.
*In the <b>Plot Edges</b> <b>Display</b> tab, check the <i>Variable</i> check boxes to visualize the point attributes on the graph.
*in the 3D view, to colorize the polylines with the arc length values, turn the <b>Plot Edges</b> visiblity on and set the <i>Color by</i> box to "arc_length".


Write a new filter (let's call it vtkSortLines) that takes in a vtkPolyData as input and produces a vtkMultiBlockDataSet with vtkPolyData blocks as output. Each vtkPolyData in the output multiblock is a single connected poly-line with points (vtkPoints) ordered along the length of the poly-line i.e. you can traverse the poly-line by simply going through points 0 to (N-1) in the vtkPoints data structure without having to refer to the connectivity information for the poly-line.
For convenience, a composite filter <b>Plot Edges by Plane intersect</b> has been created to automatically apply the filters <b>Extract Surface</b>, <b>Slice</b> and <b>Plot Edges</b>.<br>
If you want concrete examples, you can run the tests <b>PlotEdges.xml</b> and <b>PlotEdges2.xml</b> located in <i>Applications/Client/Testing/XML</i>.


The output from this filter can then directly plotting in a XY Plot View.
=Technical details=
 
The <b>Plot Edges</b> filter accepts 2 types of inputs: a [http://www.vtk.org/doc/nightly/html/classvtkPolyData.html vtkPolyData] or a [http://www.vtk.org/doc/nightly/html/classvtkMultiBlockDataSet.html vtkMultiBlockDataSet] containing one or more vtkPolyData.<br>
The vtkCutter with applied to poly-data input produces line segments. The first task for this filter is to merge connected line segments into a single poly-line. Once we have the poly-line then we can create the output vtkPolyData for each poly-line with ordered vtkPoints.
The output generates a [http://www.vtk.org/doc/nightly/html/classvtkMultiBlockDataSet.html vtkMultiBlockDataSet] with a [http://www.vtk.org/doc/nightly/html/classvtkPolyData.html vtkPolyData] leaf for each polyline.<br>
 
The algorithm can be summarized as:
[[Image:PlotOverCurversFigure2.png|300px|thumb|Figure 2: Cases to be wary of]]
* Starting with a line segment, traverse connected line segments till you come to an end. Then start traversing in the reverse direction till you reach the other end to form the poly-line.  
* If you encounter a loop, then, take the starting point as the point with min-X (or something consistent).
* Beware of branches and branches with loops as shown in Figure 2. In such cases we want to pick longest non-overlapping segments possible.

Latest revision as of 12:48, 28 May 2009

Presentation

The Plot Edges filter sort and order polylines for graph visualization. The filter split and merge any set of polylines to generate a more coherent set of point-ordered smoothed polylines. The points and cells of the output polylines are ordered in order to have an easy to read graph visualization of the point attributes.

  • Ordering

If an input polyline has a set of points like 1,3,5,7,...29,31,30,28...4,2,0, jumps would occurs in the graph. This is why the filter sorts the points along the lines.

Rectangle shaped polyline with points not ordered
Rectangle shaped polyline with points ordered
  • Branching

The previous example was trivial, the input polydata was simple polylines with no branching. In some other cases, input polydata contains loops and branches. The Plot Edges filter tries to overcome the problem by merging the best branches together. It infers that a polyline is smooth and regular: no abrupt change in direction and points spacing is homogeneous. For each nodes in the polydata, a score is computed between the node's polylines. The polylines that make the best pair (highest score) are merged together.

Intersection of polylines. The polylines are inferred to be smoothed and regular.
  • Limitations

The branch merging algorithm may not be optimum for all the cases. Sometimes the choice of merging would require more high-level information.

What should be the result? 1 long polyline or 2 polylines with circle shape?
What should be the result? 1 long polyline or 2 polylines with circle shape?

Suggestion: different merging algorithms can be designed, the user could choose what algorithm would process the best his data...

How to use

The Plot Edge filter can only be connected to 2D lines. The typical workflow would be:

  • Apply the Extract Surface filter to the object
  • Apply the Slice filter (plane cut) to Extract Surface.
  • Apply the Plot Edges filter to Slice.
  • In the Plot Edges Display tab, check the Variable check boxes to visualize the point attributes on the graph.
  • in the 3D view, to colorize the polylines with the arc length values, turn the Plot Edges visiblity on and set the Color by box to "arc_length".

For convenience, a composite filter Plot Edges by Plane intersect has been created to automatically apply the filters Extract Surface, Slice and Plot Edges.
If you want concrete examples, you can run the tests PlotEdges.xml and PlotEdges2.xml located in Applications/Client/Testing/XML.

Technical details

The Plot Edges filter accepts 2 types of inputs: a vtkPolyData or a vtkMultiBlockDataSet containing one or more vtkPolyData.
The output generates a vtkMultiBlockDataSet with a vtkPolyData leaf for each polyline.