N4BiasFieldCorrection Error

202 views
Skip to first unread message

Melvin Selim Atay

unread,
Apr 18, 2022, 2:46:16 PM4/18/22
to Clinica
I am using clinica version 0.5.5 in miniconda environment,
when I ran the clinica run t1-linear pipeline on ADNI bids folder,
Below is the relevant part of the crash report:

"File "/truba/home/meatay/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/traits/base_trait_handler.py", line 75, in error
object, name, self.full_info(object, name, value), value
traits.trait_errors.TraitError: The 'bias_image' trait of a N4BiasFieldCorrectionOutputSpec instance must be a pathlike object or string representing an existing file, but a value of '/tmp/tmpi20eej5o/t1-linear/0ea45a1f7fc21983dd3ac274b9c70e8580e28d67/n4biascorrection/sub-ADNI002S0413_ses-M162_T1w_bias.nii.gz' <class 'str'> was specified.
Traceback (most recent call last):
File "/truba/home/meatay/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 401, in run
outputs = self.aggregate_outputs(runtime)
File "/truba/home/meatay/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 461, in aggregate_outputs
raise FileNotFoundError(msg)
FileNotFoundError: No such file or directory '/tmp/tmpi20eej5o/t1-linear/0ea45a1f7fc21983dd3ac274b9c70e8580e28d67/n4biascorrection/sub-ADNI002S0413_ses-M162_T1w_bias.nii.gz' for output 'bias_image' of a N4BiasFieldCorrection interface"
From my understanding it is not able to find the bias template for some reason, is it an issue with ANTs compilation or clinica setup, any help is much appreciated. Thanks in advance.

Omar Rifai

unread,
Apr 20, 2022, 5:42:59 AM4/20/22
to Clinica
Hi Melvin,

Indeed, the ants command did not run successfully.
Can you please check if you are able to run the command from your terminal without passing by Clinica. For instance, you should be able to run the following command in your environment:

N4BiasFieldCorrection -i <input-niifti> -o <output-niifti>

Also, you should make sure that the paths to your BIDS directory does not contain any "space" characters.

Regards

Melvin Selim Atay

unread,
Apr 2, 2023, 3:57:09 AM4/2/23
to Clinica

Late answer: Thanks Omar, N4BiasFieldCorrection has been working perfectly but found that this early error is because of using a tmp space on a HPC which was cleared immediately and fixed it by saving result directory into different direction.

My current problem is that pipeline ran correctly but couldn't form the n4biascorrection.pklz file and gives the error.
Here is the error log.
 sub-ADNI941S6998 | ses-M00,^[[0m
^[[32m2023-03-31 11:49:38,224:INFO:The pipeline will last approximately 6 minutes per image.^[[0m
exception calling callback for <Future at 0x14b407f966d0 state=finished raised FileNotFoundError>
concurrent.futures.process._RemoteTraceback:

"""
Traceback (most recent call last):
  File "/truba/home/meatay/miniconda3/envs/clinicaEnv/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/truba/home/meatay/miniconda3/envs/clinicaEnv/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 524, in run
    result = self._run_interface(execute=True)
  File "/truba/home/meatay/miniconda3/envs/clinicaEnv/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 642, in _run_interface
    return self._run_command(execute)
  File "/truba/home/meatay/miniconda3/envs/clinicaEnv/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 742, in _run_command
    _save_resultfile(
  File "/truba/home/meatay/miniconda3/envs/clinicaEnv/lib/python3.8/site-packages/nipype/pipeline/engine/utils.py", line 245, in save_resultfile
    savepkl(resultsfile, result)
  File "/truba/home/meatay/miniconda3/envs/clinicaEnv/lib/python3.8/site-packages/nipype/utils/filemanip.py", line 720, in savepkl
    pkl_file.write(content)
  File "/truba/home/meatay/miniconda3/envs/clinicaEnv/lib/python3.8/gzip.py", line 335, in close
    myfileobj.close()
OSError: [Errno 5] Input/output error

During handling of the above exception, another exception occurred:


Traceback (most recent call last):
  File "/truba/home/meatay/miniconda3/envs/clinicaEnv/lib/python3.8/concurrent/futures/process.py", line 239, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
  File "/truba/home/meatay/miniconda3/envs/clinicaEnv/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 70, in run_node
    result["result"] = node.result
  File "/truba/home/meatay/miniconda3/envs/clinicaEnv/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 223, in result
    return _load_resultfile(
  File "/truba/home/meatay/miniconda3/envs/clinicaEnv/lib/python3.8/site-packages/nipype/pipeline/engine/utils.py", line 291, in load_resultfile
    raise FileNotFoundError(results_file)
FileNotFoundError: /truba_scratch/meatay/263257/tmp1eevv8tb/t1-linear/56ce09f543d8bee1a3314383ad290bbc216b6e31/n4biascorrection/result_n4biascorrection.pklz
"""

Melvin Selim Atay

unread,
Apr 2, 2023, 4:04:41 AM4/2/23
to Clinica
My setup is also changed since the first question, clinica version is now  0.7.2

Melvin Selim Atay

unread,
Apr 5, 2023, 4:24:36 AM4/5/23
to Clinica
Hi,
Sorry for posting repeatedly, just wanted to inform you that due to a little error I did while  defining the path of the working directory for the job clinica t1-linear, I got the error above, now fixed it and successfully ran the clinica t1-linear pipeline on ADNI MRI.
Kind regards and thank you.

Omar Rifai

unread,
Apr 5, 2023, 6:34:16 AM4/5/23
to Clinica
Hello Melvin,

Thanks for the update. Don't hesitate if you have further issues.

Regards,
Omar
Reply all
Reply to author
Forward
0 new messages