Skip to main content

A collection of image and statistical processing functions and classes

Project description

PyLogik

A Python package dedicated to sharing functions and classes for common image processing and statistical tools. This includes Sørensen–Dice coefficient (Dice) score and plotting functions.


Citing this work:

A. Kline, PyLogik, 2022


  • Integration with Jupyter Lab/Jupyter Notebooks
  • Built-in plotting functionality for image comparisons


Installation

Install the package through pip:

$ pip install pylogik

Image Processing Import

from pylogik.im import imag_analysis

Data Import

Options for reading in images:

  • Matplotlib — plt.imread()

  • OpenCV — cv2.imread()

  • Pillow — Image.open()

  • scikit-image — io.imread()

# read in your data
im1 = cv2.imread('example_im1.png')
im2 = cv2.imread('example_im2.png')

Dice Score

The mathematical formalism of the Dice score is denoted by the equation:

$$ DSC = \frac{2*|X \cap Y|}{|X|+ |Y|} $$

where $\cap$ denotes the intersection of two images $X$ and $Y$.

Performing the calculation using a function in PyLogik:

dice = imag_analysis.dice_score(pred, true, k=1)

Note:

  • pred - array of the predicted segmentation
  • true - array of the ground truth segmentation
  • k - value to perform matching on (default = 1)
  • Returns: dice score (float)

Impairshow Graphical Output

imshowpair returns the array and image associated with a dice score comparison of 2 logical images. Colors are prespecified as magenta and green but can be adjusted by the user.

imag_analysis.imshowpair(pred, true, color1 = (124,252,0), color2 = (255,0,252), show_fig = True):

Note:

  • pred - array of the predicted segmentation
  • true - array of the ground truth segmentation
  • color1 - first color to show unique values from first image
  • color2 - second color to show unique values from second image
  • Returns: array and graphical plot

Conclusion

This package offers a user friendly dice score calculation and dice score plotting functionality to showcase the intersection and complement of each image relative to the other. This package will be continually built on to incorporate other statistical and image processin functionality

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylogik-0.0.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

pylogik-0.0.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file pylogik-0.0.1.tar.gz.

File metadata

  • Download URL: pylogik-0.0.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for pylogik-0.0.1.tar.gz
Algorithm Hash digest
SHA256 60adee283c05a69b8ab92ef1ec39859e8573823f538898f643feda55f406c78d
MD5 dd32ea8caa662b0003aac7eb5f66f200
BLAKE2b-256 2c88a69c37581188c086b1c434c70f6544e479e47c30158d6ad14131fe57a1ba

See more details on using hashes here.

File details

Details for the file pylogik-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pylogik-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for pylogik-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 50048cce599106594004a268cc02ccbcd76557edf986f33630e2d1f17ad66b82
MD5 ed709622f1570e252a14196a8624be00
BLAKE2b-256 5757bd2ef3f9e9732bc65d81f574cf9f7f13913bad3e393b69ec7eff957b31dc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page