Skip to main content

Python Client for Sectra

This python package aims to facilite the development of AI applications for Sectra PACS.

Version

The library currently supports functionality up to do version 3.4 (Dec 2023). However, we will update to 5.0 in Juli, after which this library will be adjusted to the newest version as well.

Installation

To install sectra_client:

pip install sectra-image-analysis-api

Usage

Before using the client, make sure you have access to a valid authentication token, and url, sent in the analysis requests.

Example 1: Retrieve image information

from sectra_client import SectraClient

# Info, sent by Sectra in the request
callback_url = "http://sectraweb.*.*.*/SectraPathologyServer/external/imageanalysis/v1"
callback_token = "abcde"
slide_id = "fghij"

# Use the context manager
with SectraClient(
    url=callback_url,
    token=callback_token
) as client:
    # Returns the image info with extended and personal health information data
    image_info = client.get_image_metadata(slide_id, extended=True, phi=True)

Example 2: Download WSI

from sectra_client import SectraClient

# Info, sent by Sectra in the request
...

# Use the context manager
with SectraClient(
    url=callback_url,
    token=callback_token
) as client:
    # Download the file(s) to an output directory, and returns the file paths of the file(s). 
    file_paths = client.download_slide_files(slide_id, output_dir="./path/to/output/dir/")

Example 3: Without context manager

It is also possible to use the SectraClient without the context manager

from sectra_client import SectraClient

# Info, sent by Setra in the request
...

# Open context manager
client = SectraClient(url=callback_url, token=callback_token)

# Perform API interactions
image_info = client.get_image_metadata(slide_id, extended=True, phi=False)

# Make sure to close the connection
client.close()

Local development with the mock server

MockSectraServer simulates a Sectra PACS instance in memory so you can develop and test without a real server.

from sectra_client.mock_server import MockSectraServer

server = MockSectraServer(token="dev-token")
with server.run(port=8001):
    server.trigger(
        webhook_url="http://localhost:8000/sectra/hook",
        application_id="my-app",
        slide_id="slide-001",
    )
    results = server.get_results(app_id="my-app", slide_id="slide-001")

See examples/local_dev.py for a complete round-trip: both servers started from a single script, a fake invocation fired, and results read back.

Metadata

Release files for sectra-image-analysis-api 1.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sectra-image-analysis-api 1.7.0
File Size Uploaded Provenance Actions
sectra_image_analysis_api-1.7.0.tar.gz 114.7 kB Without provenance Details for sectra_image_analysis_api-1.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sectra-image-analysis-api 1.7.0
File Interpreter ABI Platform Actions
sectra_image_analysis_api-1.7.0-py3-none-any.whl Python 3 none any Details for sectra_image_analysis_api-1.7.0-py3-none-any.whl

Total release size: 135.4 kB

Release files / sectra_image_analysis_api-1.7.0.tar.gz

Download URL sectra_image_analysis_api-1.7.0.tar.gz
Size 114.7 kB
Tags Source
SHA-256 checksum
How to use checksums
069f03f06cddd2fefa90e7fb809df1246269725296fd1a41821009b9d3ba4926
BLAKE2b-256 checksum
How to use checksums
bf6a6030019ebb20e7c96d55b3711b329b080d11737d659b3b2486ad035b2bdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / sectra_image_analysis_api-1.7.0-py3-none-any.whl

Download URL sectra_image_analysis_api-1.7.0-py3-none-any.whl
Size 20.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70d8c41ff1dbb222d51816874d848c2dbfc773e201e9a7f95e54e112cd422239
BLAKE2b-256 checksum
How to use checksums
19e097a4682a74283adc36671d7b2b8f54ef339f95048d3d3e0fa5261f1814a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for sectra-image-analysis-api 1.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page