Picking

Picker

Initialise a GUI to pick various points on images.

This Module provides a class to initialise a GUI, to pick various points on one or multiple images.

class PointPicker[source][source]

Bases: object

GUI for picking points.

pick(images, all_pts=True)[source][source]

Initialise a GUI to pick points on multiple images.

A matplot GUI will be initialised, where the user can pick multiple points on the N images. Afterwards the PointPicker will return N ndarrays, which holds the coordinates of the marked points. Each ndarray holds the points for one image.

Parameters:
  • images (list(ndarray)) – List of images (ndarray)
  • all_pts (bool) – If True all points will be returned and else just ‘selected’ points will be returned.
Returns:

Returns a List of length N, where each cell contains a ndarray (M,2), which holds the coordinates of the M marked points per image.

Return type:

list(ndarray)

Draggables

This module contains draggable objects for the matplotlib GUI.

The objects are used to mark specific points on an image. The module also contains a special list to save these objects. This list is extended with special functions to get the coordinates of the marked points.

class DraggableMark(mark, img=None)[source][source]

Bases: object

Defines marks which can be dragged by mouse.

The placed mark can be dragged by simple left click and can be refined by pressing the key_refine specific button and they can be marked as selected by pressing key_select.

key_refine = 'r'
key_select = 's'
get_coordinate()[source][source]

Return the current coordinate of the mark.

Returns:center of the mark (2,).
Return type:ndarray
connect()[source][source]

Connect to the mark to various Events.

disconnect()[source][source]

Disconnect all the stored connection ids.

class DraggableMarkList(*args)[source][source]

Bases: list

Extended List with some extra functions for DraggableMark objects.

get_points(all_pts=True)[source][source]

Convert the list of DraggableMark objects to a ndarray holding just coordinates.

Parameters:all_pts (bool) – if True function returns all coordinate. If False function return just coordinates form DraggableMark objects marked as selected.
Returns:array that contains just the coordinates of the DraggableMark objects of the list.
Return type:ndarray