Skip to content

Refactor sample#165

Merged
MartinHjelmare merged 34 commits intodevelopfrom
refactor-sample
Dec 29, 2019
Merged

Refactor sample#165
MartinHjelmare merged 34 commits intodevelopfrom
refactor-sample

Conversation

@MartinHjelmare
Copy link
Copy Markdown
Collaborator

@MartinHjelmare MartinHjelmare commented Dec 29, 2019

The sample state should represent the sample with a representation that is specific to each implemented microscope api using the ImageContainer api of camacq. An image container has a name, a dictionary of images and a dictionary of values as attributes. The container also fires a specific event on container change.

class ImageContainer(ABC):
    """A container for images."""

    @property
    @abstractmethod
    def change_event(self):
        """:Event: Return an event class to fire on container change."""

    @property
    @abstractmethod
    def images(self):
        """:dict: Return a dict with all images for the container."""

    @property
    @abstractmethod
    def name(self):
        """:str: Return an identifying name for the container."""

    @property
    @abstractmethod
    def values(self):
        """:dict: Return a dict with the values set for the container."""

There are two special cases of the image container. The first is the main sample container of each microscope api, eg the leica container. The main container has an extra attribute data which is a dictionary with all the containers of the sample. The second special case is the image in the dictionary of images of an image container. The image is also a container and has only itself in the images dictionary and a path attribute with the path of the image.

Eg for the leica sample there are plate, well, field, z_slice, channel and image containers under the main leica sample container.

All implemented sample states are available as a variable samples in templates in automations. The leica sample is available as samples.leica.

See below for the leica sample state attribute structure in camacq. The words in all capital letters are example values. Each image container has a name, which is either of plate, well, field, z_slice, channel or image. The different leica containers have different leica specific attributes that aren't all shown below.

samples:
  leica:
    name: leica
    images:
      PATH:
        name: image
        path: PATH
        plate_name: PLATE_NAME
        well_x: WELL_X
        well_y: WELL_Y
        field_x: FIELD_X
        field_y: FIELD_Y
        z_slice_id: Z_SLICE_ID
        channel_id: CHANNEL_ID
        images:
          PATH: self
        values:
          VALUE_KEY: VALUE
    values:
      VALUE_KEY: VALUE
    data:
      CONTAINER_ID:
        name: plate/well/field/z_slice/channel/image
        images:
          PATH:
            name: image
            path: PATH
            plate_name: PLATE_NAME
            well_x: WELL_X
            well_y: WELL_Y
            field_x: FIELD_X
            field_y: FIELD_Y
            z_slice_id: Z_SLICE_ID
            channel_id: CHANNEL_ID
            images:
              PATH: self
            values:
              VALUE_KEY: VALUE
        values:
          VALUE_KEY: VALUE

@MartinHjelmare MartinHjelmare merged commit 54f8ee0 into develop Dec 29, 2019
@MartinHjelmare MartinHjelmare deleted the refactor-sample branch December 29, 2019 21:29
@MartinHjelmare MartinHjelmare mentioned this pull request Feb 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant