MCDESPOT Workflow on macDESPOT.stanford.edu The analysis process has been greatly automated with Sean’s scripts. A few modifications were made to get them to function properly on macDESPOT. Most notably, since the system is using FSL 4.1.4, the output of any FSL program is in the compressed NIfTI-1 format (.nii.gz). However, all the routines assume that the images are in the Analyze 7.5 format. fslchfiletype is used after employing each FSL tool to convert the images output in NIfTI to Analyze. Other variations from Sean’s original scripts (fullDataPrep.py and calculateT1andB1CalibrationMaps.py) include making them executable from the shell and numbering the subdirectories that are created. Parallel processing with any command-line program or script is now possible with mtbatch.py. It allows the user to deal with the MSmcDESPOT file structure and run a program for each subject. Any number of threads is possible as well as choosing a particular thread to work on, for example the 4th thread of an 8 thread process. This is useful for splitting work amongst remote terminals or getting around system instability when 8 threads start simultaneously. At the moment, the command-line feedback is a garble of all the threads; this will be fixed by moving away from the now deprecated os.fork command in Python. In the future, all the scripts will be merged into a master file so that analyses can be run with minimal human interaction. Step-by-step: 1. cd dataPath/ 2. /mcDESPOT/1-fullDataPrep.py ./ 3. /mcDESPOT/2-calculateT1andB1CalibrationMaps.py ./ 4. /mcDESPOT/3-performMTpcMCDESPOT.py <15 or 3T> 3maskedData/spgr/ 3-maskedData/ssfp_phase0/ 3maskedData/ssfp_phase180/ mcDESPOTResults/ 8 2 calibrationMaps/DESPOT1HIFI_B1Map 5. /mcDESPOT/mcDESPOTMerge-NewStruct.py 6. /mcDESPOT/dtiproc.py 7. /mcDESPOT/structural.py 8. /mcDESPOT/StdSpaceRegistration.py Required Data Structure: dataPath/ originalData/ irspgr/ (inversion recovery SPGR images in Analyze format) irspgr_tr47_fa5_ti350_pe120_ds.hdr irspgr_tr47_fa5_ti350_pe120_ds.img -TR: 4.7 ms, flip angle: 5°, TI: 350 ms, readouts after inversion: 120 spgr/ (spoiled gradient recovery images) spgr_tr47_fa3000_ds.hdr spgr_tr47_fa3000_ds.img -TR: 4.7 ms, flip angle: 3.000° ssfp_phase0/ (0° phase RF, steady-state free precession images) ssfp_tr31_fa12000_phase0.hdr ssfp_tr31_fa12000_phase0.img -TR: 3.1 ms, flip angle: 12.000° ssfp_phase180/ (180° phase RF, steady-state free precession images) ssfp_tr31_fa12000_phase180.hdr ssfp_tr31_fa12000_phase180.img -TR: 3.1 ms, flip angle: 12.000° Everything past here is not required knowledge for operation. Original Image Format Flow 1. Original data – DICOM (.dcm) 2. ImageJ conversion –> Analyze 7.5 (.hdr & .img) (this could be NIfTI-1) 3. 1-fullDataPrep.py a. FSL FLIRT down-sampling -> Compressed NIfTI-1 (.nii.gz) b. fslchfiletype -> Analyze 7.5 (this conversion is not necessary) c. FSL FLIRT co-registration -> Compressed NIfTI-1 d. fslchfiletype -> Analyze 7.5 e. FSL BET2 brain extraction on one image-> Compressed NIfTI-1 f. fslchfiletype on single brain mask -> Analyze 7.5 g. applyMask – Analyze 7.5 4. 2-calculateT1andB1CalibrationMaps.py a. despot1 – Analyze 7.5 5. 3-performMTpcMCDESPOT.py a. pcmcdespot – Analyze 7.5 1-fullDataPrep.py Operations 1. Create subdirectories to hold processed data. Original data structure is recreated in each subdirectory. 2. Down-sample images in dataPath/originalData/ using FLIRT by “registering” to a 110x110x120 voxel image using an identity matrix. 3. Outputs NIfTI files to dataPath/1-downsampledData/origName_ds.nii.gz 4. Convert back to Analyze using fslchfiletype 5. Co-register images in dataPath/1-downsampledData/ using FLIRT to 2nd SPGR image 6. Convert back to Analyze using fslchfiletype 7. Compute brain mask using BET2 –f .5, convert to Analyze 8. Brain extract all images using applyMask, output to /dataPath/3maskedData/ Data Generated by 1-fullDataPrep.py: dataPath/ 1-downsampledData/ (part a, downsampled to 110x110x120 voxels, 2x2x2 mm) irspgr/ spgr/ ssfp_phase0/ ssfp_phase180/ 2-coregisteredData/ (linear registration via FSL’s FLIRT to 2nd SPGR image) irspgr/ spgr/ ssfp_phase0/ ssfp_phase180/ 3-maskedData/ (brain extraction via FSL’s BET2 –f .5 on 2nd SPGR image) irspgr/ spgr/ ssfp_phase0/ ssfp_phase180/ brainMask/ calibrationMaps/ (empty) mcDESPOTResults/ (empty) 2-calculateT1andB1CalibrationMaps.py Operations 1. Get list of images in dataPath/3-maskedData/spgr/ and dataPath/3maskedData/irspgr/ 2. Parse image filenames for TR and flip angle values for SPGR 3. Parse image filenames for TR, TI, flip angle, and # readouts after inversion for IRSPGR 4. Feed into despot1 with parameters: 1.5T, 2 inversions per slice, B1 smoothing, and no speckle removal Data Generated by 2-calculateT1andB1CalibrationMaps.py dataPath/ calibrationMaps/