nipreps / fmriprep

fMRIPrep is a robust and easy-to-use pipeline for preprocessing of diverse fMRI data. The transparent workflow dispenses of manual intervention, thereby ensuring the reproducibility of the results.
https://fmriprep.org
Apache License 2.0
637 stars 295 forks source link

fmriprep - ‘NiftiException’ what(): Error: cant open file #1774

Open sameera2004 opened 5 years ago

sameera2004 commented 5 years ago

Hi, I recently started to use fmriprep to prep-process our fmri data.

I am getting an error when I tried to process multi-echo data. I haven’t seen this error when I process single echo data. Following you can find the fmriprep command I used and the error,

Fmriprep command: fmriprep /gpfs/projects/fmriprep/test /gpfs/projects/fmriprep/test_outputs -w /gpfs/projects/fmriprep/test_outputs/derivatives/scratch --t2s-coreg --write-graph --cifti-output participant --participant-label sub-13023

Error,

Node Name: fmriprep_wf.single_subject_13023_wf.func_preproc_ses_1_task_Insight2_run_01_echo_1_wf.bold_bold_trans_wf.bold_reference_wf.enhance_and_skullstrip_bold_wf.pre_mask_dilate

File: /gpfs/projects/fmriprep/test_outputs/fmriprep/sub-13023/log/20190908-104336_c8903beb-1cfc-4488-a74d-4b7fabe30bd2/crash-20190908-110915-sabeykoon-pre_mask_dilate.a0-158e7553-4307-47a0-a8bf-0ec3002d6c45.txt
Working Directory: /gpfs/projects/fmriprep/test_outputs/derivatives/scratch/fmriprep_wf/single_subject_13023_wf/func_preproc_ses_1_task_Insight2_run_01_echo_1_wf/bold_bold_trans_wf/bold_reference_wf/enhance_and_skullstrip_bold_wf/_bold_file_..gpfs..projects..fmriprep..test..sub-13023..ses-1..func..sub-13023_ses-1_task-Insight2_run-01_echo-1_bold.nii.gz/pre_mask_dilate
Inputs:

args: ``
environ: {'FSLOUTPUTTYPE': 'NIFTI_GZ'}
in_file: /gpfs/projects/fmriprep/test_outputs/derivatives/scratch/fmriprep_wf/single_subject_13023_wf/func_preproc_ses_1_task_Insight2_run_01_echo_1_wf/bold_bold_trans_wf/bold_reference_wf/enhance_and_skullstrip_bold_wf/_bold_file_..gpfs..projects..fmriprep..test..sub-13023..ses-1..func..sub-13023_ses-1_task-Insight2_run-01_echo-1_bold.nii.gz/map_brainmask/tpl-MNI152NLin2009cAsym_space-MNI_res-02_brainmask_trans.nii.gz
internal_datatype: char
kernel_file: ``
kernel_shape: sphere
kernel_size: 3.0
nan2zeros: ``
operation: max
out_file: ``
output_datatype: ``
output_type: NIFTI_GZ
Traceback (most recent call last): File “/gpfs/software/Anaconda3/envs/fmriprep1.2.5/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py”, line 69, in run_node result[‘result’] = node.run(updatehash=updatehash) File “/gpfs/software/Anaconda3/envs/fmriprep1.2.5/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 473, in run result = self._run_interface(execute=True) File “/gpfs/software/Anaconda3/envs/fmriprep1.2.5/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 557, in _run_interface return self._run_command(execute) File “/gpfs/software/Anaconda3/envs/fmriprep1.2.5/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 637, in _run_command result = self._interface.run(cwd=outdir) File “/gpfs/software/Anaconda3/envs/fmriprep1.2.5/lib/python3.6/site-packages/nipype/interfaces/base/core.py”, line 369, in run runtime = self._run_interface(runtime) File “/gpfs/software/Anaconda3/envs/fmriprep1.2.5/lib/python3.6/site-packages/nipype/interfaces/base/core.py”, line 752, in _run_interface self.raise_exception(runtime) File “/gpfs/software/Anaconda3/envs/fmriprep1.2.5/lib/python3.6/site-packages/nipype/interfaces/base/core.py”, line 689, in raise_exception ).format(**runtime.dictcopy())) RuntimeError: Command: fslmaths -dt char /gpfs/projects/fmriprep/test_outputs/derivatives/scratch/fmriprep_wf/single_subject_13023_wf/func_preproc_ses_1_task_Insight2_run_01_echo_1_wf/bold_bold_trans_wf/bold_reference_wf/enhance_and_skullstrip_bold_wf/bold_file…gpfs…projects…fmriprep…test…sub-13023…ses-1…func…sub-13023_ses-1_task-Insight2_run-01_echo-1_bold.nii.gz/map_brainmask/tpl-MNI152NLin2009cAsym_space-MNI_res-02_brainmask_trans.nii.gz -kernel sphere 3.0000 -dilF /gpfs/projects/fmriprep/test_outputs/derivatives/scratch/fmriprep_wf/single_subject_13023_wf/func_preproc_ses_1_task_Insight2_run_01_echo_1_wf/bold_bold_trans_wf/bold_reference_wf/enhance_and_skullstrip_bold_wf/bold_file…gpfs…projects…fmriprep…test…sub-13023…ses-1…func…sub-13023_ses-1_task-Insight2_run-01_echo-1_bold.nii.gz/pre_mask_dilate/tpl-MNI152NLin2009cAsym_space-MNI_res-02_brainmask_trans_dil.nii.gz Standard output: Standard error: terminate called after throwing an instance of ‘NiftiException’ what(): Error: cant open file /gpfs/projects/fmriprep/test_outputs/derivatives/scratch/fmriprep_wf/single_subject_13023_wf/func_preproc_ses_1_task_Insight2_run_01_echo_1_wf/bold_bold_trans_wf/bold_reference_wf/enhance_and_skullstrip_bold_wf/bold_file…gpfs…projects…fmriprep…test…sub-13023…ses-1…func…sub-13023_ses-1_task-Insight2_run-01_echo-1_bold.gz/pre_mask_dilate/tpl-MNI152NLin2009cAsym_space-MNI_res-02_brainmask_trans_dil.nii.gz Return code: -6

Does anyone seen this error before? Can you help me to fix this issue.

sameera2004 commented 5 years ago

sub-13023.html.txt Here is the html file created from fmriprep. (I saved it again as .txt file to attached here)

effigies commented 5 years ago

This looks likely to be a filesystem synchronization issue, where files are written but for some reason attempting to read them fails for a short period. Would try re-running and seeing if the problem resolves itself.

sameera2004 commented 5 years ago

Thanks @effigies for your advice. Rerun gave the same error report. Now I am rerunning it one more time after deleting all the previous outputs. I will let you know the outcome.

sameera2004 commented 5 years ago

Hi @effigies, Rerun produced the same error. The issue is, I am only getting this error when with multi-echo data processing. I downloaded small multi echo data set from https://openneuro.org and tried to process it for an example and I got the same error.

Following you can find the command I am using, (Am I doing something wrong?) fmriprep test_data test_outputs -w test_outputs/derivatives/scratch --t2s-coreg --write-graph --cifti-output participant --participant-label sub-13023

oesteban commented 5 years ago

How are you running fMRIPrep?

sameera2004 commented 5 years ago

Hi @oesteban , I am using our university cluster to run fMRIprep. I requested them to install fMRIprep for our group. They manually installed the libraries and prepared the environment.

oesteban commented 5 years ago

I see. The fastest way to work around installation issues is using containers. Do you know whether your cluster has Singularity installed or the admins will be willing to install it?

oesteban commented 5 years ago

(BTW, FSL 6 will not work for sure - if you want to keep trying the manually prepared environment then you'll need FSL 5)

sameera2004 commented 5 years ago

@oesteban Thank you for all the comments, I will request them to install it. Not sure whether they will install it. Right now I am the only one using fMRIprep. It took sometime for the manual installation and testing. Then, I was able to successfully pre process few single-echo fMRI datasets using fMRIprep. We still need to check the quality assurance of those outputs. Now I need to process some multi-echo data. Once pipeline is running and working other members of our group want to use fMRIprep to pre process single-echo and multi-echo data. We have lot of data sets.

oesteban commented 5 years ago

Sure, do not hesitate to redirect your cluster admins to us in case they have any doubts but installing Singularity is generally pretty effective as regards installation problems.

TheChymera commented 1 year ago

Well, this is pretty clearly an fsl issue and not an fmriprep issue — though fsl issue tracking is more difficult so I'll be expanding on this here.

I think the more likely culprit is the file itself rather than the FSL installation. If the latter would be broken you'd expect something like a segfault...

In any case, some FSL commands operate on files in-place and will end up throwing the error mentioned here if permissions are lacking, e.g.:

[neuro]/tmp ❱ wget http://repo.mouseimaging.ca/repo/DSURQE_40micron_nifti/DSURQE_40micron_average.nii
--2023-06-06 03:47:09--  http://repo.mouseimaging.ca/repo/DSURQE_40micron_nifti/DSURQE_40micron_average.nii
Resolving repo.mouseimaging.ca... 192.75.158.41
Connecting to repo.mouseimaging.ca|192.75.158.41|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 145149832 (138M)
Saving to: ‘DSURQE_40micron_average.nii’

DSURQE_40micron_average.nii                                            100%[===========================================================================================================================================================================>] 138.42M   510KB/s    in 4m 19s  0

2023-06-06 03:51:28 (548 KB/s) - ‘DSURQE_40micron_average.nii’ saved [145149832/145149832]
0
[neuro]/tmp ❱ cp ~/src/mouse-brain-templates_generator/resources/DSURQE_40micron_average.nii datalad_DSURQE_40micron_average.nii
[neuro]/tmp ❱ md5sum datalad_DSURQE_40micron_average.nii
c6786abc10de99be504f0f961057e7db  datalad_DSURQE_40micron_average.nii
[neuro]/tmp ❱ md5sum DSURQE_40micron_average.nii
c6786abc10de99be504f0f961057e7db  datalad_DSURQE_40micron_average.nii
[neuro]/tmp ❱ ls -lah
total 693M
drwxrwxrwt  9 root    root     12K Jun  6 03:54 .
drwxr-xr-x 21 root    root    4.0K Apr 29  2021 ..
-r--r--r--  1 chymera chymera 139M Jun  6 03:54 datalad_DSURQE_40micron_average.nii
-rw-r--r--  1 chymera chymera 139M Aug 28  2017 DSURQE_40micron_average.nii
[neuro]/tmp ❱ fslorient -setsform 0.04 0 0 -6.27 0 0.04 0 -10.6 0 0 0.04 -7.88 0 0 0 1 DSURQE_40micron_average.nii
[neuro]/tmp ❱ fslorient -setsform 0.04 0 0 -6.27 0 0.04 0 -10.6 0 0 0.04 -7.88 0 0 0 1 datalad_DSURQE_40micron_average.nii
terminate called after throwing an instance of 'NiftiIO::NiftiException'
  what():  Error: cant open file try2_DSURQE_40micron_average.nii
Aborted