imaging_api.routers.download

Attributes

router

XNATAuthHeaders

Functions

download_images_by_accession_number(...)

Downloads XNAT experiment image data corresponding to a given accession ID and encrypted central hub project ID.

Module Contents

imaging_api.routers.download.router
imaging_api.routers.download.XNATAuthHeaders
async imaging_api.routers.download.download_images_by_accession_number(net_id: str, request_data: imaging_api.routers.schemas.DownloadImagesRequestData, *, assessor_type: str = 'scan', resource_type: str = 'NIFTI', headers: XNATAuthHeaders) imaging_api.routers.schemas.DownloadImagesResponse

Downloads XNAT experiment image data corresponding to a given accession ID and encrypted central hub project ID.

If data exists for the experiment, all image scan resources will be downloaded and the location returned.

All data is downloaded in a single .zip file. Once the file download is complete, this method will then attempt to unzip the folder and delete the existing .zip file.

Parameters:
  • net_id (str) – The ID of the FL net that will run the training.

  • request_data (DownloadImagesRequestData) – Contains encrypted central hub project ID and accession ID.

  • assessor_type (str) – The type of assessor to use for the download. Default is “scan”. Can be “assessor”.

  • resource_type (str) – XNAT resource type e.g DICOM/NIFTI. ALL will download all resources. Custom value is

  • scans. (allowed if researcher has added their own custom XNAT resource type into)

  • headers (XNATAuthHeaders) – XNAT authentication headers.

Returns:

The path where the downloaded and unzipped images are stored.

Return type:

DownloadImagesResponse

Raises:

HTTPException – If there is an error during decryption, if the resource is not found, or if there is an error during download/unzipping.