bebi103.image.verts_to_roi

bebi103.image.verts_to_roi(verts, size_i, size_j)

Converts list of vertices to an ROI and ROI bounding box

Parameters
  • verts (array_like, shape (n_verts, 2)) – List of vertices of a polygon with no crossing lines. The units describing the positions of the vertices are interpixel spacing.

  • size_i (int) – Number of pixels in the i-direction (number of rows) in the image

  • size_j (int) – Number of pixels in the j-direction (number of columns) in the image

Returns

  • roi (array_like, Boolean, shape (size_i, size_j)) – roi[i,j] is True if pixel (i,j) is in the ROI. roi[i,j] is False otherwise

  • roi_bbox (tuple of slice objects) – To get a subimage with the bounding box of the ROI, use im[roi_bbox].

  • roi_box (array_like, shape is size of bounding box or ROI) – A mask for the ROI with the same dimension as the bounding box. The indexing starts at zero at the upper right corner of the box.