Example 21k: Fitting motion of an LV FE model to fiducial markers manually tracked in 3D images

A left ventricular finite element mesh fitted to the geometry of a human LV is deformed by fitting the mesh to manually tracked data points in 3D MRI (untagged) images. Distinct features in the images have been traced by placing a data-point (fiducial marker) on it from frame to frame. The material point that one such marker correspond to in time-frame 1 will generally move out of the image-plane for frame n, where n>1. The tracked marker is considered an approximation of the projection of the material point onto the image-plane. The coordinates of each marker is given in the data-files where the last three columns are the elements of the image plane normal for each corresponding marker.

The motion of the mesh is fitted to the displacements of these tracked markers, but if the predicted material point moves out of the image-plane, the error-component along the image-plane normal is ignored.

As the tracked points most often lie outside or on the LV FE model walls the LV mesh is embedded in a larger host mesh. The host mesh also embeds the fiducial markers. The fitting procedure is applied to the host mesh and then the LV mesh is updated inside the host mesh.

For more details see paper "Parameter distribution models for estimation of left ventricular deformation using sparse fiducial markers", submitted 2003.

Created by Espen Remme April 2004.
 


The comfile run by this example is as follows:

# If the example path is not set, default to current directory
if(!defined $example)
{
  $example = "./";
}


$targetNumber = 8; 
$nFits=10

$landmarks = sprintf("mesh_%02d", 1);
$target = sprintf("mesh_%02d", $targetNumber);

$HOST 		= 1;
$SLAVE 		= 2;
fem def para;r;fitting;example
fem def region;r;regions;example


################ SLAVE MESH ################ 
fem def coord;r;slaveCoord;example reg $SLAVE;
fem define base;r;bases2;example reg $HOST,$SLAVE

$name = "mesh_1"
fem define node;r;mesh_1;example reg $SLAVE
fem define elem;r;slave;example reg $SLAVE
fem export node;slave as slave offset 1000 reg $SLAVE
fem export elem;slave as slave offset_elem 1000 reg $SLAVE

################ HOST MESH #################
fem def coor;r;hostCoord;example reg $HOST;
fem def node;r;host_1;example reg $HOST;
fem def elem;r;host;example reg $HOST;
fem export node;host as host offset 1500 reg $HOST;
fem export elem;host as host offset_elem 1500 reg $HOST;

######### HOST MESH TRANSFORMATION #########
#fem def xi;c nodes contain of $SLAVE in $HOST loose_tolerance by 10
fem def xi;c nodes contain of $SLAVE in $HOST
fem def xi;w;slave nodes contain of $SLAVE in $HOST

fem def data;r;$landmarks;example   #reads in global coords of landmark points
fem export data;landmark as landmark offset 16000 reg $HOST
fem def xi;c contain reg $HOST;   #calculates xi posns of landmark points in host
#fem def xi;c close reg $HOST;   #calculates xi posns of landmark points in host
fem def xi;w;landmark reg $HOST;

fem def data;r;$target;example         #reads in global coords of target points
fem def xi;r;landmark;example reg $HOST;
fem export data;target as target error offset 17500 reg $HOST

fem list data error reg 1;     #outputs initial error

fem update field from geometry reg $HOST;
fem def fit;r;host;example geom reg $HOST

# Fitting the motion of the hostmesh to the data-points
# ignoring error component normal to image-plane
fem fit in_plane reg $HOST;

fem def xi;r;slave;example nodes contain of $SLAVE in $HOST;
fem update mesh position fit of $SLAVE in $HOST;
$name = "fittedMesh_$targetNumber";
fem def node;w;$name reg $SLAVE

fem update node fit reg $HOST;
fem def data;r;$landmarks;example
fem define data;c from_xi
fem define data;w;newLandmark

system("perl markerError.pl 8");


for($n=2;$n<=$nFits;$n++)
{

  print "\n\n\************************************\n"
  print "\n\n\Fit number $n\n"
  print "\n\n\************************************\n"

  fem def data;r;newLandmark;example
  #fem def xi;c contain reg $HOST;
  fem def xi;c close reg $HOST;
  fem def xi;w;landmark2 reg $HOST;
  fem def data;r;$target;example
  fem def xi;r;landmark2 reg $HOST;
  
  fem update field from geometry reg $HOST;
  fem def fit;r;host;example geom reg $HOST
  
  # Fitting the motion of the hostmesh to the data-points
  # ignoring error component normal to image-plane
  fem fit in_plane reg $HOST;
  
  fem def xi;r;slave;example nodes contain of $SLAVE in $HOST;
  fem update mesh position fit of $SLAVE in $HOST;
  $name = "fittedMesh_$targetNumber";
  fem def node;w;$name reg $SLAVE
  #fem def elem;w;$name reg $SLAVE

  fem update node fit reg $HOST;
  fem export data;data_cust as data_cust error offset 18000 reg $HOST
  fem def data;r;$landmarks
  $name = "newLandmark";
  fem define data;c from_xi
  fem define data;w;$name

  #system("perl markerError.pl $targetNumber");
}


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

fem def xi;r;slave;example nodes contain of $SLAVE in $HOST;
fem update mesh position fit of $SLAVE in $HOST;

fem export node;transformed_slave as transformed_slavex offset 00000 reg $SLAVE;
fem export elem;transformed_slave as transformed_slavex offset_elem 00000 reg $SLAVE;

$name = "preparedMesh_$targetNumber";
fem def node;w;$name reg $SLAVE
#fem def elem;w;$name reg $SLAVE

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

fem update node fit reg $HOST;
fem export node;deformed_host as deformed_host offset 2000 reg $HOST;
fem export elem;deformed_host as deformed_host offset_elem 2000 reg $HOST;

fem def data;r;$landmarks;example
$name = "newLandmark";
fem define data;c from_xi
fem define data;w;$name
fem export data;$name as $name error offset 0

#system("perl markerError.pl $targetNumber");


Files used by this example are:

Name               Modified     Size

example_21k.com 21-Apr-2004 4.2k bases2.ipbase 21-Apr-2004 8.7k createHost.pl 21-Apr-2004 11k draw.com 21-Apr-2004 2.4k fitting.ippara 21-Apr-2004 5.9k host.ipelem 21-Apr-2004 6.9k host.ipfit 13-Apr-2007 5.1k host.ipnode 21-Apr-2004 21k hostCoord.ipcoor 21-Apr-2004 657 host_1.ipnode 21-Apr-2004 24k hostmesh.com 21-Apr-2004 4.2k markerError.pl 21-Apr-2004 1.9k mesh_01.ipdata 21-Apr-2004 4.8k mesh_08.ipdata 21-Apr-2004 4.8k mesh_1.ipnode 21-Apr-2004 36k moveHost.com 21-Apr-2004 678 regions.ipregi 21-Apr-2004 93 slave.ipelem 21-Apr-2004 9.7k slaveCoord.ipcoor 21-Apr-2004 656

Download the entire example:

Name                      Modified     Size

examples_2_21_21k.tar.gz 14-Apr-2007 25k

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

Input last modified: Fri Apr 13 10:31:09 2007


CMISS Help / Examples / 2 / 21 / 21k