Skip to main content
Skip table of contents

Image Session Scans API

Get A Listing Of Scans From An Image Session

CODE
GET - /data/projects/{project-id}/subjects/{subject-id | subject-label}/experiments/{experiment-id | experiment-label}/scans
GET - /data/experiments/{experiment-id}/scans

Parameters

{project-id}

Required path parameter

{subject-id} or {subject-label}

Required path parameter

{experiment-id} or {experiment-label}

Required path parameter

format

Optional querystring parameter

  • json (default)

  • html

  • xml

  • csv

Response

CODE
{
  "ResultSet": {
    "Result": [
      {
        "xsiType": "xnat:mrScanData",
        "xnat_imagescandata_id": "integer",
        "note": "string",
        "series_description": "string",
        "ID": "integer {scan-id}",
        "type": "integer",
        "URI": "path",
        "quality": "string"
      },
      ...
    ],
    "totalRecords": "integer"
  }
}


Get A Listing Of A Single Scan's Resources

CODE
GET - /data/projects/{project-id}/subjects/{subject-id | subject-label}/experiments/{experiment-id | experiment-label}/scans/{scan-id}
GET - /data/experiments/{experiment-id}/scans/{scan-id}

Parameters

{project-id}

Required path parameter

{subject-id} or {subject-label}

Required path parameter

{experiment-id} or {experiment-label}

Required path parameter

{scan-id}

Required path parameter

format

Optional querystring parameter

  • html (default)

  • json

  • xml

  • csv

Response

Each items[n].children object in the response object contains another items array that contains resource details.

CODE
{
  "items": [
    {
      "children": [
        ...
      ],
      "meta": {
        "create_event_id": integer,
        "xsi:type": "xsiType",
        "isHistory": boolean,
        "start_date": "UTC Date Time"
      },
      "data_fields": {
        "series_description": "string",
        "scanner/manufacturer": "string",
        "image_session_ID": "string {experiment-id}",
        "type": "string",
        "xnat_imageScanData_id": integer,
        "parameters/voxelRes/z": number,
        "xnat_imagescandata_id": number,
        "parameters/voxelRes/x": float,
        "parameters/voxelRes/y": float,
        "scanner": "string",
        "startTime": "time",
        "parameters/imageType": "string",
        "ID": "string",
        "coil": "string",
        "parameters/pixelBandwidth": float,
        "frames": integer,
        "parameters/fov/y": number,
        "scanner/model": "string",
        "parameters/fov/x": number,
        "parameters/tr": number,
        "quality": "string",
        "UID": "string",
        "parameters/orientation": "string",
        "fieldStrength": "float",
        "parameters/acqType": "string"
      }
    }
  ]
}


Add Scan To An Image Session

In order to add scans, you must specify the xsiType of the scan. See the note for xsiTypes in XNAT REST XML Path Shortcuts for more details.

For a full tutorial on uploading image session and scan resources, see Upload Image Session Files with REST API.

CODE
PUT - /data/projects/{project-id}/subjects/{subject-id | subject-label}/experiments/{experiment-id | experiment-label}/scans/{scan-id}

Parameters

{project-id}

Required path parameter

{subject-id} or {subject-label}

Required path parameter

{experiment-id} or {experiment-label}

Required path parameter

{scan-id}

Required path parameter. Specify a new scan ID that does not already exist in this image session.

xsiType

Required querystring parameter. Example:

  • ?xsiType=xnat:mrScanData

{params}

Optional querystring parameters. You can add additional scan descriptors using Scan Data REST XML Path Shortcuts. Example:

  • ?xnat:mrScanData/type=T1

Modify Scan Metadata

To set a new value for an existing scan property, specify the parameter key/value pair using one or more Scan Data REST XML Path Shortcuts. You will also need to specify the xsiType, as with any PUT request regarding scans.

This is the same URI as when creating a scan, but you are using a scan ID that already exists.

CODE
PUT - /data/projects/{project-id}/subjects/{subject-id | subject-label}/experiments/{experiment-id | experiment-label}/scans/{scan-id}
PUT - /data/experiments/{experiment-id}/scans/{scan-id}

Parameters

{project-id}

Required path parameter

{subject-id} or {subject-label}

Required path parameter

{experiment-id} or {experiment-label}

Required path parameter

{scan-id}

Required path parameter. Specify a scan ID that already exists in this session.

xsiType

Required querystring parameter. Example:

  • ?xsiType=xnat:mrScanData

{params}

Optional querystring parameters. You can add additional scan descriptors using Scan Data REST XML Path Shortcuts. Example:

  • ?xnat:mrScanData/type=T1

Rebuild Scan Metadata from DICOM Headers

Rather than manually update metadata, you can ask XNAT to rebuild the metadata from the DICOM headers of that scan’s resource files. This uses a subset of the above call and the Experiment API Utility Functions.

CODE
PUT - /data/projects/{project-id}/subjects/{subject-id | subject-label}/experiments/{experiment-id | experiment-label}/scans/{scan-id}?{utility}
PUT - /data/experiments/{experiment-id}/scans/{scan-id}?{utility}

Params

{project-id}

Required path parameter

{subject-id} or {subject-label}

Required path parameter

{experiment-id} or {experiment-label}

Required path parameter

{scan-id}

Required path parameter. Specify a scan ID that already exists in this session.

{utility}

Required querystring parameter to trigger a scan API utility. See Experiment API Utility Functions for details.

  • ?pullDataFromHeaders=true

  • ?fixScanTypes=true

Delete Scan From Image Session

CODE
DELETE - /data/projects/{project-id}/subjects/{subject-id | subject-label}/experiments/{experiment-id | experiment-label}/scans/{scan-id}
DELETE - /data/experiments/{experiment-id | experiment-label}/scans/{scan-id}

Params

{project-id}

Required path parameter

{subject-id} or {subject-label}

Required path parameter

{experiment-id} or {experiment-label}

Required path parameter

{scan-id}

Required path parameter. Specify a scan ID that already exists in this image session.

removeFiles

Optional query param. Defaults to "FALSE", which will leave files in the file system after deleting the experiment record in Postgres. When this param is set to "TRUE", those files are permanently deleted.

Response Code

200

Scan Deleted

403

Permission Denied (User cannot delete data in this project)

Response Format: none

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.