Example 21e2: Creating an initial mesh for fitting

Creating an initial mesh for fitting to data points

After creating data points using the digitisation process outlined in index.html, we must create an initial mesh to fit to our data. Some free license must be given here to how you create this mesh, as the varying geometries will require different mesh types.

The procedure used here is to create a very basic mesh consisting of only 4 nodes and 3 elements that represents the type of mesh we want and also vaguely represents the data shape. This mesh is then 'refined' using cm until we have enough nodes and elements. Between each refine the mesh is adjusted using cmgui to alter the nodal positions and derivatives so that the surfaces are close to the data. Care also has to be taken where you refine your mesh so that it is consistent with the other three surfaces.

The 3 initial surface meshes that are required are each in their own directory under the cmiss_input directory. We will follow the course of the epicardial initial mesh creation.

Refine and Adjust 1

The initial files are epi.ipelem. They contain four nodes and three elements in a hemispherical shape that we will refine and adjust as the mesh is refined.
Refine the mesh by typing cm 1st-refine at the prompt. The com file contains:

fem def coord 3,1
fem def base;r;bicubic
fem def node;r;epi
fem def elem;r;epi
fem ref xi 2 at 0.4
fem ex node;epi-ref1 as epi
fem ex elem;epi-ref1 as epi
fem def node;w;epi-ref1
fem def elem;w;epi-ref1
Which refines the mesh once and then writes it out again in both cm and cmgui format. We will now adjust the mesh in cmgui.
Do this by typing cmgui adjust1 at the prompt. Create the data points on the screen also by using the graphical element editor. One should then get an image like the following:
This cmgui model was created by copying the ideas of CMISS example at. Now click on the node tool, near the bottom left hand corner of the 3d window. After doing this one can then click on the node points and edit their position and derivative values (altering the curvature of the mesh) to hug the data more closely. This is not completely necessary for a simple mesh but in some cases where the meshes are complex it will be necessary to get a better initial approximation to the data.

Now, once the mesh has been adjusted write out the node file: gfx write node epi-ref1-adjust. This will create an exnode file, which has to be converted from cmgui format to cm format. Do this by typing the following at the prompt:
nawk -f $CMISS_ROOT/cmiss_utils/data_utils/exnode_to_ipnode.awk epi-ref1-adjust.exnode > epi-ref1-adjust.ipnode

Refine and Adjust 2

The process here follows exactly that of Refine and Adjust 1. Use the com files as follows:

cmo 2nd-refine
cmgui adjust2
And then adjust the nodes using the same steps outlined before. Once this has been done then you have done enough to create an initial mesh for fitting, we only have to use the .ipnode and .ipelem files that have been created here.

The comfile run by this example is as follows:

#Example 21e2

Files used by this example are:

Name              Modified     Size

example_21e2.com 09-Feb-2001 14 epi/ 27-Feb-2004 - lv/ 27-Feb-2004 - rv/ 27-Feb-2004 -

Download the entire example:

Name                           Modified     Size

examples_2_21_21e_21e2.tar.gz 19-Aug-2006 152k

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

Input last modified: Fri Feb 9 14:46:33 2001

CMISS Help / Examples / 2 / 21 / 21e / 21e2