Example e42: Tri-Cubic Hermite Host Mesh Customisation

A small generic model is customised to a larger specific subject (p111) with the aid of 9 control parameters. A tri-cubic Hermite host mesh is used to transform the generic model.

The customised mesh can be visualised with draw.com.

Front Customisation Ortho Customisation


The comfile run by this example is as follows:

# Example e42
# -----------
#


# Inputs
#

$SLAVEFILES 	= "pig06"
$CUSTFILES 	= "pig06_cust"
$SLAVE 		= "1..6"
$HOST 		= 7



# Controls
#

$CALCXI 	= 1
$FITTING 	= 1
$UPDATE 	= 1 #Update the slave mesh.
$OUTPUT		= 1 #Write out ipnode/elem files.



fem def para;r;fitting;example
fem def regi;r;seven;example
fem def coor 3,1
fem def base;r;bicubic_tricubic;example


if( $CALCXI==1 )
{
fem def node;r;host;example reg $HOST
fem def elem;r;host;example reg $HOST
fem up node deriv 1 reg $HOST
fem up node deriv 2 reg $HOST
fem up node deriv 3 reg $HOST


#
#----------------------------#
# Refine host mesh
#----------------------------#
fem ref xi 3 reg $HOST


#
#----------------------------#
# Export host geometry
#----------------------------#
#
fem export node;host as host offset 1000 reg $HOST
fem export elem;host as host offset_elem 1000 reg $HOST


#
#----------------------------#
# Calculate xi's for data points
#----------------------------#
#
fem def data;r;gen_landmark9;example reg $HOST
fem def xi;c contain reg $HOST
fem export data;gen_landmark as gen_landmark error offset 16000 reg $HOST
fem def xi;w;gen_landmark reg $HOST


#
#----------------------------#
# The slave mesh
#----------------------------#
#
fem def node;r;$SLAVEFILES;example reg $SLAVE
fem def elem;r;$SLAVEFILES;example reg $SLAVE

fem export node;pig_gen as pig_gen offset 10000 reg $SLAVE
fem export elem;pig_gen as pig_gen offset_elem 10000 reg $SLAVE


#
#----------------------------#
# Calculate xi's for node points
#  calcs the xi posns of nodes 
#  in nr2 contained by host in nr1
#----------------------------#
#
fem def xi;c nodes contain of $SLAVE in $HOST
fem def xi;w;generic nodes contain of $SLAVE in $HOST



} #CALCXI

Additional testing commands:

if( $FITTING==1 )
{

#
#----------------------------#
# Fit the host mesh
#----------------------------#
#

fem def data;r;p111_landmark9;example reg $HOST

fem def xi;r;gen_landmark reg $HOST
fem export data;p111_landmark as p111_landmark error offset 17500 reg $HOST


#
#----------------------------#
# Tricubic fitting with 1 elem
#----------------------------#
#
#fem def field;r;host_cub;example       reg HOST
#fem def elem;r;host;example field      reg HOST
#fem def fit;r;host_tricub;example geom reg HOST


#
#----------------------------#
# Tricubic fitting with 2 elem
#----------------------------#
#
fem def field;r;host_cub_ref;example       reg $HOST
fem def elem;r;host_ref;example field      reg $HOST
fem def fit;r;host_tricub_ref;example geom reg $HOST


fem list data error reg $HOST                #Show starting error.
fem fit reg $HOST
fem update nodes reg $HOST
fem list data error reg $HOST                #Show final error.


fem def node;w;host_cust reg $HOST
fem def elem;w;host_cust reg $HOST


#
#----------------------------#
# Export customised host geometry
#----------------------------#
#
fem export nodes;host_cust as host_cust      offset 2000       reg $HOST
fem export elements;host_cust as host_cust   offset_elem 2000  reg $HOST
fem export data;data_cust as data_cust error offset 18000      reg $HOST


} #FITTING



if( $UPDATE==1 )
{

#
#----------------------------#
# Update the slave mesh
#----------------------------#
#

fem def node;r;host_cust reg $HOST
fem def elem;r;host_cust reg $HOST

fem def node;r;$SLAVEFILES;example reg $SLAVE
fem def elem;r;$SLAVEFILES;example reg $SLAVE
fem def xi;r;generic nodes of $SLAVE in $HOST


#
#----------------------------#
# Moves nodes of reg 2 
#  according to reg 1
#----------------------------#
#
fem up mesh posit of 1 in $HOST
fem up mesh posit of 6 in $HOST


#
#----------------------------#
# Export customised slave geometry
#----------------------------#
#
fem export node;pig_cust as pig_cust offset 20000      reg $SLAVE
fem export elem;pig_cust as pig_cust offset_elem 20000 reg $SLAVE


fem export elem;skin   as skin   reg 1    offset_elem 20000 elem 1281..2336
fem export elem;lungs  as lungs  reg 2..3 offset_elem 20000 
fem export elem;lvendo as lvendo reg 4    offset_elem 20000 
fem export elem;rvendo as rvendo reg 5    offset_elem 20000
fem export elem;heart  as heart  reg 6    offset_elem 20000 


# 
#----------------------------#
# Export electrodes for comparison
#----------------------------#
#
fem def data;r;electrode;example reg 1
fem def xi;c close reg 1
fem list data error reg 1
fem exp data;cust_error as cust_error error offset 24000 reg 1


} #UPDATE



if( $OUTPUT==1 )
{

fem def node;w;$CUSTFILES reg $SLAVE
fem def elem;w;$CUSTFILES reg $SLAVE

} #OUTPUT







Files used by this example are:

Name                     Modified     Size

example_e42.com 06-Apr-2001 1.7k bicubic_tricubic.ipbase 10-Apr-2000 7.7k electrode.ipdata 10-Apr-2000 24k fitting.ippara 12-Nov-2002 5.9k gen_landmark9.ipdata 10-Apr-2000 748 host.ipelem 10-Apr-2000 432 host.ipelfd 10-Apr-2000 374 host.ipnode 06-Apr-2001 12k host_cub.ipfiel 10-Apr-2000 6.7k host_cub_ref.ipfiel 07-Apr-2001 19k host_ref.ipelfd 10-Apr-2000 654 host_tricub.ipfit 13-Apr-2007 5.0k host_tricub_ref.ipfit 13-Apr-2007 5.1k p111_landmark9.ipdata 10-Apr-2000 715 pig06.irelem 10-Apr-2000 1.3M pig06.irnode 10-Apr-2000 3.5M seven.ipregi 10-Apr-2000 93 test_output.com 06-Apr-2001 2.7k

Download the entire example:

Name                      Modified     Size

examples_e_e4_e42.tar.gz 19-Aug-2014 3.0M

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmSuccessSun Mar 6 00:22:24 201645
cm-debugFailureSun Mar 6 01:55:28 2016234
last breakTue Aug 19 03:08:00 2014374
last successThu Feb 10 03:06:00 2011371
mips-irix
cmSuccessSun Aug 19 05:33:45 2007568
cm-debugSuccessWed Aug 1 06:43:54 20072342
cm-debug-clear-mallocSuccessSat Aug 11 06:23:12 20072358
cm-debug-clear-malloc7SuccessMon Aug 6 05:30:48 20072384
cm64SuccessSun Aug 19 05:26:08 2007572
cm64-debugSuccessFri Jul 27 05:13:30 20072480
rs6000-aix
cmSuccessWed Mar 4 01:28:11 200964
cm-debugSuccessMon Mar 2 02:15:18 2009652
cm64SuccessWed Mar 4 01:28:06 200964
cm64-debugSuccessTue Mar 3 02:37:14 2009771
x86_64-linux
cmFailureSun Mar 6 00:04:30 201623
last breakSun Aug 24 00:07:00 201427
last successSun Aug 17 00:25:00 201427
cm-debugFailureSun Mar 6 00:08:39 2016106
last breakTue Aug 19 01:00:00 2014143
last successSat Aug 16 01:02:00 2014143

Testing status by file:


Graphical output from this problem is given here.


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

Input last modified: Mon Aug 18 10:58:19 2014


CMISS Help / Examples / e / e4 / e42