Overview
Forum
Mango
iMango
Papaya
Multi-image Analysis GUI
Download
User Guide
Developer Guide
Troubleshooting
Acknowledgements

Mango ROI Metadata

Mango ROI metadata stores point (POI) and line (LOI) data, as well as region (ROI) label information. See below for an example:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE MangoROI SYSTEM "http://mangoviewer.com/mangoroi.dtd">
<MangoROI version="3.2">
    <Points>
        <POI color="0" name="My Point" x="59" y="43" z="75"/>
    </Points>
    <Lines>
        <LOI closed="false" color="0" direction="0" length="2" name="My Line" slice="75">
            <Point index="0" x="22" y="58"/>
            <Point index="1" x="109" y="78"/>
        </LOI>
    </Lines>
    <Regions>
        <ROI color="0" name="My ROI"/>
    </Regions>
</MangoROI>
 

These data are stored as a NIFTI extension. ROI mask data is stored in the associated NIFTI image block. In order to remain backwards compatible with previous versions of Mango, these metadata are prefixed with 20 empty bytes which should be ignored.

Mango ROI Metadata (Legacy)

The following is a description of the ROI metadata format for versions of Mango prior to v3.2.

Mango ROI data is stored in NIFTI image format. Image dimensions, voxel dimensions, orientation, and origin are all based on the original base image. Data type is always 1-byte unsigned integer with each bit representing one of eight ROI mask colors. By default, the ROI is always saved as a single, compressed file. Click here to see a video tutorial of the new ROI format.

In addition to mask data, a Mango ROI may store the vector information of ROI lines and points. This information is stored between the header and image parts of the file according to the NIFTI specification for extension data. The extension code to identify Mango ROI extension data is TBD. These data follow the below specification:


Data are stored in 5 sections: points, axial lines, coronal lines, sagittal lines, and labels. Each section is preceded by a 4-byte size header indicating the number of bytes to follow in that section. Byte order of size fields will match original image byte order. Byte order of stored data is always big endian. If a section contains no data, the size header will still be stored and will contain zero. No extension data is stored if none of the 5 sections contain any data.

Points

Size of section (4 bytes)
Loop for each point
  Identifier (magic number = -9998) (2 bytes)
  ROI color (0 to 7) (2 bytes)
  X (2 bytes)
  Y (2 bytes)
  Z (2 bytes)
End loop

Lines (three sections in this order: axial, coronal, sagittal)

Size of section (4 bytes)
Loop for each line
  Identifier (magic number = -9999) (2 bytes)
  Slice number (2 bytes)
  ROI color (lower byte, 0 to 7) and closed shape flag (upper byte, 0 or 1) (2 bytes)
  Loop for each point
    X (2 bytes)
    Y (2 bytes)
  End loop
End loop

Labels

Size of section (4 bytes)
Vector<String> object data