Skip to content
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

Get NGFF channel index from name #70

Merged
merged 3 commits into from
Feb 25, 2023
Merged

Get NGFF channel index from name #70

merged 3 commits into from
Feb 25, 2023

Conversation

ziw-liu
Copy link
Collaborator

@ziw-liu ziw-liu commented Feb 24, 2023

Requested by #45.
Related to #58.

@ziw-liu ziw-liu mentioned this pull request Feb 24, 2023
3 tasks
@ziw-liu ziw-liu added enhancement New feature or request NGFF OME-NGFF (OME-Zarr format) labels Feb 24, 2023
@ziw-liu ziw-liu self-assigned this Feb 24, 2023
@ziw-liu ziw-liu added this to the 0.1.0 milestone Feb 24, 2023
@ziw-liu
Copy link
Collaborator Author

ziw-liu commented Feb 24, 2023

---------- coverage: platform darwin, python 3.9.16-final-0 ----------
Name                      Stmts   Miss  Cover
---------------------------------------------
iohub/__init__.py             0      0   100%
iohub/_version.py             2      2     0%
iohub/cli/__init__.py         0      0   100%
iohub/cli/cli.py             24     24     0%
iohub/lf_utils.py            12      1    92%
iohub/multipagetiff.py      162     25    85%
iohub/ngff.py               408     76    81%
iohub/ngff_meta.py          181     20    89%
iohub/pycromanager.py        69      7    90%
iohub/reader.py             151     11    93%
iohub/reader_base.py         25      4    84%
iohub/singlepagetiff.py     155     20    87%
iohub/upti.py                87     70    20%
iohub/zarrfile.py           139     29    79%
---------------------------------------------
TOTAL                      1415    289    80%

@ziw-liu ziw-liu marked this pull request as ready for review February 24, 2023 19:30
@JoOkuma
Copy link
Member

JoOkuma commented Feb 24, 2023

Hey @ziw-liu , I got this error running the changed example.

WARNING:root:Image has 2 channels, while the dataset  has 3.
Traceback (most recent call last):
  File "/home/jordao/Softwares/iohub/examples/single_fov_ome_zarr.py", line 30, in <module>
    dataset["img"] = tczyx
  File "/home/jordao/miniconda3/envs/iohub/lib/python3.10/site-packages/iohub/ngff.py", line 481, in __setitem__
    self.create_image(key, value)
  File "/home/jordao/miniconda3/envs/iohub/lib/python3.10/site-packages/iohub/ngff.py", line 531, in create_image
    self._group.array(
  File "/home/jordao/miniconda3/envs/iohub/lib/python3.10/site-packages/zarr/hierarchy.py", line 1187, in array
    return self._write_op(self._array_nosync, name, data, **kwargs)
  File "/home/jordao/miniconda3/envs/iohub/lib/python3.10/site-packages/zarr/hierarchy.py", line 895, in _write_op
    return f(*args, **kwargs)
  File "/home/jordao/miniconda3/envs/iohub/lib/python3.10/site-packages/zarr/hierarchy.py", line 1193, in _array_nosync
    return array(data, store=self._store, path=path, chunk_store=self._chunk_store,
  File "/home/jordao/miniconda3/envs/iohub/lib/python3.10/site-packages/zarr/creation.py", line 394, in array
    z = create(**kwargs)
  File "/home/jordao/miniconda3/envs/iohub/lib/python3.10/site-packages/zarr/creation.py", line 178, in create
    init_array(store, shape=shape, chunks=chunks, dtype=dtype, compressor=compressor,
  File "/home/jordao/miniconda3/envs/iohub/lib/python3.10/site-packages/zarr/storage.py", line 437, in init_array
    _init_array_metadata(store, shape=shape, chunks=chunks, dtype=dtype,
  File "/home/jordao/miniconda3/envs/iohub/lib/python3.10/site-packages/zarr/storage.py", line 498, in _init_array_metadata
    raise ContainsArrayError(path)
zarr.errors.ContainsArrayError: path 'img' contains an array

@edyoshikun
Copy link
Contributor

@JoOkuma That's because you already created a zarr store with that position. You can do dataset.print_tree() to check the store tree.

@JoOkuma
Copy link
Member

JoOkuma commented Feb 25, 2023

@edyoshikun got it, thanks

Copy link
Member

@JoOkuma JoOkuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ziw-liu ziw-liu merged commit e7105f9 into main Feb 25, 2023
@ziw-liu ziw-liu deleted the ngff-ch-idx branch February 25, 2023 00:27
@edyoshikun
Copy link
Contributor

This worked well on my side. Thanks @ziw-liu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request NGFF OME-NGFF (OME-Zarr format)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants