AudiLabFie: Fabrication d’imagerie extraordinaire


Table of contents

1. Introduction

Fie is a programme for various image-editing and related tasks. Its main purpose these days is for 3-D segmentation.

1.1 3-D segmentation

The drawing operations in Fie can be used to trace structure outlines in stacks of images. The outlines are maintained in text files suitable for subsequent surface triangulation using Tr3, for either visualization (VRML) or finite-element simulation.

The use of open contours (in addition to the usual closed contours) facilitates the controlled handling of complex structures with shared surfaces. An important feature is that one can specify that a line should start and/or finish at the start or finish of some other line. This provides a mechanism for specifying and ensuring topological continuity and integrity. This continuity is specified for a particular line within groups of slices, and is displayed graphically, so the user can visually verify connections. Since the connectivity often changes from slice to slice, a mechanism is provided to specify Joins across such divisions, and Caps can be defined to close the beginnings and ends of 3-D surfaces.

The alignment operations in Fie can be used to align histological serial sections for subsequent segmentation and 3-D reconstruction.

The .tr3 file produced by Fie contains specifications for visualization and mechanical properties together with the basic geometry, so complete models can be generated in one operation. Two different colours (an editing colour and a separate rendering colour) and a transparency can be specified for each line. Nodal boundary conditions (whether free or clamped) and applied pressure can be specified. Material properties for the 3-D surfaces can be specified for each line by reference to a list of material types, and specification of thickness.

A syntax is available for specifying the triangulation of subsets of a whole model, and for specifying different mesh resolutions for different parts of a model or for different versions of a model. Algorithms have been developed for resolving start-at/finish-at dependencies and detecting circular indeterminacy, and for detecting and removing duplicate nodes (essential to ensuring mechanical continuity for simulations).

Triangulated models are generated in both VRML format (for interactive visualization) and SAP format (for finite-element simulation). The VRML models include dynamic labels with two levels of granularity, one well suited for debugging and the other for teaching purposes.

1.2 Miscellaneous features

Additional features include:

1.3 Availability

Fie is implemented in Fortran. It was originally developed under VMS and later under Unix for Alpha. It is currently being developed under Debian GNU/Linux for x86 and x86_64, and (alas) under Microsoft Windows; the binaries are available for downloading below. It can be used for any purpose as long as I am informed of its use. So far there is no documentation beyond what you're looking at.

1.4 History

Fie has been evolving gradually since 1989, and I have added various features as I needed them for various projects. (The ‘F’ originally stood for Fancy or Fortran or Funnell, depending on the phase of the moon and other factors; these days maybe it would stand for Funky. The ‘IE’ stood for Image Editor. These days we don't use Fie much for image editing, but more for creating 3-D models, so I came up with Fabrication d'imagerie extraordinaire as a new excuse for the name Fie.)

1.5 Overview of documentation

Section 2 explains how to install the software. Section 3 gives some general information about the graphical user interface, file saving and automatic backups. Section 4 then presents the functions of every menu and submenu. Section 5 describes the detailed format of the .tr3 file produced by Fie; although much of the file is created and modified by Fie, there are some sections which still need to be created and edited directly by the user.

Section 6 presents an example to illustrate the use of Fie. Section 7 presents a history of changes to Fie.

[New] When new information is added to this documentation, it is flagged as [New]. You can find new items by using the Find feature of your Web browser to look for ‘[New]’. If you hover over the [New] indicator with the mouse, your Web browser will display the date when the item was added or modified.

2. Installation

2.1 Installation under Microsoft Windows

Either download the Fie executable for 32-bit Windows (about 1.5 Mbytes) or (if your computer is part of the McGill BME network) create a shortcut to the executable on probeShare. Follow the general instructions for installation of Dip software.

If you are using a copy of Fie installed on your local hard disk, then you must also provide the Glib library and two associated libraries. Download the following DLL files into the same directory that fie.exe is in:

These libraries are used by the snake feature. Further information about these libraries (including their source code) can be found at the GTK+ Web site.

Fie has been used with MS Windows 95, 98, NT, 2000, XP and Vista.

2.2 Installation under GNU/Linux

If your computer is part of the McGill BME network, create a symbolic link (ln -s) to the executable on probeShare. Otherwise download the Fie executable from here and do chmod u+x fie to make it executable.

Follow the general instructions for installation of Dip software.

3. User interface

3.1 Layout

Interface

Fie has a menu-based graphical user interface. The interface is identical under different operating systems. As shown at right, the interface consists of

3.2 Menus

See the Dip documentation for a general discussion of how to use the menus. Note that every menu button has a shortcut key, indicated by underlining in the button label.

In some cases when a menu is displayed in Fie, you can either click on one of the menu items or click in one of the image windows. For example, when selecting a line for some purpose, you can either click on the appropriate button in the menu or click near the line within either the main image window or the overview window.

3.3 Versions of files

When Fie saves a file, if a file already exists with the same name then the old file is renamed by adding a version number. The version number is of the form #n# and is appended to the file name. For example, if three versions of the file test.tr3 exist, called test.tr3#1#, test.tr3#2# and test.tr3, when a new version is saved it will be called test.tr3 and the previous version will be renamed to test.tr3#3#. If you ever need to recover an older version, just use your operating system to delete the later version (or rename it to something else if you're not sure) and then rename the version you want by removing the version number.

3.4 Automatic backups

As you are doing Draw operations (or Tailor ▶ Align operations) Fie will automatically back up the .tr3 file from time to time. The backup is done to a file called fie_tr3.tmp in your HOME directory. If something goes wrong during a session (e.g., Fie crashes or your computer crashes), or you accidentally quit without saving your latest changes, you can recover the contents of the last automatic backup:

  1. Move (or copy) the file fie_tr3.tmp from your HOME directory to the directory where your .tr3 file normally resides.
  2. Rename the last .tr3 file to something else.
  3. Rename fie_tr3.tmp to have the name of your normal .tr3 file.

The frequency with which automatic backups are done can be controlled by the Autobackup frequency item in the settings menu (which is available from within several menus). Specify how many interactive operations you want to have happen between backups.

4. Menus

The following summarizes the functionality of Fie, organised according to the items on the top-level menu (shown at right).

File includes file opening, saving, etc.

Set includes a number of settings. Other than font size, the important ones for most current uses are included at various places under Draw.

Focus allows the specification of focus regions for operations like filtering and statistics. Filter includes various image-processing operations.

Filter provides a number of image filters.

Paint provides some simple pixel-painting operations.

Draw provides a sophisticated set of drawing and segmentation operations.

Stats provides various kinds of statistics for pixels and clusters of pixels.

Tailor provides a number of image operations like resizing, reshaping, distortion removal and alignment.

Combine produces a combination image by combining selected images from a stack of images, using either average or maximum pixel values.

Surface generates a 3-D surface from a stack of images using a user-specified threshold and a marching-tetrahedra algorithm. The surface is output as a VRML file.

Quit just quits, after checking for any unsaved modifications, and with saving of session settings.

Note that all of the contour-tracing things are located under Draw, and the alignment tools for stacks of histological images are under Tailor.

4.1 File

4.1.1 Open

Fie can read in several different types of files, as described in the following subsections. When Open is selected from the File menu, Fie will display a list of recently opened files (if any). If the desired file appears on that list, select it. If not (or if no such list is available) click on Other or use the + shortcut key. Fie will then display a list of the subdirectories and files within some starting directory. (The particular starting directory used may depend on which files have been opened recently, on whether the HOME environment variable is defined, and on the phase of the moon.) Browse to find the file to be opened and click on it.

Currently (for historical reasons) Fie handles JPEG images differently from the way it handles other types of images. JPEG images can be handled only by opening a .tr3 file which includes a list of a set of JPEG images. For other types of images, open the image file itself; Fie will then automatically open the corresponding .tr3 file if it finds one with the same name as the image file.

For new datasets that we create ourselves, the format of choice is JPEG. It provides greater image compression and more flexibility.

4.1.1.1 JPEG (.jpg)

Fie can read both grey-scale and colour JPEG images. A 3-D stack consists of a set of image files, one image for each slice.

The images in a stack must all have the same numbers of rows and columns of pixels.

The usual practice is to have all of the image files in a subdirectory of the directory where the .tr3 file is. The name of that subdirectory, and the names of the image files, are specified in the SLICES section of the .tr3 file.

4.1.1.2 TIFF (.tif)

Fie can read several types of TIFF-encoded images: 8-bit grey-level or paletted, and 24-bit RGB, either uncompressed or with run-length-encoding compression.

A 3-D stack of TIFF-encoded images must be stored in a single multi-image TIFF file. The images must all have the same numbers of rows and columns of pixels, and must all be of the same type.

If the file name.tif is opened, then Fie will look for a file name.tr3 in the same directory, and open it if found.

4.1.1.3 Raw byte stream (.raw)

Fie can read images, or stacks of images, stored as raw byte streams.

If the file name.raw is opened, then Fie will look for a file name.fie in the same directory. This is an auxiliary plain-text file which provides the image size and other characteristics. It contains lines with the following syntax:

NPIXH nh nh = no. pixels horizontally
NPIXV nv nv = no. pixels vertically
NSLICE ns ns = no. slices in image stack
NBITS nb [nbu [{SWAP|NOSWAP}]] nb = no. bits/pixel = 8 or 16. If nb=16, then nbu = no. bits actually used/pixel = 8 or 16; and byte order is specified as either SWAP or NOSWAP. Default no. bits/pixel = 8. If no. bits/pixel = 16, default no. bits used/pixel = 16 and default byte order = NOSWAP.
TYPE t t = image type: GREY or RGB. Default = grey.

Any line which starts with a semicolon is interpreted as a comment.

Example. A stack of 8-bit grey images might have this .fie file:

;15516.fie
NPIXH 228
NPIXV 186
NSLICE 168
NBITS 8
TYPE GREY

If no .fie file is found, Fie will query the user for the image characteristics.

Fie will also look for a file name.tr3 in the same directory, and open it if found.

4.1.1.4 Density files (.den)

These are grey-level files as used in VolPack. The .den file format includes a header which specifies, among other things, the numbers of rows, columns and slices.

If the file name.den is opened, then Fie will look for a file name.tr3 in the same directory, and open it if found.

4.1.2 New

Fie can generate test images or new .tr3 files.

4.1.2.1 Image

Fie can generate test images and image stacks with user-specified size and various contents:

4.1.2.2 Tr3

Fie can generate a new .tr3 file corresponding to an existing set of .jpg files. It will first ask to confirm that you have such a set of files. If you answer Yes, it will ask you to select the first file in the set, and then to select the last file in the set. All the files must be in the same directory. Fie assumes that the filenames of every file in the set consist of the same text followed by a sequence number (with leading zeros if required), e.g., cat01.jpg, cat02.jpg, … cat20.jpg. It asks what increment to use for the sequence numbers; the default is 1, but you could specify, e.g., 2 if you only wanted to use every second image, or if you only had cat02.jpg, cat04.jpg, etc.

Fie will then ask for the file path and name to use for the new .tr3 file. It will offer a default path and name based on the path and names of the image files.

Fie will then ask for the z coördinate to use for the first slice, and for the z spacing between slices. It will then ask for the x-y pixel size, which should be measured in the same units as the z coördinates. If you don't know the actual dimensions at this point, you can just accept the defaults and then adjust things later.

Finally, Fie will ask for your initials and a line of comment, and create the new .tr3 file. The file can now be opened using File ▶ Open.

4.1.3 Import

4.1.3.1 SurfDriver

Fie can import contours traced by SurfDriver. The contours must first have been Exported from SurfDriver to .txt files, and the corresponding set of .bmp files used by SurfDriver must have been combined into an image stack (TIFF, raw or .den).

To import the contours, first use File ▶ Open to open the image stack. Then do File ▶ Import. You will then be asked for

You will then be asked to specify one or more .txt files. For each file you will be asked to specify a short Prefix text string to be used (combined with sequence numbers) in forming the contour names in Fie. Once the contours have been imported, you can use Edit attributes to change their attributes from the defaults assigned by Import.
4.1.3.2 MRP
0 13502 27000
[landmarks]

[nodes]
2.0781 2.3786 1.9818
2.0789 2.3786 1.9924
2.0753 2.3647 1.
…
2.4724 2.9489 2.3444
2.468 2.9474 2.3474
2.4756 2.9458 2.3422

[surface]
1 2 3
1 3 4
5 6 7
5 7 8
…
  

Fie can import .mrp files. This is a rather primitive surface-definition file format; an extract from an example file is shown on the right. Fie assumes that an image-stack file is available; the stack should be opened before doing the import. Landmarks are ignored. It is assumed that nodes come before triangles.

4.1.4 Save

Fie can save data in various formats:

See the descriptions above in the Open section for more details about some of the file formats.

When using Fie to do image segmentation, the only file that needs to be saved is the .tr3 file. The images themselves are not modified.

Saving a stack of images is a convenient way of converting the images to a different format, e.g., converting a TIFF or raw image stack to a set of JPEG images. When a stack of images is saved, they will not include any changes made to them within Fie.

4.2 Set

4.2.1 Palette

Choose from several palette options. For 3-D segmentation, the Grey palette is the usual choice.

For grey-scale images, the palette controls how the grey levels are displayed, possibly with colour. Normally one would choose either a grey-level palette (possibly specifying a gamma and thresholds) or a false-colour palette.

For full-colour (3 bytes/pixel, RGB) images, the grey-level mapping defined by the palette is applied to any pixel which is a shade of grey, i.e., for which the red, green and blue values are the same.

For paletted images (1 byte/pixel colour) the selected palette controls the mapping from the single-byte pixel value to colour. Currently this applies only to TIFF images which are paletted; such an image will set up its palette when it is read in.

4.2.1.1 Grey

grey-level palette, gamma = 1.0 The grey-level palette controls the mapping of 8-bit pixel values to displayed grey levels or colours. A submenu and thumbwheel are provided for adjusting the black level, white level, gamma, low (blue) threshold and high (yellow) threshold. The default palette just maps pixel values of 0-255 linearly to the same range of greys.

Black allows adjustment of the pixel value below which all values are displayed as completely black. By default the black level is 0.

White allows adjustment of the pixel value above which all values are displayed as completely white. By default the white level is 255 (i.e., the maximum pixel value).

grey-level palette, gamma = 0.5 grey-level palette, gamma = 1.5
γ=0.5 γ=1.5
Gamma is the exponent of a non-linear mapping from pixel value (v) to grey level (g): g = vγ. The default value of gamma (γ) is 1.0, corresponding to a linear mapping. Adjusting γ is sometimes useful to enhance contrast in grey-scale images. These examples show the grey-level palette with γ = 0.5 and 1.5.

Blue and Yellow correspond to two thresholds. Pixels are set to shades of blue if their values are less than the first threshold, and to shades of yellow if their grey-level values are greater than the second threshold. Such thresholds can be used to assist segmentation. The sample image shown here has the thresholds set to differentiate among bone, soft tissue and no tissue. As here, the distinction will generally be only approximate and in itself cannot provide accurate segmentation.

4.2.1.2 False colour
false-colour palette

False-colour palette ranging from black through blue, green and yellow to white. This palette provides monotonically increasing brightness. It can be used to enhance visual contrast and to make images prettier.

4.2.1.3 3-3-2
3-3-2 palette

RGB encoded with 3, 3 and 2 bits, respectively

4.2.1.4 5-6-5
5-6-5 palette

RGB encoded with ranges of 0 to 5, 6 and 5, respectively

4.2.1.5 RGB-CMY
rgb-cmy palette

Palette starting with black and white; then saturated red, green, blue, cyan, magenta and yellow; then six unsaturated colours having combinations of 0, 0.5 and 1 for r, g and b; then two greys; then 30 shades each for grey, red, green, blue, cyan, magenta, yellow and orange

4.2.1.6 B & w

Black and white

4.2.1.7 TIFF

Uses palette embedded in TIFF image (if any).

4.2.2 Pen

Pen size and shape for painting. Partially broken and not used much these days.

4.2.3 Font

Font size (an integer) used in the interface.

4.2.4 Image

Which image from a stack of images.

Normally adjusted using the New image function within Draw.

4.2.5 Replication

Same as Zoom.

4.2.6 Region of interest

Specify whether certain operations are to be applied to all of the image, to the visible part of the image, or to specified foci.

4.2.7 Window size

Set size of main image window (currently broken)

4.2.8 Watch

Sets or unsets watch mode for watching the progress of certain operations.

4.2.9 Indirect input

Allows user to specify the name of a command file for executing scripts (currently broken)

4.3 Focus

Specify various regions of ‘focus’, which can be used to restrict the part(s) of the image involved in other operations

4.4 Filter

Apply various filtering operations

4.5 Paint

Paint things into the image, actually changing the pixels. this is here for historical reasons, and for playing with algorithms, and isn't really very useful at the moment.

4.6 Draw

Draw menu

4.6.1 Introduction

Draw things ‘over’ the image, not actually changing the pixel values in the underlying image. In addition to the windows described above, two additional windows appear. They are used for displaying side views of either the stack of images or (as shown on the right) the lines used to segment the images.

In Draw mode a scale bar is displayed in the main image window. The units used for this scale bar are specified in the XY_CALC command.

The image on the left shows how lines are displayed when not being edited. Their colours, the line thickness and the symbol sizes can all be controlled by the user. The first point of a line is indicated by a triangle pointing to the right and the last point of a line is indicated by a triangle pointing to the left . First and last points of lines which start at or finish at the ends of other lines are displayed as right-pointing and left-pointing 3-pointed stars (like dehydrated triangles). Other points are shown as squares. Connections due to start-at/finish-at commands are shown as thinner lines.

The image on the right shows how lines are displayed when being edited. All lines in the current slice are green, except for the currently active segment which is red. Lines in the previous slice are shown as thin blue lines; those in the next slice are shown as thin magenta lines. The user can control whether all lines in the previous and following slices are shown, or just the currently active line, or none at all.

The rest of this section describes the various items in the Draw menu.

4.6.2 Zoom image

Zoom in or out by factors of two, or specify an integer zoom factor. Zoom factors ≥ 1 correspond to magnifications. Negative zoom factors ≤ −1 correspond to reductions; e.g., −2 corresponds to a magnification of ½.

As seen in the examples above, when zoomed in, the original pixels are shown enlarged (rather than smoothly interpolated) so one doesn't lose sight of the resolution limitations of the data.

4.6.3 Pan image

If the image is larger than the displayed area, shift the display window by clicking in either the overview window or the main image window, at the point that you'd like to have centred in the display window.

One can also recentre the displayed area by right-clicking in the overview window when the main Draw menu is active, but not when the Draw ▶ Edit lines menu is active.

4.6.4 New image

A 7-button navigation menu pops up, allowing selection of a new image from the stack of images.

4.6.5 Settings

Set various parameters. Many of the parameters are optionally stored in a session-settings files when the user exits from the programme. The file is used to restore the settings when the programme is run again.


4.6.6 Show lines

This button can be used to quickly toggle on or off the display of lines in the main image window.

4.6.7 Copy lines

Copy lines to an internal clipboard

4.6.8 Paste lines

Paste lines from internal clipboard

4.6.9 Edit attributes

Use this function to edit the attributes of either lines or slices.

4.6.9.1 Edit line attributes

You can choose to edit the attributes of either a single line or multiple lines.

If you choose to edit the attributes for a single line, a menu will appear which permits selection of one line. After you select the line, a menu will appear in which each button displays the current value of an attribute. Click on the appropriate button to change an attribute. Clicking on Copy attributes from another line will allow you to select some other line from which all attributes (except the name) will be copied to the line whose attributes are being edited. For some attributes (e.g., Open/Closed, Interpolation, Boundary conditions), a menu will appear for selecting the new attribute value. For most other attributes a simple text prompt will appear asking for the new value.

If you choose to edit the attributes for multiple lines, a menu will appear which permits selection of the lines to be affected. After you select some lines, a menu will appear for editing only those attributes which can sensibly be applied to multiple lines. The attribute values will be preset to those for the first of the selected lines. The only attributes whose values will be transferred to the multiple lines are those whose menu buttons you use (whether or not you actually change their values).

4.6.9.1.1 Colour

For the Colour attribute, a colour-selection tool will appear. Find and click on the desired editing colour (the colour used within Fie), then click outside the tool to make the selection. The colour-selection tool will then appear again, this time for selecting the rendering colour (the colour used for the 3-D models produced by Tr3).

4.6.9.1.2 Start-at and Finish-at attributes

For the start-at and finish-at attributes, each of the two menu buttons displays the word Dependent if there are any such conditions, and how many there are; or the word Independent if there are none. Clicking on the button causes a menu to be presented which displays the current start-at or finish-at specifications, and a A (new) button which can be used to create a new start-at or finish-at specification with default settings. Clicking on the button for an existing specification causes a menu to appear which displays the current settings. For example, the menu shown on the right corresponds to a connection to the finish-of the line wallextfr_001. The first four buttons indicate that the specification should be applied to the range –∞ < z ≤ 5. Clicking on button A or D permits specification of a new z value. Clicking on button B or C toggles between < and . Clicking on button E offers a choice of Start, Finish or Nearest. The Up and Down buttons move the current start-at or finish-at specification up or down in the original list; the specifications should be arranged in order of increasing z. The Delete button causes the current specification to be deleted.

4.6.9.2 Edit slice attributes

Choose whether to edit the attributes for one slice at a time, or for a range of slices: the current slice and all preceding ones, the current slice and all following ones, or all slices. If one slice at a time, the usual slice-choosing tool appears - use the tool to position yourself to the desired slice and then click outside the tool to make the selection. You will then be prompted for new attribute values for the slice: z value, slice name, rotation, and x and y offsets. The slice-choosing tool then appears again; either select a new slice, or select the same slice to quit.

If editing attributes for a range of slices, the values requested are a z scale factor and a z shift.

4.6.10 Edit joins

The editing of Joins is not yet documented.

4.6.11 Edit caps

The editing of Caps is not yet documented.

4.6.12 Add line

Add a new line to this image. You can either use an existing line definition or add a new one; you can then use the following functions to specify the new line:

For lines which are small and/or difficult, the line is best specified manually point by point.

For long stretches of clear boundaries, the autotrace function works well. It continues until it runs into the edge of the visible image, or until it runs into itself, or until it has generated too many points. Usually it will go too far, and it may also run off course. In either case the trim function can be used to cut off the unwanted part, and then the line tracing can be continued.

For closed regions with clear boundaries, the flood function works well.

The manual and automatic tracing methods can be mixed in any order, although the flood method is normally used by itself, and will overwrite any previous tracing.

The median-filter and smooth operations are particularly useful after the flood and autotrace functions, which tend to produce jagged curves and many more points that are required. The snake method of fitting (Edit linesLines ...Fit line using snake) may also be useful after tracing here.

The 2×/5×/10× resample function may be useful to add smoothly interpolated points after a few points have been specified manually.

4.6.13 Edit lines

Edit the existing lines in this image. Left-clicking within the image selects the closest point to be the active point. Right-clicking within the image repositions the currently active point.

4.6.14 Delete lines

Delete some or all of the lines in some or all slices.

4.6.15 Locate line

Determine which slices a particular line occurs in. If a line never appears and is never referenced, it can be marked for deletion.

4.6.16 Modify lines

Some functions repeated from Edit lines ▶ Line …

4.6.17 Transform z's

Apply scale factor and offset

4.6.18 Mark voxels

Reslice

An image stack is resliced perpendicular to the original plane of section, and x-z and z-y views are displayed. The side views are slices through a user-specified point. The user can select that point by right-clicking in any of the three image windows, or by using the menu.

Voxels can be ‘marked’, in which case they will be displayed in a distinctive colour. Once you exit from the Reslice mode the marked voxels can continue to be displayed in the main image window. One use for this is to help with the segmentation of structures which are difficult to visualise in the x-y images. Another use of this feature is to mark particular voxels for display as blocks in the VRML models produced by Tr3.

The remainder of this section explains the use of the menu.

4.7 Stats

Calculate density histograms

4.8 Tailor

4.9 Quit

5. Model-definition file

5.1 Introduction

The model definitions created by Fie are stored in plain-text files with the filename extension .tr3. These files are used by the Tr3 programme to create VRML and finite-element models.

A .tr3 file may contain the following sections:

Section END?* Notes
Comments No Any line starting with a semicolon is interpreted as a comment. Only the comments at the beginning of the file, before the first non-comment line, are preserved when Fie (or Tr3) saves a new version of the file. Whenever Fie (or Tr3) saves a revised version of the file, the user is asked for initials and a comment, which are added (with the current date) to the end of the initial comments.
LINES Yes See Lines
SCALE No See Scaling
XY_CALC No See Scaling
Z_CALC No See Scaling
SLICES Yes See Slices
JOINS Yes See Joins
CAPS Yes See Caps
SUBSETS Yes See Subsets
VOLUMES Yes See Volumes
MATERIALS Yes See Material properties
SPRINGS Yes See Springs
CONC_LOADS Yes See Concentrated loads
LABELS Yes See Labels
VIEWPOINTS Yes See Viewpoints
DATA Yes The actual x and y coördinates of lines are stored in this section.
COSTS Yes Used by Tr3 to record cost functions chosen by user for triangulation. Normally not directly modified by the user.
GLOBAL_RANGES   Obsolete
MERGES   Obsolete

*Whether section must be terminated by END record.

In the syntax specifications here, square brackets ([ ]) denote optional elements and { | } denotes alternative values. Roman (upright) characters denote actual strings to be used, while italic (slanted) characters denote values to be chosen by the user.

5.2 Lines

Within the LINES section of a .tr3 file, the syntax for a line definition is:

name: [qualifiers] descriptive_text

The possible qualifiers are:

-openclosed { OPEN | CLOSED }
-on  
-off  
-reverse  
-do_slices { ALL | FIRST | LAST }
-colour ecolour[;rcolour]
-transparency transp
-boundary_condition {F | C[{S|F|B}[{F|L|B}]]}
-pressure press
-material itype
-thickness thick
-mtt itype thick [deprecated]
-m itype thick [deprecated]
-xyresolution ires_xy
-zresolution ires_z
-resolution ires_xy ires_z [deprecated]
-linetype { STRAIGHT | BEZIER | ELLIPTICAL }
-start [([[=]zmin][, [=]zmax])] {START|FINISH|NEAREST} line_name
-finish [([[=]zmin][, [=]zmax])] {START|FINISH|NEAREST} line_name
-url URL

The attributes are discussed in more detail below. All qualifier names may be abbreviated to any unambiguous degree. In fact, they can all be abbreviated to a single character except -openclosed, -on and -off, which require at least two characters.

5.2.1 Basic attributes

5.2.2 Model-creation attributes

5.2.3 Visualization-related attributes

5.2.4 Simulation-related attributes

5.2.5 Examples

incus1: -op CL -c yellow;bone -r 100 1 -m 1 .04 ;Incus top
Example incus1 demonstrates a closed line which will be shown as yellow in Fie and rendered as bone coloured in the 3-D models; which is to be triangulated using every slice at 100 elements/diameter; and which consists of material type 1 with a thickness of 0.04.

tm_inf: -op OP -c green;white -t .5 -r 50 2 -m 4 .001 -s f annlig -f s manub ;TM
Example tm_inf demonstrates an open line which will be shown as green in Fie, but in the VRML model as translucent white with a transparency of 0.5; it is to be triangulated using only every second slice at 50 elements/diameter; it consists of material type 4 with a thickness of 0.001; and it starts at the finish of line annlig and finishes at the start of line manub.

5.3 Slices

The first line of the SLICES section may be of the form

IMAGE_PATH path

path can be used to specify where to find the image files if they are not in the same directory as the .tr3 file. It will be prefixed to the image names before the path of the .tr3 file is prefixed, so it will specify a path relative to the path of the .tr3 file. (Neither the image-path name nor the path of the .tr3 file will be used if the image name itself contains a path specification.) The image-path name should not include leading or trailing path delimiters; it will be system independent if it does not include any path delimiters, i.e., it specifies only a single directory name. This path is used only when there is a separate image file for each slice. The usual method is to put all of the image files into a subdirectory of the directory where the .tr3 file is, and then give the subdirectory name as the path.

The rest of the SLICES section consists of records of the form

i, name, [z, [rotate, offsetx, offsety]]

There should be one record for each image (slice). i is the slice sequence number. name is a descriptive name for the slice (or an actual file name when the slices are stored as separate files). z is the z coördinate for the slice. rotate, offsetx and offsety optionally specify the offset and orientation required to align the image with the rest of the stack (usually for histological images).

5.4 Joins

As a structure subdivides from slice to slice, or becomes connected to other structures, multiple line names must be used for the same structure. The Join mechanism is provided to specify how triangulation should be done across such changes of line name. The syntax for Joins allows concatenation of multiple lines; forward or backward traversal of lines; and incorporation of only the first or last point of a line. The syntax permits transitions between Closed and Open lines. Joins can either inherit properties from the lines which constitute them, or take on new properties.

Within the JOINS section of a .tr3 file, the syntax for a Join definition is:

name: [qualifiers] [-]i1[{>|<}] [-]i2[{>|<}] … to [-]j1[{>|<}] [-]j2[{>|<}] … [;description]

i1, i2, etc., are the names of the lines to be concatenated in order to form multiline 1. j1, j2, etc., are the names of the lines to be concatenated in order to form multiline 2. A surface is triangulated between multiline 1 and multiline 2.

A minus sign (-) before a line name means that that line is to be traversed backwards when being concatenated to its multiline.

The symbol > after a line name means that only the first node of that line is used. The symbol < after a line name means that only the last node of that line is used.

The following attributes (qualifiers) can be defined for Joins. Their meanings are the same as for line attributes.

Attributes which are not explicitly specified for the Join are inherited from the first component of its multiline 1.

Example. If you had a structure defined by two open lines, bone_ant_50 and bone_post_50, from slices 50 to 79, and then at slice 80 they combined into a single closed line, bone_80, you could define the join between them as

bone_50: bone_ant_50 bone_post_50 to bone_80 ;Bone

If you wanted to specify a distinctive colour for the triangles corresponding to the join, you could use, for example,

bone_50: -c red bone_ant_50 bone_post_50 to bone_80 ;Bone

5.5 Caps

Within the CAPS section of a .tr3 file, the syntax for a Cap definition is:

name: {HEAD|TAIL} [qualifiers] [-]i1[{>|<}] [-]i2[{>|<}] … [;description]

HEAD means that the cap is to created at the first slice for which all of the component lines are present. TAIL means that the cap is to created at the last slice for which all of the component lines are present.

i1, i2, etc., are the names of the lines to be concatenated in order to form the cap. A flat surface is triangulated within the resulting multiline.

A minus sign (-) before a line name means that that line is to be traversed backwards when being concatenated to the multiline.

The symbol > after a line name means that only the first node of that line is used. The symbol < after a line name means that only the last node of that line is used.

The following attributes (qualifiers) can be defined for Caps. Their meanings are the same as for line attributes.

Attributes which are not explicitly specified for the Cap are inherited from the first component of its multiline.

Example. If you had a structure defined by two open lines, bone_ant_50 and bone_post_50, from slices 50 to 79, you could a define a cap at slice 50 as

bone: HEAD bone_ant_50 bone_post_50 ;Bone
or a cap at slice 79 as
bone: TAIL bone_ant_50 bone_post_50 ;Bone

5.6 Volumes

The syntax for the VOLUMES section of a .tr3 file is the following:

VOLUMES
volname1
[-]i1[{>|<}] [-]i2[{>|<}] …
[-]i1[{>|<}] [-]i2[{>|<}] …
End of volume
volname2
[-]i1[{>|<}] [-]i2[{>|<}] …
[-]i1[{>|<}] [-]i2[{>|<}] …
End of volume
End of volumes

i1, i2, etc., are the names of the lines to be concatenated in order to form a closed multiline. These closed multilines should be specified in the order in which they are encountered in processing from the first slice to the last.

The syntax for specifying a multiline is the same as for Joins and Caps. A minus sign (-) before a line name means that that line is to be traversed backwards when being concatenated to the multiline. The symbol > after a line name means that only the first node of that line is used; the symbol < after a line name means that only the last node of that line is used.

The purpose of this section is to produce surface model definitions suitable for use by volume-mesh generators. This section has essentially been superseded by the use of the Volume qualifier for subsets.

5.7 Subsets

The syntax of the SUBSETS section of a .tr3 file is the following:

SUBSETS
subsetname1 [VOLUME] [MIRROR]
subsetrecord1a
subsetrecord1b
End of subset
subsetname2 [VOLUME] [MIRROR]
subsetrecord2a
subsetrecord2b
End of subset
End of subsets

The optional VOLUME qualifier is intended to result in the output of the model in file formats for use by volume-mesh generators. (Currently no such formats are output because a separate application, sap2gmsh, is used to convert .sap files to Gmsh format.) This qualifier should be used only for a subset which defines a single, simple closed surface.

The optional MIRROR qualifier causes the model to be flipped to become a mirror image: the z coördinates are all multiplied by –1 and the node numbering is reversed in each triangle.

The syntax for each subset record is one of the following:

linename: [qualifiers] descriptive_text
(cap) capname: [qualifiers] descriptive_text
(join) joinname: [qualifiers] descriptive_text
(vol) volname: { -on | -off }
(clip) { xmin val | xmax val | xrange val1 val2 | ymin val | ymax val | yrange val1 val2 | zmin val | zmax val | zrange val1 val2 }
(rot) θx θy θz
(tran) tx ty tz
@[-]subsetname
SUBSETS
SUBSET Bone
*: -off
bone*: -on -c red
(join) bone1: -off
(join) bone2: -on
End of subset
End of subsets

Each line, cap and join name field can contain any number of (*) or ? wildcard characters. The * matches any number of characters, including zero characters, and the ? matches exactly one character. For example, inc?_*med_* would match incA_antmed_050, incB_postmed_100, etc.

Any of the line, cap and join attributes which are specified here will over-ride those specified in the original line, cap and join definitions.

The (vol) lines are used to turn specified volumes on or off.

The (clip) line is used to exclude ranges of x and y, or slices based on their z values, from the 3-D model. For example, (clip) zmin 5. would cause all slices with z less than 5. to be dropped; (clip) zmax 10. would cause all slices with z greater than 10. to be dropped; and (clip) zrange 5. 10. would result in keeping only slices with 5. ≤ z ≤ 10.

The (rot) and (tran) lines are used to apply specified rotations and translations to the overall model.

The @ line is used to include another subset within this subset. Subsets can be nested to any depth; that is, the included subset can itself include other subsets. The optional - (minus sign) can be used to reverse the numbering of all of the triangles in the included subset.

The usual practice is to begin each subset definition with *: -off (i.e., turn off all lines) and then turn on the desired lines, turn caps and joins on or off as required, etc. When some other subset is included using an @ line, the *: -off line of the included subset is ignored (to avoid turning off the lines that have already been turned on in the subset requesting the inclusion).

As an example, the SUBSET definition shown at the right would suppress all lines and then reactivate (and turn red) all those whose names start with ‘bone’. It would also turn off Join bone1 and replace it with join bone2 (which presumably would initially have been defined with -off.

5.8 Material properties

Within the MATERIALS section of a .tr3 file, the syntax for a record is:

nmat ym pr den descriptive_text

nmat is a sequence number for the material type, normally starting at 1 and incremented for each material type. ym is the Young's modulus, pr is Poisson's ratio, and den is the mass density of the material. The value of Young's modulus may be expressed with a metric suffix, e.g., 2G or 2.G for 2 GPa, or 1.5M for 1.5 MPa.

Everything after the density value is taken as descriptive text.

If no material properties are defined, then no .sap finite-element model will be generated by Tr3.

5.9 Springs

Within the SPRINGS section of a .tr3 file, the syntax for a record is:

{D|R} stiffness [-]line0(n0) [-]line1(n1) … [[-]line4(n4)]

If the first item in the spring definition is D then the spring is a translational one (e.g., N/m); if it's an R then the spring is a rotational one (e.g., N/rad). stiffness is the actual stiffness of the spring.

The spring will be attached to the model at the first node of line line0 in slice n0, or at its last node if the line name is preceded by a minus sign.

The direction of the spring is determined by the position(s) of from 1 to 4 other nodes, each of which is specified using the same syntax as node 0. The following table describes how the direction of the spring is determined. The notation Vmn indicates a vector from node m to node n.

No. other nodes Direction of spring
1 parallel to V01
2 parallel to V12
3 perpendicular to the plane formed by V12 and V13
4 perpendicular to the plane formed by V12 and V34

Note that the length of the spring is immaterial.

5.10 Concentrated loads

Within the CONC_LOADS section of a .tr3 file, the syntax for a record is:

{F|M} load [-]line0(n0) [-]line1(n1) … [[-]line4(n4)]

If the first item in the concentrated-load definition is F then the load is a force (e.g., N); if it's an M then the load is a moment (torque, e.g., N m). load is the actual value of the load.

The load will be applied to the model at the first node of line line0 in slice n0, or at its last node if the line name is preceded by a minus sign.

The direction of the load is determined in the same way as for springs.

5.11 Labels

Within the LABELS section of a .tr3 file, the syntax for a record is:

label_text [-size size] [-colour colour] [-family family] [-]line0(n0) [[-]line1(n1)]

label_text is the text that will be displayed as the label. If the text contains any space characters, it should be enclosed in double quotation marks, e.g., "Label 1".

size is the font size used for the label, measured in the same units as the model. If unspecified, the default value is 1.

colour is the colour used for the text of the label, specified by name. If unspecified, the default value depends on the browser. The colour names available are the same as those offered by menu as line, join and cap colours.

family specifies the font family to be used for the label. It can specify the name of any font on the user's computer, but the only values guaranteed to work are the generic values SERIF, SANS and TYPEWRITER. If unspecified, the default value is SERIF.

The label will be attached to the model at the first node of line line0 in slice n0, or at its last node if the line name is preceded by a minus sign.

5.12 Viewpoints

Within the VIEWPOINTS section of a .tr3 file, the syntax for a record is one of the following:

name XYZ rotx roty rotz description
name AA posx posy posz axisx axisy axisz angle description
(reldist) relative_distance

The xyz option defines a viewpoint corresponding to what one sees in Fad after the specified x, y and z rotations (in that order). In other words, one can use the rotation angles displayed in Fad in order to re-create a view from the same direction. If one is starting from an orientation in Thrup’ny, one can use View ▶ Display current orientation to display the rotation angles, apply them in the order z, y and x in Fad using the interactive rotation tool, and then use the angles displayed by Fad.

The aa option defines a viewpoint using the same method used by VRML itself. The required parameters can be determined by requesting Tr3 to include code in the VRML file which causes the current position (posx posy posz) and orientation (axisx axisy axisz angle) of the viewpoint to be continuously displayed.

Whether or not any viewpoints are defined in the .tr3 file, six standard viewpoints are generated, in both directions along each of the x, y and z axes.

A (reldist) line defines the relative distance from the centre of the model to any xyz-type viewpoint and to the six standard viewpoints along the axes. The actual distance is the relative distance multiplied by an estimate of the size of the model. The default value for the relative distance is 2.

5.13 Scaling

Fie needs to handle two different ways of thinking about x, y and z coördinates. On the one hand, line nodes need to be positioned with respect to pixel positions (columns and rows) within images and with respect to slice numbers within a stack of images. On the other hand, the x, y and z coördinates of the final model normally need to be expressed in real-world coördinates, e.g., millimetres.

There are two ways to manage Fie's scaling between the real-world x and y coördinates of a model and the row and column pixel positions:

  1. store x, y and z coördinates internally as real-world coördinates and use XY_CALC parameters (below) to map the real-world coördinates to pixel positions when displaying lines within images; or
  2. store x and y coördinates internally in units of pixels, and z coördinates as multiples of the pixel size, and use SCALE parameters (below) to convert to real-world coördinates when creating the final triangulated models.
If the x and y coördinates are not expressed in the same units as the z coördinates, then the side views of the traced contours will not be scaled properly.

There is also a set of Z_CALC parameters (below) which is concerned with mapping between z coördinates and slice numbers.

5.13.1 XY_CALC

XY_CALC
[-u unitux [uy [ox [oy]]]

ux and uy are scaling parameters (in units/pixel). ox and oy are offsets (in pixels). These parameters are used by Fie to transform real-world x and y coördinates in the .tr3 file to match the images. The z coördinates of the slices are assumed to be given using the same real-world coördinates.

The directive XY_CALC is on one line and the parameter values are on the next line.

By default, ux and uy are 1., and ox and oy are 0., implying that the x and y coördinates in the .tr3 file, and presumably also the z coördinates, are measured in pixels. If the z coördinates were measured in, say, mm, then ux and uy would normally specify the pixel size in mm.

If uy is not specified, it is assumed to be the same as ux, i.e., the x and y units are assumed to be the same.

The -u parameter is an optional name for the units, e.g., -u m for metres, or -u um for micrometres.

Example. If you had images with a pixel size of 0.5 mm, then you might use the following:

XY_CALC
-u mm 0.5

5.13.2 SCALE

SCALE
sx [sy sz]

These scaling parameters are not actually used within Fie. Tr3 uses them to scale the x, y and z coördinates that it reads from the .tr3 file.

Normally only sx needs to be specified, and sy and sz will be taken to be the same as sx. By default, sx = 1.

The directive SCALE is on one line and the parameter values are on the next line.

One use for these parameters is to produce real-world coördinates in the VRML and SAP files produced by Tr3 when the coördinates in the .tr3 file are expressed in pixels.

Example. If you had images with a pixel size of 0.5 mm, then you might use the following:

SCALE
0.5

The SCALE parameters could also be used to convert from one set of units to another, say from mm in the .tr3 file to m in the VRML and SAP files.

5.13.3 Z_CALC

Z_CALC
z1 dz

z1 is the z coördinate for the first image of a stack of images, measured in the same units as used for x and y. dz indicates the nominal spacing between slices.

The directive Z_CALC is on one line and the parameter values are on the next line.

Note that these parameters are just used to guess an appropriate z coördinate for a slice which has not yet had a z coördinate assigned, and to assign slice numbers to contours read from an old .tr3 file which does not contain explicit slice-number/z-coördinate information.

6. Example

6.1 Cat middle ear

The main image shows part of slice 127 from a magnetic-resonance microscopy dataset for a cat middle ear. The data are courtesy of Drs. M.M. and O.W. Henson (UNC) and the CIVM (Duke University). The image shown is a small part of the original image. Click on the image for a larger version.

Below the main image window are x-z and z-y views showing a selected subset of the lines that have been created by the user. The lines shown in the side views correspond to parts of the eardrum, malleus, tensor tympani muscle and stapes.

Each line in the image is represented by a set of vertices. The first vertex of a line is represented by a rightward-pointing triangle; the last vertex is represented by a leftward-pointing triangle; and the others are represented by squares. The straight-line segments between the vertices of a line are relatively thick. When a line is specified as starting at, or finishing at, some other line, then that connection is drawn as a thin straight-line segment.

In the centre of the image are seen a part of the malleus bone (yellow) and the tensor tympani muscle (red) attached to it. Notice that the shared surface between the two is represented as a separate line. These lines could be defined as shown in the following table: mallmuscinf and mallmuscsup represent the inferior (lower) and superior (upper) lines defining the part of the malleus to which the muscle is attached, and ttymp represents the tensor tympani muscle. The lines mallmuscsup and ttymp are both defined as starting at the finish of mallmuscinf and finishing at the start of mallmuscinf. Note that the bone has a material type of 1 while the muscle has a material type of 2.

mallmuscinf: -op OP -c yellow;bone -xyr 100 -mat 1 Malleus
mallmuscsup: -op OP -c yellow;bone -xyr 100 -mat 1 -s f mallmuscinf -f s mallmuscinf Malleus
ttymp: -op OP -c red;muscle -xyr 100 -mat 2 -s f mallmuscinf -f s mallmuscinf Tensor tympani

7. Tutorial

This section is the beginning of a collection of mini-tutorials on specific tasks. Links are given to the Menus documentation for details on the various menu items used.

For now, at least, this section focusses on working with stacks of images like X-ray CT scans, MR scans, serial-section histology or optical-sectioning microscopy.

7.1 General notes

7.2 Getting a dataset into Fie

7.2.1 Working with an existing .tr3 file

This section assumes that you already have a .tr3 file and the corresponding stack of images. Look at the following two sections if that's not the case.

If your images are in either JPEG or PNG format, you need to tell Fie to open the .tr3 file. If the images are in the form of a TIFF or raw stack, you need to tell Fie to open the stack file.

Start by clicking on File and then Open. The first time you work with a dataset in Fie, you need to browse to find it. Click on the + Other menu button. The first button in the next menu will be A <other> and will display what Fie considers to be the current directory. You can navigate from there by using the B <up> button or by clicking on one of the buttons indicating a subdirectory. (Each button in a file-selection menu contains, after its shortcut key, either d for directory or f for file.) Use the buttons at the bottom of the menu to scroll up and down as required.

If you want to go directly to some other directory (or don't recognize what directory you're in) click on the A <other> button. You will then be asked to type in the name of a directory, e.g., /home or C:\users. You can then start browsing from there.

Once you're looking at the right directory, click on the button corresponding to the desired .tr3, .tif or .raw file.

Next time you run Fie, the most recently opened file will be at the top of a list of all of your previously opened files, so you don't need to browse for it again.

7.2.2 Creating a test dataset

Mañana.

7.2.3 Importing a stack of images into Fie

Mañana.

7.3 Browsing among images

Once you have opened a .tr3 file for the first time, you will see some or all of the first image in the stack. To look at the other images, click on Draw in the main Fie menu and then # New image. Use the 7-button navigation menu to move back and forth in the stack. Next time you use Fie to look at this dataset, it will start at the image that you were looking at last.

The first time you look at a dataset, the images will be displayed at 100% scaling. If the images are very large, you may see only part of the image; you can zoom out to see more of the images. If the images are quite small, they may take up only a small area of the screen; you can zoom in to make them bigger or to focus on a small area. To zoom in or out, use the ! Zoom button. If you are viewing less than the whole image, the Overview window will show you which part you are viewing.

If you are looking at only part of an image (because you have zoomed in) you can choose which part to look at by using the @ Pan button.

7.4 Adding a line

If you have not already done so, click on Draw in the main Fie menu, then click on Add line. If lines already exist in this .tr3 file, a list of them will appear as a menu, with A (new) at the top of the list. If no lines exist yet, only the A (new) button will appear. Click on it and then on /OK.

When the menu for specifying line attributes appears, click on Name =. A prompt will appear near the bottom of the window, asking for the name of the new line to be added. Type in a name. You can set other attributes either now or later. Click on /OK to continue. There are three different methods available for adding the points that define a line: manual, autotrace and flood. The manual method is the most straightforward but also the most tedious. The autotrace and flood methods can greatly speed things up – when they're successful. They work best for structures with good contrast.

7.4.1 Manual method

To add points to a new line manually, simply left-click in the image window. The prompt near the bottom of the screen will show the number of the point to be added next. At any time the last point in the line can be deleted using the Delete last pt button.

7.4.2 Autotrace

The Autotrace function will attempt to trace a boundary automatically. It will use the last point so far as its starting point; if no points have been added yet it will ask for a starting point. It will ask you to point to a point that lies in the direction in which it should go. It will then attempt to trace a boundary that has properties similar to the boundary defined by the two points that it has been given to start with. It will continue tracing until it hits the edge of the visible image or until it runs into itself. Often it will trace successfully for a while and then go off course. In that case the Trim tail function can be used to delete all of the points following a point that you specify. You can then add some points manually and perhaps try autotracing again.

7.4.3 Flood

The Flood function traces a line around a closed region based on a range of pixel intensities. This method cannot be combined with the manual and autotrace methods. When you invoke the flood method, you are asked to specify a ‘seed rectangle’ by pointing to two diagonally opposite corners. The pixels within that rectangle will be used to determine the range of desired intensities, and a line will be traced around the corresponding region. A menu is then presented which permits adjustment of the thresholds in case the line isn't quite right (or is terribly wrong). Click on Quit when the line is satisfactory (or as satisfactory as it's going to get). If the line is mostly acceptable but part is not, Cut function can be used to remove that part by pointing to each end of it.

7.4.4 Cleaning up

The Autotrace and Flood methods often produce excessive numbers of points and very jagged lines. The Median filter and Smooth functions can be used to clean things up somewhat. The more powerful Snake function can also be used for this.

When using the Manual method, it is sometimes useful to manually specify only a small number of points and then use the Smooth or Resample function to interpolate additional points.

7.4.5 Doing multiple images

When a line has been satisfactorily traced in one image, it is often useful to immediately use the # New image button to advance to another image, rather than doing Quit. This way a line can be added to multiple slices without having to specify the line name each time. The flood method works particularly effectively this way because it automatically attempts to use the same location and intensity range for the next slice.

7.5 Editing a line

Once a line has been added, it can be manually edited by clicking on Edit lines.

Note that the Undo facility is extremely primitive. It can only be used to undo the positioning of a single point, and only if undone immediately. The best protection against errors is to save frequently. Every time you save a .tr3 file, Fie creates a backup version with a version number, so you can retrieve older versions. Fie also automatically creates a temporary backup file periodically, which may be useful for getting yourself out of trouble if you haven't saved recently.

7.6 Splitting a line

If an existing line needs to be split into two lines, first position yourself at the first slice (or only slice) in which you want to do the splitting. Also zoom and pan so that you'll be able to see the place where the split is to be made. Then use Edit lines ▶ Line ... ▶ Split line. You will then specify which line is to be split.

You will next specify which lines will correspond to parts 1 and 2 after the split. Often you will select A (new) for one or both lines. In that case you will be presented with the menu for editing line attributes. Change the line name and then click on /OK. Notes:

You will next specify which slice or slices you want to do the splitting in, by selecting a choice from a menu.

The actual splitting is done with a menu which allows you to select the node where the split will be performed and then to associate that node with one (or neither) of the two resulting line parts. Select the node by using the Next and Prev buttons or by left-clicking on the node in the main image window, then press Point -> part 1, Point -> part 2 or Cancel.

If you have chosen to do the split in more than one slice, you will immediately be moved to another slice, ready to select the node and do the split. This continues until the requested slices have been processed. If at a certain slice you can no longer see the place where the split is to be made, press Cancel, do the required pan, and then restart the split operation. You'll find that the appropriate line-selection buttons have already been pressed.

Line splitting and snipping A similar Snip line operation is also available. This corresponds to snipping out part of a line to form a second line. There is also a Concatenate lines operation for combining two lines together.

After lines have been split or snipped, it will probably be necessary to specify appropriate start at or finish at attributes.

7.7 Fitting a line

An existing line can also be refined using the semi-automatic line-fitting functions. The snake method is especially useful. There are several ways of taking advantage of it:

Invoke the snake method by doing Edit lines then Line ... then Fit line using snake. Choose the line to be fitted from the menu that appears. A menu then appears that offers a number of settings that can be adjusted. See the detailed documentation for how to use the various adjustments.

The actual fitting is done by using the the Slither ahead button. If the results of that slithering are bad, use either Undo & slither again or Restore original line to back up and try again.

If the snake algorithm is having trouble getting part of the line to fit the desired boundary, then Manual adjustment can be used to help it along. The functions are similar to those for manually editing lines.

Once you are satisfied with the fit, or have given up, click on Quit. In the menu that then appears, you can choose to keep the results of the fitting and go directly to another slice. This allows efficient fitting of the same line in a number of slices after having added it using, say, the flood method. If the line that you were fitting does not already appear in the new slice, the line will be pasted into the new slice, ready for fitting. This allows efficient addition of a line to a number of slices without having to do an explicit Add line for each slice. Whether it's better to do a series of floods followed by a series of snakes, or just do a series of snakes, depends on the nature of the data and on personal preference.

When fitting an open (as opposed to closed) line in a sequence of images, it is often useful to do a manual adjustment of the first and last points before slithering in each new image. When you click on Manual adjustment the first point in the line will be the active point. You can reposition it by right-clicking, then use Previous point to move to the last point in the line and reposition it. Then click on Quit and try slithering.

8. Changes

History of changes, in chronological order, starting in 2003 Jun.

Minor bug fixes and menu changes are not all included. Some changes listed here actually reflect changes in the Dip library.

8.1 2003 Jun

Fixed so multiple saves per session won't lose comments; truncate long comments if necessary to make space for initials and date. Fixed so autosaves don't add comments.

Implemented function for concatenating lines.

Revised surface-smoothing function, to hopefully give better results when multiple Bézier segments are used; the number of Bézier segments must now be a power of 2.

Implemented -on/off qualifiers for Joins. This means that joins, as well as caps and lines, can be initialized On then turned Off in subsets, and vice versa.

When lines are reversed, start-at and finish-at connections are adjusted accordingly. Multiple lines can be reversed at the same time.

The shortcut keys for Black and Blue are now different in the colour-selection menu. (This is actually a change in the Dip library.)

Enforce restriction that line names may contain only letters, digits and '_'.

Implemented specification of Volumes.

8.2 2003 Jul

Implemented checking of date & time of .tr3 file when first change is made and before saving.

Increased maximum number of Joins.

8.3 2003 Aug

Increased maximum number of lines from 500 to 1000.

8.4 2003 Sep

In snake fitting, implemented option of carrying newly modifed contour to next slice and applying snake again; added option of using GVF for snake; changed line colouring.

Added Copy & Paste to Edit-lines menu.

Implemented median filter in Filter.

Removed an obscure Dip feature which permitted menu-button selection by typing " or ' followed by button text. Now " can be used as a shortcut key in menus.

8.5 2003 Oct

Allow customisation of colours to be used for contours in previous and next slices.

In snake fitting, added manual-adjustment facility for snake; allow fitted contour to be carried to previous slice as well as to next contour, and also backward or forward several slices; implemented adjustable downsampling (to get reasonable speed and attraction to boundaries over large areas); fixed normalisation in GVF, so it works better now, and fixed memory leak.

In line splitting, removed special treatment for closed lines because it was confusing, user now must set starting point appropriately before splitting a closed line; added to menus that it's deprecated to assign point to both parts.

Display Bézier lines properly in overview and sideview windows.

Use of a different shade of green for inactive lines when editing.

Implemented interpretation of Shift-click as selecting or unselecting a range of buttons, in all multiple-selection menus.

Save low (blue) and high (yellow) thresholds in session settings. Added advice to use -1 if no threshold is wanted.

Revised shortcut keys in Preferences menu.

8.6 2003 Nov

Comments from the .tr3 file are now stored in memory rather than in a temporary file (avoiding conflicts between, e.g., Fie and Tr3 running at the same time). The user's initials are now requested only the first time changes are saved, and are then re-used for subsequent saves during that session.

Pressure (-p) is now recorded using metric prefixes, e.g., 3.m instead of 0.3E-2. Changed internal logic so negative and zero pressures can be specified. (The value of -666. is now used to mean undefined, and therefore will not be preserved when a new .tr3 file is written.)

Allow longer file names in certain places.

In the Reslice function for viewing sideview images:

The Reslice function is now much more useful, but unfortunately it is only practical for smallish datasets.

Added saving of session setting for whether lines or images are displayed in sideviews.

No longer clear the text-terminal screen when starting up.

Named colour definitions are now created internally, rather than all being taken from a diprgb.txt file. (That file is no longer required, but it can still be used for overriding or supplementing the internal definitions.) The colours are now displayed in a somewhat different (hopefully better) order than before.

Implemented proper clipping of polygons in Dip library; this mainly affects Fad but may also affect symbol display in Fie.

Implemented mirror attribute for subsets.

Implemented separate -material and -thickness line attributes; the attribute abbreviations -m and -t are recognised as, and converted to, -mtt (both material type and thickness) and -tr (transparency).

Implemented separate -xyresolution and -zresolution. Old -resolution (both xy and z) is still recognised.

Changed contour_names and slice_descriptors to lines and slices, but still recognise old forms.

Made indenting more consistent in .tr3 files as saved by Fie & Tr3.

The -op (open/closed) and -c (colour) are no longer written to .tr3 file if they have the default values, viz., open and 1;white. The -op filled attribute is changed to -op closed.

Implemented viewpoints, for generating extra viewpoints in the VRML file.

Revised handling of Dip initialisation errors. Kill Fie if there are too many invalid mouse clicks or keyboard presses at the main menu, to avoid a possible infinite loop when Dip has not been properly initialised.

Added -url line attribute, which can be used to specify a URL which the browser will display if the user clicks on a structure.

In Tr3: ask about Separate vs. Combined before starting triangulation; added option of adding code to VRML file to continuously display the position and orientation of the viewpoint, to facilitate defining viewpoints in the .tr3 file.

8.7 2003 Dec

Extended features for marking voxels.

Further extended features for marking voxels. Added reading and saving of marked voxels in .tr3 file.

8.8 2004 Apr - May

Implemented Labels.

8.9 2004 Jul

Implemented display of scale bar.

Implemented unit-name specification in XY_CALC.

8.10 2004 Aug

Added 'saving' to progress message when saving resliced files.

Fix to cursor handling.

8.11 2004 Oct

In _read_tr3_fie, don't try to get file date/time if no file

8.12 2004 Nov

For Volumes, added use of * to specify that multiline is Open.

Added Reverse flag for lines, caps & joins.

Added side-view display of selected line even if not in list of lines to display

Added Do_slices attribute (= all, first or last).

Implemented Volume qualifier for subsets.

Cosmetic change in user query for new .tr3 file.

For snake, added 'keep & go to specified slice'.

In _reslice, do z-y reslicing in a separate loop, in an attempt to speed things up

Made top-level directives case-insensitive in .tr3 file.

Allow editing of slice attributes for a range of slices at one time.

Fixed handling of file names when reslicing images.

Use TEMP environment variable for log file if HOME not found.

Minor changes in saving of resliced image stacks.

8.13 2004 Dec

Added explicit error message for excessively long subset name.

Revised reslicing to use multiple passes, to speed things up by using memory better.

Minor fixes in error checking.

Implemented saving and re-use of resliced .jpg files. If images are in TIFF or .raw stack, always save resliced stacks, don't bother to ask.

For reslicing, calculate block sizes for multiple passes based on image size and use of 200 MB of memory.

Fixes and refinements in session save and restore; image and palette initialisation; import.

Fixed logic for retrieving previous reslicing for .jpg images.

Implemented display of sideview images when resliced images are in JPEG images rather than stacks

Fix to drawing of scale bar.

Implemented consistent & graceful handling of Nxy too big

Added 'No lines available' message when trying to ask user which line(s) to use.

Added checks to make sure start-at and finish-at names for a line are not the same as the name of the line.

Use of thumbwheel for adjusting grey palette; removed query re using rarely used densities for r,g,b,c,m,y; don't ask about converting pixels to grey if it's already a grey-scale image.

When reslicing, base amount of memory used on amount of physical memory available, rather than always using 200 MB

8.14 2005 Jan

For snake, added option of deleting line; in manual mode, added Trim function.

Fix to z scaling.

For side views, fixed handling of .jpg images, revised menu text and one shortcut key.

Keep history of .jpg files that have been opened (when creating new .tr3 files) separate from history of datasets opened by Fie.

For reslicing, fixed specification of amount of memory used, and reverted to using a single pass for TIFF and .raw datasets.

For splitting lines, removed option of assigning split point to both parts (had side effect of making accidentally hidden Cancel button appear; reworded '-> neither part' to 'delete'.

For snake, divide internal weight by vertex spacing to prevent stiffening for vertex spacing > 1.

For image side views, added option of not showing marked voxels (because it slows things down); count voxel marking and unmarking as modifications (for purpose of auto backup).

8.15 2005 Feb

In line side views, if line is being displayed only because it's currently active, display it as light grey.

8.16 2005 Mar

Use of grey palette for rgb images when pixels are grey.

8.17 2005 Apr

Added snake threshold-strength feature.

Added adjustment of blue/yellow thresholds from within Snake, and adjustment of all grey-palette settings from within Preferences (rather than just Gamma).

When reading .tr3 file, fixed handling of slice spacing < 0 when trying to match z; output extra info to log file in case of error matching z.

8.18 2005 May

Changed order in menu for setting palette, putting Grey and False Colour first.

Added font size to session settings that are saved and restored.

Fixed logic for initialising palette superbutton; fixes problem when font size is changed.

Added saving of images in JPEG format.

Added flood filling. Fixed bug in smoothing and resampling.

Added display of name of .tr3 file at top, along with image name.

Fixed scaling bugs in line smoothing and resampling.

Use of deferred mode rather than immediate mode when choosing colours; a couple of other minor colour-related changes.

Changed initial value of Err_smooth(2) from 0.5 to 0.25.

Fix to output of statistics.

8.19 2005 Jun

When editing line attributes, added check for name already used.

No longer accept Filled as a line type.

For line colours within Fie, allow same colours as for rendering in VRML.

For colours of caps and joins, allow conversion of old-style colour codes to colour names.

Enhanced scale bar.

Don't allow ‘\’ character in descriptive text.

Added ability to specify zmin and/or zmax for subsets.

Reworded msg if image not open when importing SurfDriver .txt file(s); check for Nmodifications_tr3 > 0 rather than Nlindes or Nxy > 0; added setting of slice z's, offsets, rotations and name lengths.

Started implementing import of .mrp files.

Minor code improvements for reading files.

8.20 2005 Jul

Fixes related to scale bar, and to drawing if pen size ≤ 0.

Continued implementing import of .mrp files. Minor improvements to logic in import.

Minor code improvements for reading files.

8.21 2005 Oct

Increased maximum number of joins.

Added error checking when parsing file names.

8.22 2005 Nov

Added control over display of red, green and blue channels. Enabled their recognition by snake algorithm, and use better conversion from colour to grey scale for passing image to snake algorithm.

Added setting of colours and transparency for marked voxels, and added auto-set function for marking voxels.

Increased maximum number of subset records.

Some improved error messages when reading files.

Additional checking of colour names when reading files.

Fixed saving of colour raw images.

Added information to saved/restored session settings.

8.23 2005 Dec

Modified session save/restore so each dataset has saved settings. Don't call session_restore at beginning; always save session settings when quitting.

When reading a file, check if a modified file is already open; if a file is already open, save session settings before opening another file. Additional call to restore session.

Internal change to passing of parent ID's to subroutines.

Improved initialisation.

Internal improvements to menu handling.

8.24 2006 Jan

Check for Islice ≤ 0 before trying to read image

In all menus where it appeared, replaced Preferences by Settings (in consistent position and with consistent shortcut key $); changed shortcut key for Reslice from 's' to 'R' (which used to be for Preferences)

Improved user interface for side-view images; implemented option of auto setting in all slices at once

Added control over visibility of lines.

Improved session saving and restoration.

Improved re-initialisation of menus (especially for font-size changes).

Increased maximum number of marked voxels.

When saving files, use ; rather than : for marked-voxel colour.

Fixes to handling of colours, gammas, etc.

Implemented option of doing statistics for all slices; added display of number ≥ threshold; added drawing of line at threshold; ask for bin size before threshold, changed default bin size from 4 to 1; after last focus, loop to ask for different threshold; added calculation of total densities <, = and > threshold; rearranged display of numbers.

8.25 2006 Feb

Added display of difference pseudo-channels R-G, G-B and B-R.

Fixed logic for handling cancellation when editing start-at and finish-at.

For side-view images, added Zoom, Pan and Settings to menu; implemented filling; fixed some logic problems.

For snake algorithm, implemented option of displaying either original image or prepared image; improved interface.

Some improved error messages when reading files.

Improvement to checking of colour names.

Additional error checking when saving files.

Fixes and added checks for statistics.

8.26 2006 Mar

Improved handling of too-long or empty material-type descriptors.

8.27 2006 Apr

Bug fix: in _redisp, added missing Ierrsw=0 at beginning

8.28 2006 May

Started implementing display of join specifications.

Improved handling of default and unspecified attributes.

In main menu, use of " and : rather than C and P as shortcut keys for Copy and Paste (as in edit-line menu).

Implementing Set command for directly setting node coördinates from keyboard; added coördinates to information displayed for a node.

Added ability to display lines in 'next' or 'previous' slices either in one slice or all slices.

Started implemented new-style start-at and finish-at.

When reversing a line, no longer reverse its start-at and finish-at specifications, because the line may not be being reversed in all slices.

Disabled 'C' short-cut key for palette to avoid conflicts. For creating new .tr3 file, fixed problem when only 1 image, then extended to permit re-use of 1 image for multiple slices.

8.29 2006 Jun

Finished implementing new-style start-at and finish-at, which allow multiple specifications per line, with specified z ranges. Implemented editing of start-at and finish-at specifications.

Further work on displaying join specifications.

Implemented ability to click in image windows to select a line or lines, supplementing use of menus.

When saving session, output window limits before zoom and pan so pan setting will be better preserved across sessions

When editing line attributes, redisplay lines after each interaction. Implemented editing of attributes for multiple lines.

Fix to avoid saving of corrupted session settings if error occurs reading file.

8.30 2006 Jul

Fixed error handling start-at and finish-at specifications which affected only i386 Linux version.

8.31

...

2009 May 27

Fixed handling of the reversals caused by using - when invoking a subset with @.

2009 Jun 5

The implementation of the -on, -off and -reverse attribute specifiers has changed. The main goal was that -on should no longer be implied in every subset record. Thus, an explicit -on is now required in subset records if that is the intent. The advantage is that a subset record can now be used to modify attributes of a set of lines without unintentionally turning back on lines that have been turned off. -on is still implied in the actual line definitions.

The implementation of wildcards in subset-record interpretation has changed. The wildcards '*' (standing for zero or more characters) and '?' (standing for a single character) can now be anywhere in the line specifier. Previously only '*' was recognized and it had to be at the end of the line specifier.


AudiLab AudiLab home page
R. Funnell
Last modified: 2012-02-17 17:33:03