ROI

From VISTA LAB WIKI

Jump to: navigation, search

mrVista has a number of tools for defining regions of interest (ROIs) in various data sets. Each view can contain a number of ROIs; these are kept in the view.ROIs field (e.g., INPLANE{1}.ROIs) as a struct array, with each ROI comprising an entry in the array. For ROI-based analyses, one ROI is generally the "selected" ROI; this ROI is specified in the ROI popup control, to the lower right of each view window.

Contents

[edit] Loading and Saving ROIs

There are several things to note about how ROIs are loaded and saved in mrVista. First, each view type keeps its own set of ROIs in its own format: volume/gray ROIs specify points in the volume anatomy, inplane ROIs specify points in the inplane anatomy, and flat ROIs specify points along a flattened cortical surface patch. These ROIs must be tranformed from one view to the other; see the section below.

Second, for Volume/Gray views, ROIs may be saved in one of a number of directories. They may be saved in a "local" directory -- e.g., sessionDir/Gray/ROIs/ -- or in a "shared" directory, along with the anatomy -- e.g., /data/anatomy/johnDoe/ROIs/. They may also be saved in subdirectories of these directories. The shared ROI directory can be useful for using the same ROI across many sessions, while local ROIs can help prevent confusion about different ROIs which may be used for different purposes. The menus

File > ROI > Load ROI (local)
File > ROI > Load ROI (shared)

access these different directories, respectively. For Inplane and Flat views, you can only save to a local directory; different session's inplanes or flat patches have different conventions, so to convert between sessions, they need to be transformed via the Volume/Gray views. Volume and Gray views can load ROIs interchangeably among one another.

[edit] ROI Selection Dialog

You can search through ROIs in several directories using the ROI selection dialog (Code: roiDialog ). This dialog is called by default when you choose to load an ROIs from the mrVista GUI.

The dialog will attempt to load the meta-data (the file name, the times the ROI was created and most recently modified, and any comments which may have been added) for the ROI file you most recently selected. You can switch between ROI directories using the popup at the top of the dialog. The edit field underneath this popup lets you search among ROI files in the current directory using a file pattern. The code will search for the pattern '*pattern*', so for instance, if you want to see all ROIs with 'V2' in the name, you can enter V2:

ROI Selection Dialog

Selecting ROIs is set up to be easy to use, but may take some explaining. The selected ROIs are indicated by asterisks next to their name. By default, these are the same as the ROIs you've highlighted in the listbox. You can use Ctrl-select to highlight multiple ROIs. If this is inconvenient, you can turn off the checkbox "Auto-select ROIs". In this case, you can manually set ROIs to be selected or not selected using the "Select" and "Deselect" buttons. This means that the ROIs you have highlighted are not automatically the ones you have selected to load.

The other checkbox, "Show ROI Metadata", determines whether the ROI modification dates and comments are automatically loaded as you highlight different ROIs. Turning this off can help if the dialog is slow.

You can use the buttons to the right of the dialog to create sub-directories for the ROI directories, and move or copy the highlighed ROIs from the current directory to one of the other directories.

[edit] Creating ROIs

Most of the ROI creation tools are under the menu

ROI > Create > 

You can initialize a new ROI with no points, or with a number of shapes:

  • a rectangle(click on two corners of the rectangle),
  • polygon (click on multiple points, right- or double-click when finished),
  • single points (left click to add a voxel, middle or Ctrl-click to remove, right-click when finished),
  • a 3D sphere,
  • a "blob", (select a point within the current data overlay, and grow the region of interest to include all voxels connected along a 6-dimensional grid which pass the data thresholds)
  • in Flat views, a line along the cortical surface.


[edit] Editing ROIs

After an ROI is created, you can add additional points under the menu

ROI > Add >

Similarly, you can remove points using

ROI > Remove >

And you can "restrict" the ROI, which will remove all voxels in the ROI for which the currently-displayed data overlay doesn't pass the thresholds set by the interface (see Inplane for more details about these thresholds -- the same principles apply to all views).

ROI > Restrict >

Further, you can name or set the color of the ROI, add comments, and view metadata about ROIs by selecting

ROI > Select/Edit Combine > Edit ROI   (Ctrl-N)

This brings up a dialog for editing the selected ROI.


[edit] Finding Talairach coordinates associated with an ROI

To do this you need to complete the Specification of Talairach points on your volume anatomy, and have an Alignment from the inplanes to the volume anatomy. [more...]

[edit] Combining ROIs

There are various tools for combining ROIs in different ways (including taking a union, intersection, or XOR of voxels across multiple ROIs)


[edit] Setting view options for ROIs

ROIs can be rendered in a view a number of different ways. The most general way to change these view settings is by using the menu

ROI > Hide/Show ROIs > Set ROI Options   (Ctrl-3)

This will produce a dialog to set which ROIs to view, how to render them, and what color to use for the selected ROI.

Example ROI dialog for an Inplane view

[edit] Transforming ROIs between views

Each view has a transform menu (Xform) which accesses the transformation options between various views. Generally, the Volume/Gray views are the central views for most data, since the volume anatomy is generally used consistently across sessions for a subject.


[edit] Details of the ROI structure

To understand what your region of interest defines in terms of sizes of regions in the brain requires some understanding of how the fMRI data are collected and stored. Two issues to consider are described here: the potential difference in resolution between functional and anatomical MR images, and the difference between the 'effective resolution' of a functional MR pulse sequence and the reconstructed image matrices stored on disk.

[edit] View Size versus Data Size

mrVista views generally show data derived from different MR scans, which may have different resolutions. For instance, in an Inplane view, the inplane anatomies are often T1-weighted anatomicals which may be at a higher resolution than the T2*-weighted functionals which comprise the time series. For Volume and Gray views, data are generally transformed from the inplane view, and resampled at the resolution of the high-quality reference anatomy (usually this is around 1mm isotropic). For Flat views, the flattened cortical gray matter is usually gridded at a constant resolution, despite the fact that the gray matter nodes used to make the flattened view have a variable distance from each other in 3D space.

Because of these considerations, there are two different 'sizes' for the data. viewSize(view) always returns the size (voxel rows by columns by slices) of the relevant anatomical image for the view, while dataSize(view) returns the size of the functional data (which in turn determines the size of all maps generated from these data).

ROIs are always defined in terms of the underlying anatomies, and the view size, not the data size. So, if you have an Inplane window open, compute a map which shows a potential region of interest, and draw an ROI around it, the coordinates of that ROI are specified in terms of the inplane anatomy. Suppose the inplanes are at 1x1x1mm resolution, and the functional voxels (and map voxels) are at 3x3x3mm. This means, in every direction, there are 3 inplane voxels for one functional voxel. So, in the ROI you selected, you could have up to (3 * 3 * 3 =) 27 anatomical voxels all representing the same functional voxel.

Most of the code which analyzes the data -- for instance, the Time Course UI code or the Traveling Wave analyses, take into account this potential redundancy when they load the data. Each functional voxel which might be in the ROI is loaded exactly once.

However, if you are looking manually at your ROIs or data, you should be aware of the two different resolutions. Each ROI is represented as a struct variable, kept in the field view.ROIs; within this structure, the field ROI.coords specifies the coordinates. For this field, different columns always specify different voxels, relative to the view's anatomy image. In Inplane views, the three rows of ROI.coords specify the (row, column, slice) of each voxel relative to the anatomy. In Volume/Gray views, ROI.coords specifies first the axial slice of each voxel, second the coronal slice, and third the sagittal slice. For Flat views, the ROI.coords field specifies the row and column of each point on the flat patch, and the third row indicates the hemisphere (1=left, 2=right).

Some useful accessor functions to help with indexing the different variables are:

  • upSampleFactor: This function returns the ratio between the functional voxel size and the inplane voxel size.
  • roiIndices: This resamples ROI coords to be relative to the data size, rather than the view size. So, given an ROI defined using the ROI tools, you can get a set of coordinates (as well as indices) into the 3D map matrices stored in view.map, view.amp, view.co, and view.ph. Note that, by default, the code removes redundant coordinates -- multiple ROI voxels which all point to the same functional voxel -- and in the process sorts the order of voxels. An optional 'preserveCoords' flag omits this step, and preserves the order of voxels.
  • roiSubCoords: This function is similar to roiIndices above, but returns coordinates relative to the view size. That is, this function removes redundant coordinates pointing to the same functional, but still keeps the remaining coordinates relative to the anatomies.

[edit] How large are voxels?

In reconstructing images from frequency space ("k-space") to image space, Preprocessing code often uses a [1]. One by-product of this is that the images are often resampled onto a grid which is a power of two: e.g., the images are 64 x 64 voxels, or 128 x 128, or 256 x 256, etc. Depending on how the MR pulse sequence has been set up, this may not accurately reflect the actual resolution of features which the pulse sequence can resolve--the actual resolution may be somewhat coarser. When writing papers on fMRI results it is always the latter, "effective" resolution of the pulse sequence that should be reported, not the resolution after the resampling step.

mrVista keeps track of both of these resolutions in the mrSESSION variable. The mrSESSION.functionals field is a struct array, with one entry for each scan in your original data (so mrSESSION.functionals(1) gives you scan 1, mrSESSION.functionals(2) gives you scan 2, etc). In this variable, there are two fields: voxelSize tells you the size of the voxels after reconstruction into image space, while effectiveResolution records the actual resolution of the pulse sequence. For sessions initialized with some data types, the header files may not record the effective resolution, and so this field will be blank. In this case, it is up to you to note the effective resolution of the pulse sequence.

ROIs, because they are defined relative to the underlying anatomies, may be defined at a different resolution than either of these functional resolutions. In the Edit ROI Fields tool (code: editROIFields;), the size of the ROI is reported. For Volume/Gray and Flat views, there is only one size, because the data have been resampled to match the anatmoies. In Inplane views, however, two sizes are reported: first, the size of the ROI in terms of the anatomical voxels (this is a product of the number of voxels times the anatomical voxel size); second, the size in terms of the underlying functional voxels. In the latter case, the size of each voxel is taken from the mrSESSION.functionals.voxelSize field: that is, it is taken from the reconstructed image resolution.

Personal tools