A Python library for working with pathology images in the iSyntax file format, powered by libisyntax.
$ pip install pyisyntaxRead 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"])To set up a development environment from the lock file:
- Ensure that you have uv installed.
- Create the virtual environment:
$ uv sync --frozen
To modify pyisyntax project dependencies:
- Edit dependencies in
pyproject.toml. - Update the lock file using uv:
$ uv lock
- Ensure that tests are passing and everything is ready for release.
- Create and push a Git tag:
$ git tag v0.1.6 $ git push --tags
- Download the artifacts from GitHub Actions, which will include the source distribution tarball and binary wheels.
- Create a new release on GitHub from the tagged commit and upload the packages as attachments to the release.
- Also upload the packages to PyPI using Twine:
$ uv run twine upload pyisyntax-*.tar.gz pyisyntax-*.whl - Bump the version number in
pyproject.tomland create a commit, signalling the start of development on the next version.
These files should also be added to a GitHub release.