David MacDonald's FAQ (Frequently Asked Questions)

This page is intended for internal users at the McConnell Brain Imaging Centre. It is a list of frequently asked questions (and answers with the same frequency) related to various projects I've have worked on at the BIC. To add questions and/or answers or correct existing ones, please send me email

David MacDonald (david@bic.mni.mcgill.ca)

Last updated: Dec. 14, 1998


List of FAQ


How do I Use Your Executables?

Most Perl scripts and IRIX 5.3 executables are in the directory ~david/public_bin. If you want executables that are compiled and therefore optimized for IRIX 6, look in ~david/public_bin/IRIX_6. The easiest thing to do is just type on the command line, or in your .login file:

set path = ($path ~david/public_bin)


How come none of your executables give ``-help'' messages?

Because most of them were written by me for my own purposes, and I knew that I could always look at the source to figure out how the programs worked. Only Display and register and ray_trace handle -help options. Most other executables will give a simple usage and description if invoked with no arguments.

How do I Automatically Create a Cortical Surface?

How do I Automatically Create Half a Brain?

There is a readme file, ~david/Surface_deformation/How_to_extract_cortical_surfaces.txt , that describes cortical surface extraction using the latest ``Double Hull'' algorithm. Be forewarned that this takes about 30 hours of CPU time on the Origin 200's.

How do I Colour Cortex with Curvatures?

Given an object such as a cortex, in a file called cortex.obj, the following commands will create a new file called coloured_cortex.obj

dump_curvatures cortex.obj tmp_curvatures.values 4

colour_object cortex.obj tmp_curvatures.values coloured_cortex.obj gray -50 25

The value 4 above is a smoothing parameter where higher values generate smoother curvature maps. The colour_object command colours the object in gray scale on a range of -50 to 25, which seem to give good results for curvatures.


How do I Create a Spherical or Ellipsoidal Flattening of the Cortex?

Any object created by the deformation software or which has a spherical topology (essentially anything that was not created by marching_cubes or the ExtractSurface menu of Display), can be mapped to a sphere or ellipsoid. Given an object such as a cortex, in a file called cortex.obj, the following commands will create a new file called sphere_with_curvature.obj

dump_curvatures cortex.obj tmp_curvatures.values 4

print_n_polygons cortex.obj

create_tetra sphere_with_curvature.obj 0 -15 20 65 75 55 81920

colour_object cortex.obj tmp_curvatures.values coloured_cortex.obj gray -50 25

Note that the value printed out by the second command, print_n_polygons, is used for the third command; in this example I've assumed that it prints out 81920. Also, the centre of the ellipsoid is 0 -15 20, and the radii are 65 75 55 which results in an ellipsoid positioned and sized to approximate the cortex in Talairach space. A unit sphere would be created by the command create_tetra 0 0 0 1 1 1 81920.


How do I Colour Cortex with Functional Activations?

This can be done entirely within Display, by loading both the functional volume (i.e. PET) and the cortex object:

Display pet_volume.mnc cortex.obj

Then perform the following:

Note that this proceedure applies the current colour coding parameters to the current object, and after you make any change to colour coding parameters, you have to hit the ColourCoding/ColourCodeObject button to cause the 3D object to be updated.


How do I Colour a Flattened Cortex with Functional Activations?

This cannot be done within Display, but is almost identical to the question: How do I Create a Spherical or Ellipsoidal Flattening of the Cortex? so read that question first, then do the following commands:

evaluate pet_volume.mnc cortex.obj tmp_values.values 4

print_n_polygons cortex.obj

create_tetra sphere_with_pet.obj 0 -15 20 65 75 55 81920

colour_object cortex.obj tmp_values.values coloured_cortex.obj spectral 1 6


How do I Crop Away Part of the Cortex and show MRI inside?

This can be done in 1 or 2 ways, both of which are complicated. I will explain method 1, how to do it within Display, and perhaps later will explain how to do it with Ray_trace. Within Display you can segment along planes, and create a pretty rough approximation to a cut-away view:

Display pet_volume.mnc cortex.obj


What is the format of these .obj files?

The .obj format is a simple format I devised to stored polygons, lines, and text. It has both an ascii and binary format, and the ascii format is described in
  • /nil/david/Source/BIC_PL/Documentation/polygons_format.txt
  • /nil/david/Source/BIC_PL/Documentation/lines_format.txt

    How to I convert .obj to ascii/binary?

    The following commands will convert a file to ascii, binary, or change to the opposite, respectively:

    ~/david/public_bin/ascii_binary input.obj output.obj ascii

    ~/david/public_bin/ascii_binary input.obj output.obj binary

    ~/david/public_bin/ascii_binary input.obj output.obj


    What other utilities are available?

    Documentation on various utilities written by many users are available in /usr/local/mni/doc/software_map