imaging_api.services.imaging
Attributes
Functions
|
Pings the imaging provider (PACS) to check if it is reachable. |
|
Checks if the PACS system is reachable by pinging it. |
Queries the imaging provider (PACS) to retrieve a list of studies associated with the provided accession number. |
|
Queues an image import request via DQR for the provided XNAT project ID. |
Module Contents
- imaging_api.services.imaging.PACS_ID
- imaging_api.services.imaging.XNAT_URL
- imaging_api.services.imaging.ping_pacs(pacs_id: int, headers: dict[str, str]) imaging_api.routers.schemas.PacsStatus
Pings the imaging provider (PACS) to check if it is reachable.
- Parameters:
pacs_id (int) – PACS ID to ping.
headers (dict[str, str]) – XNAT authentication headers.
- Returns:
Status of the PACS system.
- Return type:
- Raises:
imaging_api.utils.exceptions.NotFoundError – If the PACS with the given ID is not found.
Exception – If there is an error during the ping request.
- imaging_api.services.imaging.check_pacs(headers: dict[str, str], pacs_id: int = PACS_ID) None
Checks if the PACS system is reachable by pinging it.
- Parameters:
headers (dict[str, str]) – XNAT authentication headers.
pacs_id (int) – PACS ID to check. Default is the PACS_ID from settings.
- Returns:
None
- Raises:
imaging_api.utils.exceptions.NotFoundError – If the PACS with the given ID is not found.
Exception – If there is an error during the ping request or if the PACS is not reachable or is disabled.
- imaging_api.services.imaging.query_by_accession_number(accession_number: str, headers: dict[str, str]) list[imaging_api.routers.schemas.Study]
Queries the imaging provider (PACS) to retrieve a list of studies associated with the provided accession number.
- Parameters:
accession_number (str) – The accession number to query.
headers (dict[str, str]) – XNAT authentication headers.
- Returns:
A list of Study objects that match the accession number.
- Return type:
list[Study]
- Raises:
Exception – If there is an error during the query request.
- imaging_api.services.imaging.queue_image_import_request(import_request: imaging_api.routers.schemas.ImportStudyRequest, headers: dict[str, str]) list[imaging_api.routers.schemas.ImportStudyResponse]
Queues an image import request via DQR for the provided XNAT project ID. Handles duplicate studies by StudyInstanceUID and checks if all studies were successfully queued.
Note that trying to retrieve a study which is already contained in the project will still successfully queue the import, but will result in an error on XNAT.
- Parameters:
import_request (ImportStudyRequest) – The import request containing project ID and study details.
headers (dict[str, str]) – XNAT authentication headers.
- Returns:
A list of ImportStudyResponse objects representing the queued import requests.
- Return type:
list[ImportStudyResponse]
- Raises:
imaging_api.utils.exceptions.NotFoundError – If the project with the given ID is not found or if no studies are
found on PACS. –
Exception – If there is an error during the import request.