isolabel2

Synopsis

A mapper macro that adds text labels to isolines. It processes the output from the isoline module and generates a DataObject that can be directly displayed.

Input Ports

Name Type Description

in_fld Field input data from isoline module

Parameters

Name Type Description UI Control

Active int Whether module updates. -
ContourFrequency int Number of contours to skip. UIslider
NodeFrequency int Number of nodes to skip. UIslider
Format string formating specification -
Decimals int number of decimal points. UIslider

Output Ports

Name Type Description

out_fld Field locations and values of labels
out_text string[] text of labels
out_obj DataObject directly renderable output object

Description

The isolabel2 macro generates and displays text annotation labels for isoline visualizations. It connects to the field output of the isoline module and generates Field data and an array of string values. The macro also generates a DataObject which can be viewed directly. In most cases it will only be necessary to use the generated DataObject. However if you wish to use the raw outputs the Field data contains the position and numerical values of the labels while the string array contains the actual label text at each point. The number of labels output and number of decimal points displayed can both be controlled through a user interface. Internally a text_glyph module is used to actually create the viewable DataObject. The text_glyph user interface is presented in the user interface so that the text display can be controlled.

The module is an alternative version of the Isolabel IAC project. Both of these projects have advantages and disadvantages and the Isolabel2 project should not be considered to be a replacement for the Isolabel project. The main improvement made by the Isolabel2 project is that the label placement algorithm is significantly more advanced. The isoline project outputs the contours it generates as a mesh with a Line cell-set. The isolabel2 macro reconstructs the generated contours from this Line mesh and generates at least one isolabel on each contour. This ensures that each contour is labelled and that the isolabel positions are relatively consistent and sensible. As the positions are consistent these isolabels are suitable for animation. Due to this reconstruction of contour lines the macro will only work with Line type data, such as that output by the isoline module.

The major disadvantage of this approach is that the isoline module does not always output each contour as a continuous series of lines. If the input data is noisy then the isoline module is likely to output each contour as a series of smaller line segments. The isolabel2 macro interprets each of these line segments as a separate contour. As one label is generated per line segment this can lead to large numbers of labels being generated. One solution to this problem is to use the ContourFrequency parameter. This parameter allows the module to skip a certain proportion of line segments, hence reducing the number of labels generated.

Alternatively the Isolabel project can be used. The original Isolabel project does not reconstruct contour lines and therefore does not suffer from this problem. It also is able to work with input data that has cell-sets other than Line.

Inputs

in_fld

Reference to a set of Field data which should be used by the module to generate the text labels. The Field should consist of a Line Mesh and Node Data. Only the first set of Node data is used and that Node data must be scalar.

Parameters

Active

Integer parameter that specifies whether the module should update. If the parameter is set to zero no updates take place. Conversely if the parameter is not set to zero updates take place as normal.

NodeFrequency

Integer parameter that specifies how frequently labels should be generated. The parameter specifies the stride that should be taken between each node that is labelled. Therefore a NodeFrequency of 1 implies that a label should be generated for every node.

ContourFrequency

Integer parameter that specifies how frequently labels should be generated for a contour. The parameter specifies the stride that should be taken between each contour that is processed. Therefore a ContourFrequency of 1 implies that labels should be generated for every contour.

Format

String parameter that is used to specify the C style formatting specification. This sets how the Node data values should be converted into text. Normally it should not be necessary to alter this parameter and hence there is no user interface.

Decimals

Integer parameter that is used to specify the number of decimal points that each text labels should have. Internally this parameter is used to generate the Format parameter that is actually used in the conversion of numerical values to text strings.

Outputs

out_fld

Field data containing the locations and numerical values of each text label. The field data contains a Point mesh that contains the locations of each label and a single set of node data that contains the node data values at each label position. If the input mesh contains any transformation data this is copied across to the output mesh.

out_text[]

String array containing the actual label text that should be displayed.

out_obj

The directly renderable output of the isolabel macro. This contains a DataObject object that can be rendered by the standard data viewers. The output object contains the generated text labels placed at the appropriate positions. The output object is generated internally by a text_glyph module. If more control of the display is required the other outputs can be used. Alternatively the Functional macro could be used directly.

Utility Macros

The User Macro isolabel2 combines the Functional Macro Isolabel2Func with the UI Macro IsolabelUI and the standard module text_glyph. The User macro also makes use of the common parameter block Isolabel2Params to tie the Functional Macro and UI macro together.

Example

Three example applications are provided, Isolabel2Eg1, Isolabel2Eg2 and Isolabel2Eg3. These applications generate text labels for 2D and 3D isoline plots. They show how the numbers of generated labels can be controlled for data-sets of various sizes and types.

Files

iac_proj/isolbl2/isl2macs.v contains the V definitions of the Functional Macro Isolabel2Func, the User macro isolabel2, the UI macro Isolabel2UI and the example applications Isolabel2Eg1, Isolabel2Eg2 and Isolabel2Eg3.

Other Notes

Please refer to AVS documentation for more information on the isoline and text_glyph modules. This macro does not use the AG kit, and should not be confused with AGContour which also contains isoline labels.

The Isolabel2Macs library inherits its process. As this library contains no procedural code, the process is not important. The modules in the low-level Isolabel2Mods library execute under the process specified in that library, not the process defined in the high-level library.

Authors

Dr Federico Gamba
Advanced Visual Systems, Inc.

Andrew Dodd
International AVS Centre

Contact

International AVS Centre
Manchester Visualization Centre
Manchester Computing
University of Manchester
Oxford Road
Manchester
United Kingdom
M13 9PL

See Also