Regions of interest - ROIs

Regions of interest (ROIs) in Aivia allow you to preview and apply recipes and pixel classifiers to user-defined areas of images. There are options to use box-shaped ROIs (2D or 3D), outline ROIs (2D), and ROIs created from mesh surfaces (3D).

You can also clip image and mesh rendering to specified box-shaped ROIs.

 

ROI Editor

The ROI editor is a view for creating/editing/viewing ROIs. It lets you reorder ROIs to create a hierarchy via drag and drop. It can do more complex actions than the ROI view that you find in the Recipe Console or Pixel Classifier. The ROI editor allows you to draw ROIs, edit/view the ROI hierarchy, and a detailed properties view of an individual ROI. You can switch to a flat view in the advanced options, which is also used when filtering ROIs.

 

ROI Editor Hierarchy View
ROI Editor Flat View

ROI Visibility

 

Press the “eye” icon to toggle the visibility of ROIs on or off.

ROI Drawing

The ROI Editor has 3 tools for drawing ROIs.

Tool Name

Icon

Description

Tool Name

Icon

Description

Draw Box

Lets you draw a box ROI. You click in one spot, and drag to another to define the region of the box. By default, the box has a depth of 1, if drawn on a 3D image.

Draw Freehand

Lets you draw an outline ROI. You click in one spot, and drag to add points to the outline. Releasing the mouse will complete the outline.

Magic Wand

The magic wand tool lets you create outline ROIs. You click on a spot, and the Magic Wand selects points that are connected within a threshold range.

Options for the Magic Wand tool are provided below the row of drawing tools when the Magic Wand is selected (see above).

In Main View (2D), expand the Thresholding Mode dropdown menu to choose one of the following modes:

  1. Bidirectional mode accepts connected pixels within the sensitivity limit above and below the intensity at the selected location.

  2. Peak Finding mode accepts connected pixels within the sensitivity limit above the intensity at the selected location.

  3. Valley Finding mode accepts connected pixels within the sensitivity limit below the intensity at the selected location.

Select a location on the image for the Magic Wand to search from. A preview of the region to be painted is shown in blue (see right). Adjust the Sensitivity slider (or use hotkeys W and R) to change the tolerance for intensity differences. The narrowest range of accepted intensity levels is used when the slider is all the way to the left. Adjust the Search Range slider (or use Ctrl + Shift + Mouse Scroll over the Image Panel) to increase or decrease the area over which the Magic Wand will search. No pixels outside of the search region are included in the painted region. The search range is indicated by the green box around the cursor when the Magic Wand is used (see right). Finally, click on Paint (or press E) to paint the region and assign it to the selected class.

 

Auto ROI Detection

Auto ROI Detection tool in Aivia allows you to auto-detect regions of interest for analysis. The algorithm identified Regions of Interest (ROIs) by analyzing areas of high variance within the input image. To use this tool, switch to the Auto ROI option located in the row of drawing tools within the ROI Editor.

Options for the AUTO ROI Detection tool are provided below the row of drawing tools when the Auto ROI tool is selected.

Parameter Settings

To apply Auto ROI detection to the image, set the parameters given below. The default settings should be a good starting point. (Kernel Size=5, Sensitivity =7)

  1. Input Channel(s): Select the channel(s) for AutoROI detection that display signals from the majority of cells. For instance, DAPI is often a good first choice as it typically labels most cells. Starting with Aivia 14, users can choose multiple channels to enhance ROI detection. Be aware that the number of channels you can select depends on your computer's RAM. Selecting an excessive number of channels will trigger a warning message about potential system slowdown or crashes.

  2. Kernel Size: Kernel size defines the size of the variance filter applied to the input image. Increase the kernel size for a smoother outline and decrease the kernel size for more details.

  3. Sensitivity: This setting adjusts the variance threshold to detect smaller ROIs more sensitively. The table below illustrates the relationship between sensitivity and variance threshold. It's important to note that in a 16-bit image, the intensity range is wider, consequently leading to larger variance thresholds. Users should be able to get similar results using the same sensitivity if they convert images between different bit-depths in Aivia. When using multiple channels, Aivia uses the highest variance value for thresholding.

Using the Auto ROI Detection

After the right parameters are chosen, click on the Detect button on the right side of the view. The regions of interest from the auto-detection can be seen in the Regions of Interest table.

In general, the ROI naming order is determined by sorting from the top to the bottom row and left to right column based on their center of mass. ROIs are considered in the same row if they fall within our estimated row spacing.

Common issues

  1. Aivia detects no ROIs: Try to reduce sensitivity. If you already use the smallest sensitivity, that means the image’s foreground and background variances are very close to each other. Try to use another channel if available.

  2. Aivia detects the whole image as one ROI: Increase sensitivity to enable the algorithm to effectively filter out background pixels.

  3. ROI is smaller than the actual sample size: To address this, one way is reducing the sensitivity. Another way is increasing kernel size to get ROIs with smoother outlines. This is particularly recommended when the marker is smaller than that of the entire cells.

 

ROI Properties

The properties for the selected ROI will be shown at the bottom of the editor. You can rename the ROI here and toggle whether it should be included in your apply/preview region. You can make minute adjustments or specify exact values, for Box ROIs only. ROI specific measurements are also displayed at the very bottom.

Action

Icon

Description

Action

Icon

Description

Crop

Creates an image from the ROI by cropping the current image to the bounds of the ROI, and only including pixels that are within the ROI.

Revert

Reverts the position of the ROI back to when it was originally loaded/added. Only applicable to Box ROIs.

Clip to Box

Only available in the 3D view and for box ROIs. Moves the clipping planes to be around the current box, allowing you to remove any channel data or mesh data not inside the Box ROI.

Remove ROI

Removes the ROI from the image. This action is undoable (ctrl+u).

Filter

Click on the filter box and enter terms to find specific ROIs. The view will switch to a flat view similar to the ROI Tables.

Advanced options

Advanced options can be accessed by clicking the gear icon in the top right.

Click the “Show FlatView” checkbox to hide the hierarchy view and show the flat view instead.

Toggle the “Add To Top Level” button to not have the currently selected ROI be the parent of any added ROIs.

The “Crop Included” action crops the given image using every included/checked ROI, rather than the currently selected one.

 

ROI Tables In the Recipe Console and Pixel Classifier

The Recipe Console Regions Of Interest Table is found in the Recipe Console, while the Pixel Classifier Regions Of Interest Table is found in the Pixel Classifier.

 

 

For both versions of the Regions Of Interest Table, the table options include the options along the top row of the table that affect all ROIs.

Table options

Options that affect all ROIs are located in the top row of the Regions Of Interest Table. The checkbox in the top row of the table may be used for (de)selecting all ROIs. The other options that affect all ROIs or are for adding ROIs are summarized in the following table:

Option

Icon

Description

Option

Icon

Description

Show/Hide ROIs

Shows/Hides all ROIs

Add ROI

Opens a dropdown with options for adding ROIs.

Options for individual regions of interest

Each ROI has its own row in the Regions Of Interest Table, which includes its name, a checkbox for selecting the ROI for processing, an icon to indicate whether it is a box, outline, or mesh ROI, and a few other options. Double-click on the name of any ROI to enable editing of the name. Other options available for individual ROIs in the Regions Of Interest Table are described in the table below.

Option

Icon

Description

Option

Icon

Description

Store

Stores the current recipe settings in the ROI (in the Recipe Console Regions Of Interest Table only)

Restore

Loads the recipe settings that are stored in the ROI into the Recipe Console (in the Recipe Console Regions Of Interest Table only)

Go to ROI in treeview

Goes to the ROI editor and finds the ROI in the treeview, selecting it. It will expand any necessary parent ROIs, and collapse any unnecessary ROIs.

Using regions of interest

You may add, remove, or select any combination of valid ROIs from the ROI Editor or Regions Of Interest Tables as your apply/preview regions. 

Adding ROIs

New ROIs get added as children to the currently selected ROI. If no ROI is selected, the new ROI is added to the top level list of ROIs. You can force it to always go to the top level by turning on the “Add to Top Level” option in the ROI editor's advanced options dropdown. The behavior is the same for the ROI Editor or the Region of Interest tables in the Recipe Console/Pixel Classifier.

Option

Description

 

 

Add a new box ROI

Creates a new box image in the current image.

Load a mesh as a ROI

Loads a mesh from file to be a ROI. The loaded mesh surface must intersect the image to be successfully converted to a ROI.

Create ROIs from Selected Meshes

Creates a ROI from any selected mesh objects.

Create ROIs from Selected Outlines

Creates a ROI from any selected outline objects.

Start drawing rectangular ROIs

Goes into the 2D Box ROI Drawing mode. If not currently in the ROI editor and/or the ROI editor is not visible, it will be selected and shown.

Start drawing outline ROIs

Goes into Outline ROI Drawing mode. If not currently in the ROI editor and/or the ROI editor is not visible, it will be selected and shown.

Start drawing ROIs with the Magic Wand

Goes into Magic Wand Drawing mode. If not currently in the ROI editor and/or the ROI editor is not visible, it will be selected and shown.

Additional ways to add mesh regions of interest

Additionally, Mesh ROIs may be loaded through the file menu, by clicking on File > Import > Mesh as a ROI, navigate to and select the desired mesh file, and then click Open. Acceptable mesh file types are the following: PLY, OBJ, OFF, OMR, and STL.

To create ROIs from meshes that are already in an image, select the meshes you wish to have as ROIs and then click either the Create ROIs from Selected Meshes item in the Add ROI dropdown in the Regions Of Interest Table or ROI Editor. You can also create Mesh ROIs by going to Edit > Create ROIs from Selected Meshes.

ROI types

Type

Icon

Description

Type

Icon

Description

Box ROI

A simple box shaped ROI, that has a width, height, and in 3D, depth.

Outline ROI

A 2D ROI made up of points.

Mesh Roi

A 3D ROI created from a mesh.

Change the size or position of a box-shaped region of interest

To enable adjustment of the size/position of a box ROI in the Image Viewer, first toggle the Show/Hide ROIs eye icon (near the upper-left corner of the Regions Of Interest Table) so that all ROIs are visible. Then, select the box ROI to be manipulated by clicking on it in the Image Viewer.

In Main View (2D), change the position of a box ROI by clicking and dragging the central red circle. Use any of the other eight red grips to adjust the extent of the ROI in the x- and/or y- directions.

To select and adjust a ROI in Main View (2D) while you are showing the Pixel Classifier, all drawing tools must be toggled off. ROIs can only be adjusted in Main View (2D) with the Pointer Tool, which can be toggled via View > Pointer Tool.

To change the position of a box ROI in one of the 3D display modes without changing its size, click and drag the central red sphere. Click and drag any of the other red spheres to change the extent of the box ROI along one direction. To change the size of the box ROI in all three dimensions without changing its position, right-click and hold within the box ROI boundary, drag the mouse toward or away from the center of the box ROI, and release the mouse button when the box ROI is the desired size.

You can also make fine adjustments to the position, width, height, and depth of box ROIs in the ROI editor by selecting a box ROI, and modifying the size in the ROI properties view at the bottom.

Additional options for manipulating box ROIs, including single-axis movement modes, are available in the 3D Crop tool.

Revert the size and position of a box-shaped region of interest

Click on the Revert icon in a box ROI's properties window to return the box ROI to its initial size and position.

 

 

 

Store and reload recipe settings from regions of interest

To store the recipe settings that are currently shown in the Recipe Console in an ROI, click on the Store icon in the ROI's row in the Recipe Console Regions Of Interest Table. The settings stored in an ROI will be used for that ROI when the corresponding recipe is run and that ROI is selected. To load the recipe settings stored in an ROI into the Recipe Console, click on the Restore icon in the ROI's row of the Recipe Console Regions Of Interest Table.

Restore recipe settings from object groups

Recipe settings that were used to generate an object group can be restored using the Load Recipe Parameters button in the Object Set Settings panel (see below). If any ROIs were selected when the recipe was applied to create the object group, restoring the recipe settings will also restore the ROI selection that was used during recipe application and will store the parameters that were used for each ROI in the respective ROIs. Note that the ROI selection is saved based on the ROIs themselves, so any changes to the sizes, or positions of the selected ROIs after the fact may lead to unintended results or errors. 

Preview and run a recipe with regions of interest

Select the set of ROIs that you would like to use for previewing or applying a recipe by checking their boxes in the Regions Of Interest Table. You may (de)select all the ROIs in the Regions Of Interest Table by clicking the topmost checkbox. If any ROIs are selected, previews are generated, and recipes are applied to only the regions encompassed by the selected ROIs. When previewing a recipe with ROIs, the preview is based on the analysis parameters in the Recipe Console. However, the analysis parameters stored in the selected ROIs are used for those ROIs when a recipe is applied, regardless of the parameters shown in the Recipe Console; if there are no recipe settings stored in a selected ROI, the analysis parameters in the Recipe Console are used when applying the recipe to that ROI. Recipes cannot be applied to overlapping ROIs with different recipe settings.

Preview and apply a pixel classifier with regions of interest

Select the set of ROIs that you would like to use for previewing or applying a pixel classifier by checking their boxes in the Pixel Classifier Regions Of Interest Table. You may (de)select all the ROIs in the Regions Of Interest Table by clicking the topmost checkbox. If any ROIs are selected, previews are generated and pixel classifiers are applied to only the regions encompassed by the selected ROIs.

Clip rendering to a region of interest

To show only information inside a box ROI in a 3D display mode, click on the Clip icon in the box ROI's row of the Regions Of Interest Table in the Recipe Console or the Pixel Classifier; this clips the mesh and volume rendering, by default, to the specified ROI. Clipping is dynamic, updating as you manipulate the box ROI size or position. 

Related articles