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

tables create by `import_ome_zarr` cannot be loaded by `illumination_correction` #662

Closed BioinfoTongLI closed 3 months ago

BioinfoTongLI commented 4 months ago

Hi there!

Great tool! Many thanks for building it!

I've imported my bioformats2raw converted ome-ngff using from fractal_tasks_core.tasks.import_ome_zarr import import_ome_zarr and I also added add_image_ROI_table=True using the import, since illumination_correction requires it.

However, it seems that there's a mismatch of folder name. The newly created one is called image_ROI_table https://github.com/fractal-analytics-platform/fractal-tasks-core/blob/main/fractal_tasks_core/tasks/import_ome_zarr.py#L88 And the expected one is called FOV_ROI_table https://github.com/fractal-analytics-platform/fractal-tasks-core/blob/main/fractal_tasks_core/tasks/illumination_correction.py#L201 Is that just an overlook? I can create a PR if so.

jluethi commented 3 months ago

Thanks for opening this issue! We should probably make the illumination correction task more flexible to allow a user to specify which ROI table is used for correction. Currently, it hard-codes the FOV_ROI_table, which we typically generate in our converters. Hard-coding this does not seem like the best approach.

Some context on why this happens: We often store many field of views in the same Zarr. We still want to apply illumination correction per field of view though. Thus, we use the FOV_ROI_tables generated by our converter. Our images also often have a well_ROI_table for the whole fused well. But it would be a bad idea to apply illumination correction on that one.

We started to become more flexible in the Import OME-Zarr task. We don't assume you necessarily have wells or that you fuse multiple FOVs into a single image. Thus, we name the ROI tables image_ROI_table for the whole OME-Zarr image (& optionally grid_ROI_table: if one had fused e.g. 3x3 FOVs with regular intervals, we can generate the equivalent of our FOV_ROI_table).

Long story short: The illumination correction task should probably support differently named ROI tables as well. I'll create a quick PR that would address this

jluethi commented 3 months ago

@BioinfoTongLI In the current main, the Illumination correction task now exposes an input_ROI_table option. You can set that one to image_ROI_table in your case and then it should work without renaming them :)

jluethi commented 3 months ago

@BioinfoTongLI This is now available in the 0.14.3 release of fractal-tasks-core :)