--- title: HYPER-MEPI Analysis Notes tags: fmri, multi-echo fmri, hyper-mepi, ge description: View the slide with "Slide Mode". --- # HYPER-MEPI Analysis Notes <!-- Put the link to this slide here so people can follow --> slide: https://hackmd.io/@weberam2/HypP3Pr8j --- Some notes on analyzing GE multi-echo fmri data (HYPER-MEPI) --- ## What is our sequence? (HYPERMEPI02; Nov 16th, 2022) | Series | Type | Name | Time | Notes | |--------|-----------------|---------------------------------|------|---------------------------------------------------------------------------| | 3 | 3DT1 | SAG FSPGR 3D .9X.9X.9 | 4:57 | FOV 24, Matrix 256x256 | | 4 | 3DT2 | Sag CUBE T2 .9X.9X.9 | 4:21 | FOV 24, Matrix 256x256 | | 5 | fMRI Hyper MEPI | Multi-echo fMRI 3 echoes pepo 0 | 15 | 3 echo, TR = 2100, FOV 23, Matrix 64x64, echos: 12.2, 35.35, 58.5; Acc 6 | | 6 | spin-echo fMRI | Spin-echo fMRI pepolar 0 | 0:18 | TR = 3000, FOV 23, Matrix 64x64 | | 7 | spin-echo fMRI | Spin-echo fMRI pepolar 1 | 0:18 | TR = 3000, FOV 23, Matrix 64x64 | | 8 | fMRI Hyper MEPI | Multi-echo fMRI 3echo 2HB | 15 | 3 echo, TR = 2100, FOV 23, Matrix 64x64, echos: 11.8, 33.90, 55.99; Acc 2 | | 9 | fMRI Hyper MEPI | Multi-echo fMRI 3echo 1000TR | 7 | 3 echo, TR = 1000, FOV 23, Matrix 64x64, echos: 12.2, 35.35, 58.5; Acc 6 | | 10 | fMRI Hyper MEPI | Multi-echo fMRI 3echo 1000TR | 7 | 3 echo, TR = 1000, FOV 23, Matrix 64x64, echos: 12.2, 35.35, 58.5; Acc 6 | --- ## How Do We Analyze It? ### Dependencies there is a lot you'll want installed before starting - [docker](https://docs.docker.com/engine/install/ubuntu/) - [miniconda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) - [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) - [jq](https://stedolan.github.io/jq/download/) - [dcm2niix](https://github.com/rordenlab/dcm2niix) - [freesurfer](https://surfer.nmr.mgh.harvard.edu/fswiki/DownloadAndInstall) (with license) - [FastSurfer](https://github.com/Deep-MI/FastSurfer) (if you want to speed things up) - a bunch of python scripts installed in a virtual environment (see below) - [bids-validator](https://github.com/bids-standard/bids-validator) - [ANTs](http://stnava.github.io/ANTs/) --- With miniconda3 installed, you should consider using a virtual environment. Here is an example of how to create, start/activate, then install some python libraries ```bash conda create mefmri python=3 pip mdp numpy scikit-learn scipy conda activate mefmri pip install nilearn nibabel pip install tedana pip install dcm2bids pip install fmriprep-docker ``` --- ### Overview of steps: ```graphviz digraph G { compound=true rankdir=TB graph [ fontname="Source Sans Pro", fontsize=20 ]; node [ fontname="Source Sans Pro", fontsize=18]; edge [ fontname="Source Sans Pro", fontsize=12 ]; "Download data" -> "BIDS" -> "FastSurfer\n (to speed things up)" -> "fmriprep" -> "tedana" } ``` --- ### Download and BIDS First navigate to where you want your main BIDS directory to be ```bash cd <yourBIDSdirectory> ``` Or make one: ```bash mkdir <yourBIDSdirectory> && <yourBIDSdirectory> ``` If not already set-up, create your BIDS scaffold: ```bash dcm2bids_scaffold . ``` Which creates a folder with a file structure similar to this: ![](https://i.imgur.com/1uOCXOR.png) --- Let's name your subject (e.g. Pilot02) and save the main bids dir and subid as variables to use throughout: ```bash subid=Pilot02 bidsdir=<yourBIDSdirectory> ``` Next, you'll want to download your files from XNAT and unzip them to the source ```bash unzip ~/Downloads/<filename>.zip -d sourcedata/sub-${subid} ``` --- For now I will only focus on the T1, the first fMRI, and the two spin-echo fMRI (blip up and blip down) First we need to create our config file for dcm2bids. In this example, I will use jq to write it as I believe it could be very handy for automation down the line. Let's go to our sourcedata/sub-Pilot02 directory: ```bash cd sourcedata/sub-${subid} ``` Then let's create a jq script and name it bids.sh. Copy the following into your favourite text editor ```bash t1w=3 fmri1=5 fmap1=6 fmap2=7 innert1=$(jq -n --arg dt anat \ --arg md T1w \ --arg fn "$(printf "%03g" $t1w)*" \ '{dataType:$dt, modalityLabel:$md, criteria:{SidecarFilename:$fn}}' ) innerfmrie1=$(jq -n --arg dt func \ --arg md bold \ --arg cl task-rest_echo-1 \ --arg fn "$(printf "%03g" $fmri1)*" \ '{dataType:$dt, modalityLabel:$md, customLabels:$cl, criteria:{SidecarFilename:$fn, EchoNumber:1}, sidecarChanges:{TaskName:"rest"}}' ) innerfmrie2=$(jq -n --arg dt func \ --arg md bold \ --arg cl task-rest_echo-2 \ --arg fn "$(printf "%03g" $fmri1)*" \ '{dataType:$dt, modalityLabel:$md, customLabels:$cl, criteria:{SidecarFilename:$fn, EchoNumber:2}, sidecarChanges:{TaskName:"rest"}}' ) innerfmrie3=$(jq -n --arg dt func \ --arg md bold \ --arg cl task-rest_echo-3 \ --arg fn "$(printf "%03g" $fmri1)*" \ '{dataType:$dt, modalityLabel:$md, customLabels:$cl, criteria:{SidecarFilename:$fn, EchoNumber:3}, sidecarChanges:{TaskName:"rest"}}' ) innerfmap1=$(jq -n --arg dt fmap \ --arg md epi \ --arg cl dir-PA \ --arg fn "$(printf "%03g" $fmap1)*" \ '{dataType:$dt, modalityLabel:$md, customLabels:$cl, criteria:{SidecarFilename:$fn}, IntendedFor:[1,2,3], B0FieldIdentifier:"pepolar_fmap0"}' ) innerfmap2=$(jq -n --arg dt fmap \ --arg md epi \ --arg cl dir-AP \ --arg fn "$(printf "%03g" $fmap2)*" \ '{dataType:$dt, modalityLabel:$md, customLabels:$cl, criteria:{SidecarFilename:$fn}, IntendedFor:[1,2,3], B0FieldIdentifier:"pepolar_fmap0"}' ) jq -n --arg dcm2niixOptions "-b y -ba y -z y -f '%3s_%f_%d_%r'" \ --argjson descriptions "[$innert1, $innerfmrie1, $innerfmrie2, $innerfmrie3, $innerfmap1, $innerfmap2]" \ '$ARGS.named' > BIDS_config.json ``` make sure it is executable: ```bash chmod +x bids.sh ``` Then execute: ```bash ./bids.sh ``` --- This will create a BIDS_config.json file that looks like this: ```bash { "dcm2niixOptions": "-b y -ba y -z y -f '%3s_%f_%d_%r'", "descriptions": [ { "dataType": "anat", "modalityLabel": "T1w", "criteria": { "SidecarFilename": "003*" } }, { "dataType": "func", "modalityLabel": "bold", "customLabels": "task-rest_echo-1", "criteria": { "SidecarFilename": "005*", "EchoNumber": 1 }, "sidecarChanges": { "TaskName": "rest" } }, { "dataType": "func", "modalityLabel": "bold", "customLabels": "task-rest_echo-2", "criteria": { "SidecarFilename": "005*", "EchoNumber": 2 }, "sidecarChanges": { "TaskName": "rest" } }, { "dataType": "func", "modalityLabel": "bold", "customLabels": "task-rest_echo-3", "criteria": { "SidecarFilename": "005*", "EchoNumber": 3 }, "sidecarChanges": { "TaskName": "rest" } }, { "dataType": "fmap", "modalityLabel": "epi", "customLabels": "dir-PA", "criteria": { "SidecarFilename": "006*" }, "IntendedFor": [ 1, 2, 3 ], "B0FieldIdentifier": "pepolar_fmap0" }, { "dataType": "fmap", "modalityLabel": "epi", "customLabels": "dir-AP", "criteria": { "SidecarFilename": "007*" }, "IntendedFor": [ 1, 2, 3 ], "B0FieldIdentifier": "pepolar_fmap0" } ] } ``` --- Now let's run dcm2bids from our main BIDS directory ```bash cd ${bidsdir} dcm2bids -d sourcedata/${subid}/ -p ${subid} -c sourcedata/${subid}/bids/BIDS_config.json -o . --forceDcm2niix ``` This could take a long time, especially if you downloaded all of the series... Once successfully completed, you should delete the .bval and .bvec files that are for some reason created with our multi-echo data: ```bash rm sub-${subid}/func/*.bv* ``` --- Bids-validator should then run without any *major* errors ```bash bids-validator . ``` --- ### FastSurfer [note: requires ~4Gb of GPU] ```bash docker run --gpus all -v ${bidsdir}/sub-${subid}/anat:/data -v ${bidsdir}/derivatives/FastSurfer:/output -v $HOME:/fs_license --rm fastsurfer:gpu --fs_license /fs_license/license.txt --t1 /data/sub-${subid}_T1w.nii.gz --sid sub-${subid} --sd /output --parallel ``` Should take ~43 minutes. --- ### fmriprep ```bash fmriprep-docker ${bidsdir} ${bidsdir}/derivatives/fmriprep participant --participant-label ${subid} --fs-license-file $HOME/license.txt --dummy-scans 10 --use-aroma --me-output-echos -w $HOME/fmriprep_work --fs-subjects-dir ${bidsdir}/derivatives/FastSurfer ``` Took about 1.5 hours with 32 threads and 126 Gb CPU --- ### Tedana Let's grab the echo times from the json files: ```bash echo1=$(cat sub-${subid}/func/sub-${subid}_task-rest_echo-1_bold.json | jq -r '.EchoTime') echo2=$(cat sub-${subid}/func/sub-${subid}_task-rest_echo-2_bold.json | jq -r '.EchoTime') echo3=$(cat sub-${subid}/func/sub-${subid}_task-rest_echo-3_bold.json | jq -r '.EchoTime') ``` ```bash tedana -d ${bidsdir}/derivatives/fmriprep/sub-${subid}/func/sub-${subid}_task-rest_echo-1_desc-preproc_bold.nii.gz ${bidsdir}derivatives/fmriprep/sub-${subid}/func/sub-${subid}_task-rest_echo-2_desc-preproc_bold.nii.gz ${bidsdir}derivatives/fmriprep/sub-${subid}/func/sub-${subid}_task-rest_echo-3_desc-preproc_bold.nii.gz -e $echo1 $echo2 $echo3 --out-dir ${bidsdir}derivatives/tedana/sub-${subid} --debug ``` Took about 2 mins # :100: :muscle: :tada: --- ## Results Your `derivatives` folder should now contain the following directories ```typescript . ├── FastSurfer │ ├── fsaverage │ │ ├── label │ │ ├── mri │ │ │ ├── orig │ │ │ └── transforms │ │ │ └── bak │ │ ├── mri.2mm │ │ ├── scripts │ │ ├── surf │ │ └── xhemi │ │ ├── bem │ │ ├── label │ │ ├── mri │ │ │ ├── orig │ │ │ └── transforms │ │ │ └── bak │ │ ├── scripts │ │ ├── src │ │ ├── stats │ │ ├── surf │ │ ├── tmp │ │ ├── touch │ │ └── trash │ └── sub-Pilot02 │ ├── label │ ├── mri │ │ ├── orig │ │ ├── tmp │ │ └── transforms │ │ └── bak │ ├── scripts │ ├── stats │ ├── surf │ ├── tmp │ ├── touch │ └── trash ├── fmriprep │ ├── logs │ └── sub-Pilot02 │ ├── anat │ ├── figures │ ├── fmap │ ├── func │ └── log └── tedana └── sub-Pilot02 └── figures ``` --- ### FastSurfer Inside `FastSurfer` the files your probably interested in are in the `mri` folder ```bash . ├── antsdn.brain.mgz ├── aparc.a2009s+aseg.mgz ├── aparc+aseg.mgz -> aparc.DKTatlas+aseg.mapped.mgz ├── aparc.DKTatlas+aseg.deep.mgz ├── aparc.DKTatlas+aseg.deep.withCC.mgz ├── aparc.DKTatlas+aseg.mapped.mgz ├── aparc.DKTatlas+aseg.mgz -> aparc.DKTatlas+aseg.mapped.mgz ├── aparc.DKTatlas+aseg.orig.mgz ├── aseg.auto.mgz ├── aseg.auto_noCCseg.mgz ├── aseg.mgz ├── aseg.presurf.hypos.mgz ├── aseg.presurf.mgz ├── brain.finalsurfs.mgz ├── brainmask.auto.mgz ├── brainmask.mgz ├── brain.mgz ├── filled.auto.mgz ├── filled.mgz ├── filled-pretess127.mgz ├── filled-pretess255.mgz ├── lh.ribbon.mgz ├── lh.surface.defects.mgz ├── mask.mgz ├── norm.mgz ├── nu.mgz ├── orig │ └── 001.mgz ├── orig.mgz ├── orig_nu.mgz ├── rawavg.mgz -> orig.mgz ├── rh.ribbon.mgz ├── rh.surface.defects.mgz ├── ribbon.mgz ├── segment.dat ├── T1.mgz ├── talairach.label_intensities.txt ├── tmp ├── transforms │ ├── bak │ ├── cc_up.lta │ ├── talairach.auto.xfm │ ├── talairach.auto.xfm.lta │ ├── talairach_avi.log │ ├── talairach.lta -> talairach.xfm.lta │ ├── talairach.m3z │ ├── talairach_with_skull.lta -> talairach.xfm.lta │ ├── talairach.xfm │ ├── talairach.xfm.lta │ └── talsrcimg_to_711-2C_as_mni_average_305_t4_vox2vox.txt ├── wm.asegedit.mgz ├── wm.mgz ├── wmparc.DKTatlas.mapped.mgz ├── wmparc.mgz -> wmparc.DKTatlas.mapped.mgz └── wm.seg.mgz ``` A rundown of these outputs can be explored in more depth [here](https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/OutputData_freeview) --- ### fmriprep ```bash . ├── dataset_description.json ├── desc-aparcaseg_dseg.tsv ├── desc-aseg_dseg.tsv ├── logs │ ├── CITATION.bib │ ├── CITATION.html │ ├── CITATION.md │ └── CITATION.tex ├── sub-Pilot02 │ ├── anat │ │ ├── sub-Pilot02_desc-aparcaseg_dseg.nii.gz │ │ ├── sub-Pilot02_desc-aseg_dseg.nii.gz │ │ ├── sub-Pilot02_desc-brain_mask.json │ │ ├── sub-Pilot02_desc-brain_mask.nii.gz │ │ ├── sub-Pilot02_desc-preproc_T1w.json │ │ ├── sub-Pilot02_desc-preproc_T1w.nii.gz │ │ ├── sub-Pilot02_dseg.nii.gz │ │ ├── sub-Pilot02_from-fsnative_to-T1w_mode-image_xfm.txt │ │ ├── sub-Pilot02_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5 │ │ ├── sub-Pilot02_from-MNI152NLin6Asym_to-T1w_mode-image_xfm.h5 │ │ ├── sub-Pilot02_from-T1w_to-fsnative_mode-image_xfm.txt │ │ ├── sub-Pilot02_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5 │ │ ├── sub-Pilot02_from-T1w_to-MNI152NLin6Asym_mode-image_xfm.h5 │ │ ├── sub-Pilot02_hemi-L_inflated.surf.gii │ │ ├── sub-Pilot02_hemi-L_midthickness.surf.gii │ │ ├── sub-Pilot02_hemi-L_pial.surf.gii │ │ ├── sub-Pilot02_hemi-L_smoothwm.surf.gii │ │ ├── sub-Pilot02_hemi-R_inflated.surf.gii │ │ ├── sub-Pilot02_hemi-R_midthickness.surf.gii │ │ ├── sub-Pilot02_hemi-R_pial.surf.gii │ │ ├── sub-Pilot02_hemi-R_smoothwm.surf.gii │ │ ├── sub-Pilot02_label-CSF_probseg.nii.gz │ │ ├── sub-Pilot02_label-GM_probseg.nii.gz │ │ ├── sub-Pilot02_label-WM_probseg.nii.gz │ │ ├── sub-Pilot02_space-MNI152NLin2009cAsym_desc-brain_mask.json │ │ ├── sub-Pilot02_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz │ │ ├── sub-Pilot02_space-MNI152NLin2009cAsym_desc-preproc_T1w.json │ │ ├── sub-Pilot02_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz │ │ ├── sub-Pilot02_space-MNI152NLin2009cAsym_dseg.nii.gz │ │ ├── sub-Pilot02_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz │ │ ├── sub-Pilot02_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz │ │ └── sub-Pilot02_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz │ ├── figures │ │ ├── sub-Pilot02_desc-about_T1w.html │ │ ├── sub-Pilot02_desc-conform_T1w.html │ │ ├── sub-Pilot02_desc-reconall_T1w.svg │ │ ├── sub-Pilot02_desc-summary_T1w.html │ │ ├── sub-Pilot02_dseg.svg │ │ ├── sub-Pilot02_fmapid-auto00000_desc-pepolar_fieldmap.svg │ │ ├── sub-Pilot02_space-MNI152NLin2009cAsym_T1w.svg │ │ ├── sub-Pilot02_space-MNI152NLin6Asym_T1w.svg │ │ ├── sub-Pilot02_task-rest_desc-aroma_bold.svg │ │ ├── sub-Pilot02_task-rest_desc-bbregister_bold.svg │ │ ├── sub-Pilot02_task-rest_desc-carpetplot_bold.svg │ │ ├── sub-Pilot02_task-rest_desc-compcorvar_bold.svg │ │ ├── sub-Pilot02_task-rest_desc-confoundcorr_bold.svg │ │ ├── sub-Pilot02_task-rest_desc-rois_bold.svg │ │ ├── sub-Pilot02_task-rest_desc-sdc_bold.svg │ │ ├── sub-Pilot02_task-rest_desc-summary_bold.html │ │ ├── sub-Pilot02_task-rest_desc-t2scomp_bold.svg │ │ ├── sub-Pilot02_task-rest_desc-t2starhist_bold.svg │ │ └── sub-Pilot02_task-rest_desc-validation_bold.html │ ├── fmap │ │ ├── sub-Pilot02_fmapid-auto00000_desc-coeff_fieldmap.nii.gz │ │ ├── sub-Pilot02_fmapid-auto00000_desc-epi_fieldmap.nii.gz │ │ ├── sub-Pilot02_fmapid-auto00000_desc-preproc_fieldmap.json │ │ └── sub-Pilot02_fmapid-auto00000_desc-preproc_fieldmap.nii.gz │ ├── func │ │ ├── sub-Pilot02_task-rest_AROMAnoiseICs.csv │ │ ├── sub-Pilot02_task-rest_desc-confounds_timeseries.json │ │ ├── sub-Pilot02_task-rest_desc-confounds_timeseries.tsv │ │ ├── sub-Pilot02_task-rest_desc-MELODIC_mixing.tsv │ │ ├── sub-Pilot02_task-rest_echo-1_desc-preproc_bold.json │ │ ├── sub-Pilot02_task-rest_echo-1_desc-preproc_bold.nii.gz │ │ ├── sub-Pilot02_task-rest_echo-2_desc-preproc_bold.json │ │ ├── sub-Pilot02_task-rest_echo-2_desc-preproc_bold.nii.gz │ │ ├── sub-Pilot02_task-rest_echo-3_desc-preproc_bold.json │ │ ├── sub-Pilot02_task-rest_echo-3_desc-preproc_bold.nii.gz │ │ ├── sub-Pilot02_task-rest_from-scanner_to-T1w_mode-image_xfm.txt │ │ ├── sub-Pilot02_task-rest_from-T1w_to-scanner_mode-image_xfm.txt │ │ ├── sub-Pilot02_task-rest_space-MNI152NLin2009cAsym_boldref.nii.gz │ │ ├── sub-Pilot02_task-rest_space-MNI152NLin2009cAsym_desc-aparcaseg_dseg.nii.gz │ │ ├── sub-Pilot02_task-rest_space-MNI152NLin2009cAsym_desc-aseg_dseg.nii.gz │ │ ├── sub-Pilot02_task-rest_space-MNI152NLin2009cAsym_desc-brain_mask.json │ │ ├── sub-Pilot02_task-rest_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz │ │ ├── sub-Pilot02_task-rest_space-MNI152NLin2009cAsym_desc-preproc_bold.json │ │ ├── sub-Pilot02_task-rest_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz │ │ ├── sub-Pilot02_task-rest_space-MNI152NLin2009cAsym_T2starmap.json │ │ ├── sub-Pilot02_task-rest_space-MNI152NLin2009cAsym_T2starmap.nii.gz │ │ ├── sub-Pilot02_task-rest_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.json │ │ └── sub-Pilot02_task-rest_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii.gz │ └── log │ └── 20221118-015253_b74f70bf-bc7f-455b-959a-43d1c3268b1c │ └── fmriprep.toml └── sub-Pilot02.html ``` A rundown of these outputs can be explored in more depth [here](https://fmriprep.org/en/stable/outputs.html) You can view the very nice boilerplate of results by opening up the sub-Pilot02.html file ```bash firefox sub-Pilot02.html & ``` --- ### Tedana ```bash . └── sub-Pilot02 ├── dataset_description.json ├── desc-adaptiveGoodSignal_mask.nii.gz ├── desc-ICAAccepted_components.nii.gz ├── desc-ICAAccepted_stat-z_components.nii.gz ├── desc-ICA_components.nii.gz ├── desc-ICA_decomposition.json ├── desc-ICA_mixing.tsv ├── desc-ICA_stat-z_components.nii.gz ├── desc-optcomAccepted_bold.nii.gz ├── desc-optcom_bold.nii.gz ├── desc-optcomDenoised_bold.nii.gz ├── desc-optcomRejected_bold.nii.gz ├── desc-PCA_decomposition.json ├── desc-PCA_metrics.json ├── desc-PCA_metrics.tsv ├── desc-PCA_mixing.tsv ├── desc-PCA_stat-z_components.nii.gz ├── desc-tedana_metrics.json ├── desc-tedana_metrics.tsv ├── figures │ ├── carpet_accepted.svg │ ├── carpet_denoised.svg │ ├── carpet_optcom.svg │ ├── carpet_rejected.svg │ ├── comp_000.png │ ├── comp_001.png │ ├── comp_002.png │ ├── comp_003.png │ ├── comp_004.png │ ├── comp_005.png │ ├── comp_006.png │ ├── comp_007.png │ ├── comp_008.png │ ├── comp_009.png │ ├── comp_010.png │ ├── comp_011.png │ ├── comp_012.png │ ├── comp_013.png │ ├── comp_014.png │ ├── comp_015.png │ ├── comp_016.png │ ├── comp_017.png │ ├── comp_018.png │ ├── comp_019.png │ ├── comp_020.png │ ├── comp_021.png │ ├── comp_022.png │ ├── comp_023.png │ ├── comp_024.png │ ├── comp_025.png │ ├── comp_026.png │ ├── comp_027.png │ ├── comp_028.png │ ├── comp_029.png │ ├── comp_030.png │ ├── comp_031.png │ ├── comp_032.png │ ├── comp_033.png │ ├── comp_034.png │ ├── comp_035.png │ ├── comp_036.png │ ├── comp_037.png │ ├── comp_038.png │ ├── comp_039.png │ ├── comp_040.png │ ├── comp_041.png │ ├── comp_042.png │ ├── comp_043.png │ ├── comp_044.png │ ├── comp_045.png │ ├── comp_046.png │ ├── comp_047.png │ ├── comp_048.png │ ├── comp_049.png │ ├── comp_050.png │ ├── comp_051.png │ ├── comp_052.png │ └── comp_053.png ├── report.txt ├── S0map.nii.gz ├── T2starmap.nii.gz ├── tedana_2022-11-18T111133.tsv └── tedana_report.html ``` A rundown of these outputs can be explored in more depth [here](https://tedana.readthedocs.io/en/stable/outputs.html) You can view the very nice boilerplate of results by opening up the sub-tedana_report.html file ```bash firefox tedana_report.html & ``` --- Example of <span style="color:red">rejected</span> component: ![](https://i.imgur.com/NisrUbE.png) Example of <span style="color:green">accepted</span> component: ![](https://i.imgur.com/shX7RuP.png) I believe the file we would want to use for further analysis would be: - `desc-optcomDenoised_bold.nii.gz` --- ## Further Analysis --- ### Transforms You might notice that Tedana is not in MNI space :frowning: We can fix that with ANTs. But first let's downsample the T1 to make things faster: ```bash fslmaths ${bidsdir}/derivatives/fmriprep/sub-${subid}/anat/sub-Pilot02_desc-preproc_T1w.nii.gz -subsamp2 ${bidsdir}/derivatives/fmriprep/sub-${subid}/anat/sub-Pilot02_desc-preproc_T1w_subsamp2.nii.gz ``` Now we can register to the downsample, and then to MNIspace: ```bash antsApplyTransforms -d 3 -e 3 --float 1 --verbose 1 -i ${bidsdir}/derivatives/tedana/sub-${subid}/desc-optcomDenoised_bold.nii.gz -o ${bidsdir}/derivatives/tedana/sub-${subid}/desc-optcomDenoised_bold-to-T1.nii.gz -r ${bidsdir}/derivatives/fmriprep/sub-${subid}/anat/sub-Pilot02_desc-preproc_T1w_subsamp2.nii.gz -t ${bidsdir}/derivatives/fmriprep/sub-${subid}/func/sub-${subid}_task-rest_from-scanner_to-T1w_mode-image_xfm.txt antsApplyTransforms -d 3 -e 3 --float 1 --verbose 1 -i ${bidsdir}/derivatives/tedana/sub-${subid}/desc-optcomDenoised_bold-to-T1.nii.gz -o ${bidsdir}/derivatives/tedana/sub-${subid}/desc-optcomDenoised_bold-to-MNI.nii.gz -r ${bidsdir}/derivatives/fmriprep/sub-${subid}/func/sub-${subid}_task-rest_space-MNI152NLin2009cAsym_T2starmap.nii.gz -t ${bidsdir}/derivatives/fmriprep/sub-${subid}/anat/sub-Pilot02_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5 imrm ${bidsdir}/derivatives/fmriprep/sub-${subid}/anat/sub-Pilot02_desc-preproc_T1w_subsamp2.nii.gz imrm ${bidsdir}/derivatives/tedana/sub-${subid}/desc-optcomDenoised_bold-to-T1.nii.gz ``` Tada:tada: