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

Using pre-run Freesurfer #4

Closed
araikes opened this issue Jul 20, 2018 · 7 comments
Closed

Using pre-run Freesurfer #4

araikes opened this issue Jul 20, 2018 · 7 comments
Labels
effort:medium Estimated medium effort task freesurfer FreeSurfer related improvements and issues impact:low Estimated low impact task

Comments

@araikes
Copy link

araikes commented Jul 20, 2018

I recognize that this concept has been addressed in poldracklab/fmriprep#1182 and I have read that thread prior to posting here. I have previously posted here on this topic but I'll refresh it for the current error. I have the most current version of fmriprep (updated today).

I have run Freesurfer (BIDS/Freesurfer v 6.0) using a longitudinal pipeline for 29 participants. The output from that is currently in OUTDIR/freesurfer. I now am trying to fmriprep. I've run on a single subject in order to assess the usability of the prior freesurfer run. The process completed and I received the reports for the subject. However, none of the freesurfer derivatives are present. A careful inspection of the logs reveals that it finds the pre-run Freesurfer directory but doesn't utilize it.

Here is the error message:

RuntimeError: Command:
recon-all -autorecon1 -noskullstrip -openmp 4 -subjid sub-01 -sd /out/freesurfer -notalairach -nonuintensitycor -nonormalization
Standard output:

ERROR: It appears that this subject ID is an existing
base/template from longitudinal processing (-base):
sub-01
If you are trying to re-run a -base template you
need to pass the -base and all -tp flags:

   \' -base <templateid> -tp <tpNid> ... -all \'

   (Instead of -all you can pass other flags, such
   as -autorecon2 -autorecon3 to run only parts.)

Standard error:

Return code: 1

I am attaching the log file with the error. Here's the commands for fmriprep:

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

Any help would be appreciated

crash_log.txt

@effigies
Copy link
Member

I'm sorry, I meant to respond to this earlier. The issue here is going to be that nipype's ReconAll interface evidently doesn't recognize a longitudinal reconstruction as complete, and attempts to resume.

In order to correctly handle this, we'll need to understand more about what the expected output of recon-all with a longitudinal pipeline should be. Could you share the following?

  1. The sequence of FreeSurfer commands you use for a single subject, from recon-all -i to complete reconstruction.
  2. The full directory structure of a reconstructed longitudinal subject.

If you're feeling ambitious, the place this would need to be changed will be in these two sections:

https://github.com/nipy/nipype/blob/aeb087470481343e4043eca1acf9196538e21d5c/nipype/interfaces/freesurfer/preprocess.py#L942-L1146

https://github.com/nipy/nipype/blob/aeb087470481343e4043eca1acf9196538e21d5c/nipype/interfaces/freesurfer/preprocess.py#L1222-L1290

We'd need ways of identifying a longitudinal subject and a new set of "steps" for the longitudinal analyses.

@pettitta
Copy link

pettitta commented Jan 4, 2019

Hi, I know I'm late to the game here, but I'm running into the same issue and I can provide you with what you're looking for. Official freesurfer instructions can be found here

For a single participant, with two time points, I first run a cross sectional recon-all for each time point

Time 1:

recon-all -i /BIDS_data/"${SUBID}"/ses-wave1/anat/"${SUBID}"_ses-wave1_T1w.nii.gz -subjid "${SUBID}_ses-wave1" -all

Time 2:

recon-all -i /BIDS_data/"${SUBID}"/ses-wave2/anat/"${SUBID}"_ses-wave2_T1w.nii.gz -subjid "${SUBID}_ses-wave2" -all

Then I created a base template from the cross-sectional scans for the participant:

recon-all -base "${SUBID}" -tp /BIDS_data/derivatives/freesurfer/"${SUBID}"_ses-wave1 -tp /BIDS_data/derivatives/freesurfer/"${SUBID}"_ses-wave2 -all

Finally we use the newly created base to create a longitudinally processed image at each timepoint:

Time 1:

recon-all -long /BIDS_data/derivatives/freesurfer/"${SUBID}"_ses-wave1 "${SUBID}" -all

Time 2:

recon-all -long /BIDS_data/derivatives/freesurfer/"${SUBID}"_ses-wave2 "${SUBID}" -all

I've attached a full directory structure of a longitudinally processed participant. Please let me know if there's anything else you need and thanks for your help!

freesurfer_directory.txt

@oesteban oesteban transferred this issue from nipreps/fmriprep Jan 8, 2019
@oesteban oesteban added templates Issues related to spatial normalization freesurfer FreeSurfer related improvements and issues and removed templates Issues related to spatial normalization labels Jan 8, 2019
@franklin-feingold franklin-feingold added effort:medium Estimated medium effort task impact:low Estimated low impact task labels Mar 12, 2019
@araikes
Copy link
Author

araikes commented Mar 21, 2019

@pettitta I'm just seeing this right now. I'm curious if this solution works for allowing FMRIPrep/Nipype to identify that Freesurfer has already been run and correctly import the expected folders?

Also, have you tried this with the BIDS/Freesurfer docker, which does all of these steps?

@oesteban
Copy link
Member

oesteban commented May 7, 2020

Was this ever addressed/documented? Thanks for your patience.

@oesteban
Copy link
Member

oesteban commented May 8, 2020

I'll close this and welcome anyone who reopens it because it wasn't correctly addressed.

@oesteban oesteban closed this as completed May 8, 2020
@effigies
Copy link
Member

effigies commented May 8, 2020

This isn't done, as it's about using longitudinal FreeSurfer. #21 should cover that.

@oesteban
Copy link
Member

oesteban commented May 8, 2020

Let's then redirect everyone to the longitudinal FS issue you linked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort:medium Estimated medium effort task freesurfer FreeSurfer related improvements and issues impact:low Estimated low impact task
Projects
None yet
Development

No branches or pull requests

5 participants