ROI Creation

Start the ROI Toolkit from the Toolkits menu: Menu item to launch the ROI Toolkit

The ROI Toolkit will now appear.

roi_toolkit

Note: in order to make better use of your computer screen space, you can 'minimise' the ROI Toolkit by clicking the ROI toolkit minimisation button. This hides the contouring settings and ROI details. To restore the ROI Toolkit and show these, click on the ROI toolkit maximisation button. The minimisation state at startup can also be configured in the ROI Preferences.

Creating an ROI

There are eight types of ROI, which can be created by clicking on the icon in the ROI Toolkit frame:

text Text
marker Marker
line_roi Line
rectangular Rectangular
elliptical Elliptical
curved_line_roi Curved line
irregular Irregular, manually drawn
Open spline Open spline
Closed spline Closed spline
contour Irregular, contour following

You can also create hollow Hollow ROIs by merging two or more ROIs, where one ROI contains all the others within its perimeter.

For handy ROI creation you can also bring up the "handy ROI tools" window from the ROI Toolkit: show_handy_tools.

This pops up the window shown below:

handy_tools

You can move this window around to wherever it is easiest to access, to minimise your movement of the mouse. Alternatively, you can also very rapidly create ROIs using the keyboard accelerators detailed below for each type of ROI.

There are different ways to create and edit the different types of ROI. These are detailed below.

Text Annotation

[Keyboard accelerator: point to the image and press the 't' key.]

To create some text annotation, click on the text icon.

The status bar gives you the instructions "click on the image and type text; ⟨Enter⟩ to finish; Esc to cancel". To define some text annotation, click on the point where you want the text to appear, then type in the text you require, and press the Enter key to finish. Alternatively, just click with the mouse away from the text you have just typed in. To cancel the operation, press the "Escape" key on the keyboard. The text ROI will look like this:

text_roi

To change the position of some text, click on the text, then click and drag one of the corner handles to move it to a new position.

All text ROIs are displayed with text in the same font size. However, the size is configurable using the ROI Toolkit Preferences.

Note: you can also rapidly create some text by pointing with the mouse to the image, and pressing the 't' key on your keyboard.

Markers

[Keyboard accelerator: point to the image and press the 'm' key.]

To create a marker, click on the marker icon.

The status bar gives you the instructions "click on the image; Esc to cancel". To drop a marker, click on your chosen point somewhere in the image. To cancel the operation, press the "Escape" key on the keyboard. The marker will look like this:

marker_roi

To change the position of the marker, click on the marker, which will then appear with a green "handle" in the centre, shown enlarged below:

marker_roi_handle

To move the marker, click and drag the handle to its new position.

Note: you can also rapidly create a Marker by pointing with the mouse within the image, and pressing the 'm' key on your keyboard.

Lines

To create a straight line distance measurement, click on the line_roi icon.

The status bar gives you the instructions "click, hold and drag to define; Esc to cancel". To define a line, click point somewhere in the image and hold the mouse button down; this will be the first end of the line. Drag the mouse to the other end of the line (somewhere within the same slice of the image), and release the mouse button. The line will now have been defined. To cancel the operation, press the "Escape" key on the keyboard. The line ROI will look like this:

line_roi_defined

To change the line, click on it, after which it will then appear with a green "handle" in the centre, as shown below:

line_roi_selected

To change the line, you can:

  • Click and drag the centre handle, which moves the line without changing the shape.
  • Click and drag the cross at either end, which will change the location of that end.
  • Hold the "shift" key down, and drag one of the crosses at either end. This will rotate the line about the centre point.

Rectangular ROIs

To create a rectangular ROI, ensure that you have a slice selected, click on the rectangular icon.

This will create a "default" rectangular ROI in the middle of the selected slice:

default_rectangular_roi

The rectangular ROI has handles, allowing you to change the shape, size and position of the ROI. These are show enlarged below:

rectangular_roi_handles

To change an ROI, click and drag one of the handles:

  • Use the centre handle to move an ROI.
  • Use an edge handle to stretch an ROI vertically or horizontally.
  • Use a corner handle to stretch an ROI both vertically and horizontally.

In addition, Line, Curved Line, Elliptical and Irregular ROIs can be rotated, by pressing the "Shift" key and dragging one of the axis handles. See ROI Editing section for more details.

Elliptical ROIs

To create an elliptical ROI, ensure that you have a slice selected, then click on the elliptical icon.

This will create a "default" elliptical ROI in the middle of the selected slice:

default_elliptical_roi

The elliptical ROI has five handles that allow you change the shape, size and angle of the ROI. Use the centre handle to move the ROI. The other four handles are at the ends of the major and minor axes: click and drag these handles to alter the major and minor axis lengths.

Curved Lines

A Curved Line ROI is actually made up multiple straight-line segments. However, if the segments are short, the appearance is that of a curve. To create a curved line distance measurement, click on the curved_line_roi icon.

The status bar gives you the instructions "click or trace points around the shape; Esc to cancel". To define a curved line, you can click the mouse at individual points around the curve, or you can hold the mouse button down to draw the curve.

curved_line_roi_being_drawn

To end the curve, double-click with the mouse. You can also finalize the curve using the keyboard accelerator 'z'. To cancel the operation press the "Escape" key on your keyboard.

Note: you can zoom and scroll the image as you are drawing the outline, as usual. To change the curved line, click on it, after which it will then appear with nine "handles", as shown below:

curved_line_roi_selected

To change the line, you can:

  • Click and drag the centre handle, which moves the line without changing the shape.
  • Click and drag the handles at the corners or edges of the bounding box. This stretches the ROI.
  • Hold the "shift" key down, and drag one of the handles at the corners or edges of the bounding box. This will rotate the line about the centre point.
  • Edit the individual points that make up the curved line. See See ROI Editing section for more details.

Irregular ROIs

[Keyboard accelerator: you can initiate creation of an Irregular ROI by pointing to the image pressing the 'i' key.]

Irregular ROIs are drawn manually on the image, and are (like Curved Lines) made up of multiple straight line segments. Click on the irregular icon to start drawing: the status bar gives the instructions: "click or trace points around the shape; Esc to cancel".

You can click the mouse at individual points around the outline of the feature you want to measure, or you can hold the mouse button down to draw around the outline.

irregular_roi_being_drawn

To close the outline, and create a completed ROI, double-click with the mouse. You can also finalize the ROI using the keyboard accelerator 'z'. To cancel the operation press the "Escape" key on your keyboard.

Note: if you make a mistake during your drawing, press the "Shift" key on your keyboard; the mouse cursor changes to look like this: roi_erase_cursor and acts an eraser. Retrace your steps with the mouse, and the eraser will remove the end of the line; release the "Shift" key to continue drawing.

Note: you can zoom and scroll the image as you are drawing the outline, as usual.

Note: for ROIs drawn by hand that have segments of the outline that cross, the "even-odd winding rule" is used to define the interior and exterior portions of the ROI. The figure below shows such a shape:

winding_rule

That which is defined to be the interior of the ROI is coloured in blue. To see how the even-odd rule works, consider the line drawn through the ROI. Each time the line crosses the outline of the ROI, a counter is incremented. When the counter is odd, the line is inside the ROI; when the counter is even, the line is outside the ROI. This rule works for any line drawn through the ROI, and for any direction of traversal of the line.

Open Spline ROIs

[Keyboard accelerator: you can initiate creation of an Open Spline ROI by pointing to the image pressing the 'o' key.]

An Open Spline ROI automatically has a smooth shape: a cubic spline interpolator is used to join the points that you define. The spline line passes through the points, but a smooth arc is drawn between the points.

Click on the Open Spline icon to start drawing: the status bar gives the instructions: "click points around the shape; Esc to cancel".

Click the mouse at individual points that you want the spline to pass through. As the Open Spline ROI is being drawn, you see the points you clicked and the line passing through them.

A Spline ROI being drawn

To complete the ROI with a final point at the end, double-click with the mouse. You can also finalize the spline using the keyboard accelerator 'z'. To cancel the operation press the "Escape" key on your keyboard. After completion, the positions of the points on the spline can be adjusted by selecting and dragging the green handles. See also the section on editing Spline ROIs.

Note: if you make a mistake during your drawing, press the "Shift" key on your keyboard and click on the last point drawn, which will remove the last point.

Note: you can zoom and scroll the image as you are drawing the outline, as usual.

Closed Spline ROIs

[Keyboard accelerator: you can initiate creation of a Closed Spline ROI by pointing to the image pressing the 's' key.]

A Closed Spline ROI is similar to the Open Spline, but the ends of the line are automatically joined to form a smooth, closed shape.

Click on the Closed Spline icon to start drawing: the status bar gives the instructions: "click points around the shape; Esc to cancel".

Click the mouse at individual points that you want the spline to pass through. As the Closed Spline ROI is being drawn, you see the points you clicked and the line passing through them. To complete the ROI, double-click to create final point and close the shape. You can also finalize the Spline using the keyboard accelerator 'z'. To cancel the operation press the "Escape" key on your keyboard.

A completed Closed Spline ROI
A completed Closed Spline ROI

After completion, the positions of the points on the spline can be adjusted by selecting and dragging the green handles. See also the section on editing Spline ROIs.

Note: if you make a mistake during your drawing, press the "Shift" key on your keyboard and click on the last point drawn, which will remove the last point.

Note: you can zoom and scroll the image as you are drawing the outline, as usual.

Contoured ROIs

[Keyboard accelerator: point to the edge of a feature and press the 'c' key.] A contoured ROI follows a contour, or level of intensity, from a point indicated by a mouse click.

To initiate contouring, select the contouring mode from the menu as detailed below, then click on the contour icon. Move the mouse near to the edge of a feature on the image, an click with the mouse to create a contour around that feature. You can also create the contour using the keyboard accelerator 'z' instead of a mouse click. To cancel the operation press the "Escape" key on your keyboard.

  • mode_mouse_position - the intensity under the mouse location is used as the contour level. The algorithm used to find the contour level is explained in more detail in the algorithms section.
  • mode_edge_seeking - Jim searches for a feature with the strongest edge in the vicinity of the mouse, and uses the intensity level at the edge as the contour level. The algorithm used to find an edge is explained detail in the algorithms section.
  • mode_fixed_level - the contour level is set manually in the text area to the side: contour_level. In this case, the contour will be at an intensity level of 900. Jim searches for a feature in the vicinity of the mouse with this intensity level.
    Note: the mouse must be placed inside the feature you want contour: Jim searches in an outward spiral pattern for a feature at the intensity level that contains the mouse location.
  • mode_mouse_plus - the contour level is calculated by adding the intensity level at the mouse position to the Δ value in the text area to the side: mouse_delta.
    Note: the mouse must be placed inside the feature you want contour: Jim searches in an outward spiral pattern for a feature at the intensity level that contains the mouse location.
  • mode_mouse_minus - the contour level is calculated by subtracting the Δ value in the text area to the side: mouse_delta from the intensity level at the mouse position.
    Note: the mouse must be placed inside the feature you want contour: Jim searches in an outward spiral pattern for a feature at the intensity level that contains the mouse location.

Note: when contouring using a fixed level or mouse +/- Δ, you can interactively alter the level value by pressing down the left mouse button and dragging the mouse pointer up and down the screen. Move the mouse up the screen to increase the level value; move it down to decrease it. The contour produced at the new level is updated as you drag the mouse.

Jim will now have produced a contour, shown in light blue, outlining an image feature. Below is the result of applying edge detection and contouring to the edge of brain lesion.

lesion_contour

The following options modify the way in which contouring works:

Intensity Hint Intensity hint

You can tell Jim what type of feature you want to contour by setting the intensity hint. This is a 3-way toggle button that cycles between:

  • hint_brighter_button - Jim will only create contours around features that are brighter than the background.
  • hint_darker_button - Jim will only create contours around features that are darker than the background.
  • hint_unknown_button - Jim will create contours around features that are either brighter or darker than the background.

Propagation in 3D propagate3D_check

Normally, contoured ROIs are only created in the slice in which you click the mouse. However, if you select the propagate3D_check check-box, then the contour is propagated to adjacent slices. Jim first finds a 3-D connected region of pixels at the contour level, and then contours the connected region at the intensity level in every slice. This can result in extra contours even in the slice where the contour was initiated because of a connection to the original region that is via different slices. Because this sometimes produces surprising results, your are given some extra control over the way that contours can propagate. You can restrict the size of the 3-D connected region by altering the Plus and minus slice range for connection in 3-D spinner. With this setting, for example, the 3-D connected region would be restricted to extend over 7 slices, including the slice in which contouring was initiated (as the central slice). Thus, the resulting contours are restricted to these same seven slices, and unwanted contours are less likely to occur.

Preview Contours preview_check_box

You can define contours interactively by selecting the preview_check_box check-box. When selected, as you move the mouse over the image, the contour that would result from a mouse click at that point is continuously updated and displayed.
Note: for large contours, or when using contouring at a fixed level, it may take a few moments to update the display as you move the mouse, as Jim searches for the correct contour.

When you are happy with the appearance of the contour, click the mouse to finalise it and create a Contour ROI. To cancel the operation press the "Escape" key on your keyboard.

Hollow ROIs

A hollow ROI is created from two or more ROIs, where one ROI contains all the other ROIs: the inner ROIs are used to form holes in the outer ROI. To create a hollow ROI, perform the following steps.

  1. Select two or more ROIs, where one ROI contains all the other ROIs, as illustrated below.

hollow_select

  1. Click the hollow button in the ROI Toolkit.

  2. You will now have a single ROI of type "Hollow". The regions within the outer ROI are "hollows" that do not contribute to ROI statistics such as area and mean intensity. However, these parts of the ROI do contribute to the perimeter.

If one regions does not completely contain all the all the other ROIs, as illustrated below, you will receive an error message when you try to create the hollow ROI.

hollow_not_allowed

This will generate the error message "one ROI must completely contain all the others to make a Hollow ROI"

Pixel Snap

Turning pixel snap on (by checking pixel_snap) causes the outlines of ROIs to snap onto the nearest corners or centres of image pixels. Thus, for example with Pixel Snap turned on, Rectangular ROIs will always contain a whole number of pixels. Without Pixel Snap, ROIs are free to have any shape defined by the user.

The ROI Toolkit can be set so that the vertices of some ROIs (Line, Curved Line, Spline and Irregular ROIs) can snap either to the corners or to the centres of pixels. Change between snapping to centres/corners, by setting your preference in the ROI Preferences dialog.