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

Longitudinal fmriprep with pre-run Freesurfer #21

Open
araikes opened this issue Apr 16, 2018 · 9 comments
Open

Longitudinal fmriprep with pre-run Freesurfer #21

araikes opened this issue Apr 16, 2018 · 9 comments
Labels
freesurfer FreeSurfer related improvements and issues multiple images Multiple T1w or T2w images (e.g., longitudinal, multisession, etc)

Comments

@araikes
Copy link

araikes commented Apr 16, 2018

Hi all,
In a previous issue (#993), there was a discussion about using fmriprep for longitudinal studies. The question came down to the reusability of Freesurfer outputs. The suggestion was made by @chrisfilo to run Freesurfer first (preferably the BIDS App Freesurfer) and then let fmriprep pull from that.

I've run Freesurfer's recon all for my participants. When I run fmriprep, should I use the --no-fs-reconall option. When I include the flag, the process crashes out with an error (see attached crash text file). When I do not include the flag, the process runs but it's not clear if the freesurfer output is being incorporated.

My call to fmriprep was:
-wrap "docker run -i --rm \ -v $INDIVDIR:/data:ro \ -v $OUTDIR:/out \ -v /data/BL2/BIDS_derivatives/code/license.txt:/opt/freesurfer/license.txt \ poldracklab/fmriprep \ /data /out \ participant \ --longitudinal \ --low-mem \ --n_cpus 1 \ --output-space template T1w fsaverage \ --work-dir /scratch \ --use-aroma \ --participant_label "sub-$subject" \ --write-graph"

where $OUTDIR already contains a "freesurfer" folder built from my $INDIVDIR. The --no-fs-reconall was included for one participant and excluded for one participant. The one where it was included completed.

Please let me know what other files might be needed to identify if freesurfer is getting incorporated as intended.

crash-20180414-015316-root-autorecon1-f42ca378-4525-48ee-ac26-65982571c354.txt

@effigies
Copy link
Member

You should not use --no-fs-reconall. That indicates that you do not intend to use FreeSurfer surface processing at all, which I do not believe is what you want. The attached crash file, however, seems to be from when you do not include the flag, as autorecon1 should not be run at all if --no-fs-reconall is specified.

Looking at that error, it's finding your FreeSurfer directory, but for some reason not identifying it as being complete. This is most likely a lapse in Nipype's ability to detect a completed directory. I'm not sure what all differences there are in such a directory.

Could you give a full listing of the commands you ran directly with FreeSurfer? If I can replicate your situation, I should be able to get ReconAll to correctly detect that your directory has already been run.

@araikes
Copy link
Author

araikes commented Apr 16, 2018

Hi @effigies,
Here's the command for running freesurfer. I'm running it in parallel using SLURM on a private cluster.

sbatch -o $LOGS/sub-"$subject"/Freesurfer_out.txt \ -e $LOGS/sub-"$subject"/Freesurfer_error.txt \ --partition="verylong.q" \ --job-name="FS_sub-$subject" \ --wrap "docker run -i --rm \ -v $BIDSDIR:/bids_dataset:ro \ -v $FSOUT:/outputs \ -v /data/BL2/BIDS_derivatives/code/license.txt:/license.txt \ bids/freesurfer \ /bids_dataset \ /outputs \ participant \ --n_cpus 1 \ --multiple_sessions longitudinal \ --hires_mode disable \ --participant_label $subject \ --refine_pial T1only \ --skip_bids_validator \ --license_file "/license.txt""

where $FSOUT is my BIDS derivatives folder/freesurfer.

Attached is a truncated text file with the file tree that gets created from running this. This is the same participant for the crash file I attached previously. The only thing I'm not sure of is whether I needed the "steps" flag in the recon-all call, but it looks like it doesn't. It appears that the cross-sectional, base, and longitudinal folders all got created.

file_tree.txt

Thanks

@effigies
Copy link
Member

Could you share the scripts/recon-all.log?

@araikes
Copy link
Author

araikes commented Apr 16, 2018

From the cross-sectional folders:
ses-Pre: recon-all.log
ses-Post: recon-all.log

From the base folder:
recon-all.log

From the longitudinal folders:
ses-Pre: recon-all.log
ses-Post: recon-all.log

@effigies
Copy link
Member

Just an update to let you know that (a) I have not yet had time to look further into this and (b) I have not forgotten about this. Thanks for your patience.

@araikes
Copy link
Author

araikes commented Apr 24, 2018

Thanks for the update @effigies

@pettitta
Copy link

Hi,

I have a follow-up tangential question for OP. I see that you have run the freesurfer scans through the longitudinal pipeline. How do you specify for fmriprep for them to use the longitudinally processed directories for each timepoint and not the original cross-sectional freesurfer output directories?

@oesteban oesteban transferred this issue from nipreps/fmriprep Jan 8, 2019
@oesteban oesteban added freesurfer FreeSurfer related improvements and issues multiple images Multiple T1w or T2w images (e.g., longitudinal, multisession, etc) labels Jan 8, 2019
@hpfisher3
Copy link

Has there been any update on this? I am also running into an issue of fmriprep not being able to recognize previously run freesurfer outputs for a longitudinal design. I get the "you are trying to re-run an existing subject with (possibly) new input data..." error

@effigies
Copy link
Member

effigies commented Dec 3, 2022

I think this is finally going to be possible in the near future with nipy/nipype#3529. We will need assistance from somebody familiar with FreeSurfer longitudinal to implement it, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
freesurfer FreeSurfer related improvements and issues multiple images Multiple T1w or T2w images (e.g., longitudinal, multisession, etc)
Projects
None yet
Development

No branches or pull requests

5 participants