Installation
Install the neuropacs module using the following command:
pip install neuropacs
Usage
Initialization
Initialize the neuropacs™ API.
# Import the neuropacs module
import neuropacs
# Define neuropacs parameters
api_key = "your_api_key" # API key
server_url = "server_url" # neuropacs™ serverl URL
product_name = "Atypical/MSAp/PSP-v1.0" # Desired neuropacs™ product
prediction_format = "JSON" # Output format of results
origin_type = "my_application" # Requestor origin
# Initialize the API
npcs = neuropacs.init(server_url=server_url, api_key=api_key, origin_type=origin_type)
Example
Working example using the neuropacs™ API.
# Create a session
conn = npcs.connect()
# Create a new order
order_id = npcs.new_job()
# Upload a dataset from path
upload = npcs.upload_dataset_from_path(
order_id=order_id,
path="/path/to/dataset/",
callback=lambda data: print(data) # optional progress callback
)
# Start an order
order_start = npcs.run_job(order_id=order_id, product_name=product_name)
# Check order status
status = npcs.check_status(order_id=order_id)
# Retrieve job results
results = npcs.get_results(order_id=order_id, prediction_format=prediction_format)
Example viewing a PNG result
Download a PNG result file and view it.
# Import pillow
from PIL import Image
# Retrieve job results in PNG
results = npcs.get_results(order_id=order_id, prediction_format="PNG")
# Create an image object from bytes
image = Image.open(results)
# Display the image
image.show()
DICOMweb WADO-RS Integration
The API retrieves and processes images directly from DICOMweb WADO-RS servers, enabling neuropacs™ analysis for streamlined diagnostic workflows.
# Define DICOMweb parameters
wado_url = "http://localhost:8080/dcm4chee-arc/aets/DCM4CHEE/rs"
study_uid = "1.3.12.2.1107.5.2.32.35162.30000022041820573832300000043"
username = "username"
password = "password"
# Upload a dataset from DICOMweb
upload = npcs.upload_dataset_from_dicom_web(
order_id=order_id,
wado_url=wado_url,
study_uid=study_uid,
username=username,
password=password,
callback=lambda data: print(data) # optional progress callback
)
Contact
Kerrick Cavanaugh (Lead Software Engineer) - kerrick@neuropacs.com
License
This project is licensed under the MIT.
Explore
Integrations
Explore the different systems and software that our product integrates with. Click each integration for detailed setup and usage instructions.
Supported Programming Languages
Our product supports various programming languages to offer flexibility in development. Click each language for APIs, libraries, and examples.