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.3.tar.gz
(247.6 kB
view hashes)
Built Distributions
Close
Hashes for pyisyntax-0.1.3-cp310-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24a24228c5878fffba20b6ad780cf2abf3628058510fde6ba3b4481381f624c3 |
|
MD5 | 56df306a63d208bef16018754a9bec32 |
|
BLAKE2b-256 | 9325db6456c13aa5ddf9a74eb79c444f7f7a5b91698a6ca3e8c953dd19cbde66 |
Close
Hashes for pyisyntax-0.1.3-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cfe96603638a50aca648997511a8c2ddfcef403e8903e40e90624421adc731e |
|
MD5 | 4127afaceec9a9dc0484fc20fc378717 |
|
BLAKE2b-256 | d3ab60ff89d07dd3898076d234c44a5cfa59a212b4b5ebb9e7bd91775d960faf |
Close
Hashes for pyisyntax-0.1.3-cp310-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4ab5a2536278135ff12abd0a859f0d59399903964fc0a10101ce43d80c60ae8 |
|
MD5 | 9db452e61ca60ae534f9f7f122e2f8fb |
|
BLAKE2b-256 | 479a7c4f2908aee340cb2ae27aa157596e1fd78f99ddd801c024b952892cbc8d |
Close
Hashes for pyisyntax-0.1.3-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a57c0768fa744cd534f3821041933f3799e3a96b3d23ea5884fb09dc38a0c318 |
|
MD5 | 6d61db7d4f949808e1d9cdeeb2f0ca32 |
|
BLAKE2b-256 | 6398d9ceffb6cf74cafe1043164b29c71835b3d579b097ca663b9a048f5b4b14 |