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

ome zarr notebook #311

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

ome zarr notebook #311

wants to merge 2 commits into from

Conversation

thewtex
Copy link
Member

@thewtex thewtex commented Dec 20, 2024

Add OME-Zarr image registration notebook

A simple example that registers one timepoint in an IDR dataset to another.

We use the IDR dataset as it is a familiar reference sample OME-Zarr
dataset in the community. This also demonstrates fetching the data
dynamically from the cloud.

PySid2 is licensed under the LGPL while PyQt5 is under the GPL and a
commercial license.

I could not successfully install the previous PyQt5 given versions
on Linux with Python 3.11.
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@thewtex thewtex force-pushed the ome-zarr-notebook branch 2 times, most recently from 3a92ba5 to ac8b7ee Compare January 16, 2025 15:15
@thewtex thewtex marked this pull request as ready for review January 16, 2025 15:15
@thewtex thewtex force-pushed the ome-zarr-notebook branch 2 times, most recently from 4f7e5e4 to 4066cb9 Compare January 16, 2025 16:05
@thewtex
Copy link
Member Author

thewtex commented Jan 16, 2025

@mstaring @N-Dekker @stefanklein please take a look 🙏

A simple example that registers one timepoint in an IDR dataset to
another.

We use the IDR dataset as it is a familiar reference sample OME-Zarr
dataset in the community. This also demonstrates fetching the data
dynamically from the cloud.
@N-Dekker
Copy link
Collaborator

Very interesting, Matt! I'm still trying to get it to work here locally but I got an error, on import ngff_zarr as nz, below here. Do you have a clue what I might have done wrong?

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[4], line 4
      2 import itk
      3 from itkwidgets import view
----> 4 import ngff_zarr as nz

File ~\.conda\envs\ITKElxPoints\Lib\site-packages\ngff_zarr\__init__.py:6
      1 # SPDX-FileCopyrightText: 2022-present Matt McCormick <[email protected]>
      2 #
      3 # SPDX-License-Identifier: MIT
      5 from .__about__ import __version__
----> 6 from .cli_input_to_ngff_image import cli_input_to_ngff_image
      7 from .config import config
      8 from .detect_cli_io_backend import ConversionBackend, detect_cli_io_backend

File ~\.conda\envs\ITKElxPoints\Lib\site-packages\ngff_zarr\cli_input_to_ngff_image.py:3
      1 import sys
----> 3 import zarr
      4 from dask.array.image import imread as daimread
      5 from rich import print

File ~\.conda\envs\ITKElxPoints\Lib\site-packages\zarr\__init__.py:2
      1 from zarr._version import version as __version__
----> 2 from zarr.api.synchronous import (
      3     array,
      4     consolidate_metadata,
      5     copy,
      6     copy_all,
      7     copy_store,
      8     create,
      9     create_array,
     10     create_group,
     11     empty,
     12     empty_like,
     13     full,
     14     full_like,
     15     group,
     16     load,
     17     ones,
     18     ones_like,
     19     open,
     20     open_array,
     21     open_consolidated,
     22     open_group,
     23     open_like,
     24     save,
     25     save_array,
     26     save_group,
     27     tree,
     28     zeros,
     29     zeros_like,
     30 )
     31 from zarr.core.array import Array, AsyncArray
     32 from zarr.core.config import config

File ~\.conda\envs\ITKElxPoints\Lib\site-packages\zarr\api\synchronous.py:7
      3 from typing import TYPE_CHECKING, Any, Literal
      5 from typing_extensions import deprecated
----> 7 import zarr.api.asynchronous as async_api
      8 import zarr.core.array
      9 from zarr._compat import _deprecate_positional_args

File ~\.conda\envs\ITKElxPoints\Lib\site-packages\zarr\api\asynchronous.py:12
      9 import numpy.typing as npt
     10 from typing_extensions import deprecated
---> 12 from zarr.core.array import Array, AsyncArray, create_array, get_array_metadata
     13 from zarr.core.array_spec import ArrayConfig, ArrayConfigLike
     14 from zarr.core.buffer import NDArrayLike

File ~\.conda\envs\ITKElxPoints\Lib\site-packages\zarr\core\__init__.py:9
      6 from __future__ import annotations
      8 from zarr.core.buffer import Buffer, NDBuffer  # noqa: F401
----> 9 from zarr.core.codec_pipeline import BatchedCodecPipeline

File ~\.conda\envs\ITKElxPoints\Lib\site-packages\zarr\core\codec_pipeline.py:20
     18 from zarr.core.config import config
     19 from zarr.core.indexing import SelectorTuple, is_scalar, is_total_slice
---> 20 from zarr.core.metadata.v2 import _default_fill_value
     21 from zarr.registry import register_pipeline
     23 if TYPE_CHECKING:

File ~\.conda\envs\ITKElxPoints\Lib\site-packages\zarr\core\metadata\__init__.py:3
      1 from typing import TypeAlias, TypeVar
----> 3 from .v2 import ArrayV2Metadata, ArrayV2MetadataDict
      4 from .v3 import ArrayV3Metadata, ArrayV3MetadataDict
      6 ArrayMetadata: TypeAlias = ArrayV2Metadata | ArrayV3Metadata

File ~\.conda\envs\ITKElxPoints\Lib\site-packages\zarr\core\metadata\v2.py:9
      6 from functools import cached_property
      7 from typing import TYPE_CHECKING, TypedDict, cast
----> 9 import numcodecs.abc
     11 from zarr.abc.metadata import Metadata
     13 if TYPE_CHECKING:

File ~\.conda\envs\ITKElxPoints\Lib\site-packages\numcodecs\__init__.py:116
    112 from numcodecs.json import JSON
    114 register_codec(JSON)
--> 116 from numcodecs import vlen as vlen
    117 from numcodecs.vlen import VLenArray, VLenBytes, VLenUTF8
    119 register_codec(VLenUTF8)

File numcodecs\\vlen.pyx:1, in init numcodecs.vlen()

ImportError: numpy.core.multiarray failed to import (auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; use '<void>numpy._import_array' to disable if you are certain you don't need it).

@thewtex
Copy link
Member Author

thewtex commented Jan 20, 2025

@N-Dekker thanks for testing!

What versions of ngff_zarr, numpy, numcodecs, zarr do you have?

@N-Dekker
Copy link
Collaborator

What versions of ngff_zarr, numpy, numcodecs, zarr do you have?

I just did a brand new install on a new pc. Now it says:

ImportError                               Traceback (most recent call last)
Cell In[1], line 5
      3 import ngff_zarr as nz
      4 from rich import print
----> 5 from zarr.storage import FSStore, LRUStoreCache
      6 import zarr
      7 import copy

ImportError: cannot import name 'FSStore' from 'zarr.storage' (C:\Users\...\.conda\envs\ITKElx\Lib\site-packages\zarr\storage\__init__.py)

I also printed the versions, as follows:

import sys
print(sys.version)
print("itk", itk.__version__)
import itkwidgets
print("itkwidgets", itkwidgets.__version__)
print("ngff_zarr", nz.__version__)
import numpy as np
print("numpy", np.__version__)
import numcodecs
print("numcodecs", numcodecs.__version__)
import zarr
print("zarr", zarr.__version__)

Which says:

3.11.11 | packaged by Anaconda, Inc. | (main, Dec 11 2024, 16:34:19) [MSC v.1929 64 bit (AMD64)]
itk 5.4.0
itkwidgets 0.32.6
ngff_zarr 0.12.1
numpy 2.2.2
numcodecs 0.15.0
zarr 3.0.1

Having pip-installed the "WindowsWheel311.zip" from the ITKElastix CI, from the last commit at the main, at https://github.com/InsightSoftwareConsortium/ITKElastix/actions/runs/12258642912

Do you have a clue?

@thewtex
Copy link
Member Author

thewtex commented Jan 24, 2025

@N-Dekker thanks for the information!

The issue is zarr 3, which was recently released. I'll have to make updates, but for now you could try with zarr 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants