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

Unable to load CH5 File #159

Open
roshankern opened this issue Jun 2, 2022 · 8 comments
Open

Unable to load CH5 File #159

roshankern opened this issue Jun 2, 2022 · 8 comments

Comments

@roshankern
Copy link

I am trying to analyze a .ch5 (CellH5) file in python. This file opens fine in ImageJ with the Bio Formats plugin, but python-bioformats throws an error when calling bioformats.ImageReader(file.ch5). How can I resolve this error, or is there a better way to analyze .ch5 files with python? The output of the code is below. Thanks!

14:47:09.187 [Thread-0] DEBUG loci.formats.FormatHandler - NDPISReader initializing /home/roshankern/Desktop/NucleusMorphology/phenotypic_profiling/idr_downloads/test.ch5
14:47:09.187 [Thread-0] DEBUG loci.formats.FormatHandler - loci.formats.in.NDPISReader.initFile(/home/roshankern/Desktop/NucleusMorphology/phenotypic_profiling/idr_downloads/test.ch5)


JavaException Traceback (most recent call last)
...
JavaException: <Java object at 0x19f14798>
During handling of the above exception, another exception occurred:
OSError Traceback (most recent call last)
...
OSError: [Errno 22] Could not load the file as an image (see log for details): b'/home/roshankern/Desktop/NucleusMorphology/phenotypic_profiling/idr_downloads/test.ch5'

CC @gwaygenomics to keep you in the loop

@gwaybio
Copy link

gwaybio commented Jun 2, 2022

thanks for opening this issue @roshankern ! Indeed, this file format has given us some trouble!

@bethac07 - would you know who can help us track this down? Would it be helpful for Roshan to attach the example file (test.ch5) to this issue?

🤞 this is a simple fix!

@bethac07
Copy link
Member

bethac07 commented Jun 2, 2022

@gwaygenomics @roshankern a test file would indeed be great. I also hope it's a simple fix but I can't promise that it is so.

@roshankern
Copy link
Author

roshankern commented Jun 2, 2022

Thank you for the help @bethac07! The test file is located here.

@roshankern
Copy link
Author

It seems the cd5 file can be manipulated in python after being opened with the pyimagej library. The code posted below saves the first frame of the .cd5 file in frame_1. Is there any reason why opening through the pyimagej library would be worse than opening with python-bioformats?

from PIL import Image
import matplotlib.pyplot as plt
import numpy as np

#Create an ImageJ2 gateway with the newest available version of ImageJ2.
import imagej
ij = imagej.init('/home/roshankern/Desktop/Fiji.app')

#Load an image.
path = '/home/roshankern/Desktop/NucleusMorphology/phenotypic_profiling/downloading/test.ch5'
jimage = ij.io().open(path)

#Convert the image from ImageJ2 to xarray
image = ij.py.from_java(jimage)
frame_1 = Image.fromarray(image.values[0, :, :, 0])

@bethac07
Copy link
Member

bethac07 commented Jun 6, 2022

There is no reason I can think of that it would be inherently worse; in terms of "how long does it take to open X image", I definitely haven't benchmarked it, but I have no reason to believe that they're substantially different and in terms of "days on the calendar until someone can be guaranteed to have it working", probably makes sense to do what's working right now

@roshankern
Copy link
Author

Sounds good, thank you for your help!

@bethac07
Copy link
Member

bethac07 commented Jun 7, 2022

If it's ok, I'd like to keep this open to eventually be able to address the issue of opening it with p-b

@bethac07 bethac07 reopened this Jun 7, 2022
@roshankern
Copy link
Author

Of course!

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