Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/grfrederic/deconvolution

Python module for performing (automatic) colour deconvolution.
https://github.com/grfrederic/deconvolution

Last synced: 18 days ago
JSON representation

Python module for performing (automatic) colour deconvolution.

Awesome Lists containing this project

README

        

*************
deconvolution
*************
A Python module providing Deconvolution class that implements and generalises Ruifrok-Johnston color deconvolution algorithm [RJ]_, [IJ]_. It allows one to split an image into distinct color layers in just
a few lines of code:

.. code:: python

from deconvolution import Deconvolution
from PIL import Image

img = Image.open("image.jpg")

# Declare an instance of Deconvolution, with image loaded and with color basis defining what layers are interesting
decimg = Deconvolution(image=img, basis=[[1, 0.1, 0.2], [0, 0.1, 0.8]])

# Constructs new PIL Images, with different color layers
layer1, layer2 = decimg.out_images(mode=[1, 2])

Installation
------------
You can install the package using pip:

.. code:: bash

pip install deconvolution

Alternatively, you can clone the repository and run:

.. code:: bash

make install

Since then you can import use the module in your scripts:

.. code:: python

from deconvolution import Deconvolution
d = Deconvolution()

Testing
-------
.. code:: bash

# For Python 3 users
make test

# For Python 2 users
make comp

# Check the code coverage
make coverage

# Check the coverage interactively, using a web browser
make html

Deconvolve
----------
For better usage experience we created a script allowing one to deconvolve images from the shell. Copy `deconvolve.py` file into `/usr/local/bin` or, if you want to use it locally:

.. code:: bash

mkdir ~/bin
cp deconvolve.py ~/bin
export PATH=~/bin:$PATH

Since then you can deconvolve images using:

.. code:: bash

deconvolve.py image1.png image2.png ...
# For help
deconvolve.py -h

Documentation
-------------
Check out our documentation at `Read The Docs
`_.

Contributors
------------
Method developed by Frederic Grabowski generalising Ruifrok-Johnston algorithm [RJ]_. and implemented by Frederic Grabowski [FG]_ and Paweł Czyż [PC]_.
We are very grateful to prof. Daniel Wójcik and dr Piotr Majka [N1]_, [N2]_ who supervised the project. We also would like to thank prof. Gabriel Landini [GL]_, who
implemented the colour deconvolution in ImageJ [IJ]_ and allowed us to test the algorithm on his data.

References
----------
.. [RJ] `Research paper by Ruifrok and Johnston
`_
.. [IJ] `ImageJ webpage
`_
.. [N1] `Laboratory of Neuroinformatics webpage
`_
.. [GL] `Prof. Gabriel Landini's webpage
`_
.. [N2] https://github.com/Neuroinflab/
.. [FG] https://github.com/grfrederic
.. [PC] https://github.com/pawel-czyz