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 ("TXT"/"JSON"/"XML"/"FEATURES")
  qc_format = "CSV" # Format of QC results ("CSV"/"TXT"/"JSON")
  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
  )

  # Run QC/Compliance check on uploaded dataset (not required)
  qc_results = npcs.qc_check(order_id=order_id, format=qc_format)

  # 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, 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, format="PNG")

  # Create an image object from bytes
  image = Image.open(results)

  # Display the image
  image.show()
            

API Key Usage Report

Generate a structured API key usage report for any neuropacs™ API key. If an admin API key is used. An aggregated report will be created with all keys associated with the same institution. If "email" format is used, an email will be sent to the admin associated with the specified API key.


  # Define neuropacs parameters
  api_key = "your_api_key" # API key
  server_url = "server_url" # neuropacs™ serverl URL
  origin_type = "my_application" # Requestor origin
  format = "JSON" # Format of report ("TXT"/"JSON"/"EMAIL")
  start_date = "10/1/2025" # Start date of report (mM/dD/YYYY)
  end_date = "12/15/2025" # End date of report (mM/dD/YYYY)

  # Initialize the API
  npcs = neuropacs.init(
    server_url=server_url, 
    api_key=api_key, # This API key will used to generate the report
    origin_type=origin_type
  )

  # Create a session
  conn = npcs.connect()

  # Generate the report    
  report = npcs.get_report(start_date=start_date, end_date=end_date, format=format)
    

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.