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

Problems opening a Nikon .nd2 file #432

Open
Clarion opened this issue Dec 18, 2022 · 1 comment
Open

Problems opening a Nikon .nd2 file #432

Clarion opened this issue Dec 18, 2022 · 1 comment

Comments

@Clarion
Copy link

Clarion commented Dec 18, 2022

Thank you first of all for putting the pims module together!!

Unfortunately, I am running into problems opening Nikon .nd2 files.

Here is what I do:

mamba create --name imageprocessing python=3.10 -c conda-forge
mamba activate imageprocessing 
mamba install jupyterlab -c conda-forge 
mamba install python-javabridge -c conda-forge  
mamba install pims -c conda-forge   

When I run the following cell in a jupyter notebook, I get the error message below. And I can’t figure out what the problem is:

import pims
import javabridge
import bioformats

javabridge.start_vm(class_path=bioformats.JARS)

a = pims.open('/Users/c_osman/Documents/Python/Lab_scripts/Microscopy/510-150.nd2’)

Error:
/Users/c_osman/mambaforge/envs/imageprocessing/lib/python3.10/site-packages/pims/api.py:204: UserWarning: <class 'pims.bioformats.BioformatsReader'> errored: 'NoneType' object has no attribute 'isJVMStarted'
warn(message)

UnknownFormatError Traceback (most recent call last)
Cell In[1], line 7
3 import bioformats
5 javabridge.start_vm(class_path=bioformats.JARS)
----> 7 a = pims.open('/Users/c_osman/Documents/Python/Lab_scripts/Microscopy/510-150.nd2')

File ~/mambaforge/envs/imageprocessing/lib/python3.10/site-packages/pims/api.py:206, in open(sequence, **kwargs)
204 warn(message)
205 exceptions += message + '\n'
--> 206 raise UnknownFormatError("All handlers returned exceptions:\n" + exceptions)

UnknownFormatError: All handlers returned exceptions:
<class 'pims.bioformats.BioformatsReader'> errored: 'NoneType' object has no attribute 'isJVMStarted'

Your help would be much appreciated!!

@nimaesmaeelpour
Copy link

nimaesmaeelpour commented Dec 19, 2022

The problem is that jpype is not installed.

The jpype variable becomes a NoneType and the error is raised.

pims/pims/bioformats.py

Lines 8 to 11 in 5ec734d

try:
import jpype
except ImportError:
jpype = None

But after installing jpype, a completely different problem opens up. The loci_tools.jar can't be downloaded.

pims/api.py:204: UserWarning: <class 'pims.bioformats.BioformatsReader'> errored: HTTP Error 404: Not Found
  warn(message)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
File "pims/api.py", line 206, in open
    raise UnknownFormatError("All handlers returned exceptions:\n" + exceptions)
pims.api.UnknownFormatError: All handlers returned exceptions:
<class 'pims.bioformats.BioformatsReader'> errored: HTTP Error 404: Not Found

I think this url is outdated (at least with version 6, which is the default value for version):

pims/pims/bioformats.py

Lines 74 to 75 in 5ec734d

url = ('http://downloads.openmicroscopy.org/bio-formats/' + version +
'/artifacts/loci_tools.jar')

Right now the workaround is to install pims-nd2which uses the Nikon SDK to open nd2-files.

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

2 participants