T1.mgz was not found when re-running failed freesurfer preprocessing

I tried to preprocess data from one participant but Freesurfer failed. Before re-running the preprocessing, I deleted the subject-specific folders in preprocessed/fmriprep, preprocessed/freesurfer and the work_dir/fmriprep_wf. Then I encountered the error message attached below. My guess is that I didn’t delete all files storing preprocessing progress. More generally, I was wondering what is the best way to let fmriprep re-preprocess one subject from scratch? Thanks a lot!

Traceback (most recent call last):
File “/usr/local/miniconda/bin/fmriprep”, line 11, in
load_entry_point(‘fmriprep==1.0.8’, ‘console_scripts’, ‘fmriprep’)()
File “/usr/local/miniconda/lib/python3.6/site-packages/fmriprep/cli/run.py”, line 267, in main
fmriprep_wf.run(**plugin_settings)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/workflows.py”, line 602, in run
runner.run(execgraph, updatehash=updatehash, config=self.config)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/plugins/base.py”, line 168, in run
self._clean_queue(jobid, graph, result=result))
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/plugins/base.py”, line 227, in _clean_queue
raise RuntimeError("".join(result[‘traceback’]))
RuntimeError: Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/plugins/multiproc.py”, line 68, in run_node
result[‘result’] = node.run(updatehash=updatehash)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py”, line 424, in run
cached, updated = self.is_cached()
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py”, line 310, in is_cached
hashed_inputs, hashvalue = self._get_hashval()
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py”, line 504, in _get_hashval
self._get_inputs()
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py”, line 531, in _get_inputs
results = loadpkl(results_file)
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/utils/filemanip.py”, line 646, in loadpkl
unpkl = pickle.load(pkl_file)
File “/usr/local/miniconda/lib/python3.6/site-packages/traits/has_traits.py”, line 1440, in setstate
self.trait_set( trait_change_notify = trait_change_notify, **state )
File “/usr/local/miniconda/lib/python3.6/site-packages/traits/has_traits.py”, line 1543, in trait_set
setattr( self, name, value )
File “/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base/traits_extension.py”, line 112, in validate
self.info_text, value))
traits.trait_errors.TraitError: The trait ‘T1’ of a ReconAllOutputSpec instance is an existing file name, but the path ‘/scratch/users/jfj/CCD/preprocessed/freesurfer/sub-18/mri/T1.mgz’ does not exist.

What is the command line you are running?

module purge
module load system
export FS_LICENSE=$PWD/license.txt
module load singularity

singularity run /share/PI/russpold/singularity_images/poldracklab_fmriprep_1.0.8-2018-02-23-8c60ec5604ac.img $SCRATCH/CCD $SCRATCH/CCD/preprocessed participant --participant_label sub-18 --output-space T1w template

I’m under the impression that you did not remove everything about your subject under the work directory.

If you anticipate that you will need to re-run subjects in an agile manner, but keeping the intermediate results of other subjects that you call “finished”, then I’d create a work directory specific to each participant:

singularity run /share/PI/russpold/singularity_images/poldracklab_fmriprep_1.0.8-2018-02-23-8c60ec5604ac.img $SCRATCH/CCD $SCRATCH/CCD/preprocessed participant --participant_label sub-18 --output-space T1w template -w work/sub-18

Please note the added -w work/sub-18 bit. This way, if you want to re-run participant 18 you would delete the following folders $SCRATCH/CCD/preprocessed/{fmriprep,freesurfer}/sub-18 and work/sub-18.

Changing the work directory solved the problem! Thanks!

1 Like