bebi103.image.draw_rois

bebi103.image.draw_rois(im, notebook_url='localhost:8888', table_height=100, crosshair_tool_alpha=0.5, color='white', fill_alpha=0.1, vertex_color='red', vertex_size=10, cmap=None, frame_height=400, frame_width=None, length_units='pixels', interpixel_distance=1.0, x_range=None, y_range=None, colorbar=False, no_ticks=False, x_axis_label=None, y_axis_label=None, title=None, flip=False, saturate_channels=True, min_intensity=None, max_intensity=None)

Draw and record polygonal regions of interest on a plot of a Bokeh image.

Parameters
  • im (2D Numpy array) – Image to display while clicking.

  • notebook_url (str, default 'localhost:8888') – URL of notebook for display.

  • table_height (int, default 200) – Height, in pixels, of table displaying polygon vertex locations.

  • crosshair_alpha (float, default 0.5) – Opacity value for crosshairs when using the crosshair tool.

  • color (str, default 'white') – Color of the ROI polygons (lines and fill).

  • fill_alpha (float, default 0.1) – Opacity of drawn ROI polygons.

  • vertex_color (str, default 'red') – Color of vertices of the ROI polygons while using the polygon edit tool.

  • vertex_size (int, default 10) – Size, in pixels, of vertices of the ROI polygons while using the polygon edit tool.

  • cmap (str or list of hex colors, default None) – If im is an intensity image, cmap is a mapping of intensity to color. If None, default is 256-level Viridis. If im is a color image, then cmap can either be ‘rgb’ or ‘cmy’ (default), for RGB or CMY merge of channels.

  • frame_height (int) – Height of the plot in pixels. The width is scaled so that the x and y distance between pixels is the same.

  • frame_width (int or None (default)) – If None, the width is scaled so that the x and y distance between pixels is approximately the same. Otherwise, the width of the plot in pixels.

  • length_units (str, default 'pixels') – The units of length in the image.

  • interpixel_distance (float, default 1.0) – Interpixel distance in units of length_units.

  • x_range (bokeh.models.Range1d instance, default None) – Range of x-axis. If None, determined automatically.

  • y_range (bokeh.models.Range1d instance, default None) – Range of y-axis. If None, determined automatically.

  • colorbar (bool, default False) – If True, include a colorbar.

  • no_ticks (bool, default False) – If True, no ticks are displayed. See note below.

  • x_axis_label (str, default None) – Label for the x-axis. If None, labeled with length_units.

  • y_axis_label (str, default None) – Label for the y-axis. If None, labeled with length_units.

  • title (str, default None) – The title of the plot.

  • flip (bool, default False) – If True, flip image so it displays right-side up. This is necessary because traditionally images have their 0,0 pixel index in the top left corner, and not the bottom left corner. If you are going to use the clicks you record in further image processing applicaitons, you should have flip set to False.

  • saturate_channels (bool, default True) – If True, each of the channels have their displayed pixel values extended to range from 0 to 255 to show the full dynamic range.

  • min_intensity (int or float, default None) – Minimum possible intensity of a pixel in the image. If None, the image is scaled based on the dynamic range in the image.

  • max_intensity (int or float, default None) – Maximum possible intensity of a pixel in the image. If None, the image is scaled based on the dynamic range in the image.

Returns

output – A Bokeh ColumnDataSource instance. This can be immediately converted to a Pandas DataFrame roicds_to_df() function. For example, bebi103.viz.roicds_to_df(output).

Return type

Bokeh ColumnDataSource

Notes

The displayed table is not particularly useful because it displays a list of points. It helps to make sure your clicks are getting registered and to select which ROI number is which polygon.