Python bindings for libisyntax
Project description
pyisyntax
A Python library for working with pathology images in the iSyntax file format, powered by libisyntax.
Installation
$ pip install pyisyntax
Usage
Read and display a region of the WSI via Pillow.
from isyntax import ISyntax
import PIL.Image
with ISyntax.open("my_file.isyntax") as isyntax:
# Read pixels from the specified region into a numpy array
pixels = isyntax.read_region(500, 500, 400, 200, level=4)
# Convert numpy array into a PIL image
pil_image = PIL.Image.fromarray(pixels)
# Show the image
pil_image.show()
Extract and save the associated macro image.
from isyntax import ISyntax
with ISyntax.open("my_file.isyntax") as isyntax:
# The macro image will be returned as compressed JPEG data.
jpeg_data = isyntax.read_macro_image_jpeg()
# This JPEG data can be written directly to a file.
with open("macro_image.jpg", "wb") as f:
f.write(jpeg_data)
# Alternatively, you could decompress the data using Pillow:
# pil_image = PIL.Image.open(io.BytesIO(jpeg_data), formats=["JPEG"])
Development
Dependency management
To set up a development environment from the lock file:
- Ensure that you have micromamba installed.
- Create the environment:
$ micromamba create -n pyisyntax -f conda-lock.yml --category main --category dev
- Activate the environment:
$ micromamba activate pyisyntax
To modify pyisyntax project dependencies:
- Edit pyproject.toml.
- Update the lock file using conda-lock:
$ conda-lock lock -f pyproject.toml -p linux-64 --micromamba
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
pyisyntax-0.1.4.tar.gz
(249.1 kB
view hashes)
Built Distributions
Close
Hashes for pyisyntax-0.1.4-cp310-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8c899c96a5aebf35057a0c79269d135576e75c0376484741fb0845a93e1e4d5 |
|
MD5 | a57063436baca23ca82a707150f94b4a |
|
BLAKE2b-256 | d2dd44e02287d0a30ea80998e315e12d356fc53c009a1fe5de2de47f1bd712b7 |
Close
Hashes for pyisyntax-0.1.4-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef26e383660af5b91c83f16018bff6a85d3bae3f21737e393f393fa2146e4700 |
|
MD5 | b9daab0b96a514a8fa9b42c66d11b6fe |
|
BLAKE2b-256 | 84a80662084b8a7f7b94fccb1052d396e7fef212108642930805f03aa4c14c69 |
Close
Hashes for pyisyntax-0.1.4-cp310-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33e94aa39f4147d49c9a54e55138d6aa09633a8bf9be6ffb4464a26a2eb2cbc4 |
|
MD5 | 1bca3f3dbc12a8b2dc814cb506fa3558 |
|
BLAKE2b-256 | 572f2e5ab0298df898e1625209180e6dafef329a6ac5c7b597eb189c7c8074df |
Close
Hashes for pyisyntax-0.1.4-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa658a31b705e6f927d2b8c6ecf0eaedb859db8df8e2a78e2ffd9de9cedd70c8 |
|
MD5 | 62359cd65c600a5ae0e0485a0a9a4ba4 |
|
BLAKE2b-256 | 02e6a4587df6060aac7fa926c6ec6c889d039e002f9668006b72b486b28f489a |