Example 972: Customisation of fitted lobes using Host mesh fitting

This example illustrates customisation of the fitted lung lobes using the host mesh fitting technique. Since the lung lobes have been fitted individually (see example 972), There is no guarantee of perfect contact between lobes. i.e. gaps and overlaps between lobes. The slave mesh (lung lobes) is completely embedded in a tri-cubic volume host mesh and the slave nodal positions can be defined using host element local coordinates. An objective function is then set up to minimise the summation of the square of the distances between the landmark(initial position) and target(final position) points in terms of host mesh nodal parameters. Any deformation that the host mesh undergoes will cause a similar change in the shape of the slave mesh as slave mesh is inside the host mesh. The new nodal values and the derivatives of the slave mesh are then updated with respect to the deformed host mesh. Note that using the host mesh fitting technique both Euclidean and Affine transformations can be performed on high-order meshes. A complete mathematical analysis of the method can be found in hostmesh_fit.pdf

The com file in this example is only for transforming the left lower lobe. For transforming of other lobes use the following com files.

left_upper.com , right_upper.com , right_middle.com , right_lower.com . All necessary input files can be found at the end of this page.

Created by Kumar Mithraratne.

Fig. 1 Fitted left lower lobe with undeformed host mesh Fig. 2 Transformed left lower lobe with deformed host mesh Fig. 3 Transformed Lung


The comfile run by this example is as follows:

${lobe} = 'left_lower'
${off}=3000
${offt}=5500
${offd}=10500
${off_data}=0

fem def para;r;all_lobe;example
fem def region;r;all_lobe;example

fem def coord;r;all_host;example reg 1          # Defines coords for host

fem def base;r;all_lobe_cubic;example reg 1,2   # Defines bases for host & slave

##################### HOST MESH ##################### 

fem def node;r;${lobe}_host;example reg 1       # Reads in hostmesh nodes
fem def elem;r;${lobe}_host;example reg 1       # Reads in hostmesh elems.

fem export node;${lobe}_host as ${lobe}_host reg 1
fem export elem;${lobe}_host as ${lobe}_host reg 1

################### HOST MESH ######################

################### SLAVE MESH ##################### 

fem def coord;r;all_slave;example reg 2        # Defines coords for slave

fem def node;r;${lobe}_fitted;example reg 2
fem def elem;r;${lobe}_fitted;example reg 2

fem export node;${lobe}_fitted as ${lobe}_fitted offset $off reg 2
fem export elem;${lobe}_fitted as ${lobe}_fitted offset_node $off offset_elem $off reg 2

#fem def xi;c nodes contain of 2 in 1 loose_tolerance # Calculates slave nodal posns wrt host
#fem def xi;w;${lobe} nodes contain of 2 in 1         # Writes out slave nodal posns wrt host

################### SLAVE MESH #################### 

############# HOST MESH TRANSFORMATION ############

fem update field from geometry reg 1

#fem def data;r;${lobe}_landmark;example reg 1  # Reads in landmark data coords   
#fem def xi;c contain reg 1                     # Calculates xi posns of landmark data wrt host     
#fem def xi;w;${lobe}_landmark reg 1            # Writes out landmark xi coords.

fem def data;r;${lobe}_target;example reg 1     # Reads in target data coords       
fem def xi;r;${lobe}_landmark;example reg 1     # Reads in landmark xi coords

fem list data error reg 1     

fem def fit;r;${lobe};example geometry reg 1    # Defines fit parameters for host
fem fit reg 1

############ HOST MESH TRANSFORMATION ############

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

fem def xi;r;${lobe};example nodes contain of 2 in 1  # Reads in slave xi coord wrt host
fem update mesh position fit of 2 in 1                # Updates slave nodal parameters wrt deformed host
fem update scale_factor normalise reg 2

fem export node;${lobe}_fitted_transformed as ${lobe}_fitted_transformed offset $offt reg 2
fem export elem;${lobe}_fitted_transformed as ${lobe}_fitted_transformed offset_node $offt offset_elem $offt reg 2

fem def node;w;${lobe}_fitted_transformed
fem def elem;w;${lobe}_fitted_transformed

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

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

fem update node fit reg 1          # Updates deformed host
fem list data error reg 1

fem export node;${lobe}_deformed_host as ${lobe}_deformed_host offset $offd reg 1
fem export elem;${lobe}_deformed_host as ${lobe}_deformed_host offset_node $offd offset_elem $offd reg 1

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


Additional testing commands:

fem list nodes reg 2

Files used by this example are:

Name                                    Modified     Size

example_972.com 19-Nov-2002 2.9k all_host.ipcoor 21-Feb-2003 796 all_lobe.ippara 19-Nov-2002 5.9k all_lobe.ipregi 19-Nov-2002 94 all_lobe_cubic.ipbase 19-Nov-2002 4.4k all_slave.ipcoor 19-Nov-2002 545 fitted_transformed.jpg 19-Nov-2002 10k left_lower.ipfit 13-Apr-2007 3.5k left_lower.ipxi 19-Nov-2002 6.3k left_lower_deformed_host.exelem 10-Aug-2004 12k left_lower_deformed_host.exnode 10-Aug-2004 15k left_lower_fitted.exelem 10-Aug-2004 83k left_lower_fitted.exnode 19-Nov-2002 51k left_lower_fitted.ipelem 19-Nov-2002 14k left_lower_fitted.ipnode 19-Nov-2002 158k left_lower_fitted_transformed.exelem 10-Aug-2004 83k left_lower_fitted_transformed.exnode 10-Aug-2004 51k left_lower_fitted_transformed.ipelem 10-Aug-2004 802 left_lower_fitted_transformed.ipnode 10-Aug-2004 22k left_lower_host.exelem 10-Aug-2004 8.7k left_lower_host.exnode 21-Feb-2003 7.8k left_lower_host.ipelem 19-Nov-2002 802 left_lower_host.ipnode 19-Nov-2002 22k left_lower_landmark.exdata 19-Nov-2002 1.2k left_lower_landmark.ipdata 19-Nov-2002 1.2k left_lower_landmark.ipxi 19-Nov-2002 1.4k left_lower_target.exdata 19-Nov-2002 1.2k left_lower_target.ipdata 19-Nov-2002 1.2k left_upper.com 19-Nov-2002 2.3k left_upper.ipfit 13-Apr-2007 3.5k left_upper.ipxi 19-Nov-2002 8.3k left_upper_deformed_host.exelem 19-Nov-2002 12k left_upper_deformed_host.exnode 19-Nov-2002 15k left_upper_fitted.exelem 19-Nov-2002 94k left_upper_fitted.exnode 19-Nov-2002 61k left_upper_fitted.ipelem 19-Nov-2002 13k left_upper_fitted.ipnode 19-Nov-2002 181k left_upper_fitted_transformed.exelem 19-Nov-2002 94k left_upper_fitted_transformed.exnode 19-Nov-2002 61k left_upper_fitted_transformed.ipelem 19-Nov-2002 802 left_upper_fitted_transformed.ipnode 19-Nov-2002 22k left_upper_host.exelem 19-Nov-2002 8.7k left_upper_host.exnode 19-Nov-2002 7.8k left_upper_host.ipelem 19-Nov-2002 802 left_upper_host.ipnode 19-Nov-2002 2.6k left_upper_landmark.exdata 19-Nov-2002 1.2k left_upper_landmark.ipdata 19-Nov-2002 1.2k left_upper_landmark.ipxi 19-Nov-2002 1.4k left_upper_target.exdata 19-Nov-2002 1.2k left_upper_target.ipdata 19-Nov-2002 1.2k right_lower.com 19-Nov-2002 2.3k right_lower.ipfit 13-Apr-2007 3.5k right_lower.ipxi 19-Nov-2002 6.8k right_lower_deformed_host.exelem 19-Nov-2002 12k right_lower_deformed_host.exnode 19-Nov-2002 15k right_lower_fitted.exelem 19-Nov-2002 76k right_lower_fitted.exnode 19-Nov-2002 50k right_lower_fitted.ipelem 19-Nov-2002 11k right_lower_fitted.ipnode 19-Nov-2002 148k right_lower_fitted_transformed.exelem 19-Nov-2002 76k right_lower_fitted_transformed.exnode 19-Nov-2002 50k right_lower_fitted_transformed.ipelem 19-Nov-2002 802 right_lower_fitted_transformed.ipnode 19-Nov-2002 22k right_lower_host.exelem 19-Nov-2002 8.7k right_lower_host.exnode 19-Nov-2002 7.8k right_lower_host.ipelem 19-Nov-2002 802 right_lower_host.ipnode 19-Nov-2002 2.6k right_lower_landmark.exdata 19-Nov-2002 1.5k right_lower_landmark.ipdata 19-Nov-2002 1.6k right_lower_landmark.ipxi 19-Nov-2002 1.9k right_lower_target.exdata 19-Nov-2002 1.5k right_lower_target.ipdata 19-Nov-2002 1.6k right_middle.com 19-Nov-2002 2.3k right_middle.ipfit 13-Apr-2007 3.5k right_middle.ipxi 19-Nov-2002 4.5k right_middle_deformed_host.exelem 19-Nov-2002 12k right_middle_deformed_host.exnode 19-Nov-2002 15k right_middle_fitted.exelem 19-Nov-2002 49k right_middle_fitted.exnode 19-Nov-2002 33k right_middle_fitted.ipelem 19-Nov-2002 7.0k right_middle_fitted.ipnode 19-Nov-2002 99k right_middle_fitted_transformed.exelem 19-Nov-2002 49k right_middle_fitted_transformed.exnode 19-Nov-2002 33k right_middle_fitted_transformed.ipelem 19-Nov-2002 802 right_middle_fitted_transformed.ipnode 19-Nov-2002 22k right_middle_host.exelem 19-Nov-2002 8.7k right_middle_host.exnode 19-Nov-2002 7.8k right_middle_host.ipelem 19-Nov-2002 802 right_middle_host.ipnode 19-Nov-2002 3.0k right_middle_landmark.exdata 19-Nov-2002 1.5k right_middle_landmark.ipdata 19-Nov-2002 1.6k right_middle_landmark.ipxi 19-Nov-2002 1.9k right_middle_target.exdata 19-Nov-2002 1.5k right_middle_target.ipdata 19-Nov-2002 1.6k right_upper.com 19-Nov-2002 2.3k right_upper.ipfit 13-Apr-2007 3.5k right_upper.ipxi 19-Nov-2002 6.8k right_upper_deformed_host.exelem 19-Nov-2002 12k right_upper_deformed_host.exnode 19-Nov-2002 15k right_upper_fitted.exelem 19-Nov-2002 76k right_upper_fitted.exnode 19-Nov-2002 50k right_upper_fitted.ipelem 19-Nov-2002 11k right_upper_fitted.ipnode 19-Nov-2002 148k right_upper_fitted_transformed.exelem 19-Nov-2002 76k right_upper_fitted_transformed.exnode 19-Nov-2002 50k right_upper_fitted_transformed.ipelem 19-Nov-2002 802 right_upper_fitted_transformed.ipnode 19-Nov-2002 22k right_upper_host.exelem 19-Nov-2002 8.7k right_upper_host.exnode 19-Nov-2002 7.8k right_upper_host.ipelem 19-Nov-2002 802 right_upper_host.ipnode 19-Nov-2002 2.6k right_upper_landmark.exdata 19-Nov-2002 1.3k right_upper_landmark.ipdata 19-Nov-2002 1.3k right_upper_landmark.ipxi 19-Nov-2002 1.6k right_upper_target.exdata 19-Nov-2002 1.3k right_upper_target.ipdata 19-Nov-2002 1.3k test_output.com 19-Nov-2002 21

Download the entire example:

Name                      Modified     Size

examples_9_97_972.tar.gz 14-Apr-2007 573k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmSuccessSun Mar 6 00:02:07 20160
cm-debugSuccessSat Mar 5 00:05:09 20161
mips-irix
cmSuccessSun Aug 19 01:36:17 20078
cm-debugSuccessWed Aug 15 01:35:07 200726
cm-debug-clear-mallocSuccessSat Aug 18 01:58:31 200761
cm-debug-clear-malloc7SuccessMon Aug 20 01:55:56 2007125
cm64SuccessSun Aug 19 01:36:25 20078
cm64-debugSuccessTue Aug 21 01:36:20 200730
cm64-debug-clear-mallocSuccessThu Apr 1 10:52:08 200418
rs6000-aix
cmSuccessWed Mar 4 01:08:05 20092
cm-debugSuccessMon Mar 2 01:08:57 20097
cm64SuccessWed Mar 4 01:08:41 20091
cm64-debugSuccessTue Mar 3 01:14:10 20096
x86_64-linux
cmSuccessSun Mar 6 00:01:04 20161
cm-debugSuccessSat Mar 5 00:01:40 20161

Testing status by file:


Html last generated: Sun Mar 6 05:50:35 2016

Input last modified: Fri Apr 13 10:37:23 2007


CMISS Help / Examples / 9 / 97 / 972