Skip to content

io_models

InitArgsCellVoyager

Bases: BaseModel

Arguments to be passed from cellvoyager converter init to compute

ATTRIBUTE DESCRIPTION
image_dir

Directory where the raw images are found

TYPE: str

plate_prefix

part of the image filename needed for finding the right subset of image files

TYPE: str

well_ID

part of the image filename needed for finding the right subset of image files

TYPE: str

image_extension

part of the image filename needed for finding the right subset of image files

TYPE: str

include_glob_patterns

Additional glob patterns to filter the available images with.

TYPE: Optional[list[str]]

exclude_glob_patterns

Glob patterns to exclude.

TYPE: Optional[list[str]]

acquisition

Acquisition metadata needed for multiplexing

TYPE: Optional[int]

Source code in fractal_tasks_core/tasks/io_models.py
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
class InitArgsCellVoyager(BaseModel):
    """
    Arguments to be passed from cellvoyager converter init to compute

    Attributes:
        image_dir: Directory where the raw images are found
        plate_prefix: part of the image filename needed for finding the
            right subset of image files
        well_ID: part of the image filename needed for finding the
            right subset of image files
        image_extension: part of the image filename needed for finding the
            right subset of image files
        include_glob_patterns: Additional glob patterns to filter the available
            images with.
        exclude_glob_patterns: Glob patterns to exclude.
        acquisition: Acquisition metadata needed for multiplexing
    """

    image_dir: str
    plate_prefix: str
    well_ID: str
    image_extension: str
    include_glob_patterns: Optional[list[str]] = None
    exclude_glob_patterns: Optional[list[str]] = None
    acquisition: Optional[int] = None

InitArgsIllumination

Bases: BaseModel

Dummy model description.

ATTRIBUTE DESCRIPTION
raw_path

dummy attribute description.

TYPE: str

subsets

dummy attribute description.

TYPE: dict[Literal['C_index'], int]

Source code in fractal_tasks_core/tasks/io_models.py
68
69
70
71
72
73
74
75
76
77
78
class InitArgsIllumination(BaseModel):
    """
    Dummy model description.

    Attributes:
        raw_path: dummy attribute description.
        subsets: dummy attribute description.
    """

    raw_path: str
    subsets: dict[Literal["C_index"], int] = Field(default_factory=dict)

InitArgsMIP

Bases: BaseModel

Init Args for MIP task.

ATTRIBUTE DESCRIPTION
origin_url

Path to the zarr_url with the 3D data

TYPE: str

method

Projection method to be used. See DaskProjectionMethod

TYPE: str

overwrite

If True, overwrite the task output.

TYPE: bool

new_plate_name

Name of the new OME-Zarr HCS plate

TYPE: str

Source code in fractal_tasks_core/tasks/io_models.py
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
class InitArgsMIP(BaseModel):
    """
    Init Args for MIP task.

    Attributes:
        origin_url: Path to the zarr_url with the 3D data
        method: Projection method to be used. See `DaskProjectionMethod`
        overwrite: If `True`, overwrite the task output.
        new_plate_name: Name of the new OME-Zarr HCS plate
    """

    origin_url: str
    method: str
    overwrite: bool
    new_plate_name: str

InitArgsRegistration

Bases: BaseModel

Registration init args.

Passed from image_based_registration_hcs_init to calculate_registration_image_based.

ATTRIBUTE DESCRIPTION
reference_zarr_url

zarr_url for the reference image

TYPE: str

Source code in fractal_tasks_core/tasks/io_models.py
13
14
15
16
17
18
19
20
21
22
23
24
class InitArgsRegistration(BaseModel):
    """
    Registration init args.

    Passed from `image_based_registration_hcs_init` to
    `calculate_registration_image_based`.

    Attributes:
        reference_zarr_url: zarr_url for the reference image
    """

    reference_zarr_url: str

InitArgsRegistrationConsensus

Bases: BaseModel

Registration consensus init args.

Provides the list of zarr_urls for all acquisitions for a given well

ATTRIBUTE DESCRIPTION
zarr_url_list

List of zarr_urls for all the OME-Zarr images in the well.

TYPE: list[str]

Source code in fractal_tasks_core/tasks/io_models.py
27
28
29
30
31
32
33
34
35
36
37
38
class InitArgsRegistrationConsensus(BaseModel):
    """
    Registration consensus init args.

    Provides the list of zarr_urls for all acquisitions for a given well

    Attributes:
        zarr_url_list: List of zarr_urls for all the OME-Zarr images in the
            well.
    """

    zarr_url_list: list[str]

MultiplexingAcquisition

Bases: BaseModel

Input class for Multiplexing Cellvoyager converter

ATTRIBUTE DESCRIPTION
image_dir

Path to the folder that contains the Cellvoyager image files for that acquisition and the MeasurementData & MeasurementDetail metadata files.

TYPE: str

allowed_channels

A list of OmeroChannel objects, where each channel must include the wavelength_id attribute and where the wavelength_id values must be unique across the list.

TYPE: list[OmeroChannel]

Source code in fractal_tasks_core/tasks/io_models.py
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
class MultiplexingAcquisition(BaseModel):
    """
    Input class for Multiplexing Cellvoyager converter

    Attributes:
        image_dir: Path to the folder that contains the Cellvoyager image
            files for that acquisition and the MeasurementData &
            MeasurementDetail metadata files.
        allowed_channels: A list of `OmeroChannel` objects, where each channel
            must include the `wavelength_id` attribute and where the
            `wavelength_id` values must be unique across the list.
    """

    image_dir: str
    allowed_channels: list[OmeroChannel]

NapariWorkflowsInput

Bases: BaseModel

A value of the input_specs argument in napari_workflows_wrapper.

ATTRIBUTE DESCRIPTION
type

Input type (either image or label).

TYPE: Literal['image', 'label']

label_name

Label name (for label inputs only).

TYPE: Optional[str]

channel

ChannelInputModel object (for image inputs only).

TYPE: Optional[ChannelInputModel]

Source code in fractal_tasks_core/tasks/io_models.py
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
class NapariWorkflowsInput(BaseModel):
    """
    A value of the `input_specs` argument in `napari_workflows_wrapper`.

    Attributes:
        type: Input type (either `image` or `label`).
        label_name: Label name (for label inputs only).
        channel: `ChannelInputModel` object (for image inputs only).
    """

    type: Literal["image", "label"]
    label_name: Optional[str] = None
    channel: Optional[ChannelInputModel] = None

    @model_validator(mode="after")
    def label_name_is_present(self: Self) -> Self:
        """
        Check that label inputs have `label_name` set.
        """
        label_name = self.label_name
        _type = self.type
        if _type == "label" and label_name is None:
            raise ValueError(
                f"Input item has type={_type} but label_name={label_name}."
            )
        return self

    @model_validator(mode="after")
    def channel_is_present(self: Self) -> Self:
        """
        Check that image inputs have `channel` set.
        """
        _type = self.type
        channel = self.channel
        if _type == "image" and channel is None:
            raise ValueError(
                f"Input item has type={_type} but channel={channel}."
            )
        return self

channel_is_present()

Check that image inputs have channel set.

Source code in fractal_tasks_core/tasks/io_models.py
174
175
176
177
178
179
180
181
182
183
184
185
@model_validator(mode="after")
def channel_is_present(self: Self) -> Self:
    """
    Check that image inputs have `channel` set.
    """
    _type = self.type
    channel = self.channel
    if _type == "image" and channel is None:
        raise ValueError(
            f"Input item has type={_type} but channel={channel}."
        )
    return self

label_name_is_present()

Check that label inputs have label_name set.

Source code in fractal_tasks_core/tasks/io_models.py
161
162
163
164
165
166
167
168
169
170
171
172
@model_validator(mode="after")
def label_name_is_present(self: Self) -> Self:
    """
    Check that label inputs have `label_name` set.
    """
    label_name = self.label_name
    _type = self.type
    if _type == "label" and label_name is None:
        raise ValueError(
            f"Input item has type={_type} but label_name={label_name}."
        )
    return self

NapariWorkflowsOutput

Bases: BaseModel

A value of the output_specs argument in napari_workflows_wrapper.

ATTRIBUTE DESCRIPTION
type

Output type (either label or dataframe).

TYPE: Literal['label', 'dataframe']

label_name

Label name (for label outputs, it is used as the name of the label; for dataframe outputs, it is used to fill the region["path"] field).

TYPE: str

table_name

Table name (for dataframe outputs only).

TYPE: Optional[str]

Source code in fractal_tasks_core/tasks/io_models.py
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
class NapariWorkflowsOutput(BaseModel):
    """
    A value of the `output_specs` argument in `napari_workflows_wrapper`.

    Attributes:
        type: Output type (either `label` or `dataframe`).
        label_name: Label name (for label outputs, it is used as the name of
            the label; for dataframe outputs, it is used to fill the
            `region["path"]` field).
        table_name: Table name (for dataframe outputs only).
    """

    type: Literal["label", "dataframe"]
    label_name: str
    table_name: Optional[str] = None

    @model_validator(mode="after")
    def table_name_only_for_dataframe_type(self: Self) -> Self:
        """
        Check that table_name is set only for dataframe outputs.
        """
        _type = self.type
        _table_name = self.table_name
        if (_type == "dataframe" and (not _table_name)) or (
            _type != "dataframe" and _table_name
        ):
            raise ValueError(
                f"Output item has type={_type} but table_name={_table_name}."
            )
        return self

table_name_only_for_dataframe_type()

Check that table_name is set only for dataframe outputs.

Source code in fractal_tasks_core/tasks/io_models.py
131
132
133
134
135
136
137
138
139
140
141
142
143
144
@model_validator(mode="after")
def table_name_only_for_dataframe_type(self: Self) -> Self:
    """
    Check that table_name is set only for dataframe outputs.
    """
    _type = self.type
    _table_name = self.table_name
    if (_type == "dataframe" and (not _table_name)) or (
        _type != "dataframe" and _table_name
    ):
        raise ValueError(
            f"Output item has type={_type} but table_name={_table_name}."
        )
    return self