question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OSError: Unable to determine file type or type not supported for bip image

See original GitHub issue

I have fluorescent microscopy data saved as BIP file and I would like to load it to python. I was following the documentation with:

from spectral import *
img = open_image('path_to_file/Frgrnd.bip')

but I’m getting an error:

~/anaconda3/lib/python3.8/site-packages/spectral/spectral.py in open_image(file)
    117         pass
    118 
--> 119     raise IOError('Unable to determine file type or type not supported.')
    120 
    121 

OSError: Unable to determine file type or type not supported.

Where is the problem and how can I fix it? I’m using: spectral 0.22.1 last updated: Fri Jan 29 2021

CPython 3.8.5 IPython 7.18.1 watermark 2.0.2

Thank you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
tboggscommented, Feb 7, 2021

“.bip” isn’t a recognized image file extension so try to open it explicitly like this:

img = spy.envi.open('/path_to_file/Frgrnd.hdr', image='/path_to_file/Frgrnd.bip')
0reactions
tboggscommented, Feb 10, 2021

If the file extension is “.bip”, you should stick with BIP, though in the case of a single band, it doesn’t even matter which interleave you choose. An offset of 2463 seems highly unlikely (I would expect it to be a multiple of 4). For now, I would stick with either 0 or 29132 as the offset.

The image you displayed doesn’t look inherently wrong but it appears to be only be showing two colors so maybe the image is just saturated. You should take a look at the histogram of the data to see if there is a large range in the data and possibly some extreme outliers. If you use the spectral.imshow function, you can try clipping the histogram using the “stretch” kwarg to see if that makes a difference. You want to set the stretch limits to where most of the “good” data resides. For example, to apply a linear stretch between the 0.1 and 0.9 percentiles of the data, you could use

spy.imshow(img[:, :, 0], stretch=(0.1, 0.9))

Depending on how many of the pixels lie in the tails of the distribution, you may need to adjust the stretch limits accordingly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot determine type of file - python - Stack Overflow
When i tried to open an image that i downloaded from the net, I keep getting this error and I have no idea...
Read more >
Re: Error message when uploading images - 343761
Hello , Without seeing the actual file saved on your computer, it's possible the encoding of the file type is incorrect. You will...
Read more >
Image file formats - Pillow (PIL Fork) 9.3.0 documentation
BLP is the Blizzard Mipmap Format, a texture format used in World of Warcraft. Pillow supports reading JPEG Compressed or raw BLP1 images,...
Read more >
Troubleshooting guide for using BI Publisher with Oracle ...
Check the template size. Large file sizes (eg due to images within the document) require more memory allocation. If in doubt, remove images...
Read more >
OSError: Can't read data - unexpectedly large 'bytes ... - GitHub
This happens when reading different h5ad datasets (e.g. is not specific to one dataset). At all times there seems to be enough free...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found