-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce
CellposeSegmentationChannel
for channel inputs in `cellpo…
…se_segmentation` (ref #412)
- Loading branch information
Showing
4 changed files
with
141 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
""" | ||
Copyright 2022 (C) | ||
Friedrich Miescher Institute for Biomedical Research and | ||
University of Zurich | ||
Original authors: | ||
Tommaso Comparin <[email protected]> | ||
This file is part of Fractal and was originally developed by eXact lab | ||
S.r.l. <exact-lab.it> under contract with Liberali Lab from the Friedrich | ||
Miescher Institute for Biomedical Research and Pelkmans Lab from the | ||
University of Zurich. | ||
Pydantic models for some task parameters | ||
""" | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel | ||
from pydantic import validator | ||
|
||
|
||
class BaseChannel(BaseModel): | ||
""" | ||
TBD | ||
""" | ||
|
||
wavelength_id: Optional[str] = None | ||
label: Optional[str] = None | ||
|
||
@validator("label", always=True) | ||
def mutually_exclusive_channel_attributes(cls, v, values): | ||
""" | ||
If `label` is set, then `wavelength_id` must be `None` | ||
""" | ||
wavelength_id = values.get("wavelength_id") | ||
label = v | ||
|
||
if wavelength_id is not None and v is not None: | ||
raise ValueError( | ||
"`wavelength_id` and `label` cannot be both set " | ||
f"(given {wavelength_id=} and {label=})." | ||
) | ||
|
||
if wavelength_id is None and v is None: | ||
raise ValueError( | ||
"`wavelength_id` and `label` cannot be both `None`" | ||
) | ||
|
||
return v | ||
|
||
|
||
class CellposeSegmentationChannel(BaseChannel): | ||
""" | ||
TBD | ||
""" | ||
|
||
pass | ||
|
||
|
||
class NapariWorkflowsChannel(BaseModel): | ||
""" | ||
TBD | ||
""" | ||
|
||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.