Example a_backup/fit_vessels:
fit_vessels: Fitting curves to vessel data points
This example shows how to use cmgui to generate a sequence of fitted curves to
grouped sets of data points.

The comfile run by this example is as follows:
# fit_snakes.com
# This command file is used to create high-order fits of vessels
# 'segments.txt' must be exported previously detailing the range
# of data points for each fitted segment.
use strict;
{
# read the piecewise points for fitting and lines for comparison later
gfx read data $example/vessel_data.exnode;
# new node group to put the new elements into
gfx cre ngroup smoothed
#now read in all the segments
$filename="$example/segments.txt";
CORE::open(IN,$filename) || die("could not open file $filename!");
@segs=<IN>;
close(IN);
#Define a weight field, normal_weight for normal nodes and
#normal_weight+end_weight for the two end points of each segment
gfx define field normal_weight constant 1;
gfx define field end_weight constant 100;
gfx define field end_point_number_1 constant 1;
gfx define field end_point_number_2 constant 1;
gfx define field filter_end_1 equal_to fields cmiss_number end_point_number_1;
gfx define field filter_end_2 equal_to fields cmiss_number end_point_number_2;
gfx define field end_points or fields filter_end_1 filter_end_2;
gfx define field end_weights multiply fields end_points end_weight;
gfx define field weight add fields normal_weight end_weights;
# just go ahead and fit the whole thing with radius (pixelcount) and intensity included
foreach $nodes (@segs) {
printf " selecting and fitting segment $nodes...\n";
gfx unsel da all; # unselection bug fixed 29 Mar 2006 :)
cmiss("gfx sel da $nodes");
@bounds=split(/\./,$nodes);
$num_els=int(($bounds[2]-$bounds[0])/4); # average 4 data points per element
#Set the first and last points into the correct fields
gfx define field end_point_number_1 constant $bounds[0];
gfx define field end_point_number_2 constant $bounds[2];
if ($num_els<1) { $num_els=1; }
#Don't need much smoothing
gfx create snake coord coordinates dest smoothed number_of_elements $num_els density 0 stiffness 0.00001 number_of_fitting_fields 3 fitting_fields coordinates pixelcount intensity weight_field weight;
}
if ($TESTING)
{
gfx write nodes group smoothed smoothed.exnode;
gfx write elements group smoothed smoothed.exelem;
}
else
{
# Rendering detail
# create b/w spectrum for visualisation
gfx modify spectrum default clear overwrite_colour;
gfx modify spectrum default log exaggeration 1 left range 0 253 extend_above extend_below red colour_range 0 1 ambient diffuse component 1;
gfx modify spectrum default log exaggeration 1 left range 0 253 extend_above extend_below green colour_range 0 1 ambient diffuse component 1;
gfx modify spectrum default log exaggeration 1 left range 0 253 extend_above extend_below blue colour_range 0 1 ambient diffuse component 1;
# show cylinders of fitted vessels
gfx modify g_element smoothed general clear circle_discretization 12 default_coordinate coordinates element_discretization "15*4*4" native_discretization none;
gfx modify g_element smoothed cylinders radius_scalar pixelcount select_on material default data intensity spectrum default selected_material default_selected;
#gfx modify g_element smoothed lines select_on material default data intensity spectrum default selected_material default_selected;
# hide data points
gfx modify g_element vessel_data general clear circle_discretization 6 default_coordinate coordinates element_discretization "4*4*4" native_discretization none;
#gfx modify g_element vessel_data data_points glyph diamond general size "1*1*1" centre 0,0,0 font default select_on material blue selected_material default_selected;
# Use a shiny per pixel lighting material
gfx create material default per_pixel ambient 0.21 0.21 0.26 diffuse 0.59 0.61 0.64 emission 0 0 0 specular 0.89 0.89 0.89 alpha 1 shininess 0.96;
gfx create window 1;
}
}
Files used by this example are:
Name Modified Size
fit_vessels.com 20-Apr-2012 3.7k
COPYRIGHT 19-Apr-2012 504
segments.txt 20-Apr-2012 2.6k
vessel_data.exnode 20-Apr-2012 474k
Download the entire example:
Name Modified Size
examples_a_backup_fit_vessels.tar.gz 12-Aug-2014 717k
Testing status by version:
Testing status by file:
- cmiss_test.log
- smoothed.exelem
i686-linux | | | |
Success | cmgui-wx: | ndiff test: no significant differences with
generic answer.
|
Success | cmgui-wx-debug: | ndiff test: no significant differences with
generic answer.
|
Success | cmgui-wx-debug-memorycheck: | ndiff test: no significant differences with
generic answer.
|
Success | cmgui-wx-debug-valgrind: | ndiff test: no significant differences with
generic answer.
|
x86_64-linux | | | |
Success | cmgui-wx: | ndiff test: no significant differences with
generic answer.
|
Success | cmgui-wx-debug: | ndiff test: no significant differences with
generic answer.
|
Success | cmgui-wx-debug-memorycheck: | ndiff test: no significant differences with
generic answer.
|
Success | cmgui-wx-debug-valgrind: | ndiff test: no significant differences with
generic answer.
|
- smoothed.exnode
i686-linux | | | |
Success | cmgui-wx: | ndiff test: no significant differences with
generic answer.
|
Success | cmgui-wx-debug: | ndiff test: no significant differences with
generic answer.
|
Success | cmgui-wx-debug-memorycheck: | ndiff test: no significant differences with
generic answer.
|
Success | cmgui-wx-debug-valgrind: | ndiff test: no significant differences with
generic answer.
|
x86_64-linux | | | |
Success | cmgui-wx: | ndiff test: no significant differences with
generic answer.
|
Success | cmgui-wx-debug: | ndiff test: no significant differences with
generic answer.
|
Success | cmgui-wx-debug-memorycheck: | ndiff test: no significant differences with
generic answer.
|
Success | cmgui-wx-debug-valgrind: | ndiff test: no significant differences with
generic answer.
|
Html last generated: Sun Mar 6 05:50:57 2016
Input last modified: Fri Apr 20 15:59:11 2012
CMISS Help /
Examples /
a_backup /
fit_vessels