Evaluate a volume image at embedded gauss point locations and write the values.
#Example image_sampling.com: Evaluate a volume image at embedded gauss point locations and write the values.
$FileFormat="jpg"
$PATH="$example"
$CTPath="$PATH/ScannedCTSlices/$FileFormat"
$OutputPath="."
#================= Read texture mesh ==================
#
# Read in block geometry used to contain the volume texture read below
gfx read nodes $PATH/texture_block.exnode;
gfx read elements $PATH/texture_block.exelem;
gfx read nodes $PATH/iso_block.exnode;
gfx read elements $PATH/iso_block.exelem;
gfx define field x component coordinates.x;
gfx define field y component coordinates.y;
gfx define field z component coordinates.z;
#================= Read texture ==================
#
# Read in a scanned volume and create some fields that reference the volume data.
#
gfx create texture mandible width 170 height 170 depth 58 image $CTPath/Mandible0000.$FileFormat number_pattern "0000" number_series 0002 0118 1 compress;
# Align the texture to the first repetition (from 0-width, 0-height, 0-depth) and compensate
# for the fact that the depth is no longer expanded out to a power of two.
gfx define field offset_coordinates offset field coordinates offsets 0 -170 126.90598;
gfx define field tex sample_texture coordinates offset_coordinates texture mandible;
# Define a grayscale spectrum useful for displaying the texture values.
gfx create spectrum grayscale clear overwrite_colour;
gfx modify spectrum grayscale linear range 0 1 extend_above extend_below red colour_range 0 1 ambi diff component 1;
gfx modify spectrum grayscale linear range 0 1 extend_above extend_below green colour_range 0 1 ambi diff component 1;
gfx modify spectrum grayscale linear range 0 1 extend_above extend_below blue colour_range 0 1 ambi diff component 1;
#================= Read in geometry ==================
#
# Read in the element geometry represent the jaw and in which the embedded points
# at which we want to evaluate the texture field will be located.
gfx read nodes $PATH/FinalMandibleGeometry2.exnode;
gfx read elements $PATH/FinalMandibleGeometry.exelem;
#================= Define graphics =====================
# Create materials
gfx create material bone ambient 0.7 0.7 0.3 diffuse 0.9 0.9 0.8 emission 0 0 0 specular 0.05 0.05 0.05 alpha 1 shininess 0.1;
gfx create material green ambient 0 1 0 diffuse 0 1 0
gfx create material mandible ambient 1 1 1 diffuse 1 1 1 emission 0 0 0 specular 0 0 0 alpha 0.65 shininess 0 texture mandible;
# Clear out the default graphics in the texture_block
gfx modify g_element texture_block general clear circle_discretization 6 default_coordinate coordinates element_discretization "1*1*1" native_discretization none;
# Clear out the default graphics in the iso_block and set the resolution we want for the iso_surface display
gfx modify g_element iso_block general clear circle_discretization 6 default_coordinate coordinates element_discretization "16*16*16" native_discretization none;
# Draw an iso_surface of this field
gfx modify g_element iso_block iso_surfaces iso_scalar tex iso_value 0.35 use_elements select_on material bone texture_coordinates coordinates selected_material default_selected render_shaded;
#================= Open graphics window =====================
#
# The graphics window is not required to calculate the texture values and the example will
# run much faster as the volume will not need to be loaded and compressed in the graphics card
# and the iso_surface will not be displayed and therefore not calculated.
#
if (! $TESTING)
{
gfx create window 1 double_buffer;
gfx modify window 1 image scene default light_model default;
gfx modify window 1 image add_light default;
gfx modify window 1 layout simple ortho_axes z -y eye_spacing 0.25 width 664 height 664;
gfx modify window 1 set current_pane 1;
gfx modify window 1 background colour 0.5 0.5 0.5 texture none;
gfx modify window 1 view perspective eye_point 147.392 688.357 150.456 interest_point 77.385 253.245 -107.58 up_vector -0.00310034 -0.509712 0.860339 view_angle 31.6892 near_clipping_plane 5.10692 far_clipping_plane 1825.04 relative_viewport ndc_placement -1 1 2 2 viewport_coordinates 0 0 1 1;
gfx modify window 1 overlay scene none;
gfx modify window 1 set transform_tool current_pane 1 std_view_angle 40 normal_lines no_antialias slow_transparency blend_normal;
}
#================= Read embedded gauss point locations =====================
#
# The locations at which we want to sample the image field are gauss points, embedded within the
# mandible mesh, specified as locations at Element:Xi locations within that mesh. Be reading in they
# are automatically displayed at the coordinates found by evaluating these Element:Xi location in the
# host mesh.
#
gfx read data $PATH/GaussPointsFittedMandible.exdata;
gfx modify g_element GaussPointsMandible general clear circle_discretization 6 default_coordinate cmiss_number element_discretization "4*4*4" native_discretization none;
gfx modify g_element GaussPointsMandible lines select_on material default selected_material default_selected;
gfx modify g_element GaussPointsMandible data_points coordinate element_xi_coordinate glyph sphere general size "1*1*1" centre 0,0,0 select_on material default selected_material default_selected;
#================= Display tex_mag on datapoints =====================
#
# To define the texture field on these embedded fields we need to define a field that connects the Element:Xi field with
# the texture sampling field. The "tex_mag" field is the one we want to sample and the "element_xi" field is the embedded
# position we want to use. (The "element_xi_coordinate" coordinate field is automatically generated for these datapoints
# but any other embedding fields need to be created manually).
gfx define field element_xi_tex embedded field tex element_xi element_xi;
# This embedded field can now be displayed on the data points
gfx modify g_element GaussPointsMandible data_points coordinate element_xi_coordinate glyph sphere general size "1*1*1" centre 0,0,0 select_on material default selected_material default_selected data element_xi_tex spectrum grayscale;
#================= Evaluate tex_mag at datapoints =====================
#
# To write out the values at the datapoints we need to explicitly evaluate the
# tex_mag field into storage locations in the data points.
# Define a field that can store the grayscale value we want
gfx define field tex_values finite_element number_of_components 1 component_names value;
# Define this field on each of the data points, the initial value will be zero.
gfx modify data group GaussPointsMandible define tex_values;
# Evaluate the element_xi_tex_mag field at each data point into this storage.
gfx evaluate dgroup GaussPointsMandible source element_xi_tex destination tex_values;
# Write out these values.
gfx write data group GaussPointsMandible field tex_values "$OutputPath/tex_mag_values.exdata";
# Additionally more fields could be evaluated and written out, such as the coordinate field or
# maybe the tex with some image processing applied as shown in many of the examples in this directory.
Name Modified Size
image_sampling.com 25-Jul-2006 7.0k FinalMandibleGeometry.exelem 22-Sep-2005 576k FinalMandibleGeometry2.exnode 22-Sep-2005 320k GaussPointsFittedMandible.exdata 22-Sep-2005 1.1M ScannedCTSlices/ 22-Sep-2005 - image_sampling.txt 22-Sep-2005 7.3k iso_block.exelem 22-Sep-2005 1.6M iso_block.exnode 22-Sep-2005 264k texture_block.exelem 22-Sep-2005 3.6k texture_block.exnode 22-Sep-2005 1.0k
| Status | Tested | Real time (s) | |
| i686-linux | |||
| cmgui | Success | Fri Aug 18 01:29:49 2006 | 12 |
| cmgui-debug | Success | Fri Aug 18 01:30:01 2006 | 11 |
| cmgui-debug-memorycheck | Success | Fri Aug 18 01:33:35 2006 | 17 |
| cmgui-debug-valgrind | Success | Fri Aug 18 05:49:51 2006 | 570 |
| mips-irix | |||
| cmgui | Success | Fri Aug 18 01:30:55 2006 | 43 |
| cmgui-debug | Success | Fri Aug 18 01:32:38 2006 | 50 |
| cmgui-debug-memorycheck | Success | Fri Aug 18 01:48:59 2006 | 110 |
| cmgui64 | Success | Fri Aug 18 01:30:10 2006 | 45 |
| rs6000-aix | |||
| cmgui | Success | Fri Aug 18 02:20:54 2006 | 4 |
| cmgui-debug | Success | Fri Aug 18 02:21:25 2006 | 5 |
| x86_64-linux | |||
| cmgui | Success | Fri Aug 18 01:11:42 2006 | 5 |
| cmgui-debug | Success | Fri Aug 18 01:11:58 2006 | 5 |
| cmgui-debug-memorycheck | Success | Fri Aug 18 01:13:53 2006 | 7 |
| i686-linux | |||
| Success | cmgui: | diff test: no differences with generic answer. | |
| Success | cmgui-debug: | diff test: no differences with generic answer. | |
| Success | cmgui-debug-memorycheck: | diff test: no differences with generic answer. | |
| Success | cmgui-debug-valgrind: | diff test: no differences with generic answer. | |
| mips-irix | |||
| Success | cmgui: | diff test: no differences with generic answer. | |
| Success | cmgui-debug: | diff test: no differences with generic answer. | |
| Success | cmgui-debug-memorycheck: | diff test: no differences with generic answer. | |
| Success | cmgui64: | diff test: no differences with generic answer. | |
| rs6000-aix | |||
| Success | cmgui: | diff test: no differences with generic answer. | |
| Success | cmgui-debug: | diff test: no differences with generic answer. | |
| x86_64-linux | |||
| Success | cmgui: | diff test: no differences with generic answer. | |
| Success | cmgui-debug: | diff test: no differences with generic answer. | |
| Success | cmgui-debug-memorycheck: | diff test: no differences with generic answer. |
| i686-linux | |||
| Success | cmgui: | ndiff test: no significant differences with generic answer. | |
| Success | cmgui-debug: | ndiff test: no significant differences with generic answer. | |
| Success | cmgui-debug-memorycheck: | ndiff test: no significant differences with generic answer. | |
| Success | cmgui-debug-valgrind: | ndiff test: no significant differences with generic answer. | |
| mips-irix | |||
| Success | cmgui: | ndiff test: no significant differences with generic answer. | |
| Success | cmgui-debug: | ndiff test: no significant differences with generic answer. | |
| Success | cmgui-debug-memorycheck: | ndiff test: no significant differences with generic answer. | |
| Success | cmgui64: | ndiff test: no significant differences with generic answer. | |
| rs6000-aix | |||
| Success | cmgui: | ndiff test: no significant differences with generic answer. | |
| Success | cmgui-debug: | ndiff test: no significant differences with generic answer. | |
| x86_64-linux | |||
| Success | cmgui: | ndiff test: no significant differences with generic answer. | |
| Success | cmgui-debug: | ndiff test: no significant differences with generic answer. | |
| Success | cmgui-debug-memorycheck: | ndiff test: no significant differences with generic answer. |
Html last generated: Fri Aug 18 06:56:52 2006
Input last modified: Tue Jul 25 14:53:24 2006