Example d31: Gait analysis using the host-mesh with volume conservation.

This examples illustrates a gait analysis using the host-mesh with volume conservation.

Initial standing position Final heel-down position
Fig. 1 Initial standing position Fig. 2 Final heel-down position


The comfile run by this example is as follows:


################ Host-mesh fitting with volume conservation ################

# This example deforms a host-mesh to conserve muscle attachment points, and 
# in addition ensures that the jacobian at each Gauss point of the host-mesh 
# is not changed (i.e. volume conservation). For the case of a tri-linear mesh  
# illustrated here this was found to pass on the volume conservation to the slave.
# This example also illustrates the host-mesh approach to gait analysis.

################ parameters, regions, bases and coordinate system################

fem def para;r;volume_eg;example	#parameter file
fem def region;r;volume_eg;example	#define regions
fem def coord 3,1;                	#3D rectangular cartesian
fem def base;r;volume_eg;example	#bases functions
$REG=1		#initialise region counter 
$TOT_FITS=6     #initialiase no. of fits variable

################ muscle host MESHES ################

# host_list 
@host_list = ('semimembranosus_host');
foreach $component(@host_list)
{ 
# Read in host
fem def node;r;$component;example region $REG 
fem def element;r;$component;example region $REG

# Define fields
fem def field;r;$component;example reg 1;
fem def elem;r;$component;example field reg 1;
 
# Export host
#fem exp nodes;$component as $component region $REG
#fem exp elem;$component as $component region $REG

$REG=$REG+1;
}

################ bone MESHES ################ 

# bone_list 
@bone_list = ('femur','tibia','hip');
foreach $component(@bone_list)
{ 
# Read in bone
fem def node;r;$component;example region $REG 
fem def element;r;$component;example region $REG

# Export initial bone
#fem exp nodes;initial_$component as $component region $REG
#fem exp elem;initial_$component as $component region $REG 

$REG=$REG+1;
}

################ SLAVE_muscles MESH ################ 

# muscle_list
@muscle_list = ('semimembranosus');
foreach $component(@muscle_list)
{ 
# Read in muscle
fem def node;r;$component;example region $REG 
fem def element;r;$component;example region $REG

# Define fields
fem def field;r;$component;example reg $REG;
fem def elem;r;$component;example field reg $REG;

# Export initial muscle
#fem exp nodes;initial_$component as $component region $REG
#fem exp elem;initial_$component as $component region $REG

################ Define material coordinates of slave and control points ################ 

# Only performed once and then future runs can read in ipxi files.

## Define material positions of nodes in host
#fem def xi;c nodes contain of $REG in 1 loose
#fem def xi;w;nodes_$component nodes contain of $REG in 1

## Create landmark points attached at muscle ends.
## These are only generated once and stored as 
## material coordinates for entire simulation 
#fem def xi;c contact_tied XI_END points 4 reg $REG
## convert to spatial data point 
#fem def data;c from_xi reg $REG
#fem def data;w;landmark
## check to see if correct
#fem exp data;landmark as landmark 
## convert into material coordinates inside host (reg 1)
#fem def xi;c closest reg 1
## write out material coordinates 
#fem def xi;w;landmark_$component reg 1

## Create target material points and store
## as material coordinates on hip and tibia bones
#fem def data;r;landmark
#fem def xi;c closest_face external reg 3,4
#fem def xi;w;target_$component 
## check to see if correct
#fem def data;c from_xi 
#fem exp data;target as target 

$REG=$REG+1;
}

#################Rigid body rotations from motion capture######################

# Adjustments to static position (orthotrak motion capture system)
fem change nodes scale by 1.2,1.2,1.2 reg 4
fem change nodes rotate by -8 axis 1,0,0 reg 2
fem change nodes rotate by -6 axis 0,1,0 reg 2
fem change nodes rotate by -180 axis 0,0,1 reg 2
fem change nodes translate by 689,-154,-76 reg 2
fem change nodes rotate by -6 axis 1,0,0 reg 3
fem change nodes rotate by 6 axis 0,1,0 reg 3
fem change nodes rotate by 180 axis 0,0,1 reg 3
fem change nodes translate by 790,-170,10 reg 3
fem change nodes rotate by 8 axis 1,0,0 reg 4
fem change nodes rotate by 8 axis 0,1,0 reg 4
fem change nodes rotate by 172 axis 0,0,1 reg 4
fem change nodes translate by 864,-545,-9 reg 4

# Bone transformation (to a random dynamic position).
fem change nodes rotate by -3.621821 axis 1,0,0 reg 2
fem change nodes rotate by -30.46 axis 0,1,0 reg 2
fem change nodes rotate by 172.25 axis 0,0,1 reg 2
fem change nodes translate by -619.76,439.90,-111.15 reg 2
fem change nodes rotate by -12.065170 axis 1,0,0 reg 3
fem change nodes rotate by -15.52 axis 0,1,0 reg 3
fem change nodes rotate by 170.17 axis 0,0,1 reg 3
fem change nodes translate by -447.84,466.63,-9.61 reg 3
fem change nodes rotate by 3.380810 axis 1,0,0 reg 4
fem change nodes rotate by -1.93 axis 0,1,0 reg 4
fem change nodes rotate by 176.87 axis 0,0,1 reg 4
fem change nodes translate by -201.99,316.14,-28.25 reg 4
 
# Export transformed bone
#fem exp nodes;transformed_femur as femur region 2
#fem exp nodes;transformed_tibia as tibia region 3
#fem exp nodes;transformed_hip as hip region 4

# Rigid body rotation of semimembranosus and host (same as femur)
# to account for global motion

# Adjustments to static position (orthotrak motion capture system)
fem change nodes rotate by -8 axis 1,0,0 reg 1,5
fem change nodes rotate by -6 axis 0,1,0 reg 1,5
fem change nodes rotate by -180 axis 0,0,1 reg 1,5
fem change nodes translate by 689,-154,-76 reg 1,5

# Bone transformation (to a random dynamic position).
fem change nodes rotate by -3.621821 axis 1,0,0 reg 1,5
fem change nodes rotate by -30.46 axis 0,1,0 reg 1,5
fem change nodes rotate by 172.25 axis 0,0,1 reg 1,5
fem change nodes translate by -619.76,439.90,-111.15 reg 1,5

# Export transformed host
#fem exp nodes;transformed_semimembranosus_host as semimembranosus_host region 1
#fem exp nodes;transformed_semimembranosus as semimembranosus region 5

############# HOST MESH FITTING ############

# put initial host geometry into fields 4,5,6
fem update field 4 reg 1 subst geometry x reg 1;
fem update field 5 reg 1 subst geometry y reg 1;
fem update field 6 reg 1 subst geometry z reg 1;

# target xi points
fem def xi;r;target_semimembranosus;example reg 1
# convert to spatial data points
fem def data;c from_xi 
# check
#fem exp data;check as check

# landmark xi points
fem def xi;r;landmark_semimembranosus;example reg 1

fem list data error reg 1;     #outputs initial error
fem def fit;r;volume_eg;example geometry reg 1;

for ($fit_itt=1; $fit_itt<=$TOT_FITS; $fit_itt=$fit_itt+1)
{
  fem fit reg 1;
  fem update node fit reg 1
  system "echo ' ======================================================' "    
  system "echo ' FIT ${fit_itt} DONE' "
  system "echo ' ======================================================' "
}

############# SLAVE MESH UPDATE ############

# put back undeformed geometry from fields 4,5,6 to geometry x,y,z
fem update geometry x reg 1 subst field 4 reg 1;
fem update geometry y reg 1 subst field 5 reg 1;
fem update geometry z reg 1 subst field 6 reg 1;
 
# check initial volume of muscle slave
#fem list elem reg 5

fem def xi;r;nodes_semimembranosus;example nodes contain of 5 in 1
fem update mesh position fit of 5 in 1;

# check final volume of muscle slave
#fem list elem reg 5

# Export transformed bone
#fem exp nodes;deformed_semimembranosus as semimembranosus region 5

############# HOST MESH UPDATE #############

# check initial volume of host mesh
#fem list elem reg 1

fem update node fit reg 1;
#fem export node;deformed_semimembranosus_host as semimembranosus_host reg 1;

# check final volume of host mesh
#fem list elem reg 1






Additional testing commands:



Files used by this example are:

Name                           Modified     Size

example_d31.com 10-Aug-2004 7.4k femur.ipelem 10-Aug-2004 473k femur.ipnode 10-Aug-2004 899k hip.ipelem 10-Aug-2004 43k hip.ipnode 10-Aug-2004 413k landmark.exdata 10-Aug-2004 7.5k landmark.ipdata 10-Aug-2004 13k landmark_semimembranosus.ipxi 10-Aug-2004 10k nodes_semimembranosus.ipxi 10-Aug-2004 2.9k semimembranosus.ipelem 10-Aug-2004 12k semimembranosus.ipelfd 10-Aug-2004 10k semimembranosus.ipfiel 10-Aug-2004 53k semimembranosus.ipnode 10-Aug-2004 31k semimembranosus_host.ipelem 10-Aug-2004 646 semimembranosus_host.ipelfd 10-Aug-2004 562 semimembranosus_host.ipfiel 10-Aug-2004 3.9k semimembranosus_host.ipnode 10-Aug-2004 2.2k target.exdata 10-Aug-2004 7.5k target_semimembranosus.ipxi 10-Aug-2004 10k test_output.com 22-Aug-2004 0 tibia.ipelem 10-Aug-2004 96k tibia.ipnode 10-Aug-2004 200k view.com 10-Aug-2004 1.4k volume_eg.ipbase 10-Aug-2004 10k volume_eg.ipfit 13-Apr-2007 2.1k volume_eg.ippara 15-Aug-2014 5.9k volume_eg.ipregi 10-Aug-2004 93

Download the entire example:

Name                      Modified     Size

examples_d_d3_d31.tar.gz 16-Aug-2014 371k

Testing status by version:

StatusTestedReal time (s)
hpc_cmo64_irixSuccessSun Jul 31 01:41:06 200553
rs6000-aix
cm64SuccessWed Mar 4 01:18:57 200920
x86_64-linux
cmFailureSun Mar 6 00:04:27 201623
last breakSat May 12 00:08:00 20126

Testing status by file:


Html last generated: Sun Mar 6 05:51:25 2016

Input last modified: Fri Aug 15 17:58:24 2014


CMISS Help / Examples / d / d3 / d31