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

Different .czi image metadata for conda vs pip install #79

Open
K-Meech opened this issue Dec 11, 2023 · 6 comments
Open

Different .czi image metadata for conda vs pip install #79

K-Meech opened this issue Dec 11, 2023 · 6 comments

Comments

@K-Meech
Copy link

K-Meech commented Dec 11, 2023

Description

I'm loading a czi image with napari-aicsimageio - 'Plate1-Blue-A-12-Scene-3-P3-F2-03.czi' from the OME sample data

If I've installed via conda like so:

conda create -n napari-env-aicsimagio -c conda-forge python=3.9 napari pyqt napari-aicsimageio

Then drag and drop the image on napari, it errors with failed with error: aicspylibczi is required for this reader. Install with pip install 'aicspylibczi>=3.0.5' 'fsspec>=2022.7.1'. It does still open the image though, and:

  • specifies the channel names on the end of layer names (like 'TagYFP'...)
  • states the microscope model under Instruments > Instrument:0 > microscope in the OME Tree Widget
  • lists only one image under 'images' in the OME Tree Widget
    etc...

If I then install the dependencies via pip, as the error stated:

pip install aicspylibczi fsspec

Then open the image again, some of the metadata is changed e.g.:

  • Channel names aren't put on the end of layer names (just 1/2/3)
  • No microscope model is listed in the OME Tree Widget
  • There are now two images listed under 'images' in the OME Tree Widget
    etc.

Not sure if this is a bug - but why the large difference? + why are some of the useful things picked up before like the channel names / microscope model not picked up after installing aicspylibczi?

Thanks for your help!

Environment

Windows installation

@psobolewskiPhD
Copy link
Collaborator

So you have everything installed from conda-forge and aicspylibczi does not appear to have a binary there. Hence the initial message. However, conda-forge does have the java tooling for the bioformats reader which is installed along with the napari plugin, so I assume that's being used to open the image. After you pip install aicspylibczi, then I assume that aicspylibczi is used and apparently the two readers handle metadata differently or pass it differently to aicsimageio which is being used by this plugin.

@evamaxfield
Copy link
Collaborator

Yep, we simply do not have aicspylibczi built on conda. That library is tough to manage / build and we haven't had too much luck getting it working with conda. Install only works with pip

@K-Meech
Copy link
Author

K-Meech commented Dec 13, 2023

Thanks for the clarification both! Ah I see - I was wondering why it still managed to open the image (without aicspylibczi), but it using bioformats makes a lot of sense.

I was wondering in this case - if there would be a way to choose between bioformats and aicspylibczi if both are installed? (e.g. in the initial popup menu that appears when you open an image in napari). For this particular image, bioformats seems to handle the metadata better, so it would be great to be able to choose it without having to uninstall aicspylibczi or have a separate environment.

@evamaxfield
Copy link
Collaborator

Good question.... I don't think we have a method to select which reader to use when loading an image using the napari UI / file options (i.e. "load image" button from napari)

when using Python directly and opening napari from a python shell, you can create and enforce reader selection by:

from aicsimageio import AICSImage
from aicsimageio.readers.czi_reader import CziReader
# OR from aicsimageio.readers.bioformats_reader import BioformatsReader

img = AICSImage("path/to/file.czi", reader=CziReader)  # or reader=BioformatsReader

@evamaxfield
Copy link
Collaborator

I can also try to work on this problem in the move over to bioio (the new version of aicsimageio) -- my task this winter break is to create napari-bioio so will keep this issue in mind

@K-Meech
Copy link
Author

K-Meech commented Dec 14, 2023

Great - thanks @evamaxfield !

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

No branches or pull requests

3 participants