ROI Statistics

Statistics about the ROIs can be displayed in the ROI Toolkit. To turn on and off the display of statistics, click the "Show Statistics" check box: show_stats

ROI editing is much slower when statistics are being shown, since each time an ROI is changed, the statistics have to be re-computed; you may therefore prefer to keep "Show Statistics" turned off while editing ROIs. This does not affect the final computation of ROI areas and volumes etc., since when needed, the statistics are always computed.

Unlike many other image analysis programs, the calculation of ROI statistics in Jim is almost exact; it is common in medical image analysis to calculate statistics around whole pixels, even though ROIs do not necessarily encompass whole pixels.

Note: the computation of ROI area statistics for Irregular and Hollow ROIs is NOT "exact", but the error is within known (small) bounds. Similarly, the computation of ROI pixel intensity statistics is also not exact, but the behaviour of the errors are stable and well-understood. The algorithms used to calculate statistics are explained in the algorithms section.

Computed Statistics

The following are computed and shown in the ROI Toolkit window when "Show Statistics" is turned on:

  • The slice number in which this ROI is defined.
  • The area of the ROI. If the display units are set to mm, the area is shown in square mm; if the display units are set to pixels, the area is shown in square pixels. For Text, Marker, Line and CurvedLine ROI types, the area statistic is always zero.
  • The mean pixel intensity in the ROI. For Line and CurvedLine ROIs, this statistic is the mean intensity along the line.
  • The standard deviation of pixel intensity in the ROI. For Line and CurvedLine ROIs, this statistic is the standard deviation of intensity along the line.
  • The minimum pixel intensity in the ROI (or, for Line and CurvedLine ROIs, along the line).
  • The maximum pixel intensity in the ROI (or, for Line and CurvedLine ROIs, along the line).
  • For Line and CurvedLine ROIs only, the length of the line. If the display units are set to mm, the length is shown in mm; if the display units are set to pixels, the length is shown in pixels.

If the turn on "Extended Statistics" from the View menu, view_show_extended, the following additional statistics are computed and shown:

  • Median. The median pixel intensity in the ROI. For Line and CurvedLine ROIs, this statistic is the median intensity along the line.
  • Perimeter. Note that the perimeter of a Text or Marker ROI is always zero, and the perimeter of a Line or Curved Line ROI is equal to twice its length.
  • Minimum Feret's diameter. The smallest distance between a pair parallel lines that just touch the perimeter of the ROI and enclose it.
  • Maximum Feret's diameter. The largest distance between a pair parallel lines that just touch the perimeter of the ROI and enclose it.

If the display units are set to mm, the perimeter and Feret's diameters are shown in mm; if the display units are set to pixels, they are shown in pixels.

Note: If you select a deleted ROI, the statistics shown for the ROI are those that applied at the time the ROI was deleted.

If you have more than one ROI selected, the statistics shown will apply to the combined ROIs. For example, the area shown will be combined area; the mean shown will be the mean intensity over the combined area.

Writing Statistics

ROI statistics can be written to a disk file in a tabular format suitable for importing into a spread-sheet for further analysis. The format of a statistics file is given in the file formats section, and is a space (" ") separated tabular format, with each ROI contributing one row to the table.

You choose which of the statistics using the check boxes to the right of the statistics in the "ROI Details" panel: write_check. Each item checked will appear as a separate column in the ROI stats file.

You can also choose to sort the statistics into different orders. By default they will simply be written out slice-by-slice. However, if you select one of the buttons beneath the "Sort by" column, you can sort the statistics into different order.

sort_by

  • Alphabetical annotation order. The case of the annotation text is ignored.
  • Slice number order - ascending slice number. This is the default sorting order when Jim is started.
  • ROI area order - largest ROI by area first.
  • ROI mean intensity - largest mean intensity first.

Write the ROI statistics using Write Statistics from the File menu of the ROI Toolkit: file_write_roi_stats,

A File Chooser will prompt you for a file name into which to write the statistics (default extension ".txt"; default file name from the image name). If the stats file already exists, you will be asked whether you want to:

  • Overwrite the existing file. The current set of statistics will replace those already in the stats file.
  • Append the statistics. The current set of statistics will be appended those already in the stats file.
  • Cancel. Nothing is written.

The ROI Toolkit will now calculate the statistics for all the ROIs in the image, and store those requested in the stats file.

Note: any space characters in the annotation text will be replaced by an underscore ("_"), since the space character may be used to delimit the columns of the table.