-
Notifications
You must be signed in to change notification settings - Fork 7
Include Omero-channels-metadata update in import-ome-zarr task #578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
First proposed solution:
Broader question: |
That makes sense :) Yes, let's go with this first implementation as proposed by you, i.e. have it use label (if it exists) with optional suffixes if it's non-unique.
If we can reasonably create that block, then yes. I'd leave out Window (that is allowed now by all our models, right?). Not 100% sure anymore whether viewers handle it well when no color is set |
Something else: should we expose this feature through a I'd be in favor, since it results into a change of an existing zarr. |
Yes, that sounds good. But I'd make it default True. Because the default behavior should be: You use the import OME-Zarr task, you now expect this Zarr file to be Fractal compatible. If it's false, we could log warnings if there are issues? Or if that results in duplicated / complex code flow: We just log when it's active so that there is some way of knowing what gets added |
Here is a proposal for the expected behavior of the "update existing Omero channels" feature - see below. If we are OK with this behavior, I'll proceed and look at the other aspects of the current issue (which are not part of this comment) -- see next comment.
|
EDIT: I'm transforming this into a to-do list to reflect ongoing work in #579:
|
import-ome-zarr
add wavelength_id
(and/or label
) information into omero
metadata?
The proposal sounds good! |
Hmm, even for a single channel image? In that case, that should eventually be supported. But we can also add that later on |
Agreed, that should be supported - but I think it cannot come before #150. As far as I understand, we don't support ZYX Zarrs in fractal-tasks-core. Therefore the only option I see is that we'd have to modify the Zarr array, and increase its shape from e.g. 3 axes (ZYX) to 4 axes (CZYX), with the C axis having dimension 1. This means changing the actual data, on top of the NGFF metadata, and IMO it doesn't fit into the "import-ome-zarr" task scope. It would rather fit in a "convert-to-fractal-zarr" task, but then again this would become obsolete with #150. |
FYI, a minor change is needed, to handle the cases where
The basic principle here is that we always keep existing |
Makes sense, let's throw an error for now then! |
Regarding color and window attributesI produced an NGFF image Zarr, with omero metadata "omero": {
"channels": [
{
"label": "1",
"wavelength_id": "1"
}
]
} and tried to load it with napari-ome-zarr. Here is the error traceback (with additional debugging info I added): venv/lib/python3.10/site-packages/napari_ome_zarr/_reader.py:151 transform.<locals>.f
metadata: {
'scale': (
1.0,
0.1625,
0.1625,
),
'channel_axis': 0,
'name': ['1'],
'visible': [True],
'contrast_limits': [None],
'colormap': [],
} (dict) len=6
Traceback (most recent call last):
File "/tmp/venv/lib/python3.10/site-packages/napari/layers/utils/stack_utils.py", line 140, in split_channels
i_kwargs[key] = next(val)
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/tmp/venv/bin/napari", line 8, in <module>
sys.exit(main())
File "/tmp/venv/lib/python3.10/site-packages/napari/__main__.py", line 564, in main
_run()
File "/tmp/venv/lib/python3.10/site-packages/napari/__main__.py", line 340, in _run
viewer._window._qt_viewer._qt_open(
File "/tmp/venv/lib/python3.10/site-packages/napari/_qt/qt_viewer.py", line 953, in _qt_open
self.viewer.open(
File "/tmp/venv/lib/python3.10/site-packages/napari/components/viewer_model.py", line 1092, in open
self._add_layers_with_plugins(
File "/tmp/venv/lib/python3.10/site-packages/napari/components/viewer_model.py", line 1318, in _add_layers_with_plugins
added.extend(self._add_layer_from_data(*_data))
File "/tmp/venv/lib/python3.10/site-packages/napari/components/viewer_model.py", line 1392, in _add_layer_from_data
layer = add_method(data, **(meta or {}))
File "/tmp/venv/lib/python3.10/site-packages/napari/utils/migrations.py", line 59, in _update_from_dict
return func(*args, **kwargs)
File "/tmp/venv/lib/python3.10/site-packages/napari/components/viewer_model.py", line 902, in add_image
layerdata_list = split_channels(data, channel_axis, **kwargs)
File "/tmp/venv/lib/python3.10/site-packages/napari/layers/utils/stack_utils.py", line 142, in split_channels
raise IndexError(
IndexError: Error adding multichannel image with data shape (1, 2, 2160, 5120).
Requested channel_axis (0) had length 1, but the 'colormap' argument only provided 0 values. while the image is displayed correctly if I add the property: "color": "FFFFFF", even in the absence of TLDR
|
That's great! Adding colormap, but not Window makes sense. I'll review the PR next, but already 👍🏻 on the overall approach |
At the moment we don't add anything.
The test with BIA data has
label
, but notwavelength_id
:If we now run import-ome-zarr an then cellpose-segmentation, with
channel=Channel(label="Channel 0")
,get_channel_from_image_zarr
fails in getting back the rightOmeroChannel
object - see traceback below.Note that the issue is not identifying the channel (which I think could be done correctly via the
label
), but it is with this blockwhich cannot cast data into
OmeroChannel
objects becausewavelength_id
is required.The text was updated successfully, but these errors were encountered: