ParaView/Users Guide/Annotation

From KitwarePublic
Jump to navigationJump to search



Scalar Bar


Figure 9.1 Scalar Bar displaying X-component of Normals



Figure 9.2 The color legend tab of the Color Scale Editor dialog




Orientation Axes


Figure 9.3 3D Orientation Axes




Center of Rotation


Text Display


Text Source




Figure 9.5 Display tab for the Text source





3D Text Source



Annotate Time




Other sources as Annotations



Cube Axes

Finally, in the Display section of the Properties tab of any object shown in a 3D view, you can toggle the display of a Cube Axes Display. When this display is enabled, a gridded, labelled bounding box is drawn around the object that lets you quickly determine the world space extent in each dimension of the object. That box is generally Axis aligned but as been extended to support arbitrary axis. In case of arbitrary axis, the source or the filter needs to provide such meta-information to the CubeAxes.

Figure 9.7 Cube Axes of a sheared cube

Pressing the Edit button next to the enable check box brings up a dialog that lets you customize the presentation of the axes display. You have one tab on this dialog for each of the three axes. Use the Title entry to specify a label. Use the Show Axes check box to enable or disable the given axes. Show Ticks and Show Minor Ticks let you customize the division markers along the axis. Show Grid Lines extends the major tick marks so that they completely surround the object. The Original bounds as range allow to rescale your object inside the Display section without changing the ruler legend. The Custom Bounds entry allows you to specify your own extent for that cube axis where as the Custom Range only change the range of the values that are used as label.

At the bottom of the dialog box are controls over all three axes. The Fly Mode drop-down controls the way the axes are drawn on different axes dependent on the camera orientation. Outer Edges draws opposing edges so as to space the annotation as widely as possible. Closest Triad and Furthest Triad draw the nearest and furthest corners respectively. The two static options lock the choice of edges to draw so that they do not change as the camera moves. Tick Location draws the tick marks inward toward the center of the object, outward away from the center, or in both directions simultaneously. Corner Offset puts some space between the actual bounds and the displayed axes, which is useful for minimizing visual clutter. The Grid line location allow to either show the Grid Lines around the whole object or choose if you only want to see them on the front or on the back of the object that you are looking at. The visibility of the grid lines automatically update when you rotate your object. (In figure 9.7, we set that value to: Furthest Faces) Finally, you have control over the color of the axes through the Set Axes Color pop-up color selector.

Figure 9.8 Edit Cube Axes Dialog

Python annotation filter

This filter uses Python to calculate an expression. It depends heavily on the numpy and paraview.vtk modules. To use the parallel functions, mpi4py is also necessary. The expression is evaluated and the resulting string or value is going to be output in a 2D text.

This filter tries to make it easy for the user to write expressions by defining certain variables. The filter tries to assign each array to a variable of the same name. If the name of the array is not a valid Python variable, it has to be accessed through a dictionary called arrays (i.e. arrays['array_name']).

The Python expression evaluated during execution. FieldData arrays are direclty available through their name. Here is the list of available variables that can be used as is:

    • input: represent the input of that filter.
    • inputMB: represent an array of block if 'input' is a Multi-block dataset.
    • t_value or time_value: represent the real time of the data that is provided by the input.
    • t_steps or time_steps: is an array with all the possible value available for the time.
    • t_range or time_range: is an array composed with the minimum and maximum time.
    • t_index or time_index: represent the index of the time_value inside the time_steps array.
    • input.FieldData, input.PointData, input.CellData: are shortcut to access any data array from the input.

Here is a set of expressions that can be used with the can.ex2 dataset once the multi block has been merged:

    • "Momentum: (%f, %f, %f)" % (XMOM[t_index,0], YMOM[t_index,0], ZMOM[t_index,0]) )
    • QA_Records[20,:8]
    • input.PointData['DISPL'][0:3,0] : Display component 0 of the first 3 DISPL points data.
    • input.PointData['DISPL'][0:3] : Display full vector of the first 3 DISPL points data.
    • input.PointData['DISPL'][0] : Display full vector of the first DISPL points data.
    • input.PointData['DISPL'] [ [ 0,10,20,30 ] ] : Display full vector of the DISPL points data [0,10,20,30].

The following example illustrate some time expression:

Figure 9.9 Python Annotation Filter showing time information

The following example illustrate a complex text generation composed of several data field.

Figure 9.10 Python Annotation Filter showing field data

In order to understand what can be done, here is the list of fields that are available in the can.ex2 dataset. In fact to highlight the easy access of the field data, the following expression are exactly the same, but as you can see the second way of writing it is much shorter:

  • input.FieldData['KE'][0,0] <=> KE[0,0]
  • input.FieldData['QA_Records'][0,0:5] <=> QA_Records[0,0:5]
Figure 9.11 Available fields in can.ex2

Global annotation filter

This filter rely on the Python Annotation Filter to extract and show a field value inside the view but in a very simple and intuitive manner. Moreover, if the selected field, like shown in the following figure, has the same number of elements than the time, we assume it's time dependent and automatically update it's value to match the time index. If you are feeling limited by that filter, you can always go back to the Python Annotation Filter to achieve a more complex data annotation.

Figure 9.12 Annotate Global Data Filter with can.ex2