camacq.plugins.leica package¶
Leica microscope API specific modules.
- class camacq.plugins.leica.LeicaApi(center: Center, config: dict[str, Any], client: AsyncCAM)[source]¶
Bases:
ApiRepresent the Leica API.
- property name: str¶
Return the name of the API.
- async receive(replies: list[dict[str, Any]] | dict[str, Any]) None[source]¶
Receive replies from CAM server and fire an event per reply.
- Parameters:
replies (list) – A list of replies from the CAM server.
- class camacq.plugins.leica.LeicaCommandEvent(data: dict[str, Any] | None = None)[source]¶
Bases:
CommandEventLeica CommandEvent class.
- property command: str¶
Return the command string.
- event_type: ClassVar[str] = 'leica_command_event'¶
- class camacq.plugins.leica.LeicaImageEvent(data: dict[str, Any] | None = None)[source]¶
Bases:
ImageEventLeica ImageEvent class.
- property channel_id: int | None¶
int: Return channel id of the image.
- event_type: ClassVar[str] = 'leica_image_event'¶
- property field_x: int | None¶
int: Return x coordinate of the well of the image.
- property field_y: int | None¶
int: Return y coordinate of the well of the image.
- property job_id: int | None¶
int: Return job id of the image.
- property path: str¶
str: Return absolute path to the image.
- property plate_name: str | None¶
str: Return plate name of the image.
- property well_x: int | None¶
int: Return x coordinate of the well of the image.
- property well_y: int | None¶
int: Return y coordinate of the well of the image.
- property z_slice_id: int | None¶
int: Return z index of the image.
- class camacq.plugins.leica.LeicaStartCommandEvent(data: dict[str, Any] | None = None)[source]¶
Bases:
StartCommandEvent,LeicaCommandEventLeica StartCommandEvent class.
- event_type: ClassVar[str] = 'leica_start_command_event'¶
- class camacq.plugins.leica.LeicaStopCommandEvent(data: dict[str, Any] | None = None)[source]¶
Bases:
StopCommandEvent,LeicaCommandEventLeica StopCommandEvent class.
- event_type: ClassVar[str] = 'leica_stop_command_event'¶
- async camacq.plugins.leica.setup_module(center: Center, config: dict[str, Any]) None[source]¶
Set up Leica api package.
- Parameters:
center (Center instance) – The Center instance.
config (dict) – The config dict.
Submodules¶
camacq.plugins.leica.command module¶
Handle commands.
- camacq.plugins.leica.command.cam_com(exp: str, wellu: int, wellv: int, fieldx: int, fieldy: int, dxcoord: float, dycoord: float) list[tuple[str, str]][source]¶
Add a field to the cam list.
Return a list with parts for the cam command.
- camacq.plugins.leica.command.camstart_com(afjob: str | None = None, afrange: int | None = None, afsteps: int | None = None) list[tuple[str, str]][source]¶
Start the cam scan with selected AF job and AF settings.
Return a list with parts for the cam command.
- camacq.plugins.leica.command.camstop_com() list[tuple[str, str]][source]¶
Stop the cam scan.
Return a list with parts for the cam command.
- camacq.plugins.leica.command.del_com() list[tuple[str, str]][source]¶
Delete the cam list.
Return a list with parts for the cam command.
- camacq.plugins.leica.command.enable_com(wellu: int, wellv: int, fieldx: int, fieldy: int, enable: bool) list[tuple[str, str]][source]¶
Enable a field in a well.
Return a list with parts for the cam command.
- camacq.plugins.leica.command.gain_com(exp: str, num: int, value: float) list[tuple[str, str]][source]¶
Change the pmt gain in a job.
Return a list with parts for the cam command.
camacq.plugins.leica.helper module¶
Helper functions for Leica api.
- camacq.plugins.leica.helper.find_image_path(relpath: str, root: str) str[source]¶
Parse the relpath from the server to find file path from root.
Convert from windows path to posix path.
- Parameters:
relpath (str) – A relative path to the image.
root (str) – Path to directory where path should start.
- Returns:
Return path to image.
- Return type:
str
- camacq.plugins.leica.helper.get_field(path: str) str[source]¶
Get path to field from image path.
- Parameters:
path (string) – Path to image.
- Returns:
Return path to field directory of image.
- Return type:
str
- camacq.plugins.leica.helper.get_imgs(path: str, img_type: str = 'tif', search: str = '') list[Path][source]¶
Get all images below path.
- Parameters:
path (string) – Path to directory where to search for images.
img_type (string) – A string representing the image file type extension.
path – A glob pattern string to use in the search.
- Returns:
Return paths of all images found.
- Return type:
list
camacq.plugins.leica.sample module¶
Provide sample implementation for leica microscope.
- class camacq.plugins.leica.sample.Channel(images: dict[str, Image], channel_id: int, **kwargs: Any)[source]¶
Bases:
Well,ImageContainerA channel with attributes.
- Parameters:
images (dict) – All the images of the sample.
channel_id (int) – ID of the channel.
well_x (int) – x coordinate of the well, minimum 0.
well_y (int) – y coordinate of the well, minimum 0.
plate_name (str) – The name of the plate.
values (dict) – Optional dict of values.
- channel_id¶
Return channel_id of the channel.
- Type:
int
- property change_event: type[SampleEvent]¶
Event: Return an event class to fire on container change.
- property name: str¶
str: Return an identifying name for the container.
- property values: dict[str, Any]¶
dict: Return a dict with the values set for the container.
- class camacq.plugins.leica.sample.ChannelEvent(data: dict[str, Any] | None = None)[source]¶
Bases:
WellEventAn event produced by a sample channel change event.
- property channel_id: int¶
int: Return the channel id of the event.
- property channel_name: str | None¶
str: Return the channel name of the event.
- event_type: ClassVar[str] = 'channel_event'¶
- class camacq.plugins.leica.sample.Field(images: dict[str, Image], field_x: int, field_y: int, **kwargs: Any)[source]¶
Bases:
Well,ImageContainerA field within a well.
- Parameters:
images (dict) – All the images of the sample.
field_x (int) – Coordinate of field in x.
field_y (int) – Coordinate of field in y.
well_x (int) – x coordinate of the well, minimum 0.
well_y (int) – y coordinate of the well, minimum 0.
plate_name (str) – The name of the plate.
values (dict) – Optional dict of values.
- field_x¶
Number showing the x coordinate of the field, from 0.
- Type:
int
- field_y¶
Number showing the y coordinate of the field, from 0.
- Type:
int
- property change_event: type[SampleEvent]¶
Event: Return an event class to fire on container change.
- property name: str¶
str: Return an identifying name for the container.
- property values: dict[str, Any]¶
dict: Return a dict with the values set for the container.
- class camacq.plugins.leica.sample.FieldEvent(data: dict[str, Any] | None = None)[source]¶
Bases:
WellEventAn event produced by a sample field change event.
- event_type: ClassVar[str] = 'field_event'¶
- property field_img_ok: bool¶
bool: Return if the field has all images acquired ok.
- property field_x: int¶
int: Return the field x coordinate of the event.
- property field_y: int¶
int: Return the field y coordinate of the event.
- class camacq.plugins.leica.sample.LeicaSample(images: dict[str, Image] | None = None, values: dict[str, Any] | None = None)[source]¶
Bases:
SampleRepresentation of the state of the sample.
The sample can have plates, wells, fields, channels and images.
- Parameters:
images (dict) – A dict of images of the sample.
values (dict) – Optional dict of values.
- property change_event: type[SampleEvent]¶
Event: Return an event class to fire on container change.
- property image_event_type: str¶
str: Return the image event type to listen to for the sample.
- property name: str¶
str: Return the name of the sample.
- async on_image(center: Center, event: ImageEvent) None[source]¶
Handle image event for this sample.
- property set_sample_schema: Schema | Any¶
Return the validation schema of the set_sample method.
- property values: dict[str, Any]¶
dict: Return a dict with the values set for the container.
- class camacq.plugins.leica.sample.LeicaSampleEvent(data: dict[str, Any] | None = None)[source]¶
Bases:
SampleEventAn event produced by a sample change event.
- event_type: ClassVar[str] = 'leica_sample_event'¶
- class camacq.plugins.leica.sample.Plate(images: dict[str, Image], plate_name: str, **kwargs: Any)[source]¶
Bases:
ImageContainerA container for wells.
- Parameters:
images (dict) – All the images of the sample.
plate_name (str) – The name of the plate.
values (dict) – Optional dict of values.
- plate_name¶
The name of the plate.
- Type:
str
- property change_event: type[SampleEvent]¶
Event: Return an event class to fire on container change.
- property name: str¶
str: Return an identifying name for the container.
- property values: dict[str, Any]¶
dict: Return a dict with the values set for the container.
- class camacq.plugins.leica.sample.PlateEvent(data: dict[str, Any] | None = None)[source]¶
Bases:
LeicaSampleEventAn event produced by a sample plate change event.
- event_type: ClassVar[str] = 'plate_event'¶
- property plate_name: str¶
str: Return the name of the plate.
- class camacq.plugins.leica.sample.Well(images: dict[str, Image], well_x: int, well_y: int, **kwargs: Any)[source]¶
Bases:
Plate,ImageContainerA well within a plate with fields and channels.
- Parameters:
images (dict) – All the images of the sample.
well_x (int) – x coordinate of the well, minimum 0.
well_y (int) – y coordinate of the well, minimum 0.
plate_name (str) – The name of the plate.
values (dict) – Optional dict of values.
- well_x¶
Number showing the x coordinate of the well, from 0.
- Type:
int
- well_y¶
Number showing the y coordinate of the well, from 0.
- Type:
int
- property change_event: type[SampleEvent]¶
Event: Return an event class to fire on container change.
- property name: str¶
str: Return an identifying name for the container.
- property values: dict[str, Any]¶
dict: Return a dict with the values set for the container.
- class camacq.plugins.leica.sample.WellEvent(data: dict[str, Any] | None = None)[source]¶
Bases:
PlateEventAn event produced by a sample well change event.
- event_type: ClassVar[str] = 'well_event'¶
- property well_img_ok: bool¶
bool: Return if the well has all images acquired ok.
- property well_x: int¶
int: Return the well x coordinate of the event.
- property well_y: int¶
int: Return the well y coordinate of the event.
- class camacq.plugins.leica.sample.ZSlice(images: dict[str, Image], z_slice_id: int, **kwargs: Any)[source]¶
Bases:
Well,ImageContainerA channel with attributes.
- Parameters:
images (dict) – All the images of the sample.
z_slice_id (int) – ID of the slice.
well_x (int) – x coordinate of the well, minimum 0.
well_y (int) – y coordinate of the well, minimum 0.
plate_name (str) – The name of the plate.
values (dict) – Optional dict of values.
- z_slice_id¶
Return z_slice_id of the channel.
- Type:
int
- property change_event: type[SampleEvent]¶
Event: Return an event class to fire on container change.
- property name: str¶
str: Return an identifying name for the container.
- property values: dict[str, Any]¶
dict: Return a dict with the values set for the container.
- class camacq.plugins.leica.sample.ZSliceEvent(data: dict[str, Any] | None = None)[source]¶
Bases:
WellEventAn event produced by a sample z slice change event.
- event_type: ClassVar[str] = 'z_slice_event'¶
- property z_slice_id: int¶
int: Return the z_slice id of the event.
- camacq.plugins.leica.sample.next_well_xy(sample: LeicaSample, plate_name: str, x_wells: int | None = None, y_wells: int | None = None) tuple[int | None, int | None][source]¶
Return the next not done well for the given plate x, y format.