Giter VIP home page Giter VIP logo

Comments (12)

jcupitt avatar jcupitt commented on July 19, 2024

Hello @EKami,

It looks like your libvips has been compiled without OpenSlide support. You'll need to rebuild with it enabled.

from pyvips.

EKami avatar EKami commented on July 19, 2024

Hello @jcupitt ,
Thanks for stepping in! Is there a particular flag I have to enable when compiling libvips to enable OpenSlide support? I can't find any.
Btw what I'm trying to achieve here is to load regions of the mirax WSI very fast from disk without loading the whole WSI into memory. I believe vips will help me reach that goal? I just want to confirm because so far I saw examples with TIFF and PNG files but not with Mirax.

Using OpenSlide directly and loading the WSI in memory give me this error coming from Pillow:

MemoryError: Integer overflow in ysize

And loading the image in chunks doesn't help either.
I hope somehow I'll be able to get past this error with Vips

from pyvips.

jcupitt avatar jcupitt commented on July 19, 2024

Just install openslide-dev before trying to configure libvips. There's a line in the output of configure where it says whether openslide was detected.

Yes, libvips should do what you need. I see:

john@kiwi:~/pics/openslide/mrxs$ vipsheader CMU-1.mrxs 
CMU-1.mrxs: 109240x220696 uchar, 4 bands, rgb, openslideload
john@kiwi:~/pics/openslide/mrxs$ time vips crop CMU-1.mrxs x.png 10000 10000 1000 1000 

real	0m0.224s
user	0m0.208s
sys	0m0.028s

ie. it pulled a 1000 x 1000 PNG from a 100x x 200k pixel MRXS in 200ms.

from pyvips.

EKami avatar EKami commented on July 19, 2024

Thanks for your help.
Ok so on one of my mirax files I get:

(dl) ekami@ekami-Z270X-Ultra-Gaming:~/workspace/pathologywatch_driveD/BVKFSK$ vipsheader 1M03_11.04.2018_20.06.578.mrxs
1M03_11.04.2018_20.06.578.mrxs: 620x1482 uchar, 3 bands, srgb, jpegload
(dl) ekami@ekami-Z270X-Ultra-Gaming:~/workspace/pathologywatch_driveD/BVKFSK$ time vips crop 1M03_11.04.2018_20.06.578.mrxs x.png 100 100 100 100

real    0m0,012s
user    0m0,005s
sys     0m0,009s

So everything worked fine. But then I got the following error:

pyvips.error.Error: no such operation openslideload
  VipsOperation: class "openslideload" not found

Traceback (most recent call last):
  File "/home/ekami/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_xml.py", line 167, in _get_type
    if isinstance(o, t[0]):
ffi.error: struct _VipsOperation: wrong total size (cdef says 80, but C compiler says 96). fix it or use "...;" in the cdef for struct _VipsOperation to make it flexible

I solved it by reinstalling libvips with sudo apt install libvips. Problem solved for now. Thanks @jcupitt :)

from pyvips.

dgutman avatar dgutman commented on July 19, 2024

Is there any quick way to figure out which libvips directory pyvips is using/pointing to?

I just built it again with openslide bindings, but I still don't see the pyvips.Image.loadopenslide coming up as a binding..

from pyvips.

dgutman avatar dgutman commented on July 19, 2024

Or perhaps I just don't know where in the pyvips interface vips_smartcrop () is exposted....

from pyvips.

jcupitt avatar jcupitt commented on July 19, 2024

It's openslideload, though just new_from_file should work.

from pyvips.

jcupitt avatar jcupitt commented on July 19, 2024

pyvips uses the standard library load system on your platform, so for linux you may need to changed LD_LIBRARY_PATH or perhaps change dld.so.conf, depending on your distro. On macOS you may need to change DYLD_LIBRARY_PATH.

You can use version to interrogate the library and get the version number:

>>> import pyvips
>>> pyvips.version(0)
8
>>> pyvips.version(1)
8
>>> pyvips.version(2)
0

So I have libvips 8.8.0.

from pyvips.

dgutman avatar dgutman commented on July 19, 2024

from pyvips.

jcupitt avatar jcupitt commented on July 19, 2024

Yes, it should work. I see:

john@kiwi:~/pics/openslide/mrxs$ python
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyvips
>>> x = pyvips.Image.new_from_file("CMU-1.mrxs", autocrop=True)
>>> x.width
68315
>>> x.height
94972
>>> x = pyvips.Image.openslideload("CMU-1.mrxs", autocrop=True)
>>> x.width
68315

from pyvips.

dgutman avatar dgutman commented on July 19, 2024

from pyvips.

jcupitt avatar jcupitt commented on July 19, 2024

You can have several libvipses installed, but you will need to set the env vars to get the right one picked up at runtime.

from pyvips.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.