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.2.tar.gz
(246.3 kB
view hashes)
Built Distributions
Close
Hashes for pyisyntax-0.1.2-cp310-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8a877719c64d8154330da709ff588c9baf2947cd362f7a9b154b9c44f2012fa |
|
MD5 | 35870cdd57b9751cf4c062c9c4ebacb0 |
|
BLAKE2b-256 | edb19b0e08724249e1e885e94fe323b5ce6b01753e83898fb048d1c454fa8a50 |
Close
Hashes for pyisyntax-0.1.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e82b36167cc8eb211f926eda7a4a207492ae4fe216ab1264e1abd37e2a088dd6 |
|
MD5 | c675d0096f350a33d27501f5bfe46496 |
|
BLAKE2b-256 | 12f90be2575fcc8fd624c9fccb9f5c995f4d82f24ea8994d1425639df356a897 |
Close
Hashes for pyisyntax-0.1.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f040832297df50f3043225e64e435cc962e0ab02ec1ac45c3174d351d6e42986 |
|
MD5 | 473a36ecb4b4b1d6eb1acd84f5075d0d |
|
BLAKE2b-256 | 7419b2144c984cd6bfd5d5d9bf18398fd1c021d21bf4c71f6cffcbe4d33370a5 |
Close
Hashes for pyisyntax-0.1.2-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 674ccd3280c13e506f9c5efc96ccdb58b01441689c9905e71de2243b038884bd |
|
MD5 | 366b4564aadfc1e027f35f9160b6cbfb |
|
BLAKE2b-256 | 338f771018d8d79e69d0a37f97441f75f3ebc6f36ad7d8244227e668d5569419 |