DVcontour


Synopsis

create an isovolume bounded by two isosurface (3D) or isolines (2D)


group DVcontour {
Mesh+Node_Data+Iparam &in {
xform+nonotify;
nnodes+req;
};
int+Iparam contour_comp;
int+Iparam map_comp[];
float+Iparam level_min;
float+Iparam level_max;
Mesh+Node_Data+Oparam out { /* output field */
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst upd_contour = "contour";
};

Description

DVcontour creates a field that is the volume bounded by two isosurfaces (if the field is 3D) or two isolines (if the field is 2D).

For example, you could set the level_min and level_max isosurfaces to be densities found just outside a bone. When combined, the isovolume produced would be the bone itself.

The isosurfaces or isolines are colored by the first map_comp selected. All of the selected map_comps are in the Node_Data of the output field.

Input

&in

The input is a reference to any mesh with Node_Data. A 2D mesh will produce isolines. A 3D mesh produces isosurfaces. At least one of the components must be scalar.

contour_omp

An integer that sets which component to isosurface/isoline. The selected component must be scalar or the message "iso: first component is not scalar" is written to stderr.

map_comp

Integer array to pick which components will be written to the output field In addition, the first component in the array will be mapped onto the isosurface/isoline (for example, map pressure value onto a density isosurface). The selection does not have to be scalar. Where the isosurface/isoline does not exactly intersect a node, the data value is linearly interpolated based on the surface's distance from the adjacent nodes.

level_min
level_max

Floats. Set the minimum and maximum isosurface/isoline values, between which data will be extracted. The float data type is converted to the data type of the node data before use.

Output

out

The output is a new field object that is an unstructured Mesh of cell type Tri (3D) or Line (2D) that represents the contour volume. Its Node_Data is the values within the volume. The surface values are interpolated along the isosurface/lines. The field's tranformation is a reference to the original input's transformation.

Algorithm

DVcontour uses the Marching Cubes algorithm to construct the isosurfaces/isolines. See W. Lorensen and H. Cline, "Marching Cubes: A High Resolution Surface Reconstruction Algorithm." Computer Graphics 21(4) (SIGGRAPH Proceedings, 1987), July, 1987, pp. 163-169.

This algorithm has a known limitation. There are cases where there are two possible paths that the isosurface could take through a cell, and only one is the correct path. If isosurface picks the wrong path, it will appear as a discontinuity in the surface such as a hole.

Files

v/dv.v
modules/contour.c

Utility DVM macros

DVMcontour_param

Example

Libraries.Main.Mappers.contour

See also