Fmriprep error - Preprocessing did not finish successfully

Dear Community,

I gave fmriprep my first go yesterday on one participant. This morning I have noticed that the preprocessing did not finish correctly. This is the error in the log:

Node: fmriprep_wf.single_subject_3000_wf.func_preproc_ses_2_task_AgeRep_run_018_wf.bold_std_trans_wf.bold_to_std_transform
Working directory: /scratch/fmriprep_wf/single_subject_3000_wf/func_preproc_ses_2_task_AgeRep_run_018_wf/bold_std_trans_wf/_std_target_MNI152NLin2009cAsym.resnative/bold_to_std_transform

Node inputs:

args =
copy_dtype = True
default_value = 0.0
dimension =
environ = {}
float = True
input_image =
input_image_type =
interpolation = LanczosWindowedSinc
interpolation_parameters =
invert_transform_flags =
num_threads = 3
out_postfix = _trans
output_image =
print_out_composite_warp_file =
reference_image =
save_cmd = True
transforms =

Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/plugins/multiproc.py”, line 67, in run_node
result[“result”] = node.run(updatehash=updatehash)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 516, in run
result = self._run_interface(execute=True)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 635, in _run_interface
return self._run_command(execute)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 741, in _run_command
result = self._interface.run(cwd=outdir)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py”, line 428, in run
runtime = self._run_interface(runtime)
File “/usr/local/miniconda/lib/python3.7/site-packages/niworkflows/interfaces/itk.py”, line 172, in _run_interface
zip(in_files, xfms_list)
File “/usr/local/miniconda/lib/python3.7/concurrent/futures/_base.py”, line 586, in result_iterator
yield fs.pop().result()
File “/usr/local/miniconda/lib/python3.7/concurrent/futures/_base.py”, line 425, in result
return self.__get_result()
File “/usr/local/miniconda/lib/python3.7/concurrent/futures/_base.py”, line 384, in __get_result
raise self._exception
File “/usr/local/miniconda/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/miniconda/lib/python3.7/site-packages/niworkflows/interfaces/itk.py”, line 234, in _applytfms
runtime = xfm.run().runtime
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py”, line 428, in run
runtime = self._run_interface(runtime)
File “/usr/local/miniconda/lib/python3.7/site-packages/niworkflows/interfaces/fixes.py”, line 48, in _run_interface
message="%s (niworkflows v%s)" % (self.class.name, version),
File “/usr/local/miniconda/lib/python3.7/site-packages/niworkflows/interfaces/utils.py”, line 239, in _copyxform
newimg.to_filename(out_image)
File “/usr/local/miniconda/lib/python3.7/site-packages/nibabel/filebasedimages.py”, line 333, in to_filename
self.to_file_map()
File “/usr/local/miniconda/lib/python3.7/site-packages/nibabel/analyze.py”, line 1007, in to_file_map
data = np.asanyarray(self.dataobj)
File “/usr/local/miniconda/lib/python3.7/site-packages/numpy/core/numeric.py”, line 553, in asanyarray
return array(a, dtype, copy=False, order=order, subok=True)
File “/usr/local/miniconda/lib/python3.7/site-packages/nibabel/arrayproxy.py”, line 391, in array
arr = self._get_scaled(dtype=dtype, slicer=())
File “/usr/local/miniconda/lib/python3.7/site-packages/nibabel/arrayproxy.py”, line 358, in _get_scaled
scaled = apply_read_scaling(self._get_unscaled(slicer=slicer), scl_slope, scl_inter)
File “/usr/local/miniconda/lib/python3.7/site-packages/nibabel/arrayproxy.py”, line 337, in _get_unscaled
mmap=self._mmap)
File “/usr/local/miniconda/lib/python3.7/site-packages/nibabel/volumeutils.py”, line 519, in array_from_file
infile.seek(offset)
File “indexed_gzip/indexed_gzip.pyx”, line 635, in indexed_gzip.indexed_gzip._IndexedGzipFile.seek
indexed_gzip.indexed_gzip.CrcError: CRC/size validation failed - the GZIP data might be corrupt

I wonder what the issue is here. Can anyone kindly tell me what was wrong please?
Thank you
Loris

Hi Loris!

Knowing some information might help us understand the problem better.

  1. Has the dataset been BIDS validated?
  2. What is your command for running fMRIprep? Are you using Singularity/Docker or a python installation? How much memory/CPU are you devoting to it?
  3. Is the problem only with this subject?

Thanks,
Steven

Hi Steven!

Thank you for your reply.

  1. The BIDS dataset has been fully validated. I uploaded it in a BIDS validator and apart from few warnings, there were no errors.
  2. Below is the command I used.
    fmriprep-docker E:\ERDeg\BIDS\loris_berlin_project E:\ERDeg\BIDS\loris_berlin_project\derivatives participant --fs-license-file E:\ERDeg\BIDS\loris_berlin_project\derivatives\license.txt --participant-label sub-3000 --nthreads 4 --fs-no-reconall --skip-bids-validation -w E:\ERDeg\BIDS\temp_file

I am using the Docker. I don not know how much memory/CPU I devoted to it since I could not change it from the Docker. When I go to settings —> resources, I can only see this:

It does not seem straightforward as I saw in the documentation

  1. The problem is only with this subject as it is the only one I tested preprocessing with so far

Loris

Hi Loris,

Good to know it’s fully validated! The command looks fine. Try running another subject and see if you get the same error first. A corrupt GZIP (as the error suggests) might be subject specific.

Best,
Steven

Hi Steven,

Sure. I will run it now and let you know tomorrow if I have issues.
Thank you
Loris

Hi Steven,

I managed to solve the problem. I do not know how, but when I reran it after removing the dummy scans and performing SDC correction it worked fine.

Two more things:

  1. I have noticed that in the output I have only functional images in MNI space. However, I would also have slice timed and realigned functional images (basically minimally preprocessed in native space) since I need to perform Rrepresentational Similarity analysis in native space. How can I output that?

  2. I also ran AROMA. Does AROMA apply smoothing to the data? MNI images appear very blurred.

Thank you very much
Loris

  1. Adding --output-spaces T1w to the fmriprep will align the bold image to the subject’s structural image. If you still have the working directory from when you first ran fmriprep then this should not take long to run.
  2. Yes, AROMA does apply smoothing (6mm FWHM kernel). Also note that the MNI space for AROMA (MNI152NLin6Asym) is different than the space for default fmriprep outputs that you likely already have (MNI152NLin2009cAsym).

Best,
Steven

Hi Steven,

Thank you so much. Could I also output both, i.e., MNI and T1w.? What shall I write in that case?
Thank you again

best wishes
Loris

You can include both T1w and MNI152NLin2009cAsym in that list (separated by a space).

1 Like

Hi Loris,

I’m struggling with a similar issue. I get a similar error that the GZIP data might be corrupt in line 635. Can you please tell me how you fixed it or what steps you took and didn’t see this error again?

Many thanks and looking forward to hearing from you.

Best,

Rubina

You can try reconverting your dicoms to niftis.

I did try reconverting DICOMs to Niftis several times but I still get the same erorr.

I used MRIcron. Is there another website you would recommend?

Dcm2niix or dcm2bids (both are built off of dcm2niix but dcm2bids also does bids naming and organization)

I used dcm2nii in Matlab with the BIDS output format but still get the same error.

I get crash errors in these files:

crash-20210826-135815-root-recon_report-b382d9b4-02e2-4ebf-8c16-1fef3e5f9522.txt (2.2 KB) crash-20210826-135851-root-mri_coreg-96822864-241a-4cc6-a9ae-668c24cf2e61.txt (4.2 KB) crash-20210826-135929-root-mri_coreg-b54ecc15-25cb-4dfc-9fc8-c2e19017ecc9.txt (4.2 KB) crash-20210826-140006-root-mri_coreg-7a227cd5-4f9c-46c2-9f7c-fa553b54867f.txt (4.2 KB)

I’ve been struggling with this error for days and don’t know what to do. Maybe there’s something I’m not seeing here.

dcm2nii in MATLAB might be deprecated, try the command line version of dcm2niix, it is still under activate development

Can you recommend other options please?

You can try GitHub - icometrix/dicom2nifti

I really appreciate your help, @Steven :slight_smile:

Hi again @Steven,

I followed your instructions and reconverted DICOMs to Niftis. However, I still get the same errors in the crash reports. I also tried the following:

  1. I used MRIcron and MRIcroGL (dcm2niix) to reconvert DICOMs to Niftis.
  2. I tried re-downloading 7-Zip Manager.
  3. I tried created a new directory.

However, all of the above failed.

In addition to these errors, I realised that the anatomical pre-processing is complete but functional pre-processing is incomplete.

I would be so grateful if you could provide me some guidance or suggestions on how I can resolve these errors.

Thank you in advance for your help.

Best wishes,

Rubina

Have you tried to visualize the files using FSLEYES, Freeview, Mango, etc? Does running fslinfo on the the files give you outputs that look correct? Perhaps the dicoms are just corrupt. In that case you can try to reacquire them from the scanner, or just forget the subject and move on.