holypipette.gui.camera module¶
- class holypipette.gui.camera.CameraGui(camera, image_edit=None, display_edit=None, with_tracking=False, base_directory='.')[source]¶
Bases:
QMainWindow
The basic GUI for showing a camera image.
- Parameters:
camera (
Camera
) – TheCamera
object that will be used for displaying an image viaLiveFeedQt
.image_edit (function or list of functions, optional) – A function that will be called with the numpy array returned by the camera. Can be used to post-process the image, e.g. to change its brightness.
display_edit (function or list of functions, optional) – A function that will be called with the
QPixmap
that is based on the camera image. Can be used to display additional information on top of this image, e.g. a scale bar or text.with_tracking (bool, optional) – Whether to activate the object tracking interface. Defaults to
False
.
- camera_reset_signal¶
- camera_signal¶
- display_edit(pixmap)[source]¶
Applies the functions stored in
display_edit_funcs
to the video image pixmap.- Parameters:
pixmap (
QPixmap
) – The pixmap to draw on.
- draw_cross(pixmap)[source]¶
Draws a cross at the center. Meant to be used as a
display_edit
function.- Parameters:
pixmap (
QPixmap
) – The pixmap to draw on.
- image_edit(image)[source]¶
Applies the functions stored in
image_edit_funcs
to the video image. Each function works on the result of the previous function- Parameters:
image (
ndarray
) – The original video image or the image returned by a previously called function.- Returns:
new_image – The post-processed image. Should be of the same size and data type as the original image.
- Return type:
ndarray
- log_signal¶
- register_commands()[source]¶
Tie keypresses and mouse clicks to commands. Should call
register_key_action
andregister_mouse_action
. Overriding methods in subclass should call the superclass if they want to keep the commands registered by the superclass(es).
- register_key_action(key, modifier, command, argument=None, default_doc=True)[source]¶
Link a keypress to an action.
- Parameters:
key (
Qt.Key
) – The key that should be handled, specified as aQt
constant, e.g.Qt.Key_X
orQt.Key_5
.modifier (
Qt.Modifer
orNone
) – The modifier that needs to be pressed at the same time to trigger the action. The modifier needs to be given as aQt
constant, e.g.Qt.ShiftModifier
orQt.ControlModifier
. Alternatively,None
can be used to specify that the keypress should lead to the action independent of the modifier.command (method) – A method implementing the action that has been annotated with the
@command
or@blocking_command
decorator.argument (object, optional) – An additional argument that should be handled to the method defined as
command
. Can be used to re-use the same action in a parametrized way (e.g. steps of different size).default_doc (bool, optional) – Whether to include the action in the automatically generated help. Defaults to
True
.
- register_mouse_action(click_type, modifier, command, default_doc=True)[source]¶
Link a mouse click on the camera image to an action.
- Parameters:
click_type (
Qt.MouseButton
) – The type of click that should be handled as aQt
constant, e.g.Qt.LeftButton
orQt.RightButton
.modifier (
Qt.Modifer
orNone
) – The modifier that needs to be pressed at the same time to trigger the action. The modifier needs to be given as aQt
constant, e.g.Qt.ShiftModifier
orQt.ControlModifier
. Alternatively,None
can be used to specify that the mouse click should lead to the action independent of the modifier.command (method) – A method implementing the action that has been annotated with the
@command
or@blocking_command
decorator.default_doc (bool, optional) – Whether to include the action in the automatically generated help. Defaults to
True
.
- class holypipette.gui.camera.ConfigGui(config, show_name=False)[source]¶
Bases:
QWidget
- value_changed_signal¶
- class holypipette.gui.camera.ElidedLabel(text, minimum_width=200, *args, **kwds)[source]¶
Bases:
QLabel
- class holypipette.gui.camera.LogViewerWindow(parent)[source]¶
Bases:
QMainWindow
- close_signal¶
- levels = {'DEBUG': 10, 'ERROR': 40, 'INFO': 20, 'WARN': 30}¶