Combining fmriprep with ME-ICA from tedana

multi-echo
fmriprep
#1

Dear all,

I have a task and resting multi-echo datasets. Very nice to see that fmriprep now has a multiecho pipeline. However, as far as I can see, fmriprep does not yet apply multiecho ICA denoising. For this, I would still be required to use tedana. My query is regarding the optimal pipeline for processing my multiecho datasets with me-ica denoising.

Does the following approach sound sensible:

  1. Use fmriprep to perform slice-timing correction on multiecho dataset.
  2. Use tedana to optimally combine multiecho-data and perform ICA denoising, removing motion, physiology, etc… non-bold components.
  3. Feed optimally combined and denoised multiecho data to fmriprep for normalisation and distortion correction using field map.

Please let me know if this sounds like a sensible approach, or whether there is an imminent release of fmriprep with me-ica denoising.

Thank you in advance for your help.
Kind regards,
Gershon.

1 Like
#2

Hi Gershon,

I know that @emdupre is working on integrating multi-echo denoising (in addition to optimal combination) with tedana into fMRIPrep, but that’s a little ways out.

I agree that, in the mean time, it makes sense to use fMRIPrep and tedana separately, but within the same overall pipeline. However, I’m not sure about the details of your approach. Specifically, I don’t think you can break fMRIPrep into separate parts like that.

The approach we’re planning to take in a tedana analysis is to run fMRIPrep and then to grab native-space partially preprocessed data (i.e., post STC and HMC) from the fMRIPrep working directory. We’ll then feed those data through tedana and finally apply fMRIPrep’s calculated transforms for coregistration and normalization. We haven’t completed the code to do this yet, but I believe that it’s all doable. The overall pipeline is the same as yours, but doesn’t require stopping and restarting fMRIPrep.

Best,
Taylor

#3

Dear Taylor,

Thank you for the helpful reply. It is good to know that integration of multi-echo denoising and fmriprep is on its way. Do you know what the timeline for this might be?

In the mean time, I wonder whether we might not just be able to obtain some partially processed images from fmriprep. For example, echo1_bold_hmc_stc, echo2_bold_hmc_stc, echo3_bold_hmc_stc and feed these files into tedana.

I take it tedana would then output a combined file of denoised optimally combined echos. Could I then feed this one file into fmriprep, to complete the SDC, normalisation etc…?

Just as a note, I am new to tedana and fmriprep so I may be naive to certain aspects of the workflow/pipeline.

Kind regards,
Gershon.

#4

The first files that you should be able to access (which will be stored in the working directory, I think) should be the data in native space, after slice timing correction, motion correction, and distortion correction. You can take those, run tedana on them, and then use coregistration and normalization warp files, saved by fMRIPrep, to transform the denoised data into standard space. I don’t think that you can submit partially processed data into fMRIPrep without it re-running the entire pipeline.

So the only difference from your proposed approach is that you would apply the final transforms, originally estimated by fMRIPrep, yourself instead of re-submitting the denoised data to fMRIPrep to have it do them. That said, I think SDC will have to be performed before tedana, although I could be wrong.

1 Like
#5

Dear Taylor,

Thank you. This sounds like a sensible solution until ME-ICA is fully integrated with fmriprep.

Thanks for giving your time.

Kind regards,
Gershon.

#6

Dear @tsalo @emdupre ,

Thank you thus far for your help setting up a pipeline using fmriprep. I have managed to get fmriprep to run, though I have a few things that are still not working correctly. I was wondering whether you had any thoughts.

Pipeline:

  1. BIDS directory: This was setup using heudiconv for BIDS directory. I a customised heuristic file to, largely, set up my directory as required. Ie., my multiecho files were individual list in /func folder. However, my sbref images were labeled with rec_magnitude for each echo image. I relabeled these to align with the labels for echo images. I have attached my heuristic file as well as an image for reference.

  2. fmriprep: I then used this BIDS directory in the fmriprep analysis pipeline (code used is attached). I managed for this to run successfully on our cluster using singularity. However, it seems as though only echo 1 was processed–I see no optimically combined image and cannot locate the minimally preprocessed echo images in my working directory that I would like to feed into tedana. Moreover, fmriprep is not recognising the I have a fieldmap in /fmap folder and sbref images for each echo. Any ideas why fmriprep is skipping these images?

Please let me know if you would like for me to attach anything else, please let me know.

Kind regards,
Gershon.fmriprep_launch_v3.txt (455 Bytes)

convert_dicom_gut2.txt (2.6 KB)

#7

Hi Gershon,

I don’t believe that fMRIPrep labels the output preprocessed file as “optimally combined,” but it shouldn’t have echo-1 in the filename. Is that the case?

Currently, fMRIPrep doesn’t output the echo-specific images, which is why we recommend collecting the relevant files from fMRIPrep’s working directory and moving them into the output directory. We have some provisional code available here, although it’s currently just a notebook tailored to our project. We plan to convert it into a more general function soon, but you can almost certainly adapt it yourself to work with your own data structure. We have tested the code (and it looks good), but haven’t checked too deeply against fMRIPrep’s code, so we’re not 100% sure we’re grabbing the right files.

Regarding the field maps, it looks like you’re using --force-syn. That would force fMRIPrep to use field map-less distortion correction. I’m not sure about the sbref files. Are you sure it’s not using them? Can you share the captured stdout?

Best,
Taylor

fMRIPREP + TEDANA Status of things as of April 2019?
#8

Thanks for the reply Taylor,

In the html report, the figure all point to figure labels with ‘echo-1’. For example, sub-018/figures/sub-018_ses-001_task-faces_echo-1_rois.svg

Moreover in my working directory I only find the following files:

about func_preproc_ses_001_task_faces_echo_1_wf
anat_preproc_wf func_preproc_ses_001_task_rest_echo_1_wf
bids_info func_preproc_ses_002_task_faces_echo_1_wf
bidssrc func_preproc_ses_002_task_rest_echo_1_wf
ds_report_about summary
ds_report_summary

Does this indicate that only echo_1 is analysed?

However, when I go to the output directory the files are not labeled with ‘echo…’. For example, fmriprep/sub-018/ses-001/func/sub-018_ses-001_task-faces_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz

Does this mean that the html report and working file label is indicating the echo-1 is being used as some reference, but actually the correct, optimally combined, images can be found in the output folder?

ie., the following image is the optimally combined image: sub-018_ses-001_task-faces_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz

I will examine your code and try to omit --force-syn.

Kind regards,
Gershon.

#9

I believe that the echo-1 is probably just an oversight in the naming. Even after the data are optimally combined across echoes, the working directory may store the files in folders with echo-1 in the name. The desc-preproc file in the output directory should definitely be the optimally combined, preprocessed data.

#10

Hi @tsalo and @emdupre,

My apologies for tagging you two again, but you seem to be the resident experts regarding combining fmriprep and tedana.

I have processed my data with the latest version of fmriprep 1.4, chosing MNI152NLin6Asym as an output space using --output-spaces.

I have managed to use the script (https://github.com/ME-ICA/tedana-reliability-analysis/blob/master/collect_fmriprep.ipynb) provided by @tsalo to obtain the minimally preprocessed images for use in tedana. However, I am having some difficulty extracting the required files for subsequent warp transformation from native BOLD space to MNI152NLin6Asym.

For example, the script points to the folder in the wf called ‘bold_to_mni_trans_wf’, which does not seem to exist. I wonder if this has changed in subsequent version of fmriprep. I think I may have found the correct files in ‘op.join(task_dir, ‘bold_mni_trans_wf’,‘bold_to_mni_transform/_inputs.pklz’)’, but not entirely sure.

Using these files, I create two files:
native_to-reference_mode-image_xfm.txt
reference_to-T1w_mode-image_xfm.txt

I then tried to use the following to files using ApplyTransform to warp my BOLD image in native space to MNI152NLin6Asym (as a sanity check prior to running tedana), but this did not work (ie, the command ran but not image was displayed).

at = ApplyTransforms()
at.inputs.dimension = 3
at.inputs.interpolation = ‘NearestNeighbor’
at.inputs.float = False
at.inputs.transforms = op.join(sub_func_dir,‘sub-002_ses-002_task-faces_from-native_to-reference_mode-image_xfm.txt’)
at.inputs.input_image = op.join(sub_func_dir,‘sub-002_ses-002_task-faces_echo-1_space-native_desc-partialPreproc_bold.nii’)
at.inputs.reference_image = op.join(sub_func_dir,‘sub-002_ses-002_task-faces_space-MNI152NLin6Asym_desc-preproc_bold.nii.gz’)
at.inputs.output_image = ‘/home/fs0/gspitz/scratch/gut_study/data/fmriprep_output/fmriprep_derivative/test.nii.gz’

I was hoping you might have an easy fix to this. I am sure the files are there, but having difficulty locating the correct ones.

Kind regards,
Gershon.