Skip to content

Remove IO package in favor of imageio #1605

Closed

Description

@blink1073

This is intended for scikit-image v1.0:

  • Replace PIL dependency with imageio
  • Import all of imageio API into skimage.io namespace.
  • Move ImageCollection to imageio
  • Keep image stack
  • Remove external.tifffile
  • Use matplotlib only for show.

I have added plugins to imageio for tifffile, gdal, fits, and itk.

imageio only depends on libfreeimage, which is included in Debian repos, and will be included within the wheel installs for OSX and Windows. There is a cross-platform conda recipe for libfreeimage.

Benefits:

  • No PIL!
  • Plugins are selected based on file extension, but can be overridden.
  • A sane API for multi-image read/write.
  • We benefit from any additional plugins that are added.

Activity

  1. blink1073 commented on Jul 13, 2015

    @blink1073
    ContributorAuthor
  2. matthew-brett commented on Jul 13, 2015

    @matthew-brett
    Contributor

    I notice that imageio does not currently have an OSX wheel on pypi - @almarklein - would you like me to set up a repo to build this, on the same lines as:

    etc?

  3. almarklein commented on Jul 13, 2015

    @almarklein
    Contributor

    Support for wheels is in progress. I think we've got the OSX wheels covered, right @blink1073 ?

  4. blink1073 commented on Jul 13, 2015

    @blink1073
    ContributorAuthor

    @matthew-brett, I am new to OSX wheels, your expertise would be greatly appreciated. I just naively created imageio-1.3-cp27-none-macosx_10_5_x86_64.whl based on the library that @almarklein had pre-compiled: https://github.com/imageio/imageio-binaries.

    imageio/imageio#108

  5. vighneshbirodkar commented on Jul 13, 2015

    @vighneshbirodkar
    Contributor

    If I understand correctly, we plan to remove the io module completely?

  6. blink1073 commented on Jul 13, 2015

    @blink1073
    ContributorAuthor

    It would contain stack, imshow and show, and then imread and friends from imageio's API: https://imageio.readthedocs.org/en/latest/userapi.html

  7. matthew-brett commented on Jul 13, 2015

    @matthew-brett
    Contributor

    Ah - OK - I will create a MacPython repo for this.

    The tricks are:

    • to make the wheels compatible with Python.org and System Pythons, which requires a dual-arch build of the libraries and the Python extensions, and:
    • embedding the dynamic library in the wheel, maybe with delocate or doing static linking, so the person installing the wheel does not need to also copy the library.
  8. vighneshbirodkar commented on Jul 13, 2015

    @vighneshbirodkar
    Contributor

    @blink1073 What do you mean by friends ?
    I am not clear, how would you read and write images ? skimage.io.imread or skimage.imageio.imread ?

  9. blink1073 commented on Jul 13, 2015

    @blink1073
    ContributorAuthor

    Sorry, I was using a colloquialism. I meant that we would present the imageio API as part of the skimage.io API. So, you would use skimage.io.imread, etc.

  10. vighneshbirodkar commented on Jul 13, 2015

    @vighneshbirodkar
    Contributor

    @blink1073, so we'll make imageio a necessary requirement and drop other plugins ?

  11. matthew-brett commented on Jul 13, 2015

    @matthew-brett
    Contributor

    How active is the Freeimage project? I see that the Makefile for OSX is still building PPC and requiring gcc-4.0, and the project is using CVS for version control.

  12. blink1073 commented on Jul 13, 2015

    @blink1073
    ContributorAuthor

    @vighneshbirodkar, yes, we would defer handling of plugins to imageio.

  13. blink1073 commented on Jul 13, 2015

    @blink1073
    ContributorAuthor

    @matthew-brett, from their website: "March 15th, 2015 FreeImage 3.17.0 released"

  14. vighneshbirodkar commented on Jul 13, 2015

    @vighneshbirodkar
    Contributor

    Nice. What about imshow ? Is it a good idea to have a light weight viewer ? A bare-minimum window with a close button.

  15. blink1073 commented on Jul 13, 2015

    @blink1073
    ContributorAuthor

    We still depend on matplotlib, and we provide some nice defaults for plt.imshow here.

  16. 37 remaining items

  17. matthew-brett commented on Jul 14, 2015

    @matthew-brett
    Contributor

    Yes, as you know, the usual situation for wheels is that you build (and test) windows and OSX binary wheels, that are platform-specific, shipping the dynamic libraries in the wheel, and assume that Linux users a) have a compiler that works and / or b) will not be much flustered about being asked to do apt-get if necessary and / or c) won't mind being pointed to a wheel repository specific for their distribution.

  18. blink1073 commented on Jul 14, 2015

    @blink1073
    ContributorAuthor

    I couldn't quite figure out how to make the wheel assert itself as platform specific, without adding an Extension to setup.py.

  19. matthew-brett commented on Jul 14, 2015

    @matthew-brett
    Contributor

    I think (but am not sure) that it would be better to label these as platform-specific, and ship the wheels with hard-coded relative paths to the platform-specific dynamic lib, rather than searching across the file-system.

    I just succeeded in building a OSX 10.6-compatible dual arch Freeimage library FWIW : https://travis-ci.org/MacPython/imageio-wheels/jobs/70881688

    I don't know how to label wheels as platform-specific more nicely than adding a spurious Extension, but I could have a go at working that out.

  20. blink1073 commented on Jul 14, 2015

    @blink1073
    ContributorAuthor

    @matthew-brett, can we take this conversation to imageio/imageio#108?

  21. matthew-brett commented on Jul 14, 2015

    @matthew-brett
    Contributor

    We can, I will.

    The question to scikit-image is - is this a sustainable way to go? I'm not sure myself. I still think it would be safer to wait say 3-6 months after imageio wheels have shipped and are working well before going this direction.

  22. stefanv commented on Jul 15, 2015

    @stefanv
    Member

    I would err on the side of Matthew's caution.

  23. almarklein commented on Jul 16, 2015

    @almarklein
    Contributor

    That's fair enough; we'll get wheels and conda packages up and then we revive this issue a few months down the line.

  24. blink1073 commented on Jul 19, 2015

    @blink1073
    ContributorAuthor

    Another data point: pyzmq ships with a copy of libzmq, and IPython has been relying on it for some time now.

    https://pypi.python.org/pypi/pyzmq

  25. matthew-brett commented on Jul 19, 2015

    @matthew-brett
    Contributor

    Sure, but in the same sense that numpy or scipy or matplotlib ship with various dynamic libraries - these all have standard C extensions linking to the libraries, when are then shipped in the platform-specific wheel. The new variant is the pure Python wheel shipping with dynamic libraries for multiple platforms (or downloading the library on import).

  26. tacaswell commented on Jul 31, 2015

    @tacaswell
    Contributor
  27. added
    ⏩ type: Enhancement
    on Dec 11, 2015
  28. added
    🔧 type: Maintenance
    on Feb 6, 2016
  29. added this to the milestone on Aug 3, 2017
  30. jni commented on Oct 27, 2020

    @jni
    Member

    Closing in favour of #5306

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ⏩ type: Enhancement🔧 type: Maintenance

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions