Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ICA-AROMA - Mask and image must be the same size #870

Closed
oesteban opened this issue Dec 3, 2017 · 7 comments · Fixed by #1064
Closed

[BUG] ICA-AROMA - Mask and image must be the same size #870

oesteban opened this issue Dec 3, 2017 · 7 comments · Fixed by #1064

Comments

@oesteban
Copy link
Member

oesteban commented Dec 3, 2017

From https://neurostars.org/t/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/985?u=oesteban

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/multiproc.py", line 51, in run_node
    result['result'] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py", line 407, in run
    self._run_interface()
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py", line 517, in _run_interface
    self._result = self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/pipeline/engine/nodes.py", line 650, in _run_command
    result = self._interface.run()
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base.py", line 1088, in run
    runtime = self._run_interface(runtime)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/common/report.py", line 55, in _run_interface
    ReportCapableInterface, self)._run_interface(runtime)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base.py", line 1654, in _run_interface
    self.raise_exception(runtime)
  File "/usr/local/miniconda/lib/python3.6/site-packages/niworkflows/nipype/interfaces/base.py", line 1600, in raise_exception
    **runtime.dictcopy()))
RuntimeError: Command:
ICA_AROMA.py -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' --------------- 

Step 1) MELODIC
  - 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/ICA_AROMA.py", line 200, in <module>
    edgeFract, csfFract = aromafunc.feature_spatial(fslDir, outDir, scriptDir, melIC_MNI)
  File "/opt/ICA-AROMA/ICA_AROMA_functions.py", 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
@oesteban oesteban added the bug label Dec 3, 2017
@oesteban oesteban added this to the 1.1.0 milestone Dec 3, 2017
@oesteban oesteban changed the title [BUG] ICA-AROMA is connected wrongly [BUG] ICA-AROMA - Mask and image must be the same size Feb 9, 2018
@chrisgorgo
Copy link
Contributor

After reading maartenmennes/ICA-AROMA#16 I'm surprised this is not happening more often. @jdkent have you run into this before?

Potential solution would be to reslice the ICA components to desired resolution/bounding box prior to passing them to AROMA.

@jdkent
Copy link
Collaborator

jdkent commented Feb 9, 2018

I haven't ran into this problem yet, but after reading the issue I'm surprised I haven't.

@oesteban oesteban modified the milestones: 1.1.0, Future Feb 13, 2018
@oesteban
Copy link
Member Author

I push this forward until we get further info from maartenmennes/ICA-AROMA#16 (pinging @maartenmennes) or we find out the proper mask ourselves.

@maartenmennes
Copy link

This is not happening more often as typically people stay in native space and provide the transformations to AROMA. That way AROMA can put the melodic_IC file into the FSL supplied - read grid size - MNI152 2mm space which is 91x109x91 in size.

as indicated in maartenmennes/ICA-AROMA/issues/16 it was a deliberate choice to bring the components to standard space, rather than bringing the masks to native space. So yes, in this case grid size is unfortunately something to keep in mind... We should implement some proper checking and error messaging in AROMA though.

@chrisgorgo
Copy link
Contributor

chrisgorgo commented Feb 14, 2018 via email

@chrisgorgo
Copy link
Contributor

@chrisgorgo
Copy link
Contributor

In the above case AROMA works only if the --template-resampling-grid 2mm argument is not specified.

oesteban added a commit to oesteban/fmriprep that referenced this issue Apr 20, 2018
This PR is an attempt to finally close nipreps#870, by ensuring that ICA-AROMA is run in the MNI152Lin space.

To do so, the corresponding workflow has been modified, including an internal BOLD resampling workflow. When the user specifies ``MNI152Lin`` as template space, this workflow will be duplicated. One possible optimization to consider in the future is identifying that situation, and avoid the outer resampling when AROMA is selected. However, for a first take I assumed this duplication is not too costly.

Other improvements included with this PR are:

  * [x] Update ICA-AROMA to the latest 0.4.4 release.
  * [x] Remove the check of ``--use-aroma`` and template.
  * [x] Update documentation accordingly.
  * [x] Update naming of non-aggresively denoised images to the new space
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants