fractal-analytics-platform / fractal-tasks-core

Main tasks for the Fractal analytics platform
https://fractal-analytics-platform.github.io/fractal-tasks-core/
BSD 3-Clause "New" or "Revised" License
11 stars 5 forks source link

[cellpose segmentation task] `label` or `wavelength_id` for ChannelInputModel #762

Open BioinfoTongLI opened 2 weeks ago

BioinfoTongLI commented 2 weeks ago

Hi there,

When running the cell segmentation task, the function requires a parameter called ChannelInputModel. One could attach either label or wavelength as the input. However, when executing the code, this line will load the existing channel from the disk (.zattrs), which requires wavelength_id to be present (?) Shouldn't we enforce it to use wavelength_id in cellpose_segmentation in this case?

Also, my zarr was preprocessed by import_ome_zarr with update_omero_metadata=True. This is currently not adding wavelength_id if it's missing. We can maybe duplicate label if wavelength_id is not there?

jluethi commented 2 weeks ago

Hey @BioinfoTongLI

Interesting point. We enforce wavelength_id present in Fractal (at least at the moment). Given that the Cellpose task fully functions when the selection happens via label, we should look for a way to relax this.

Given that this model is used in multiple places, the change isn't fully trivial.

Also, my zarr was preprocessed by import_ome_zarr with update_omero_metadata=True. This is currently not adding wavelength_id if it's missing. We can maybe duplicate label if wavelength_id is not there?

I'd be in favor of adding this to the Import OME-Zarr task as well! Our definition for wavelength_id vs. label is: A label is a string that describes a channel and that is unique within a given OME-Zarr image and also typically unique across some selections of OME-Zarrs (e.g. all images in a well when those images are separate acquisitions) A wavelength_id is a string that describes a channel (by some wavelength identifier) and it's unique only within a given image (but e.g. a way to describe the same wavelength in different images where the channels have different names).

We'll probably have to revisit these definitions for the more general, non-HCS cases. I'd be fine with a solution of just adding the label as wavelength_id in the import task if there is no wavelength_id present there