czbiohub-sf / iohub

Pythonic and parallelizable I/O for N-dimensional imaging data with OME metadata
https://czbiohub-sf.github.io/iohub/
BSD 3-Clause "New" or "Revised" License
29 stars 7 forks source link

CLI to update metadata of zarr stores #210

Open ieivanov opened 7 months ago

ieivanov commented 7 months ago

@ziw-liu and I discussed the need to update metadata of a zarr store after it has been created. In shrimPy we have an update_scale_metadata CLI call which we use frequently - it allows us to update the scale metadata by calling Position.set_transform on all positions in a zarr store. @ziw-liu also brought up the need to update the channel names in a zarr store, and I know that @Soorya19Pradeep has also had similar needs - this can be done using Position.rename_channel.

We are asking other users if they would prefer to have CLI calls in iohub to update these metadata or if the existing python API is sufficient to do that, say in a python script.

Separately, are there other metadata fields which you have had the need to update? Is there a need for more general methods to update the ome-zarr metadata (outside of channel names and data scale)? @ziw-liu brought up the point that the metadata tree is relatively deep and a general update-metadata method will be difficult to maintain.

@edyoshikun @talonchandler @JoOkuma

ieivanov commented 7 months ago

I have occasionally wanted to update the mix/max/start/end values of the contrast limits, such that data will open up in napari looking nice without having to adjust the contrast slider every time. Minor annoyance for now.

JoOkuma commented 7 months ago

There's a napari-metadata for editing ome-zarr metadata, but it doesn't allow editing all the fields, and I'm not sure if it works with HCS files.

I usually change start and end as Ivan. To do this, I use a text editor, but this doesn't scale to multiple plates.

edyoshikun commented 7 months ago

I regularly use the shrimPy update-scale-metadata especially with Falcon datasets since we don't have a way to tell it that it's a 60x vs 20x objective when we swap them, so inherently the pixel sizes in XY are wrong. Also, currently use it for virtual staining since the predictions default scale is (1,1,1,1,1).

This probably is better suited as an iohub CLI than shrimPy.

talonchandler commented 7 months ago

I agree that modifying scale, channel names, and contrast limits are good candidates for CLI shortcuts in iohub.