Region of Interest (ROI) File Format

This page details the format of a Jim ROI file in Backus -Naur Form (BNF) notation. This is intended for those who wish to build their own syntactically correct parser to interpret ROI files. See the BNF section for a description of the notation.

An ROI file is a plain text file, consisting of a list of ROIs (<ROI-list>). In the ROI file, white space is used to separate the elements within an ROI. White space may consist of space characters, tab characters or new-line characters. The amount of white space is not significant. Individual elements that may contain white space are enclosed in double quotes ("). Literal string elements are shown in non-italic font below.

<ROI-list> ::= <ROI-spec>|<ROI-list><ROI-spec>|<null>
<ROI-spec> ::= Begin <ROI-name-spec> ROI <build-spec> <annotation-spec> <source-spec> <slice-spec> <history-list> <statistics-spec> <shape-spec> End <ROI-name-spec> ROI
<ROI-name-spec> ::= Marker|Line|CurvedLine|Rectangular|Elliptical|Irregular
<build-spec> ::= Build version=<version-spec>
<annotation-spec> ::= Annotation=<string-spec>
<source-spec> ::= Source=<string-spec>
<slice-spec> ::= Slice=<num-spec>
<history-list> ::= <history-spec>|<history-list><history-spec>
<statistics-spec> ::= Statistics: Area=<num-spec>; Mean=<num-spec>; Std Dev=<num-spec>; Min=<num-spec>; Max=<num-spec>|
Statistics: Area=<num-spec>; Mean=<num-spec>; Std Dev=<num-spec>; Min=<num-spec>; Max=<num-spec>;Length=<num-spec>

<version-spec> is a string of ASCII text characters enclosed in double quotation marks (") giving the build version of Jim. The build version is of the form "MajorVersion_MinorVersion", e.g., "4.0_a"

<string-spec> is a string of ASCII text characters enclosed in double quotation marks (").

<num-spec> is a numerical value that may be either in integer or floating point format, depending on the context.

The specification for a <history-list> is given in the audit trail section.

The shape of an ROI is defined in the <shape-spec>, and is different for each of the three types of ROI. The <shape-spec> found within an ROI will match the name (Rectangular|Elliptical|Irregular) found in the <ROI-spec>.

The second version of the <statistics-spec> is for line ROIs (curved and straight) that have an additional length statistic.

<shape-spec> ::= Begin Shape <geom-spec> End Shape
<geom-spec> ::= <marker-spec>| <line-spec>| <rectangular-spec>| <elliptical-spec>| <irregular-spec>
<marker-spec> ::= X=<num-spec>; Y=<num-spec>
<line-spec> ::= X1=<num-spec>; Y1=<num-spec>; X2=<num-spec>; Y2=<num-spec>
<rectangular-spec> ::= X=<num-spec>; Y=<num-spec>; Width=<num-spec>; Height=<num-spec>
<elliptical-spec> ::= X=<num-spec>; Y=<num-spec>; A=<num-spec>; B=<num-spec>; Theta=<num-spec>
<irregular-spec> ::= Points=<num-spec> <vertex-list>
<vertex-list> ::= <vertex-spec>|<vertex-list><vertex-spec>|<null>
<vertex-spec> ::= X=<num-spec>; Y=<num-spec>

The X and Y positions define the top left hand corner location for a rectangular ROI, while they define the centre location for an Elliptical ROI. The angle Theta is the angle between the major axis and the x-direction. A positive rotation angle is clockwise.

Below is an example of the contents of an ROI file, containing three ROIs (rectangular, elliptical and irregular with five vertices). The ROIs were defined from an image called "TEST_1" in the directory "/home/xinapse". Note that the Irregular ROI has been modified.

Begin Rectangular ROI
  Annotation="rectangular_roi_a"
  Image source="/home/xinapse/TEST_1"
  Slice=1
  Created  "21 Dec 2005 11:09:46.540 GMT+00:00" by Operator ID="xinapse"
  Statistics: Area=549.31641; Mean=82.8656; Std Dev=37.15474; Min=0; Max=350
  Begin Shape
    X=-34.21875; Y=-37.96875; Width=23.4375; Height=23.4375
  End Shape
End Rectangular ROI
Begin Elliptical ROI
  Annotation="this_is_an_elliptical_ROI_b"
  Image source="/home/xinapse/TEST_1"
  Slice=2
  Created  "21 Dec 2005 11:09:57.488 GMT+00:00" by Operator ID="xinapse"
  Statistics: Area=1756.10121; Mean=101.37751; Std Dev=14.21971; Min=50; Max=155
  Begin Shape
    X=30; Y=7.96875; A=22.5; B=24.84375; Theta=28.088516
  End Shape
End Elliptical ROI
Begin Irregular ROI
  Annotation="an_irregular_one_c"
  Image source="/home/xinapse/TEST_1"
  Slice=3
  Created  "21 Dec 2005 10:14:36.166 GMT+00:00" by Operator ID="xinapse"
  Modified "22 Dec 2005 12:44:32.750 GMT+00:00" by Operator ID="xinapse"
  Statistics: Area=971.19141; Mean=97.84889; Std Dev=34.41824; Min=0; Max=261
  Begin Shape
    Points=5
    X=-51.5625; Y=25.3125
    X=-68.4375; Y=49.6875
    X=-46.875; Y=68.4375
    X=-31.875; Y=54.375
    X=-31.875; Y=34.6875
  End Shape
End Irregular ROI
    
Google
WWW Xinapse Web Site

Jim Home