Error with T2 processing - fmriprep

I am running fmriprep-1-4-1rc1 on singularity using the following code.

singularity run --cleanenv -B ${DATA_RAW}:${HOME}/data ${HOME}/singularity/fmriprep-1-4-1rc1.simg ${HOME}/data/Nifti ${HOME}/data/Preprocessed participant --participant_label sub-999d --fs-license-file $FS_LICENSE --ignore fieldmaps

I am repeatedly getting an error during recon-all. This error is related to the T2 image, and fmriprep successfully completes if I delete the T2 image. I have checked the T2 image in mricron and the image looks fine. I noticed that this was similar to another thread, but I am not sure whether this was resolved? Could not read error : while file ":/out/freesurfer/sub-001/mri/T2.prenorm.mgz" exist

Here is the last part of my log file:

Started at Wed Jan 1 01:48:48 UTC 2020 
Ended   at Wed Jan  1 01:50:15 UTC 2020
BBR-Run-Time-Sec 87
bbregister Done
To check results, run:
tkregisterfv --mov /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/orig/T2raw.mgz --reg /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/transforms/ --surfs 

 cp /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/transforms/ /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/transforms/T2raw.lta 

 mri_convert -odt float -at /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/transforms/T2raw.lta -rl /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/orig.mgz /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/orig/T2raw.mgz /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/T2.prenorm.mgz 

mri_convert.bin -odt float -at /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/transforms/T2raw.lta -rl /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/orig.mgz /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/orig/T2raw.mgz /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/T2.prenorm.mgz 
$Id: mri_convert.c,v 1.226 2016/02/26 16:15:24 mreuter Exp $
reading from /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/orig/T2raw.mgz...
TR=3000.00, TE=0.00, TI=0.00, flip angle=0.00
i_ras = (0.99904, 0.00598773, 0.0433888)
j_ras = (-0.00729297, 0.999524, 0.0299869)
k_ras = (-0.0431886, -0.0302745, 0.998608)
INFO: Reading transformation from file /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/transforms/T2raw.lta...
Reading transform with LTAreadEx()
reading template info from volume /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/orig.mgz...
INFO: Applying transformation from file /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/transforms/T2raw.lta...
INFO: Transform Matrix (linear_ras_to_ras)
 1.00000   0.00005  -0.00024   0.02214;
-0.00005   1.00000   0.00101  -0.15579;
 0.00024  -0.00101   1.00000  -0.03862;
 0.00000   0.00000   0.00000   1.00000;
Applying LTAtransformInterp (resample_type 1)
writing to /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/T2.prenorm.mgz...

 mri_normalize -sigma 0.5 -nonmax_suppress 0 -min_dist 1 -aseg /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/aseg.presurf.mgz -surface /home/danella/data/Preprocessed/freesurfer/sub-999d/surf/rh.white identity.nofile -surface /home/danella/data/Preprocessed/freesurfer/sub-999d/surf/lh.white identity.nofile /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/T2.prenorm.mgz /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/T2.norm.mgz 

znzTAGskip: tag=1077952576, failed to calloc 1077952512 bytes!

using Gaussian smoothing of bias field, sigma=0.500
disabling nonmaximum suppression
retaining  points that are at least 1.000mm from the boundary
using segmentation for initial intensity normalization
reading from /home/danella/data/Preprocessed/freesurfer/sub-999d/mri/T2.prenorm.mgz...
Cannot allocate memory
Linux oac3loeffdanH 4.15.0-47-generic #50-Ubuntu SMP Wed Mar 13 10:44:52 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

recon-all -s sub-999d exited with ERRORS at Wed Jan  1 01:50:20 UTC 2020

For more details, see the log file /home/danella/data/Preprocessed/freesurfer/sub-999d/scripts/recon-all.log
To report a problem, see

Standard error:

Return code: 1

The freesurfer recon-all.log file is not helpful - says “recon-all -s sub-999d finished without error at Wed Jan 1 02:48:32 UTC 2020”.

This is the first time I am running this subject ID, so I don’t think it is a problem of pre-existing files. And there were no problems with BIDS conversion. Any suggestions? Thanks in advance!!

Hi, this should be resolved in the latest fMRIPrep: 1.5.4.

Yes - this worked. Thanks! One additional (and separate) question. Currently, my work directory is defaulted to my home directory /work; but this is problematic because I do not have enough space there. I have attempted to change this with the following code:

singularity run --cleanenv -B ${DATA_RAW}:${HOME}/data ${HOME}/singularity/fmriprep-1-5-4.simg ${HOME}/data/Nifti ${HOME}/data/Preprocessed participant --participant_label sub-999d --fs-license-file $FS_LICENSE -w ${HOME}/data/work

However, I am getting permissions errors here, related to the work directory. I get about 16 crash files in my log. Here is one of them.

Node: fmriprep_wf.single_subject_999d_wf.func_preproc_ses_1_task_rest1_run_001_wf.bold_reference_wf.enhance_and_skullstrip_bold_wf.fixhdr_unifize
Working directory: /home/danella/data/work/fmriprep_wf/single_subject_999d_wf/func_preproc_ses_1_task_rest1_run_001_wf/bold_reference_wf/enhance_and_skullstrip_bold_wf/fixhdr_unifize

Node inputs:

hdr_file =
in_file =

Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/plugins/”, line 69, in run_node
result[‘result’] =
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/”, line 479, in run
result = self._run_interface(execute=True)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/”, line 585, in _run_interface
return self._run_command(execute)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/”, line 678, in _run_command
result =
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/”, line 382, in run
runtime = self._run_interface(runtime)
File “/usr/local/miniconda/lib/python3.7/site-packages/niworkflows/interfaces/”, line 74, in _run_interface
shutil.copy(in_file, out_name)
File “/usr/local/miniconda/lib/python3.7/”, line 242, in copy
copymode(src, dst, follow_symlinks=follow_symlinks)
File “/usr/local/miniconda/lib/python3.7/”, line 144, in copymode
chmod_func(dst, stat.S_IMODE(st.st_mode))
PermissionError: [Errno 1] Operation not permitted: ‘/home/danella/data/work/fmriprep_wf/single_subject_999d_wf/func_preproc_ses_1_task_rest1_run_001_wf/bold_reference_wf/enhance_and_skullstrip_bold_wf/fixhdr_unifize/uni_xform.nii.gz’

I am not sure why since this is a directory that I have given singularity access to through binding. Any other suggestions for how I can change the location of the “work” directory? Thanks!

Hi @effigies -

I have still not been able to figure out the issue above. Here is my singularity command:

singularity run --cleanenv -B ${DATA_RAW}:${HOME}/data ${HOME}/singularity/fmriprep-1-5-4.simg ${HOME}/data/Nifti ${HOME}/data/Preprocessed participant --participant_label sub-999d --fs-license-file $FS_LICENSE -w ${HOME}/data/work

The analysis runs fine without the specification of the work directory; however, the work directory is by default in my home directory, which does not have adequate space for these files.

I am getting 16 crash files related to permissions errors. Here is an example.

PermissionError: [Errno 1] Operation not permitted: ‘/home/danella/data/work/fmriprep_wf/single_subject_999d_wf/anat_preproc_wf/brain_extraction_wf/atropos_wf/copy_xform/09_relabel_wm_mask_xform.nii.gz’

All are from either copy_xform or fixhdr_unifize.

Any ideas what would be causing this, or suggestions for how to fix it? Thanks!

Hi @Danella1. This is a very strange error. For some reason it’s copying a file, but your OS is not allowing you to chmod it.

There might be constraints on whatever filesystem you’re using. I would check with your system administrator to see if there’s a reason that copying a file and then copying its mode would fail.

Thank you! This was a permissions issue. The directory I was using only allowed the owner and group to “create and delete” files, but only allowed everyone else to “access files”. When I changed that, fmriprep ran just fine.

1 Like