imaging_api.routers.projects
Attributes
Functions
|
Retrieves a list of all projects in XNAT. |
Creates a new project in XNAT. |
|
Creates a new project in XNAT based on Central Hub project information. |
|
Deletes an existing project in XNAT. |
|
|
Retrieves details of a specific project in XNAT. |
Retrieves a list of subjects in a specific project in XNAT. |
|
Retrieves a list of experiments in a specific project in XNAT. |
|
|
Retrieves details of a specific experiment in a project in XNAT. |
Module Contents
- imaging_api.routers.projects.router
- imaging_api.routers.projects.XNATAuthHeaders
- imaging_api.routers.projects.get_projects(headers: XNATAuthHeaders) list[imaging_api.routers.schemas.Project]
Retrieves a list of all projects in XNAT.
- Parameters:
headers (XNATAuthHeaders) – XNAT authentication headers.
- Returns:
List of projects in XNAT.
- Return type:
- Raises:
HTTPException – If there is an error during the retrieval of projects.
- imaging_api.routers.projects.create_project_endpoint(project_id: str, project_secondary_id: str, project_name: str, *, project_description: str = '', headers: XNATAuthHeaders) imaging_api.routers.schemas.Project
Creates a new project in XNAT.
- Parameters:
project_id (str) – Unique identifier for the project.
project_secondary_id (str) – Secondary identifier for the project.
project_name (str) – Name of the project.
project_description (str, optional) – Description of the project.
headers (XNATAuthHeaders) – XNAT authentication headers.
- Returns:
The created project object.
- Return type:
- Raises:
HTTPException – If there is an error during the creation of the project.
- async imaging_api.routers.projects.create_project_from_central_hub_project(central_hub_project: imaging_api.routers.schemas.CentralHubProject, headers: XNATAuthHeaders, background_tasks: fastapi.BackgroundTasks) imaging_api.routers.schemas.CreatedProject
Creates a new project in XNAT based on Central Hub project information. Central Hub project information includes the project ID, project name, and users.
A dedicated XNAT project ID will be created, as well as corresponding users. If users already exist on XNAT with those emails, they will be added to the project. If users do not exist on XNAT, they will be created and added to the project.
- Parameters:
central_hub_project (imaging_api.routers.schemas.CentralHubProject) – Central Hub project object including its
ID
name
users. (and)
headers (XNATAuthHeaders) – XNAT authentication headers.
background_tasks (BackgroundTasks) – Background task manager for retrieval scheduling.
- Returns:
The created project object.
- Return type:
- Raises:
HTTPException – If there is an error during the creation of the project.
- async imaging_api.routers.projects.delete_project_endpoint(project_id: str, headers: XNATAuthHeaders) imaging_api.routers.schemas.Project
Deletes an existing project in XNAT.
- Parameters:
project_id (str) – Unique identifier for the project.
headers (XNATAuthHeaders) – XNAT authentication headers.
- Returns:
The deleted project object.
- Return type:
- Raises:
HTTPException – If there is an error during the deletion of the project.
- imaging_api.routers.projects.get_project_endpoint(project_id: str, headers: XNATAuthHeaders) imaging_api.routers.schemas.Project
Retrieves details of a specific project in XNAT.
The reason we are not using the specific XNAT endpoint
GET /data/projects/{id}is because it returns something like the below, which I am not sure is very useful, is missing fields likepi_firstname,pi_lastname,URIwhich we may want to retrieve.{ "project": { "items": [ { "children": [], "meta": { "create_event_id": 270, "xsi:type": "xnat:projectData", "isHistory": false, "start_date": "Mon Mar 24 18:21:46 UTC 2025" }, "data_fields": { "secondary_ID": "dc5c1758-1a4d-4fca-80ce-fa208d11874d", "name": "string:3fa85f64-5717-4562-b3fc-2c963f66afa6-FL-Project", "description": "Project corresponding to central hub project 3fa85f64-5717-4562-b3fc-2c963f66afa6", "active": "true", "ID": "dc5c1758-1a4d-4fca-80ce-fa208d11874d" } } ] } }
- Parameters:
project_id (str) – Unique identifier for the project.
headers (XNATAuthHeaders) – XNAT authentication headers.
- Returns:
The project object.
- Return type:
- Raises:
HTTPException – If there is an error during the retrieval of the project.
- imaging_api.routers.projects.get_project_subjects_endpoint(project_id: str, headers: XNATAuthHeaders) list[imaging_api.routers.schemas.Subject]
Retrieves a list of subjects in a specific project in XNAT.
- Parameters:
project_id (str) – Unique identifier for the project.
headers (XNATAuthHeaders) – XNAT authentication headers.
- Returns:
List of subjects in the project.
- Return type:
list[Subject]
- Raises:
HTTPException – If there is an error during the retrieval of subjects for the project.
- imaging_api.routers.projects.get_project_experiments_endpoint(project_id: str, headers: XNATAuthHeaders) list[imaging_api.routers.schemas.Experiment]
Retrieves a list of experiments in a specific project in XNAT.
- Parameters:
project_id (str) – Unique identifier for the project.
headers (XNATAuthHeaders) – XNAT authentication headers.
- Returns:
List of experiments in the project.
- Return type:
list[Experiment]
- Raises:
HTTPException – If there is an error during the retrieval of experiments for the project.
- imaging_api.routers.projects.get_project_experiment_endpoint(project_id: str, experiment_id_or_label: str, headers: XNATAuthHeaders) dict
Retrieves details of a specific experiment in a project in XNAT.
- Parameters:
project_id (str) – Unique identifier for the project.
experiment_id_or_label (str) – Unique identifier for the experiment.
headers (XNATAuthHeaders) – XNAT authentication headers.
- Returns:
The experiment object.
- Return type:
dict
- Raises:
HTTPException – If there is an error during the retrieval of the experiment.