ethoscope.roi_builder package

Module contents

This module define modular ROI builders. These objects take an image (or camera stream) and use them to construct a list of BaseROIBuilder is defined. This will typically be done when new arenas (hardware components) is defined.

ethoscope.roi_builders.roi_builders module

class ethoscope.roi_builders.roi_builders.BaseROIBuilder[source]

Bases: ethoscope.utils.description.DescribedObject

Template to design ROIBuilders. Subclasses must implement a _rois_from_img method.

build(input)[source]

Uses an input (image or camera) to build ROIs. When a camera is used, several frames are acquired and averaged to build a reference image.

Parameters:input (BaseCamera or ndarray) – Either a camera object, or an image.
Returns:list(ROI)
class ethoscope.roi_builders.roi_builders.DefaultROIBuilder[source]

Bases: ethoscope.roi_builders.roi_builders.BaseROIBuilder

The default ROI builder. It simply defines the entire image as a unique ROI.

Template to design ROIBuilders. Subclasses must implement a _rois_from_img method.

ethoscope.roi_builders.img_roi_builder module

class ethoscope.roi_builders.img_roi_builder.ImgMaskROIBuilder(mask_path)[source]

Bases: ethoscope.roi_builders.roi_builders.BaseROIBuilder

Class to build rois from greyscale image file. Each continuous region is used as a ROI. The greyscale value inside the ROI determines it’s value.

IMAGE HERE

ethoscope.roi_builders.target_roi_builder module

class ethoscope.roi_builders.target_roi_builder.HD12TubesRoiBuilder[source]

Bases: ethoscope.roi_builders.target_roi_builder.TargetGridROIBuilder

Class to build ROIs for a twelve columns, one row for the HD tracking arena (see here)

class ethoscope.roi_builders.target_roi_builder.OlfactionAssayROIBuilder[source]

Bases: ethoscope.roi_builders.target_roi_builder.TargetGridROIBuilder

Class to build ROIs for a one-column, ten-rows (see here)

class ethoscope.roi_builders.target_roi_builder.SleepMonitorWithTargetROIBuilder[source]

Bases: ethoscope.roi_builders.target_roi_builder.TargetGridROIBuilder

Class to build ROIs for a two-columns, ten-rows for the sleep monitor (see here).

class ethoscope.roi_builders.target_roi_builder.TargetGridROIBuilder(n_rows=1, n_cols=1, top_margin=0, bottom_margin=0, left_margin=0, right_margin=0, horizontal_fill=0.9, vertical_fill=0.9)[source]

Bases: ethoscope.roi_builders.roi_builders.BaseROIBuilder

This roi builder uses three black circles drawn on the arena (targets) to align a grid layout:

IMAGE HERE

Parameters:
  • n_rows (int) – The number of rows in the grid.
  • n_cols (int) – The number of columns.
  • top_margin (float) – The vertical distance between the middle of the top ROIs and the middle of the top target
  • bottom_margin (float) – same as top_margin, but for the bottom.
  • left_margin (float) – same as top_margin, but for the left side.
  • right_margin (float) – same as top_margin, but for the right side.
  • horizontal_fill (float) – The proportion of the grid space user by the roi, horizontally (between 0 and 1).
  • vertical_fill (float) – same as vertical_fill, but horizontally.