CmUtils::Digitise

CmUtils::Digitise contains a selection of routines for digitising a set of images.

CONTAINS

 cmguiInit *
 loadExdata 
 loadExdataGroup *
 saveExdata
 splitExdata *
 loadImage
 unloadImage
 loadImageSet *
 visibleon
 visibleoff
 update_view
 trace
 checkImageSet *
 setDataGroups *
 digitiseSlices *

* = routines you may wish to call directly. Short example of usage:

  use CmUtils::Digitise qw( cmguiInit checkImageSet digitiseSlices );
  cmguiInit( 600,600 );
  
  $images = [ glob( "*.rgb" ) ];
  checkImageSet( $images );
  digitiseSlices( $images );

Global variables

  %settings

List of settings and global information.

      <key>       <default>   <description>
User settings:
      {view3d}    0         whether 3D window is used
      {keep_view} 0         keeps the closest viewpoint when changing frames
      {dynamic}   1         images loaded dynamically
      {max_load}  10        maximum number of images in memory
      {saveall}   undef     whether to save all datagroups to named file
Set by "setDataGroups":
      {datanames} { data => "green" }
                            list of names to digitise, and associated colours
      {datalist}  ["data"]  sorted list of names
Used internally:
      {current}   0         index of current image
      {previous}  0         index of previous image
      {loaded}    undef     list of last n viewed images (= number loaded)
      {dataindex} 0         index of current data name in {datalist}
      {combo}     undef     combo widget with list of images
      {toggle}    undef     toggle button for digitising

cmguiInit

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

Create a CMGUI 2d window of an appropriate size and also create five materials of different colours for use. Last 3 variables are optional, but if defined create a second window use for 3d viewing of all datapoints.

loadExdata

  &loadExdata( $image );

This routine loads the data points associated with a given image.

loadExdataGroup

  &loadExdataGroup( $filename, $images);

This routine loads all data groups in a given file, then destroys all groups not containing data points.

saveExdata

  &saveExdata( $image );

Saves exdata from current image.

splitExdata

  &splitExdata( $datafile, @groupnames );

Splits the exdata file $datafile into separate files for each specified groupname.

loadImage

  &loadImage( $image );

Load in a single image along with an exnode and an exelem file. This routine then textures the element with the image.

unloadImage

  &unloadImage( $image );

This routine unloads an image from memory, destroying material and texture.

loadImageSet

  &loadImageSet( $images );

This subroutine loops though an image list and calls loadImage for each image unless dynamically loaded, and loads all exdata.

visibleon

  &visibleon( $image(s), [$pattern] );

Turn the visibility on for all graphical elements that contain the string given by pattern.

visibleoff

  &visibleoff( $image(s), [$pattern] );

Turn the visibility off on all graphical elements that match the supplied pattern.

update_view

  &update_view( $images );

Update the 2D and 3D windows.

trace

  &trace( $images );

Set up the viewing window and clipping planes with the correct spacings so the digitised points lie on the correct slice. Start up the data point tool with the data creation options set.

checkImageSet

  &checkImageSet( $images );

Checks that the image set $images has all necessary information to load, and fills in default values for undefined keys. On input, $images must either be an array of hashes e.g

  foreach $f ( "image1", "image2" ) {
    push @{$images}, {name=>$f, filename=>$f, ext=>".rgb", glyph=>"cross"};
  }
  checkImageSet( $images );

or an array of filenames (with or without extensions) e.g.

  $images = [ glob "*.rgb" ];
  checkImageSet( $images );

Other modules including CmUtils::Digitise::VisibleHuman and CmUtils::Digitise::Echo have routines for easily creating the $images structure.

Returns $images as a hash structure:

    <key>       <default> <description>
    {name}                Basename of image
    {filename}  {name}    Image file name including directory (no ext)
    {ext}       {.rgb}    Image file extension (including '.' if needed)
    {imgtype}   undef     Required if no extension, or if different type needed
    {imgloaded} 0         If image is loaded into cmgui
    {visible2D} 0         If image is visible in 2D window
    {glyph}     "sphere"  Glyph used for drawing data on this image

setDataGroups

  &setDataGroups( @names_and_colours );

Sets new data groups. e.g. setDataGroups(qw(Epi red Endo blue));

digitiseSlices

  &digitiseSlices( $images );

This routine takes care of the digitisation book keeping. If image viewing is all that is needed then this is unnecessary although it is handy if you want to go backwards and forwards through the image stack.