ROImanager data organization

ROImanager data organization

The ROI session file used by ROImanager is a MATLAB MAT-file that stores both the image context and the ROI definitions associated with that image. Older files use the naming convention ROImasks_xxxxx.mat, while newer files use the extension .roimsk. Despite the different file extensions, both formats can be read as MATLAB MAT-files. In the newer format, the file can be loaded with load(filename, '-mat').

In brief, the file contains two structures: img_info, which stores the reference image and image-related settings, and ROI_info (a structure array), which stores the list of ROIs and their associated statistics. This file organization allows ROImanager to reopen a saved ROI session and restore the ROIs and also the image used to create them.

How it is organized


The ROI session file contains the following variables:

Variable Description
img_info A scalar structure containing image-related information such as the reference image, calibration, display parameters, logical mask, and alignment reference data.
ROI_info A structure array in which each element represents one ROI and stores its metadata, geometry, and descriptive statistics.

The img_info structure


The img_info variable stores the image context used by ROImanager. It contains the following fields:

Field Description
imageData The reference image on which the ROIs were drawn and from which the ROI statistics were computed.
refPt The image reference point (origin) used for spatial measurements. The values are always expressed in pixels.
pxPermm The spatial calibration in pixels per millimeter. If this value is nonzero, all distance-related statistics are expressed in millimeters instead of pixels.
cmap The colormap used to display the image.
clims The current display intensity limits for the image.
clims_def The default display intensity limits for the image.
reference_frame A reference image used during data alignment. This field is generally empty and is populated when the user creates an Image Reference File (see how to create an Image Reference File in here).
logical_mask A binary mask associated with the image used to exclude irrelevant regions during ROI creation.
datFile The source data file name, when applicable.

The ROI_info structure array


The ROI_info variable is a structure array in which each element defines one ROI. Each ROI contains the following fields:

Field Description
Name The ROI label.
Color An RGB triplet used to display the ROI.
Type The ROI type. Depending on the ROI, this can be of type Shape or Point.
Shape A MATLAB polyshape object defining the ROI geometry.
DOC The Date Of Creation of the ROI.
Stats A structure containing the ROI mask, geometric measurements, and descriptive statistics computed from img_info.imageData.

The ROI_info.Stats structure


The Stats field stores measurements associated with each ROI. These statistics correspond to the data stored in img_info.imageData.

Field Description
ShapeArea The area of the ROI.
ShapeCentroid The centroid coordinates of the ROI.
EuclDistFromOrig The Euclidean distance between the ROI centroid and the reference point img_info.refPt.
ROI_binary_mask A binary image mask representing the ROI.
n_pix_inside The number of pixels inside the ROI.
min The minimum pixel value inside the ROI.
max The maximum pixel value inside the ROI.
mean The mean pixel value inside the ROI.
median The median pixel value inside the ROI.
std The standard deviation of the pixel values inside the ROI.

Notes on measurements


  • The descriptive statistics stored in ROI_info(k).Stats are computed from img_info.imageData.
  • If img_info.pxPermm ~= 0, distance-related statistics are expressed in millimeters instead of pixels. Otherwise, spatial measurements remain in pixel units.
  • The reference_frame field is generally empty. It is used only when an Image Reference File is created, in which case it stores the reference image used during data alignment.

  • Back to top

    Copyright © LabeoTech 2026. This work is licensed under the GNU General Public License, Version 3.0.

    This site uses Just the Docs, a documentation theme for Jekyll.