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

Error accessing image due to wrong interal url #3

Closed
haesleinhuepf opened this issue Apr 1, 2024 · 1 comment
Closed

Error accessing image due to wrong interal url #3

haesleinhuepf opened this issue Apr 1, 2024 · 1 comment

Comments

@haesleinhuepf
Copy link

Hi all, I'm retrieving an error when accessing this dataset using the API.

To reproduce

from bia_explorer import io, biostudies
accession = 'S-BIAD599'
study = io.load_bia_study(accession)
image = study.images[0]
image.show()

Error:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
Cell In[1], line 5
      3 study = io.load_bia_study(accession)
      4 image = study.images[0]
----> 5 image.show()

File C:\structure\code\bia-explorer\bia_explorer\io.py:39, in BIAImage.show(self)
     38 def show(self):
---> 39     return self.show_pil()

File C:\structure\code\bia-explorer\bia_explorer\io.py:42, in BIAImage.show_pil(self)
     41 def show_pil(self):
---> 42     return load_pil_image_from_uri(self.uri)

File C:\structure\code\bia-explorer\bia_explorer\io.py:26, in load_pil_image_from_uri(image_uri)
     23 def load_pil_image_from_uri(image_uri):
     25     r = requests.get(image_uri)
---> 26     assert r.status_code == 200
     28     im = Image.open(BytesIO(r.content))
     30     return im

AssertionError: 

Potential solution:

image.uri contains the wrong slashes \ instead of /:

image

This works:

image

Thus, adding image.uri.replace("\\", "/") internally before returning the uri could help.

Alternative solution

Go though the bioimage archive database and correct broken uris.

@liviuba
Copy link
Contributor

liviuba commented Apr 24, 2024

Hi @haesleinhuepf ,

Thanks for reporting this!

Some of our images did have an inconsistent path separator. We fixed all broken image representation URIs, please let us know if you have any other issues with this.

Kind regards,
Liviu

@liviuba liviuba closed this as completed Apr 24, 2024
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