imaging_api.services.imaging ============================ .. py:module:: imaging_api.services.imaging Attributes ---------- .. autoapisummary:: imaging_api.services.imaging.PACS_ID imaging_api.services.imaging.XNAT_URL Functions --------- .. autoapisummary:: imaging_api.services.imaging.ping_pacs imaging_api.services.imaging.check_pacs imaging_api.services.imaging.query_by_accession_number imaging_api.services.imaging.queue_image_import_request Module Contents --------------- .. py:data:: PACS_ID :value: 1 .. py:data:: XNAT_URL :value: 'http://xnat-web:8080' .. py:function:: 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. :param pacs_id: PACS ID to ping. :type pacs_id: int :param headers: XNAT authentication headers. :type headers: dict[str, str] :returns: Status of the PACS system. :rtype: PacsStatus :raises imaging_api.utils.exceptions.NotFoundError: If the PACS with the given ID is not found. :raises Exception: If there is an error during the ping request. .. py:function:: check_pacs(headers: dict[str, str], pacs_id: int = PACS_ID) -> None Checks if the PACS system is reachable by pinging it. :param headers: XNAT authentication headers. :type headers: dict[str, str] :param pacs_id: PACS ID to check. Default is the PACS_ID from settings. :type pacs_id: int :returns: None :raises imaging_api.utils.exceptions.NotFoundError: If the PACS with the given ID is not found. :raises Exception: If there is an error during the ping request or if the PACS is not reachable or is disabled. .. py:function:: 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. :param accession_number: The accession number to query. :type accession_number: str :param headers: XNAT authentication headers. :type headers: dict[str, str] :returns: A list of Study objects that match the accession number. :rtype: list[Study] :raises Exception: If there is an error during the query request. .. py:function:: 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. :param import_request: The import request containing project ID and study details. :type import_request: ImportStudyRequest :param headers: XNAT authentication headers. :type headers: dict[str, str] :returns: A list of ImportStudyResponse objects representing the queued import requests. :rtype: list[ImportStudyResponse] :raises imaging_api.utils.exceptions.NotFoundError: If the project with the given ID is not found or if no studies are :raises found on PACS.: :raises Exception: If there is an error during the import request.