Skip to content

Tissue ROI Detection

William Silversmith edited this page Jun 2, 2023 · 3 revisions

CloudVolume has the capability to read an extension to the Neuroglancer spec, "rois" in the highest resolution scale of the info file. These ROIs identify the location of tissue in the volume using a list of 3D bounding boxes.

When tissue ROIs are provided, if a cutout is requested that does not overlap at all with any ROI, CloudVolume will render a background color cutout (usually all zeros) without making network requests. This can help improve performance when processing large regions that may be background (common during alignment). While loading empty image chunks is relatively fast, this reduces an operation on the order of seconds to milliseconds.

The format for "rois" in the info file is as follows where the variables xstart thru zend are integers and are inclusive bounds.

{
    ...
    "scales": [
       { ..., 
          "rois": [
             [ xstart, ystart, zstart, xend, yend, zend ]   
          ] 
       },
       ...
    ],
    ...
}

If ROIs are not specified, CloudVolume will fetch the empty chunks as usual. You can specify ROIs manually by modifying the info file. You can also determine them automatically using Igneous. A simple example is shown below using the Igneous CLI.

igneous image roi $PATH

You can disable ROIs for a CloudVolume instance by doing the following:

cv.meta.rois = None

You can use the ROIs to determine if a point or Bbox is located in the active region.

if cv.meta.overlaps_roi(pt_or_bbox, mip=0):
   print("inside ROI")