17. Trace

The Trace tab offers commands for accessing the Magnetic Trace (MagTrace) tool for defining vector contours that snap to edges of objects in the image. This tool can be used to speed up manual segmentation of organs and tissues.

17.1. Magnetic Trace tool

When using the Magnetic Tool, the user places clicks the mouse along the edge of the organ to be segmented to place control points connected by a spline curve (Fig. 17.1).

MagTrace in action

Fig. 17.1 MagTrace in action.

The “magnetic” property allows placing the control points in the vicinity of the edge, but not exactly on it, and the Magnetic Trace tool automatically moves them closer to the edge. The user can configure the MagTrace properties and control the precision of snapping.

17.2. MagTrace settings

The MagTrace tool can be configured before use by selecting Trace > MagTrace settings. This command opens a panel with the tool parameters (MagTrace Parameters, Fig. 17.2).

MagTrace Parameters

Fig. 17.2 MagTrace Parameters.

Connect End to Start – Creates a closed contour. Checked by default.

Centered Auto ZoomADD DETAILS. Unchecked by default.

Edge Parameters – Opens a sub-panel (Multiscale Texture Gradient, Fig. 17.3) with parameters of edge detection algorithm that can be adjusted for specific applications. Presets configured for applications are available through Application specific settings.

Multiscale Texture Gradient Panel:

Low and high radius (vox)ADD DETAILS.

Distance Metric – Choose between Signal Difference or Earth Mover Distance metrics.

MagTrace Edge Parameters

Fig. 17.3 MagTrace Edge Parameters.

Voxel Weights – Options include Constant, Gaussian, Radial, and Raleigh. ADD DETAILS

Magnitude measureLinear, Logarithm, Normalized.

Normalization CoefficientADD DETAILS.

Snap-to-Edge radius (vox) – The radius of the MagTrace tool aperture (in voxels) within which the tool detects edges and snaps to them. The larger the aperture, the faster the contour can be drawn, but also the more likely the tool is to snap to irrelevant edges. The smaller the aperture, the slower and the more precise is the drawing.

Spline tension [0, 1] – A coefficient that controls the curvature of the spline connecting the control points. The lower the tension, the straighter the line. A straight line has the spline tension of zero. The tension can also be adjusted after the contour is drawn through the contour properties panel.

17.3. Application Specific Settings

Offers presets configured for segmentation of specific organs.

17.3.1. Femur MR (0.24 mm x 0.24 mm)

MagTrace Settings for Femur

Fig. 17.4 MagTrace settings for femur.

MagTrace parameters and Edge Parameters (Multiscale Texture Gradient) for segmenting femoral head (Fig. 17.4).

Snap-to-Edge radius (vox): 10. Spline tension: 0.5.

Edge Parameters: Low & radius (vox): 6.070. Distance Metric: Earth Mover Distance. Voxel Weights: Constants. Magnitude measure: Normalized. Normalization Coefficient: 1.

17.3.2. Hippocampus (1 mm x 1 mm)

MagTrace parameters and Edge Parameters (Multiscale Texture Gradient) for segmenting hippocampal region of the brain (Fig. 17.5).

Snap-to-Edge radius (vox): 8. Spline tension: 0.5.

Edge Parameters: Low & radius (vox): 2.180. Distance Metric: Earth Mover Distance. Voxel Weights: Radial. Magnitude measure: Normalized. Normalization Coefficient: 1.

MagTrace Settings for Hippocampus

Fig. 17.5 MagTrace settings for hippocampus.

17.4. Start MagTrace

Launches the MagTrace tool. The cursor becomes a green ring of the size set by the Snap-to-Edge radius parameter. MagTrace can also launched using the main toolbar icon trace_magtrace_icon.

To draw a contour, click the image to place the control points. The points will be shown as green circles connected to the previous point with a red line (spline).

The contours are defined only on the current slice. To replicate the contours (to the current slice or other slices), use Copy commands.

The radius of the snapping region can also be controlled by scrolling the mouse wheel up and down.

If there is an active contour in the document, starting MagTrace will continue drawing this contour. To start drawing a new contour, press Esc to exit MagTrace, click anywhere on the image to de-activate the existing contour, and restart MagTrace.

To exit from MagTrace, press Esc.

To delete a contour, click it and press Delete.

17.5. Manipulate control points

To manipulate the individual commands, press Esc exit the MagTrace tool. Click the contour to activate it. An active contour shows the control points as green circles(Fig. 17.6).

MagTrace Active Contour

Fig. 17.6 Active MagTrace contour shows control points.

To move a control point, hover the cursor over it (the cursor becomes a cross), click and drag it to a new location and then release the mouse.

To add a control point, hover the cursor over the spline contour (the cursor becomes a cross), and press Alt+1.

To delete a control point, hover the cursor over the point to be deleted and press Alt+4.

17.6. Spline properties

The properties of an existing spline can be configured when the MagTrace tool is off. Double-click the contour to open Polyline and Spline properties (Fig. 17.7). Alternatively, select View > Contour and Fill Properties to open this panel.

The options include:

Area – Click the Fill box to fill the area within the contour. Press the Color button to open the color selector to customize the color.

Contour – Check the Draw box to show the outline of the contour. Click the Color button to open a color picker and select the line color. To control the line width, enter a number (in points) in Width box. Check the Close box to connect the first and last points in the contour.

Spline – Check the Spline box to convert the contour into a spline. Uncheck for straight line. If Spline is checked, enter the spline tension into the Tension box.

Slice index – Displays the slice number (first slice has the index of 0) on which the contour is defined. Enter another number in the Slice index box to move the contour to that slice.

Alpha [0, 100] – Value of the alpha channel, in percent, controlling transparency of the contour. Transparency of both the line and the fill area (if selected) transparency is set simultaneously. Alpha equal to zero results in a fully transparent contour, alpha of 100% results in a fully opaque contour.

MagTrace Spline and Polyline properties

Fig. 17.7 MagTrace Spline and Polyline properties.

17.7. Copy and snap commands

Copy selected spline (Alt+5) – Copies and pastes the active contour onto the current slice. If the current slice is the slice containing the selected contour, the contour is duplicated in place. The pasted contour is pasted with the default parameters (color, fill, close, alpha).

Snap selected spline to image (Any direction: Alt+2) – Snaps the selected spline to the edges of the image (in plane and across slices). ADD DETAILS.

Snap selected spline to image (Normal: Alt+3) – Snaps the selected spline to the edges of the image (across slices). ADD DETAILS.

Copy from adjacent slice and snap – Combines copy and snap commands. Copies and pastes the selected slice to the current slice and snaps the contour to images. May be useful when replicating an outline of an organ through slices.

17.8. Rasterize MagTrace contours

Use Vector > Rasterize selected vector entities or Rasterize All Splines to rasterize the active spline or all spline contours in the document. The raster ROIs are placed either into the current ROI layer or a new ROI layer, if the current layer is not an ROI layer. See Vector chapter for details.

17.9. MapFit

Opens a MapFit (Multi-Agent) panel (Fig. 17.8).

MapFit panel

Fig. 17.8 MapFit panel.