Reward File Management: Fw heudiconv (2019) - PennBBL/reward2018 GitHub Wiki

Overview

The reward dataset is a large dataset with various MRI scan protocols, clinical protocols, and reward-related tasks. The purpose of fw-heudiconv'ing this dataset is to properly the scan directory structure into a BIDS-compliant directory structure so that the pre-processing step will be more seamless. This is done through the process of heudiconv -- in this case, fw-heudiconv since the reward dataset is now on Flywheel.

Prior to this process, the following dependencies were installed:

Note that both of these require Python and xcode installed. After the installation of these dependencies, commands described in this wiki were ran in a terminal unless otherwise stated.

The main steps in fw-heudiconv'ing the reward dataset include the following:

  1. Make sure all the dicoms in Flywheel are converted into nifti's.
  2. Figure out which scans are in each sub-project and a heuristic to determine how to sort the scans.
  3. Create a python script that specifies this heuristic and proper file name.
  4. Validate that at least one subject in each of the sub-projects has a BIDS compliant directory structure using BIDS validator.

On Flywheel, if you go to an acquisition for any subject and switch to BIDS view, you should see the niftis in BIDS-compliant directory structure format.

Fw-heudiconv steps in detail

1. Convert all dicoms to nifti's.

All dicoms were converted to nifti's using the Flywheel gear dcm2nii. The python script reward_dcm2nii_20190516.py documents the steps that were done for this process. Essentially, the script checks for scans that only have dicoms (but not niftis) and then runs dcm2nii.

2. Find scan information in each sub-project.

Scan information was found using the command fw-heudiconv-tabulate --project 'Reward2018' --path .

The output of this command is a .tsv file with information on the protocol names and scan types. This information was used to create the heuristic python script. In particular, the protocol names and series description were used to define the different scans in each sub-project (see step 3).

3. Create a heuristic python script.

Heuristic python scripts to be used in step 4 were written based on the Flywheel HeuDiConv Explained tutorial. Briefly, scan information for each sub-project was assessed to find a heuristic that discriminated different types of scans. Each heuristic python script documents the heuristic used for each scan type.

4. Run fw-heudiconv.

For each sub-project of the reward dataset, we individually ran fw-heudiconv using the following command on the terminal:

fw-heudiconv-curate --project 'Reward2018' --heuristic '{heuristic_python_script}' --session '{sub-project_name}',

where {heuristic_python_script} was the script corresponding to each sub-project and {sub-project-name} is the sub-project's name (see step 3 for name of script corresponding to sub-project). This command takes each heuristic python script and uses it to turn the scans on Flywheel into BIDS-compliant directory structure.

5. Aftermath clean up/BIDS validation.

After fw-heudiconv'ing the reward dataset, we ran the BIDS validator on 1-2 subjects for each subproject.

Addressing multiple scans of the same type

We noticed there were multiple T1's in the sub-projects NEFF2 and NODRA. To address this issue, we deleted T1 scans that were navigators and scans with the sag_mpr protocol (sag_mpr refers to an early MGH scan protocol). Because the heuristic python scripts used had already sorted these scans as different acquisitions with the label acq-nav and acq-sag, we used the script rewardT1CleanUp_20190612.py to pinpoint files with the label acq-nav and acq-sag and delete them.

The niftis of scan types with multiple scans (e.g., multiple scans of run 1 of a task) were cleaned up by deleting the scan that was not used. These are noted in Flywheel for the corresponding acquisitions.

⚠️ **GitHub.com Fallback** ⚠️