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

Add Numpy, PIL, Scikit-Image support #59

Open
44 of 56 tasks
myselfhimself opened this issue Sep 2, 2020 · 16 comments
Open
44 of 56 tasks

Add Numpy, PIL, Scikit-Image support #59

myselfhimself opened this issue Sep 2, 2020 · 16 comments
Assignees
Labels
enhancement New feature or request

Comments

@myselfhimself
Copy link
Owner

myselfhimself commented Sep 2, 2020

Matrix layout and (de)interleaving presets:
- [x] add presets to G'MIC module and add validator GmicImage class method

  • set up Jupyter Lab document for simpler testing than Pytest and RFC-ing of presets to the numpy, PIL and and scikitimage communities
    - [x] parameters mutual-exclusion: prevent from/to_numpy_array parameters tuning (except for as_type) if a preset is used, raise GmicException in such cases

Numpy I/O support

- [x] add 'a': a third letter for the 'i'/'d' (de)interleaving option to have no effect on channels pixel format. 'a' for agnostic

  • from_numpy() - deinterleaving input

    • code
    • docstring
    • pytest
  • to_numpy() - interleaving output

    • code
    • docstring
    • pytest
  • solidify GmicImage.to_numpy_helper()

    • remove preset= parameter
    • up-to-date C docstring
    • permute='xyzc' parameter
      • cpython code
      • pytest
    • interleave=False:bool parameter
      • cpython code
      • pytest
    • squeeze_shape=False:bool parameter
      • cpython code
      • pytest
    • astype=None:numpy.dtype parameter
      • cpython code
      • pytest
  • solidify GmicImage.from_numpy_helper()

    • up-to-date C docstring
    • deinterleave=False:bool parameter
      • cpython code
      • pytest
    • permute='xyzc':bool parameter
      • cpython code
      • pytest

Scikit-image I/O support

  • Scikit-image support documentation section
  • from_scikit()
    • pure-python code
    • well-documented C string
    • cpython code
    • pytest
    • advanced pytest with skimage module
  • to_scikit()
    • pure-python code
    • well-documented C string
    • cpython code
    • pytest
    • advanced pytest with skimage module

PIL I/O support

  • PIL support documentation section
  • from_PIL()
    • pure-python code
    • well-documented C string
    • cpython code
    • pytest (PIL output to image+G'MIC output to image + pixel-to-pixel comparisons)
  • to_PIL()
    • pure-python code
    • well-documented C string
    • cpython code
    • pytest (PIL output to image+G'MIC output to image + pixel-to-pixel comparisons)
myselfhimself added a commit that referenced this issue Sep 2, 2020
myselfhimself added a commit that referenced this issue Sep 3, 2020
@myselfhimself myselfhimself self-assigned this Sep 17, 2020
@myselfhimself myselfhimself pinned this issue Sep 17, 2020
@myselfhimself
Copy link
Owner Author

Let me try to write the pytest cases for input-output conversion in pure Python / Numpy to the various toolkits and code the conversion operations in C/Python when they work... (scaffolding in the biological cellular sense)..

@myselfhimself
Copy link
Owner Author

An early presets design specification (premute, interleave) config tuples has been submitted for RFC in our lab:
https://colab.research.google.com/drive/1bZzJDqdEvtoIgGrx3GchPwu95SgFM8D7?usp=sharing (public Google Colab sheet)

I might push this sheet on Twitter and Pixls.us for more RFC, when there are working examples for each preset (eg. pure Python transposes from vanilla from_/to_numpy_array() calls in order to reach a display in PIL/ScikitImage/Numpy-Matplot).

@myselfhimself
Copy link
Owner Author

myselfhimself commented Sep 29, 2020

In gmic-2.9.1-alpha1, presets and options are mixing up their effects. Will be fixed (checkbox added in the TODO above)

@myselfhimself
Copy link
Owner Author

Created an editable RFC of conversion presets on Google Colab, also backed up here on Github. It both gives preset specifications and code blocks exemplify and testing them.
Uploading fresher and fresher wheels to pypi.org will allow to write those tests within the notebook.

@myselfhimself
Copy link
Owner Author

gmic-py 2.9.1 alpha 2 with PIL I/O and solidified numpy I/O is released at: https://pypi.org/project/gmic/2.9.1a2/

  • will update the docs (Numpy support page) and add a new PIL support page as well on the https://gmic-py.readthedocs.io/ website
  • tutorials and examples are slated for November-December 2020 instead

@myselfhimself
Copy link
Owner Author

Rearranged TODO list into 3 distinct numpy, PIL, scikit sections at the top of this issue

@myselfhimself
Copy link
Owner Author

  • discarded to_numpy_gmic and from_numpy_gmic converters (ie. for non (de)-interleaved non-permuted numpy<->g'mic array conversion), in favour of just to_/from_numpy_helper's default parameters as they are now (and locked in their behaviour by current unit tests..)
  • discarding the idea of module-level per-toolkit preset constants.. those string constants in a home-made format could have been replaced by dictionaries for calling to_/from_numpy_helper (ie. function kwargs).. but I am chosing to keep things even simpler for now, especially I do not want to force numpy import at module-instantiation time, and the PIL preset would require this (ie. casting to uint8 using numpy.uint8)

@myselfhimself
Copy link
Owner Author

Come on come on!!! A few TODO checkboxes remaining and we are close to the goal!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant