Behavior and Neuroimaging Core User Manual
  • About
  • Infrastructure Overview
  • XNAT
    • Getting Started
    • Accessing XNAT
    • BIDS Ready Protocols
    • New XNAT projects
    • Uploading Data
    • Downloading Data
  • Demo Dataset
    • Introduction
    • How to access it
    • Protocol Information
    • Basic analysis example: checks task
  • XNAT to BIDS
    • Getting Started
    • XNAT2BIDS Software
    • Exporting to BIDS using Oscar
      • Oscar Utility Script
        • Running xnat2bids using default configuration
        • Running xnat2bids with a custom configuration
        • Syncing your XNAT project & Oscar data directory
        • Extra tools & features
      • Step-wise via Interact Session
    • BIDS Validation
      • Oscar
      • Docker
    • Converting non-MR data
      • Physiological data
      • EEG data
  • XNAT TO BIDS (Legacy)
    • Oscar SBATCH Scripts
  • BIDS and BIDS Containers
    • Introduction to BIDS
    • mriqc
    • fmriprep
    • BIDS to NIMH Data Archive (NDA)
  • Analysis Pipelines
    • Freesurfer
    • 🚧CONN Toolbox
    • FSL topup and eddy
    • Tractography: DSI Studio
    • Brown University MRS Data Collection and Preprocessing Protocol
    • LC Model
      • Installation
      • Example Run
      • Running LCModel on your own data
    • Quantitative Susceptibility Mapping (QSM)
  • Standalone Tools
    • Multi-session spectroscopy with voxalign
    • dicomsort: a tool to organize DICOM files
    • ironmap
    • convert enhanced multi-frame DICOMs to legacy single-frame
    • DICOM anonymization
  • MRF GUIDES
    • MRI simulator room
      • Motion Trainer: Balloon Task
      • Simulating scanner triggers
    • Stimulus display & response collection
    • Eyetracking at the scanner
    • Exporting data via scannershare
    • EEG in the scanner
    • Exporting spectroscopy RDA files
  • Community
    • MRF/BNC user community meetings
Powered by GitBook
On this page

Was this helpful?

  1. XNAT to BIDS
  2. Exporting to BIDS using Oscar
  3. Oscar Utility Script

Extra tools & features

We are continuing to develop run_xnat2bids.py and xnat-tools, so please get in touch with any new feature suggestions!

PreviousSyncing your XNAT project & Oscar data directoryNextStep-wise via Interact Session

Last updated 9 months ago

Was this helpful?

Correct DICOM headers during XNAT export

Use this tool responsibly! Modifying DICOM headers can create corrupt or invalid DICOM data if not done correctly. (Although your data on XNAT will not be modified, so you can always re-export if necessary)

If you have any corrections you need to make to your DICOMs, you can create a .json file that lists the scan(s) to be modified, DICOM field(s) to be changed, and the new value(s) you'd like to change it/them to. This can be useful, for example if your participant was registered with their actual birthdate but you'd like to change it to a pseudo birthdate (e.g. Jan 1st, birth year) before further analyzing and/or sharing the data.

For example, say that I am exporting the data from demodat subject 004, and I would like to 1) correct the birth date to 19880101 and 2) change the Patient ID to "Anonymous".

This is how I would set up my json file
{
    "mappings": [
        {
            "scans_to_correct": [
                "anat-scout_acq-localizer",
                "anat-scout_acq-aascout",
                "anat-scout_acq-aascoutMPRsag",
                "anat-scout_acq-aascoutMPRcor",
                "anat-scout_acq-aascoutMPRtra",
                "anat-T1w_acq-memprage",
                "anat-T1w_acq-memprageRMS",
                "fmap_acq-boldGRE",
                "func-bold_task-checks_run-01",
                "func-bold_task-checks_run-02",
                "func-bold_task-motionloc",
                "func-bold_task-resting",
                "dwi_acq-b1500_dir-ap_SBRef",
                "dwi_acq-b1500_dir-ap",
                "dwi_acq-b1500_dir-apTENSOR",
                "fmap_acq-diffSE_dir-ap",
                "dwi_acq-b1500_dir-pa_SBRef",
                "dwi_acq-b1500_dir-pa",
                "dwi_acq-b1500_dir-paTENSOR",
                "fmap_acq-diffSE_dir-pa"
            ],
            "dicom_field": "PatientBirthDate",
            "new_value": "19880101"
        },
        {
            "scans_to_correct": [
                "anat-scout_acq-localizer",
                "anat-scout_acq-aascout",
                "anat-scout_acq-aascoutMPRsag",
                "anat-scout_acq-aascoutMPRcor",
                "anat-scout_acq-aascoutMPRtra",
                "anat-T1w_acq-memprage",
                "anat-T1w_acq-memprageRMS",
                "fmap_acq-boldGRE",
                "func-bold_task-checks_run-01",
                "func-bold_task-checks_run-02",
                "func-bold_task-motionloc",
                "func-bold_task-resting",
                "dwi_acq-b1500_dir-ap_SBRef",
                "dwi_acq-b1500_dir-ap",
                "dwi_acq-b1500_dir-apTENSOR",
                "fmap_acq-diffSE_dir-ap",
                "dwi_acq-b1500_dir-pa_SBRef",
                "dwi_acq-b1500_dir-pa",
                "dwi_acq-b1500_dir-paTENSOR",
                "fmap_acq-diffSE_dir-pa"
            ],
            "dicom_field": "PatientID",
            "new_value": "Anonymous"
        }
    ]
}

After saving it as "x2b_demodat_dicomfix_config.json" on Oscar, I just need to add one line to the [xnat2bids-args] section of my :

dicomfix-config="/oscar/home/elorenc1/scripts/demodat/x2b_demodat_dicomfix_config.json"

Then, launch run_xnat2bids.py as usual. Be sure to check your output log file when your job completes - it will print INFO messages as it makes changes to DICOMs:

INFO Modified PatientBirthDate in /users/elorenc1/bids-export/bnc/study-demodat/xnat-export/sub-004/ses-01/anat-scout_acq-localizer/1.3.12.2.1107.5.2.43.67050.30000022051915365316000000043-1-1-n8iroc.dcm: 19880101

and WARNING messages if it runs into any trouble:

WARNING PatientsBirthDate field is not present in /users/elorenc1/bids-export/bnc/study-demodat/xnat-export/sub-004/ses-01/fmap_acq-boldGRE/1.3.12.2.1107.5.2.43.67050.30000022051915365316000000043-8-11-178dtrw.dcm.

configuration file