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 Sorensen–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.image 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 segmentationtrue
- array of the ground truth segmentationk
- 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 segmentationtrue
- array of the ground truth segmentationcolor1
- first color to show unique values from first imagecolor2
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pylogik-0.0.2.tar.gz
.
File metadata
- Download URL: pylogik-0.0.2.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2896204436a10a88e960c98fb7c372b96ab6c23b0eb3c92db2b3dc17d8d924d |
|
MD5 | b4974067bb2101a68fda04983cd6b75b |
|
BLAKE2b-256 | a9e004bb373503c6c4bf2a0d32541f14be300c3b91bdb06c71a8dadee1078b3e |
File details
Details for the file pylogik-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: pylogik-0.0.2-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 247fa8ace547e2cca333c6d75919aa246948ecebe244ecdc1d813f192c6973e8 |
|
MD5 | 2ed327c8a7c366d8dd626ece0ec92cdc |
|
BLAKE2b-256 | 507fc8d4aa47498e8ccb1606c136ee03c58f9ea13b0eee69b77cba9c7dee353f |