Personal tools
You are here: Home cmgui Wiki Creating A Mesh Interactively in CMGUI
Views

Creating A Mesh Interactively in CMGUI

last edited 4 years ago by glennr

This page is going to be a blog of my experience as a new user of building a tricubic mesh in cmiss. One day it might become a tutorial on this topic...

In a nutshell to create a mesh manually you simply need to have a bunch of nodes in cmgui and then you "connect the dots" to build the elements of the mesh.

There are a number of ways to get suitable nodes into cmgui:

  1. Pick node points on a physical model using the faro arm.
  2. Convert relevant points from a data cloud into nodes. You can create a data cloud using a laser scanner or using the visible human digitiser utilities as described in Cmiss example a/digitise. You will also need the exnode_exelem_creator script from Cmiss example 21f (or my customised version) to create the planes that the images will be attached to as textures.

Assuming that you have a data cloud then you will already have one or more exdata files. To convert these into exnode format simply change the name from .exdata to .exnode. If you have a number of files then the perl script on the RenamingFiles page might be useful.

If you have a single exnode file then you can now just read that into cmgui using

gfx read nodes ;
If you have multiple files then you can use cmCombine to concatenate them or just read them in one at a time. Here is an example script that allows you to load multple groups and set the colours and glyphs.

Now you have a bunch of nodes which can be used for building elements. The order in which nodes are selected is important. When selecting nodes to create a hexahedral element (eg a cube) in the nodes must be selected in this order:

                Xi1     Xi2     Xi3
node # 1         0      0       0
node # 2         1      0       0
node # 3         0      1       0
node # 4         1      1       0
node # 5         0      0       1
node # 6         1      0       1
node # 7         0      1       1
node # 8         1      1       1

Where the table entries are the local coordinate values for each node (I will supply a diagram sometime).

A common (well, I know of at least one other person that did it!) beginners mistake is to just create a bunch of randomly oriented elements that look pretty in cmgui and fit the geometry. Don't do that. You need to make sure that the local coordinate directions of each element are aligned in some sort of consistent manner. This is especially important if the mesh will will fitted to data. The best alignment will depend on what the mesh will be used for (see DesigningAMesh).

To make things a bit more ordered you may find it convenient to put nodes into groups. This can be done using the following commands

# create a new node group
gfx create ngroup ;

# now select some nodes with the mouse # add the selected node to the new group gfx modify ngroup add selection;

# note that the nodes are now in both the root group and your new group

Once you have created a linear mesh it can be exported to the backend using the element export scripts in the CMISS perl utilites ( see MeshExportCmgui2Cm ).

To be continued...

Contributing to this site

Please add to the wiki any relevant information that you think might be useful to other users of this website. For example, you might like to contribute your experiences, questions and answers.

You are encouraged to contribute to this site regardless of your level of experience. Contributions are welcomed from new and regular visitors.

If you ask a question and receive an answer from a developer you should record it in the wiki. This information is extremely useful and can help other users overcome the same problem.

See how to add and edit pages for more information.