experimentor.views.camera package¶
Submodules¶
experimentor.views.camera.camera_viewer_widget module¶
Camera Viewer Widget¶
Wrapper around PyQtGraph ImageView.
-
class
experimentor.views.camera.camera_viewer_widget.
CameraViewerWidget
(parent=None)[source]¶ Bases:
experimentor.views.data_view_widget.DataViewWidget
The Camera Viewer Widget is a wrapper around PyQtGraph ImageView. It adds some common methods for getting extra mouse interactions, such as performing an auto-range through right-clicking, it allows to drag and drop horizontal and vertical lines to define a ROI, and it allows to draw on top of the image. The core idea is to make these options explicit, in order to systematize them in one place.
- clicked_on_image: Emits [float, float] with the coordinates where the mouse was clicked on the image. Does not
- distinguish between left/right clicks. Any further processing must be done downstream.
-
layout
¶ Type: QHBoxLayout, in case extra elements must be added
-
viewport
¶ Type: GraphicsLayoutWidget
-
view
¶ Type: ViewBox
-
img
¶ Type: ImageItem
-
imv
¶ Type: ImageView
-
auto_levels
¶ Type: Whether to actualize the levels of the image every time they are refreshed
Adds actions to the contextual menu. If you want to have control on which actions appear, consider subclassing this widget and overriding this method.
-
clicked_on_image
¶
-
classmethod
connect_to_camera
(camera, refresh_time=50, parent=None)[source]¶ Instantiate the viewer using connect_to_camera in order to get some functionality out of the box. It will create a timer to automatically update the image
-
do_auto_range
()[source]¶ Sets the levels of the image based on the maximum and minimum. This is useful when auto-levels are off (the default behavior), and one needs to quickly adapt the histogram.
-
draw_target_pointer
(locations)[source]¶ gets an image and draws a circle around the target locations.
Parameters: locations (DataFrame) – DataFrame generated by trackpy’s locate method. It only requires columns x and y with coordinates.
-
get_roi_values
()[source]¶ Get’s the ROI values in camera-space. It keeps track of the top left corner in order to update the values before returning. :return: Position of the corners of the ROI region assuming 0-indexed cameras.
-
keyPressEvent
(key)[source]¶ Triggered when there is a key press with some modifier. Shift+C: Removes the cross hair from the screen These last two events have to be handeled in the mainWindow that implemented this widget.
-
mouseMoved
(arg)[source]¶ Updates the position of the cross hair. The mouse has to be moved while pressing down the Ctrl button.
Module contents¶
-
class
experimentor.views.camera.
CameraViewerWidget
(parent=None)[source]¶ Bases:
experimentor.views.data_view_widget.DataViewWidget
The Camera Viewer Widget is a wrapper around PyQtGraph ImageView. It adds some common methods for getting extra mouse interactions, such as performing an auto-range through right-clicking, it allows to drag and drop horizontal and vertical lines to define a ROI, and it allows to draw on top of the image. The core idea is to make these options explicit, in order to systematize them in one place.
- clicked_on_image: Emits [float, float] with the coordinates where the mouse was clicked on the image. Does not
- distinguish between left/right clicks. Any further processing must be done downstream.
-
layout
¶ Type: QHBoxLayout, in case extra elements must be added
-
viewport
¶ Type: GraphicsLayoutWidget
-
view
¶ Type: ViewBox
-
img
¶ Type: ImageItem
-
imv
¶ Type: ImageView
-
auto_levels
¶ Type: Whether to actualize the levels of the image every time they are refreshed
Adds actions to the contextual menu. If you want to have control on which actions appear, consider subclassing this widget and overriding this method.
-
clicked_on_image
¶
-
classmethod
connect_to_camera
(camera, refresh_time=50, parent=None)[source]¶ Instantiate the viewer using connect_to_camera in order to get some functionality out of the box. It will create a timer to automatically update the image
-
do_auto_range
()[source]¶ Sets the levels of the image based on the maximum and minimum. This is useful when auto-levels are off (the default behavior), and one needs to quickly adapt the histogram.
-
draw_target_pointer
(locations)[source]¶ gets an image and draws a circle around the target locations.
Parameters: locations (DataFrame) – DataFrame generated by trackpy’s locate method. It only requires columns x and y with coordinates.
-
get_roi_values
()[source]¶ Get’s the ROI values in camera-space. It keeps track of the top left corner in order to update the values before returning. :return: Position of the corners of the ROI region assuming 0-indexed cameras.
-
keyPressEvent
(key)[source]¶ Triggered when there is a key press with some modifier. Shift+C: Removes the cross hair from the screen These last two events have to be handeled in the mainWindow that implemented this widget.
-
mouseMoved
(arg)[source]¶ Updates the position of the cross hair. The mouse has to be moved while pressing down the Ctrl button.