Runtime error (invalid literal for int() with base 10: 'Mask and image must be the same size') during ICA-AROMA, fMRIprep 1.0.0-rc8


I am trying to run fMRIprep (v. 1.0.0-rc8) with ICA-AROMA and am getting the following error:

Node: fmriprep_wf.single_subject_105_wf.func_preproc_task_future_run_01_wf.bold_confounds_wf.ica_aroma_wf.ica_aroma
Working directory: /root/src/fmriprep/work/fmriprep_wf/single_subject_105_wf/func_preproc_task_future_run_01_wf/bold_confounds_wf/ica_aroma_wf/ica_aroma

Node inputs:

TR = <undefined>
args = <undefined>
compress_report = auto
denoise_type = nonaggr
dim = <undefined>
environ = {}
feat_dir = <undefined>
fnirt_warp_file = <undefined>
generate_report = True
ignore_exception = False
in_file = /root/src/fmriprep/work/fmriprep_wf/single_subject_105_wf/func_preproc_task_future_run_01_wf/bold_confounds_wf/ica_aroma_wf/smooth/vol0000_xform-00000_merged_smooth.nii.gz
mask = <undefined>
mat_file = <undefined>
melodic_dir = /root/src/fmriprep/work/fmriprep_wf/single_subject_105_wf/func_preproc_task_future_run_01_wf/bold_confounds_wf/ica_aroma_wf/melodic
motion_parameters = /root/src/fmriprep/work/fmriprep_wf/single_subject_105_wf/func_preproc_task_future_run_01_wf/bold_hmc_wf/normalize_motion/motion_params.txt
out_dir = <undefined>
out_report = ica_aroma_reportlet.svg
report_mask = /root/src/fmriprep/work/fmriprep_wf/single_subject_105_wf/func_preproc_task_future_run_01_wf/bold_mni_trans_wf/mask_mni_tfm/ref_image_corrected_trans_masked_corrected_brain_mask_maths_trans.nii.gz
terminal_output = <undefined>

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/plugins/", line 51, in run_node
    result['result'] =
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/", line 407, in run
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/", line 517, in _run_interface
    self._result = self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/", line 650, in _run_command
    result =
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/", line 1088, in run
    runtime = self._run_interface(runtime)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/common/", line 55, in _run_interface
    ReportCapableInterface, self)._run_interface(runtime)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/", line 1654, in _run_interface
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/", line 1600, in raise_exception
RuntimeError: Command: -den nonaggr -i /root/src/fmriprep/work/fmriprep_wf/single_subject_105_wf/func_preproc_task_future_run_01_wf/bold_confounds_wf/ica_aroma_wf/smooth/vol0000_xform-00000_merged_smooth.nii.gz -meldir /root/src/fmriprep/work/fmriprep_wf/single_subject_105_wf/func_preproc_task_future_run_01_wf/bold_confounds_wf/ica_aroma_wf/melodic -mc /root/src/fmriprep/work/fmriprep_wf/single_subject_105_wf/func_preproc_task_future_run_01_wf/bold_hmc_wf/normalize_motion/motion_params.txt -o /root/src/fmriprep/work/fmriprep_wf/single_subject_105_wf/func_preproc_task_future_run_01_wf/bold_confounds_wf/ica_aroma_wf/ica_aroma
Standard output:

------------------------------- RUNNING ICA-AROMA ------------------------------- 
--------------- 'ICA-based Automatic Removal Of Motion Artifacts' --------------- 

  - The existing/specified MELODIC directory will be used.
  - The MELODIC directory does not contain the required 'stats' folder. Mixture modeling on the Z-statistical maps will be run.
Step 2) Automatic classification of the components
  - registering the spatial maps to MNI
  - extracting the CSF & Edge fraction features
Standard error:
Traceback (most recent call last):
  File "/opt/ICA-AROMA/", line 200, in <module>
    edgeFract, csfFract = aromafunc.feature_spatial(fslDir, outDir, scriptDir, melIC_MNI)
  File "/opt/ICA-AROMA/", line 388, in feature_spatial
    '-V | awk \'{print $1}\''])))
ValueError: invalid literal for int() with base 10: 'Mask and image must be the same size'
Return code: 1

Any ideas what’s wrong? Please let me know if I can provide any additional information about the error, I just don’t know exactly what to check.


I’m assuming that the other post (FreeSurfer license file error in fMRIprep 1.0.0-rc10) was a result of trying to upgrade to see if that fixes the problem? If so, that would be my first suggestion, to make sure that this issue hasn’t been fixed.

I am still getting the same error in newer versions. I tried all the way up to 1.0.0-rc12. Any idea what I could look at to find out what’s going on?

Hi @kwiebels, you are right - looking at the inputs it seems I made a mistake when I refactored the confounds workflow. I’ve opened and try to have a look ASAP.

Volunteers, of course, are always welcome.

Thanks @oesteban. I would love to help, but unfortunately I don’t have the technical skills at all. Let me know if there is anything a little noob can do.

Thanks so much to you and the team for developing such great tools!


We are struggling to replicate this on our data. Could you try out this solution?

Hi @kwiebels, are you still interested in running your data through ICA-AROMA? If so, could you please give a try to poldracklab/fmriprep:1.0.12-dev0?



yes, I am. I’ll try that and will report back soon.

Thanks, @oesteban and @ChrisGorgolewski

Sorry for the late reply. We had some technical issues with our computing resources (unrelated). But it finally got resolved now and using poldracklab/fmriprep:1.0.12-dev0 worked perfectly!


The error message invalid literal for int() with base 10 would seem to indicate that you are passing a string that’s not an integer to the int() function . In other words it’s either empty, or has a character in it other than a digit. You can solve this error by using Python isdigit() method to check whether the value is number or not. The returns True if all the characters are digits, otherwise False .

if val.isdigit():

The other way to overcome this issue is to wrap your code inside a Python try…except block to handle this error.

Python2.x and Python3.x

Sometimes the difference between Python2.x and Python3.x that leads to this ValueError: invalid literal for int() with base 10 . With Python2.x , int(str(3/2)) gives you “1”. With Python3.x , the same gives you (“1.5”): ValueError: invalid literal for int() with base 10: “1.5”.