PGraph Implementation

From ParaQ Wiki
Jump to navigationJump to search

Overview

This document is an overview of the state of the PGraph implementation as of May 11, 2006. See Plotting Parallel Data (PGraph) for the overall design.

Extraction

Two extraction filters have been implemented: vtkExtractHistogram and vtkExtractScatterPlot. Both filters are derived from vtkPolyDataAlgorithm, so that they accept any vtkDataSet as input and produce vtkPolyData as output. Note that this is a departure from the original design, which suggested producing a vtkRectilinearGrid as output. The rationale for generating vtkPolyData instead is that (per Berk) the current VTK pipeline is poorly equipped for handling extents when data is being converted from unstructured data to structured data (which is highly unusual).

vtkExtractHistogram has two attributes: BinCount controls the number of bins in the output histogram data, and Component determines which array component will be extracted, when extracting data from input arrays with dimension greater than one. For a BinCount of N, the output vtkPolyData will contain two arrays. First, a vtkDoubleArray named "bin_extents" that will contain N+1 single-component tuples, which establish the boundary values between bins. Note that with this arrangement, bins need not have uniform extents. Second, a vtkUnsignedLongArray named "bin_values" that will contain N single-component tuples, which contain the count for each bin.

vtkExtractScatterPlot is basically a histogram in two dimensions - there are XBinCount, YBinCount, XComponent, and YComponent attributes that control the number of bins and array components to extract for two input data arrays. The output vtkPolyData will contain three arrays - vtkDoubleArrays named "x_bin_extents" and "y_bin_extents" that contain X + 1 and Y + 1 single-component tuples, respectively; and a vtkUnsignedLongArray named "bin_values" that will contain X number of Y-component tuples.

vtkExtractHistogram and vtkExtractScatterPlot are located in the VTK/Graphics directory, and have regression tests in VTK/Graphics/Testing/Cxx.

Client/Server

Not implemented.

Testing

A sample ParaQ client in Applications/PGraph/Histogram can be used to test the vtkExtractHistogram filter, albeit in client-side mode only. The application displays a histogram chart in a dockable window at startup. After creating a pipeline, you can create an instance of the ExtractHistogram filter. Whenever the ExtractHistogram filter is selected, the extracted histogram will be displayed in the chart (this is not meant to be the final user interface, it's just for testing). The interface between the ExtractHistogram output and an instance of pqHistogramWidget is provided by an adapter class (cleverly named ChartAdapter) which responds to events and converts the vtkExtractHistogram output, pushing it into pqHistogramWidget for actual display to the user.