Example a/isolines: Generating isolines and points on those lines.

Screenshot of example a/isolines

The comfile run by this example is as follows:

# Example a/isolines:  Load an image and generate datapoints at threshold value.

# Read in some geometry to hold our texture and define coordinates.
gfx read node $example/transverse_155.exnode;
gfx read element $example/transverse_155.exelem;

# Read in our texture
gfx create texture image image $example/transverse_155.tif width 1 height 1;
gfx create material transverse_155 texture image;

# Define a gray spectrum useful for rendering out image field.
gfx create spectrum gray_spectrum clear overwrite_colour
gfx modify spectrum gray_spectrum linear range 0 1 extend_above extend_below monochrome colour_range 0 1 ambient diffuse component 1;

# Would really benefit from some image processing here!

# Use a fine discretization with for generating the isolines.
gfx modify g_element transverse_155 general element_discretization "512*512*512"

# Define the density field used to control the number of points generated below.
# Here we want a constant number of points per segment length.
gfx define field point_density constant 5;

# Create the isolines
gfx modify g_element transverse_155 iso_surfaces as isolines select_on iso_scalar image iso_value 0.09 use_elements select_on material white selected_material default_selected render_shaded data point_density;

gfx modify g_element transverse_155 surfaces as texture_surface select_on material transverse_155 texture_coordinates xi selected_material default_selected render_shaded;

if (!$TESTING)
	 gfx create window 1;
	 gfx mod win 1 set perturb_lines;
	 gfx modify window 1 layout 2d ortho_axes z -y;

# Generate points on the isolines calculated above.
gfx create ngroup data;
gfx convert graphics scene default.isolines render_surface_node_cloud region data coordinate coordinates;
# Alternative using regions:
#gfx create region data;
#gfx define field data/coordinates coordinate_system rectangular_cartesian finite_element number_of_components 3 coordinate real component_names x y z;
#gfx convert graphics scene default.isolines render_surface_node_cloud region data coordinate coordinates;

# Write out these points
gfx write nodes group data data_cloud.exnode;

if (!$TESTING)
	 gfx modify g_element data node_points glyph cross general size "2*2*2" centre 0,0,0 font default select_on material default selected_material default_selected;

Files used by this example are:

Name                   Modified     Size

isolines.com 17-Mar-2014 2.3k COPYRIGHT 17-Mar-2014 504 transverse_155.exelem 17-Mar-2014 2.2k transverse_155.exnode 17-Mar-2014 742 transverse_155.tif 17-Mar-2014 110k

Download the entire example:

Name                        Modified     Size

examples_a_isolines.tar.gz 09-Mar-2016 163k

Testing status by version:

StatusTestedReal time (s)
cmgui-wxFailureSun Mar 6 00:11:55 20162
last breakMon Aug 25 13:02:00 20146
cmgui-wx-debugFailureSun Mar 6 00:16:26 20164
last breakMon Aug 25 13:03:00 20149
cmgui-wx-debug-memorycheckFailureSun Mar 6 00:16:58 20165
last breakMon Aug 25 13:07:00 201414
cmgui-wx-debug-valgrindFailureSun Mar 6 01:38:41 2016153
last breakTue Feb 24 00:45:00 2015163
cmgui-wxFailureSun Mar 6 00:01:47 20161
last breakFri Aug 15 00:30:00 20142
cmgui-wx-debugFailureSun Mar 6 00:01:48 20162
last breakFri Aug 15 00:30:00 20142
cmgui-wx-debug-memorycheckFailureSun Mar 6 00:01:54 20163
last breakFri Aug 15 00:30:00 20143
cmgui-wx-debug-valgrindFailureSun Mar 6 00:10:02 2016137
last breakSun Mar 6 00:07:00 2016137
cmgui-wx-gcc-cad-debug-valgrindSuccessThu Jan 7 00:11:08 2016134

Testing status by file:

Html last generated: Wed Mar 9 16:02:15 2016

Input last modified: Wed Mar 9 15:49:42 2016

CMISS Help / Examples / a / isolines