navigate.model.devices.camera.base.CameraBase
- class navigate.model.devices.camera.base.CameraBase(microscope_name: str, device_connection: Any, configuration: dict[str, Any], *args: Optional[Any], **kwargs: Optional[Any])
Bases:
ABC
Abstract base class for cameras.
This class provides the interface and common functionality for controlling cameras with navigate.
- __init__(microscope_name: str, device_connection: Any, configuration: dict[str, Any], *args: Optional[Any], **kwargs: Optional[Any]) → None
Initialize CameraBase class.
- Parameters:
microscope_name (str) – Name of microscope in configuration
device_connection (Any) – Hardware device to connect to
configuration (Dict[str, Any]) – Global configuration of the microscope
- Raises:
NameError – If microscope name is not in configuration
Methods
__init__
(microscope_name, device_connection, ...)Initialize CameraBase class.
Convert normal mode exposure time to light-sheet mode exposure time.
Close camera.
Close image series.
Return stored camera line interval.
Get a new frame from the camera.
Get offset and variance maps from file.
initialize_image_series
([data_buffer, ...])Initialize image series and attach the given data_buffer, which serves as the destination for incoming images.
set_ROI
([roi_width, roi_height, center_x, ...])Change the size of the active region on the camera.
set_ROI_and_binning
([roi_width, roi_height, ...])Change the size of the active region on the camera and set the binning mode.
set_binning
([binning])Set the camera binning mode.
set_exposure_time
(exposure_time)Set the camera exposure time.
set_line_interval
(line_interval_time)Set the camera line interval time.
set_readout_direction
(mode)Set HamamatsuOrca readout direction.
set_sensor_mode
(mode)Set camera sensor mode.
set_trigger_mode
([trigger_source])Set the camera trigger source to external or internal free run mode.
Attributes
Return offset map.
Return variance map.
Name of microscope in configuration
Global configuration of the microscope
Hardware device to connect to
Camera parameters
Whether the camera is currently acquiring
Minimum image width
Minimum image height
Minimum step size for image width.
Minimum step size for image height.
Number of pixels in the x direction
Number of pixels in the y direction
minimum exposure time
- abstract calculate_light_sheet_exposure_time(full_chip_exposure_time: float, shutter_width: int) → tuple[float, float, float]
Convert normal mode exposure time to light-sheet mode exposure time. Calculate the parameters for an acquisition
- Parameters:
full_chip_exposure_time (float) – Normal mode exposure time in seconds.
shutter_width (int) – Width of light-sheet rolling shutter.
- Returns:
exposure_time (float) – Light-sheet mode exposure time (s).
camera_line_interval (float) – HamamatsuOrca line interval duration (s).
full_chip_exposure time (float) – Full chip exposure time (s).
- close_camera() → None
Close camera.
- abstract close_image_series() → None
Close image series.
This abstract method must be implemented by all subclasses.
- get_line_interval() → Optional[float]
Return stored camera line interval.
- Returns:
line_interval – line interval duration (s).
- Return type:
float
- abstract get_new_frame() → list[int]
Get a new frame from the camera.
This abstract method must be implemented by all subclasses.
- Returns:
frame_ids – New frame ids from the camera.
- Return type:
list[int]
- get_offset_variance_maps() → Any
Get offset and variance maps from file.
- Returns:
offset (np.ndarray) – Offset map.
variance (np.ndarray) – Variance map.
- Raises:
FileNotFoundError – If offset or variance map is not found.
- abstract initialize_image_series(data_buffer: Optional[list] = None, number_of_frames: int = 100) → None
Initialize image series and attach the given data_buffer, which serves as the destination for incoming images.
This abstract method must be implemented by all subclasses.
- Parameters:
data_buffer – List of SharedNDArrays of shape=(self.img_height, self.img_width) and dtype=”uint16” Default is None.
number_of_frames (int) – Number of frames. Default is 100.
- abstract set_ROI(roi_width: int = 2048, roi_height: int = 2048, center_x: int = 1024, center_y: int = 1024) → bool
Change the size of the active region on the camera.
- Parameters:
roi_width (int) – Width of active camera region.
roi_height (int) – Height of active camera region.
center_x (int) – X position of the center of view
center_y (int) – Y position of the center of view
- Returns:
result – True if successful, False otherwise.
- Return type:
bool
- set_ROI_and_binning(roi_width: int = 2048, roi_height: int = 2048, center_x: int = 1024, center_y: int = 1024, binning: str = '1x1') → bool
Change the size of the active region on the camera and set the binning mode.
- Parameters:
roi_width (int) – Width of active camera region.
roi_height (int) – Height of active camera region.
center_x (int) – X position of the center of view
center_y (int) – Y position of the center of view
binning (str) – Desired binning properties (e.g., ‘1x1’, ‘2x2’, ‘4x4’, ‘8x8’, ‘16x16’, ‘1x2’, ‘2x4’)
- Returns:
result – True if successful, False otherwise.
- Return type:
bool
- abstract set_binning(binning: str = '1x1') → bool
Set the camera binning mode.
- Parameters:
binning (str) – Desired binning properties (e.g., ‘1x1’, ‘2x2’, ‘4x4’, ‘1x2’, ‘2x4’)
- Returns:
result – True if successful, False otherwise.
- Return type:
bool
- abstract set_exposure_time(exposure_time: float) → bool
Set the camera exposure time.
- abstract set_line_interval(line_interval_time: float) → bool
Set the camera line interval time.
This abstract method must be implemented by all subclasses.
- Returns:
result – True if successful, False otherwise.
- Return type:
bool
- abstract set_readout_direction(mode: str) → None
Set HamamatsuOrca readout direction.
- Parameters:
mode (str) – ‘Top-to-Bottom’, ‘Bottom-to-Top’, ‘bytrigger’, or ‘diverge’.
- abstract set_sensor_mode(mode: str) → None
Set camera sensor mode.
- Parameters:
mode (str) – Sensor mode. Options are ‘Normal’ or ‘Light-Sheet’.
- abstract set_trigger_mode(trigger_source: str = 'External') → None
Set the camera trigger source to external or internal free run mode.
This abstract method must be implemented by all subclasses.
- Parameters:
trigger_source (str) – Trigger source. Options are ‘External’ or ‘Internal’.
- camera_controller
Hardware device to connect to
- Type:
object
- camera_parameters
Camera parameters
- Type:
dict
- configuration
Global configuration of the microscope
- Type:
dict
- is_acquiring
Whether the camera is currently acquiring
- Type:
bool
- microscope_name
Name of microscope in configuration
- Type:
str
- min_image_height
Minimum image height
- Type:
int
- min_image_width
Minimum image width
- Type:
int
- minimum_exposure_time
minimum exposure time
- Type:
float
- property offset: Any
Return offset map. If not present, load from file.
- Returns:
offset – Offset map.
- Return type:
np.ndarray
- step_image_height
Minimum step size for image height.
- Type:
int
- step_image_width
Minimum step size for image width.
- Type:
int
- property variance: Any
Return variance map. If not present, load from file.
- Returns:
variance – Variance map.
- Return type:
np.ndarray
- x_pixels
Number of pixels in the x direction
- Type:
int
- y_pixels
Number of pixels in the y direction
- Type:
int