Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When dealing with multiple sessions, `anat` workflow output per session missing #993

Closed
mick-d opened this issue Feb 20, 2018 · 15 comments

Comments

Projects
None yet
7 participants
@mick-d
Copy link

commented Feb 20, 2018

I run fmriprep on a subject having two sessions, (cf command and directory structure below):

RUNNING: docker run --rm -it -v /my/freesurfer/license.txt:/opt/freesurfer/license.txt:ro -v /my/raw_data/bids:/data:ro -v /my/proc_data/fmriprep:/out -v /my/tmp_data:/scratch -v /my/raw_data/bids/nipype.cfg:/root/.nipype/nipype.cfg:ro poldracklab/fmriprep:1.0.7 /data /out participant --participant_label sub-HC001 --output-space T1w template --use-aroma --bold2t1w-dof 6 --fs-no-reconall --resource-monitor --write-graph --nthreads 10 -w /scratch
180220-11:57:01,397 workflow IMPORTANT:
     
    Running fMRIPREP version 1.0.7:
      * BIDS dataset path: /data.
      * Participant list: ['HC001'].
      * Run identifier: 20180220-115701_cbf57247-643e-49cd-9281-9a27d866fd1c.
sub-HC001
├── ses-a
│   ├── anat
│   │   ├── sub-HC001_ses-a_T1w.json
│   │   └── sub-HC001_ses-a_T1w.nii.gz
│   └── func
│       ├── sub-HC001_ses-a_task-rest_bold.json
│       └── sub-HC001_ses-a_task-rest_bold.nii.gz
└── ses-b
    ├── anat
    │   ├── sub-HC001_ses-b_T1w.json
    │   └── sub-HC001_ses-b_T1w.nii.gz
    └── func
        ├── sub-HC001_ses-b_task-rest_bold.json
        └── sub-HC001_ses-b_task-rest_bold.nii.gz

However, while the func workflow has distinct outputs per session, the anat workflow only has a general output (cf below). I was wondering if that was an issue, or a desired feature, and if the latter what does this output correspond to w.r.t. to the raw distinct-session T1s. Even if it is a desired feature, would there be away to have a separate output per session?
Also please note that when a subject has a single session (e.g. raw_data/sub-HC002/ses-a), then the anat output is in the "right" place (i.e. proc_data/sub-HC002/ses-a/anat)

sub-HC001
├── anat
│   ├── sub-HC001_T1w_brainmask.nii.gz
│   ├── sub-HC001_T1w_class-CSF_probtissue.nii.gz
│   ├── sub-HC001_T1w_class-GM_probtissue.nii.gz
│   ├── sub-HC001_T1w_class-WM_probtissue.nii.gz
│   ├── sub-HC001_T1w_dtissue.nii.gz
│   ├── sub-HC001_T1w_preproc.nii.gz
│   ├── sub-HC001_T1w_space-MNI152NLin2009cAsym_brainmask.nii.gz
│   ├── sub-HC001_T1w_space-MNI152NLin2009cAsym_class-CSF_probtissue.nii.gz
│   ├── sub-HC001_T1w_space-MNI152NLin2009cAsym_class-GM_probtissue.nii.gz
│   ├── sub-HC001_T1w_space-MNI152NLin2009cAsym_class-WM_probtissue.nii.gz
│   ├── sub-HC001_T1w_space-MNI152NLin2009cAsym_dtissue.nii.gz
│   ├── sub-HC001_T1w_space-MNI152NLin2009cAsym_preproc.nii.gz
│   ├── sub-HC001_T1w_space-MNI152NLin2009cAsym_target-T1w_warp.h5
│   └── sub-HC001_T1w_target-MNI152NLin2009cAsym_warp.h5
├── figures
│   ├── sub-HC001_ses-a_task-rest_bold_flt_bbr.svg
│   ├── sub-HC001_ses-a_task-rest_bold_ica_aroma.svg
│   ├── sub-HC001_ses-a_task-rest_bold_rois.svg
│   ├── sub-HC001_ses-b_task-rest_bold_flt_bbr.svg
│   ├── sub-HC001_ses-b_task-rest_bold_ica_aroma.svg
│   ├── sub-HC001_ses-b_task-rest_bold_rois.svg
│   ├── sub-HC001_T1w_seg_brainmask.svg
│   └── sub-HC001_T1w_t1_2_mni.svg
├── ses-a
│   ├── anat
│   │   └── sub-HC001_ses-a_T1w_space-orig_target-T1w_affine.txt
│   └── func
│       ├── sub-HC001_ses-a_task-rest_bold_AROMAnoiseICs.csv
│       ├── sub-HC001_ses-a_task-rest_bold_confounds.tsv
│       ├── sub-HC001_ses-a_task-rest_bold_MELODICmix.tsv
│       ├── sub-HC001_ses-a_task-rest_bold_space-MNI152NLin2009cAsym_brainmask.nii.gz
│       ├── sub-HC001_ses-a_task-rest_bold_space-MNI152NLin2009cAsym_preproc.nii.gz
│       ├── sub-HC001_ses-a_task-rest_bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc.nii.gz
│       ├── sub-HC001_ses-a_task-rest_bold_space-T1w_brainmask.nii.gz
│       └── sub-HC001_ses-a_task-rest_bold_space-T1w_preproc.nii.gz
└── ses-b
    ├── anat
    │   └── sub-HC001_ses-b_T1w_space-orig_target-T1w_affine.txt
    └── func
        ├── sub-HC001_ses-b_task-rest_bold_AROMAnoiseICs.csv
        ├── sub-HC001_ses-b_task-rest_bold_confounds.tsv
        ├── sub-HC001_ses-b_task-rest_bold_MELODICmix.tsv
        ├── sub-HC001_ses-b_task-rest_bold_space-MNI152NLin2009cAsym_brainmask.nii.gz
        ├── sub-HC001_ses-b_task-rest_bold_space-MNI152NLin2009cAsym_preproc.nii.gz
        ├── sub-HC001_ses-b_task-rest_bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc.nii.gz
        ├── sub-HC001_ses-b_task-rest_bold_space-T1w_brainmask.nii.gz
        └── sub-HC001_ses-b_task-rest_bold_space-T1w_preproc.nii.gz
@effigies

This comment has been minimized.

Copy link
Collaborator

commented Feb 20, 2018

We merge the T1w images (using FreeSurfer's mri_robust_template) and run the anatomical preprocessing pipeline on that. The per-session affines describe the transformation from the original image to the preprocessed space.

There is not currently a way to separate anatomical output by session. Probably the simplest possibility that isn't currently implemented is to allow --session-label to limit processing to a single session, and then iterate over sessions in multiple separate processes. Another approach would be to add a flag to disable session merging, which would require some refactoring to keep the anatomical and functional workflows correctly segregated within a single process.

@mick-d

This comment has been minimized.

Copy link
Author

commented Feb 20, 2018

Many thanks for the clarification @effigies. In my particular project the T1 of two different sessions can be different due to disease, so separate outputs are required. All the possibilities you mentioned sound good (in this particular case I would have used the flag to disable session merging). At the moment I could simply rerun the analysis with independent processes for data associated to each session.

@mick-d mick-d closed this Feb 20, 2018

@chrisgorgo

This comment has been minimized.

Copy link
Contributor

commented Feb 20, 2018

I am curious what kind of higher level analysis do you have in mind that would require access to preprocessed structural scans from each individual session. Could you elaborate?

@mick-d

This comment has been minimized.

Copy link
Author

commented Feb 23, 2018

Only saw this message now. There are a few possibilities, just to mention the two I am facing for the current project:

  • first, the one I already mentioned: disease introduces structural changes, so anatomical scans are analysed separately
  • second, when doing a cross-sectional study looking at only the first time point (e.g. only some subjects have more than one time-point)

@mick-d mick-d reopened this Feb 23, 2018

@chrisgorgo

This comment has been minimized.

Copy link
Contributor

commented Feb 23, 2018

Sorry I wasn't too clear. I was curious what analysys you use the T1w images produced by FMRIPREP for? VBM or something similar? Or are you after the FreeSurfer outputs and want to do cortical thickness?

We mostly though about T1w in context of coregistration and bold data. Your first use case is definitelly supported if you only interested in bold changes. There is even a flag for constructing unbiased subject specific templates for longitudinal studies like this one.

@treanus

This comment has been minimized.

Copy link

commented Feb 25, 2018

It would be an enhancement to have the anat-workflow per session as well. I would use these for VBM analysis.

@mick-d

This comment has been minimized.

Copy link
Author

commented Feb 26, 2018

@chrisfilo, although part of the data is longitudinal we are interested in cross-sectional per-session measurements at this point (with a custom analysis, although FreeSurfer outputs may be used)

@oesteban

This comment has been minimized.

Copy link
Contributor

commented Feb 26, 2018

@treanus FMRIPREP will not perform nonlinear co-registration of the T1w images... not sure that could be used in VBM, correct?

I think we could spin that workflow off of FMRIPREP and have a VBM-specific workflow. Then tune it up to perform nonlinear registration of T1s along time. Would you like to start that idea?

@araikes

This comment has been minimized.

Copy link

commented Mar 27, 2018

As a bump to this question, am I correct in understanding that as of right now, the freesurfer folder that gets written in a longitudinal study would not be useful for doing longitudinal assessments of thickness change?

I'm getting down to processing some data using fmriprep and attempting to maximize what I get out of running various analyses. Knowing on the front end that fmriprep's FS output won't allow me to make structural longitudinal assessments just helps me calibrate my expectations.

Thanks for all the work you put into this program @oesteban and @chrisfilo

@chrisgorgo

This comment has been minimized.

Copy link
Contributor

commented Mar 28, 2018

In such case (when you are planning a longitudinal cortical thickness analysis and a fMRI analysis) I recommend running the FreeSurfer BIDS App first (https://github.com/BIDS-Apps/freesurfer) and reuse it's outputs in FMRIPREP. The FreeSurfer BIDS App is capable of doing a variety of longitudinal analyses and can produce outputs (subject specific templates) that FMRIPREP should understand (if not please let us know).

@araikes

This comment has been minimized.

Copy link

commented Mar 28, 2018

@chrisfilo I will test it out. For FMRIPREP to recognize it, does my output folder need to be "freesurfer" or if I chose another name is there a way to mount the volume in a particular way when I pipe it into docker?

Thanks again

@chrisgorgo

This comment has been minimized.

Copy link
Contributor

commented Mar 28, 2018

it has to be freesurfer/sub-XX inside the output folder you pass to FMRIPREP. More details at http://fmriprep.readthedocs.io/en/stable/workflows.html#surface-preprocessing

@oesteban

This comment has been minimized.

Copy link
Contributor

commented May 3, 2018

I think this has been addressed in #1068. Let me know if I'm wrong closing it.

@oesteban oesteban closed this May 3, 2018

@hpfisher3

This comment has been minimized.

Copy link

commented Feb 20, 2019

@chrisfilo Is there a singularity version of the Freesurfer app, or is it currently only implemented through docker

@chrisgorgo

This comment has been minimized.

Copy link
Contributor

commented Feb 20, 2019

Docker only, but new versions of singualrity can import docker directly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.