Example a/digitise: Digitising mri scan images of the vocal tract.

The com file listed below demonstrates the use of the old digitiser which uses some perl modules and is run from cmgui. If you install the Zinc 0.6.0.0 plugin for firefox, you can use the much improved Zinc Digitiser 0.44 instead of the older digitiser. The Zinc digitiser is run from firefox 1.5, or higher, rather than cmgui. A detailed Zinc Digitiser Help page is available which includes full installation and use instructions. Installation only takes a few minutes.

Once Zinc is installed you can run the Zinc digitiser vocal tract example.

The Zinc digitiser is the successor of the mozCmgui digitiser. Features added include:

To use the digitiser you will need to create your own xml settings file. This can be done by customising the VocalTractDigitiseSettings.xml which is fully commented. For a more complicated example file see NonAxialVocalTractDigitiseSettings.xml which shows how to define non axially aligned slices.

There are scripts which you can use to convert a traces.exdata from the old digitiser to this new one: traces2database.pl and back again: traces2database.pl.


This example shows how to use the digitiser to create data points for a model. The digitiser loads up image slices and positions each slice according to the location specified by the appropriate exelem and exnode files. The user can then use the digitiser interface to add data points on each slice. In this example the images are from mri scans of the vocal tract and are not co-planar (the set of slices are not all stacked on top of each other but are at various different angles).

The digitser interface consists of three windows in addition to the cmgui command window.

The Image Digitising window allows you to select and load an image slice to digitise. Select a slice to work on by using the either the drop down list or the previous and next buttons. This loads the slice into memory. Only a few slices are stored in memory to cut on memory use so only the last few slices are cached. The Digitise button toggles on and off digitising the selected slice.

Graphics window 1 provides a 2D view of the current slice being digitised. Note that when you first load up the digitiser it may appear blank if you are not using planar images. Clicking on the Digitise button will position the selected slice correctly in the viewing plane and will also bring up the data tool window. New data points can now be created by clicking on graphics window 1. Toggling the Digitise button off allows you to use the mouse to zoom and move your view of the slice.

Graphics window 2 provides a 3D view that shows the position of all the data points digitised so far. Data points on the current slice appear as yellow spheres and any selected data points are shown as pink spheres. Other data points on other slices display as green spheres.

Each slice has a data group associated with it and when you select a new slice to work on that data group is automatically written out to a file in the directory that the digitiser was run from. Any data files that correspond to slices will be reloaded on subsequent runs of the digitiser from that directory.

Screenshot of example a/digitise


The comfile run by this example is as follows:

# This example illustrates the use of the digitiser.
# It loads up 10 slices sampled from and MRI scan of my throat for digitising

#Use strict ensures we have declared all our variables and haven't made a typo.
#To make this work we need to execute the whole comfile as a single block
{
use strict;

use Cmiss::Example_path qw($example);
use CmUtils;
use CmUtils::Digitise qw( cmguiInit digitiseSlices setGlyphs);
use CmUtils::Digitise::VisibleHuman qw( VH_CreateImageSet );

# Variables user should change
#-----------------------------

# Cmgui 2d digitizer window size
my $WinWidth2d    = 400;
my $WinHeight2d   = 850;

# Set this to create a 3D data window
my $View3d        = 1;

# Cmgui 3d data point viewer window size
my $WinWidth3d    = 350;
my $WinHeight3d   = 350;

# The image directory contains all image files plus the associated exelem and 
# exnode files that specify the position of each image.
# The exnode, exelem and image files all have a name of the form:
# imagename.* 
# the imagename is of the form specified in the variable pattern and 
# includes an image number
# The digitiser attempts to load all images that fit the specified 
# pattern and image numbers.

# Image directories
my $ImageDir      = "$example/slices/";

# Filename pattern
# Numbers need to be zero padded otherwise digitiser uses 1 in place of 11,12,13 etc
# In this example the images are named plane001.jpg through to plane020.jpg
my $pattern       = "plane%03d";

# Image numbers
my $FirstImage    = 1;
my $LastImage     = 10;
my $ImageIncr     = 1;

# Image file extension
my $FileExt       = '.jpg';

# Set this to 1 to view images only
my $ViewOnly      = 0;

# Variables user can change
#--------------------------

# Default glyph values:
my $glyphType = "sphere";
my $glyphSize = 3;

$CmUtils::ViewNormal::Scale = 60;
$CmUtils::ViewNormal::ViewRange = 4;
$CmUtils::Digitise::settings{max_load} = 4;
#Specify whether or not the digitiser should try and preserve your current
#interest point and range of view.
$CmUtils::Digitise::settings{keep_view} = 0;

# Below here should be left alone
#---------------------------------

&cmguiInit( $WinWidth2d, $WinHeight2d, $View3d, $WinWidth3d, $WinHeight3d );

my $image = &VH_CreateImageSet( $pattern, $FirstImage, $LastImage, $ImageIncr, $ImageDir, $FileExt );

# Use setGlyphs if you want to change the default glyph (sphere of size 3)
&setGlyphs($glyphType,$glyphSize,$image);

&digitiseSlices( $image );

#Test the interface by calling functions manually
#------------------------------------------------

$CmUtils::Digitise::settings{current} = 4;
CmUtils::Digitise::update_view( $image );

$CmUtils::Digitise::settings{current} = 7;
CmUtils::Digitise::update_view( $image );

$CmUtils::Digitise::settings{current} = 6;
CmUtils::Digitise::update_view( $image );

$CmUtils::Digitise::settings{toggle}->set_active(1);
CmUtils::Digitise::update_view( $image );

$CmUtils::Digitise::settings{current} = 5;
CmUtils::Digitise::update_view( $image );

$CmUtils::Digitise::settings{current} = 4;
CmUtils::Digitise::update_view( $image );

$CmUtils::Digitise::settings{current} = 3;
CmUtils::Digitise::update_view( $image );

#Test the keep_view option.
$CmUtils::Digitise::settings{keep_view} = 1;

$CmUtils::Digitise::settings{current} = 2;
CmUtils::Digitise::update_view( $image );

$CmUtils::Digitise::settings{toggle}->set_active(0);
CmUtils::Digitise::update_view( $image );
}

Files used by this example are:

Name                                    Modified     Size

digitise.com 17-Mar-2014 3.3k COPYRIGHT 17-Mar-2014 504 NonAxialVocalTractDigitiseSettings.xml 17-Mar-2014 7.6k VocalTractDigitiseSettings.xml 17-Mar-2014 9.6k images/ 18-Mar-2014 - plane001.exdata 17-Mar-2014 6.1k plane002.exdata 17-Mar-2014 1.8k plane003.exdata 17-Mar-2014 1.7k plane004.exdata 17-Mar-2014 1.5k plane005.exdata 17-Mar-2014 1.9k plane006.exdata 17-Mar-2014 2.4k plane007.exdata 17-Mar-2014 2.0k plane008.exdata 17-Mar-2014 923 plane009.exdata 17-Mar-2014 1.2k plane010.exdata 17-Mar-2014 1.1k slices/ 18-Mar-2014 - tractDatabase.exnode 17-Mar-2014 18k

Download the entire example:

Name                        Modified     Size

examples_a_digitise.tar.gz 09-Mar-2016 5.9M

Html last generated: Wed Mar 9 16:01:39 2016

Input last modified: Wed Mar 9 15:49:33 2016


CMISS Help / Examples / a / digitise