Skip to content

Omero channels window parameters became required unintentionally with 0.12.0 changes #547

Closed
@jluethi

Description

@jluethi

With our new use of NgffImageMeta, the Omero channels window appears to have become required in 0.12.0, while it's an optional thing for a user to enter in the web interface.

I don't fully understand how this issue arises to be honest though. Looking at the models, it looked like it should work. Why would an omero channel not have a window parameter? Don't we always set the min & max in the task based on the pixel bitrate? Or do we only do this when a user provides start & end?

In any case, we apparently get the following error when running the Yokogawa to OME-Zarr task (without setting window in the Create OME-Zarr step before):

2023-10-02 17:32:21,639; INFO; START yokogawa_to_ome_zarr task
2023-10-02 17:32:25,050; ERROR; Contents of /path/to/Hodgkin CV8000/Hodgkin CV8000 processed data fractal/Metastasis p146-1.zarr/F/04/0/ cannot be cast to NgffImageMeta.
Original error:
4 validation errors for NgffImageMeta
omero -> channels -> 0 -> window
  field required (type=value_error.missing)
omero -> channels -> 1 -> window
  field required (type=value_error.missing)
omero -> channels -> 2 -> window
  field required (type=value_error.missing)
omero -> channels -> 3 -> window
  field required (type=value_error.missing)
Traceback (most recent call last):
  File "/path/to/FRACTAL_TASK_DIR/.fractal/fractal-tasks-core0.12.0/venv/lib/python3.9/site-packages/fractal_tasks_core/tasks/yokogawa_to_ome_zarr.py", line 271, in <module>
    run_fractal_task(
  File "/path/to/FRACTAL_TASK_DIR/.fractal/fractal-tasks-core0.12.0/venv/lib64/python3.9/site-packages/fractal_tasks_core/tasks/_utils.py", line 79, in run_fractal_task
    metadata_update = task_function(**pars)
  File "pydantic/decorator.py", line 40, in pydantic.decorator.validate_arguments.validate.wrapper_function
    from contextlib import _GeneratorContextManager
  File "pydantic/decorator.py", line 134, in pydantic.decorator.ValidatedFunction.call
    
  File "pydantic/decorator.py", line 206, in pydantic.decorator.ValidatedFunction.execute
    
  File "/path/to/FRACTAL_TASK_DIR/.fractal/fractal-tasks-core0.12.0/venv/lib/python3.9/site-packages/fractal_tasks_core/tasks/yokogawa_to_ome_zarr.py", line 115, in yokogawa_to_ome_zarr
    ngff_image_meta = load_NgffImageMeta(zarrurl)
  File "/path/to/FRACTAL_TASK_DIR/.fractal/fractal-tasks-core0.12.0/venv/lib64/python3.9/site-packages/fractal_tasks_core/lib_ngff.py", line 397, in load_NgffImageMeta
    raise e
  File "/path/to/FRACTAL_TASK_DIR/.fractal/fractal-tasks-core0.12.0/venv/lib64/python3.9/site-packages/fractal_tasks_core/lib_ngff.py", line 391, in load_NgffImageMeta
    return NgffImageMeta(**zarr_attrs)
  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 4 validation errors for NgffImageMeta
omero -> channels -> 0 -> window
  field required (type=value_error.missing)
omero -> channels -> 1 -> window
  field required (type=value_error.missing)
omero -> channels -> 2 -> window
  field required (type=value_error.missing)
omero -> channels -> 3 -> window
  field required (type=value_error.missing)

The relevant parameter in the Create OME-Zarr task looked like this (no window set):

    "allowed_channels": [
        {
            "wavelength_id": "A01_C04",
            "label": "DAPI",
            "color": "0000FF",
            "active": true,
            "coefficient": 1,
            "inverted": false
        },

We should either revert this and make windows really optional again, or make it also required in the pydantic models we use for the web interface. This is a good example for the importance of #540

There is a good workaround for the moment: As long as one actually sets the window parameter in Omero channel, this issue does not arise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions