datamap_function

Synopsis

Uses C++ functions to convert scalar node data into colour node data. Demonstrates now datamap functions can be written.

Input Ports

in Mesh+Node_Data Field data to be colour mapped.

Parameters

datamap_function int Function to use to colour map data.

Output Ports

out_fld Mesh+Node_Data Output field with colour Node_Data.
out_obj DataObject Directly renderable output object.

Description

The datamap_function user macro takes a set of scalar Node data and converts it into colour node data. This colour node data can be included in a DataObject and input into a viewer. Since the AVS/Express renderer uses this colour node data to directly colour the output this effectively provides an alternative to using the standard AVS/Express datamapping system. Directly creating colour node data allows the user total control of how their data is colour mapping at the expense of forcing the user to perform the whole datamapping process themselves.

Although it is possible to use the datamap_function user macro as it is this is not really the intended purpose of the macro. The user macro does provide 7 different datamapping functions. However no user interface is provided to alter how these functions work. Hence they are not really suitable for general use. The datamap_function user macro is really intended as a demonstration of how this technique can be used. It is expected that the user will extend the range of datamapping functions so that they cover their own application area. More details of how this can be done are given in the user_defined_datamap documentation. If you create an interesting new datamapping function that want to submit to the IAC we would be very interested to hear from you.

Limitations

Generating colour node data in this way is a powerful technique however it does suffer from a number of limitations that should be pointed out. The most important is that creating or modifying datamap functions requires some degree of C or C++ experience. The project has been designed so that editing the source code is easy to do. However changing the datamap functions requires the user to edit the datmp_fn.cxx file.

Another limitation is that this technique will normally increase the size of the input data. Colour data is represented by 3 floats for red, green and blue values. If we consider the worse case of the input data being bytes. This would result in the output data being 12 times as large as the input data. Whether this is important depends on the type and size of your data, and whether optimizations in the renderer mean that the colour node data is used directly.

The final limitation is that the datamap_function macro does not use the standard AVS/Express datamapping system in any way. This is an intrinsic result of how the project was designed. However it does mean that none of the AVS/Express components that operate on the Datamap object can be used. These include the standard datamap editor and the Legend modules. Instead of using the standard datamap editor it is expected that uses will create user interfaces that are suitable to their own applications. A future update to this project will include a set of specialized Legend modules that work with the datamap_function macro.

Input Ports

in

The input Field data for the datamap_function user macro. This data should contain a least a single set of scalar Node Data. Vector Node Data can be present but will be ignored. The lower-level module DatamapFunctionCore is used, inside the Functional Macro DatamapFunctionFunc, to colour the Node_Data of the input field. This colour Node_Data is then recombined with the original Mesh (if present).

Parameters

datamap_function

A member of the DatamapFunctionParams parameter group, this integer value specifies which datamap function should be used to colour the data. The following values for this parameter are available. The definitions for all of these functions are contained in the datmp_fn.cxx file.

  1. User Defined Datamap
  2. Default AVS/Express Datamap
  3. Greyscale Datamap
  4. Hot Iron Datamap (Ranging from Red through Orange to White)
  5. Cool Blue Datamap (Ranging from Blue through Cyan to White)
  6. Alternating Black and White bands every 10% of the data range
  7. Alternating Coloured bands every 10% of the data range

Output Ports

out_fld

The output field for the datamap_function macro. This contains the coloured Node_Data combined with the original Mesh (if present). The coloured Node_Data is a vector of 3 float numbers which represents red, green and blue intensities. The Node_Data has an id number of 667 which indicates that the rendered should treat this node data as colour data. Normally the out_obj output will be used instead of this output.

out_obj

The directly renderable output object of the datamap_function macro. This contains the Field that contains the coloured Node_Data. This output can be directly connected to a viewer.

Utility Macros

The User Macro datamap_function combines the Functional Macro DatamapFunctionFunc with the UI Macro DatamapFunctionUI, via the use of the common parameter block DatamapFunctionParams, to provide a usable macro in the visualization library. The Functional Macro uses the low-level module DatamapFunctionCore.

Example

Two example applications are provided with the DatamapFunction project. The DatamapFunctionEg application reads the hydrogen data-set and calculates an isosurface and orthoslice from this data. These are then coloured by two datamap_function user macros. You should be able to select between the various different datamapping functions. You should also be able to notice some stepping between different colours. This is particularly apparent with the banded datamap functions and is caused by the way that the renderer interpolates between widely different colours. It is particularly apparent in this example because of the low resolution of the data-set. This effect also occurs with the standard AVS/Express datamapping system.

The InterpolateDataEg example application shows one way of working around this problem. In this application the intep_data module is used to interpolate between node data values and hence great a much higher resolution grid. This is then colour mapped by the datamap_function macro. This produces good results but does greatly increase the number of triangles that have to be displayed. A better solution would be to use the Scalar2Texture IAC project to apply a texture map to the scalar data. This technique does not suffer from these interpolation problems.

Files

iac_proj/datmp_fn/dmfnmods.v contains the V definitions of the low-level module DatamapFunctionCore and the parameter block DatamapFunctionParams.

iac_proj/datmp_fn/dmfnmacs.v contains the V definitions of the Functional Macro DatamapFunctionFunc, the UI Macro DatamapFunctionUI and the User Macros datamap_function and user_defined_datamap.

iac_proj/datmp_fn/dmfnapps.v contains the V definitions of the Example Applications DatamapFunctionEg and InterpolateDataEg.

Other Notes

The low-level DatamapFunctionMods library containing the low-level DatamapFunctionCore module does not specify a process. By default the express process will be used.

Author

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