nulogo

Selection Module

flyqma.selection provides a matplotlib-based GUI for defining a region of interest within each image.

User Interface

Tools for constructing a layer and stack selection GUI.

class flyqma.selection.interface.LayerInterface(layer, axes)[source]

Event handler for an individual layer.

Attributes:

include (bool) - flag for layer inclusion

active_polyhon (bool) - if True, polygon is currently active

pts (list) - selection boundary points

traceback (list) - exception traceback

Inherited attributes:

path (str) - layer path

layer (flyqma.Layer) - layer instance

axes (array like) - axes for blue/red/green color channels

add_point(pt)[source]

Add point to layer selection bounds.

clear()[source]

Clear all points from layer selection bounds.

load()[source]

Load layer selection.

remove_point()[source]

Remove last point added to layer selection bounds.

save()[source]

Save selected points and selection metadata to file.

undo()[source]

Remove last point added and update polygon.

update_polygon()[source]

Update polygon for each image.

class flyqma.selection.interface.LayerVisualization(layer, axes)[source]

Object for visualizing a single layer.

Attributes:

path (str) - layer path

layer (flyqma.Layer) - layer instance

axes (array like) - axes for blue/red/green color channels

add_marker(x, y, color='k', markersize=10)[source]

Add marker to layer images.

add_polygon()[source]

Add polygon to each image.

clear_markers()[source]

” Remove all markers.

overlay(msg, s=18)[source]

Overlay string centered on image.

remove_marker()[source]

Remove marker from layer images.

remove_polygon()[source]

Remove polygon from each image.

render_images(layer, cmap=None)[source]

Add blue, green, and red channels of layer to axes.

Args:

layer (Layer) - RGB image layer

cmap (matplotlib.colors.ColorMap)

update_marker(color, markersize, ind=-1)[source]

Update size and color of last added marker.

class flyqma.selection.interface.StackInterface(stack)[source]

Object for visualizing multiple layers in an image stack.

Attributes:

path (str) - layer path

axes (array like) - axes for blue/red/green color channels

build_interface(stack)[source]

Build interface by adding interface for each layer.

Args:

stack (Stack) - image stack

Event Handling

Tools for managing GUI-mediated event-handling.

class flyqma.selection.gui.GUI(stack)[source]

GUI for manually selecting regions within each layer of an image stack.

Following instantiation, run “GUI.connect()” to begin event handling.

Key actions:

T: remove last added point

Y: reset all points in layer

E: exclude entire layer

W: save ROI data

Q: disconnect and exit GUI

connect()[source]

Connect event handling.

disconnect()[source]

Disconnect event handling.

exit()[source]

Disconnect and exit GUI.

static load(stack)[source]

Load selection GUI from file.

Args:

stack (Stack) - image stack

Returns:

gui (GUI) - disconnected gui

on_click(event)[source]

Click action: add point.

on_key(event)[source]

Key actions.

T: remove last added point

Y: reset all points in layer

E: exclude entire layer

W: save ROI data

Q: disconnect and exit GUI

save(image=True)[source]

Save selection path for each layer.

Args:

image (bool) - if True, save overall image of selections

which_layer(event)[source]

Returns layer ID where event took place.