maartenmennes / ICA-AROMA

ICA-AROMA Software Package: a data-driven method to identify and remove head motion-related artefacts from functional MRI data.
Apache License 2.0
91 stars 53 forks source link

Error running ICA-AROMA #51

Open StephDocTUM opened 3 years ago

StephDocTUM commented 3 years ago

Dear all,

I ran ICA-AROMA for several subjects and everything worked well. For some subjects I encounter the following error, although they are very similar to the ones where ICA-AROMA works fine:

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

Step 1) MELODIC libc++abi.dylib: terminating with uncaught exception of type std::logic_error: subtraction: incompatible matrix dimensions: 0x0 and 1x0 Traceback (most recent call last): File "/Users/neurolab/Desktop/Stephan/Programmes/ICA-AROMA-master/ICA_AROMA.py", line 204, in aromafunc.runICA(fslDir, inFile, outDir, melDir, mask, dim, TR) File "/Users/neurolab/Desktop/Stephan/Programmes/ICA-AROMA-master/ICA_AROMA_functions.py", line 94, in runICA nrICs = int(float(subprocess.getoutput(cmd))) ValueError: could not convert string to float: Image Exception : #63 :: No image files match: /Users/neurolab/Desktop/Drmed/CART_Code_rearranged_concat_prep/derivatives/participant/fmriprep/sub-10/ses-5/func/ICA_AROMA/melodic.ica/melodic_IC No ima

I couldn't find out why this is happening,

Best,

maartenmennes commented 3 years ago

Hi Stephan, it looks that for these subject the melodic run failed? Perhaps it ran out of memory and you did not notice.

StephDocTUM commented 3 years ago

Thanks a lot for your reply.

That error looks different:

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

Step 1) MELODIC Step 2) Automatic classification of the components

maartenmennes commented 3 years ago

yes: "Found 20 head motion-related components in a total of 20 components."

i.e., all of your components are marked to be removed from the data, nothing would be left... Something is likely off, either in your data itself (e.g., a severe artifact) or in the analysis path (e.g., registration failed so your brain data is not on the standard brain)

StephDocTUM commented 3 years ago

or because I set the criteria to -dim 20?

maartenmennes commented 3 years ago

potentially, but unlikely. A good indication could be to see how many components melodic returns if you don't set the dimensionality to 20. Is there a particular reason why you did this? We typically recommend to not set the dimensionality for denoising purposes (unless you have a huge number of volumes e.g., in the case of multiband data).

StephDocTUM commented 3 years ago

without the command it works:

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

Step 1) MELODIC Step 2) Automatic classification of the components

----------------------------------- Finished -----------------------------------

StephDocTUM commented 3 years ago

But I am still having the error from above: runs for about 5 seconds and then brings up this error (available memory 64GB and same command runs fine for other subjects)

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

Step 1) MELODIC libc++abi.dylib: terminating with uncaught exception of type std::logic_error: subtraction: incompatible matrix dimensions: 0x0 and 1x0 Traceback (most recent call last): File "/Users/neurolab/Desktop/Stephan/Programmes/ICA-AROMA-master/ICA_AROMA.py", line 204, in aromafunc.runICA(fslDir, inFile, outDir, melDir, mask, dim, TR) File "/Users/neurolab/Desktop/Stephan/Programmes/ICA-AROMA-master/ICA_AROMA_functions.py", line 94, in runICA nrICs = int(float(subprocess.getoutput(cmd))) ValueError: could not convert string to float: Image Exception : #63 :: No image files match: /Users/neurolab/Desktop/Drmed/CART_Code_rearranged_concat_prep/derivatives/participant/fmriprep/sub-1/ses-1/func/ICA_AROMA_auto/melodic.ica/melodic_IC No

and it is not a memory error.

maartenmennes commented 3 years ago

This error is related to FSL's melodic and not ICA-AROMA. I suspect something is off with your input data or the mask that is being calculated. Have you looked at the raw data? Have you tried running melodic directly on those data?

StephDocTUM commented 3 years ago

The input data looks fine. And running directly with melodic works.

maartenmennes commented 3 years ago

Do the components look sensible? You can now also try to run AROMA where you provide the melodic directory you just created. If you run melodic as part of FEAT, AROMA will detect the .ica directory and not rerun melodic.

StephDocTUM commented 3 years ago

How would I provide the output directory to AROMA?

for ((i = 1; i < 2; i++));for ((ses = 1; ses < 8; ses++)); python2.7 /Users/neurolab/Desktop/Stephan/Programmes/ICA-AROMA-master/ICA_AROMA.py -in /Users/neurolab/Desktop/Drmed/CART_Code_rearranged_concat_prep/derivatives/participant/fmriprep/sub-${i}/ses-${ses}/func/sub-${i}_ses-${ses}_task-rest_run-3_space-MNI152NLin2009cAsym_desc-preproc_bold_skipped_5_smoothed_6.nii.gz -out /Users/neurolab/Desktop/Drmed/CART_Code_rearranged_concat_prep/derivatives/participant/fmriprep/sub-${i}/ses-${ses}/func/sub-1_ses-1_task-rest_run-3_space-MNI152NLin2009cAsym_desc-preproc_bold_skipped_5_smoothed_6.ica -mc /Users/neurolab/Desktop/Drmed/CART_Code_rearranged_concat_prep/sub-${i}/ses-${ses}/func/sub-${i}_ses-${ses}_task-rest_run-3_bold_mcf.par

sub-1_ses-1_task-rest_run-3_space-MNI152NLin2009cAsym_desc-preproc_bold_skipped_5_smoothed_6.ica is the created output directory.

maartenmennes commented 3 years ago

use the -md option. The -out option is for the directory where you want AROMA to save its results...

python2.7 /Users/neurolab/Desktop/Stephan/Programmes/ICA-AROMA-master/ICA_AROMA.py --help

gives your more info...

StephDocTUM commented 3 years ago

ah, great. Could not find that command in the manual. Coming back to my post above: ...Found 49 head motion-related components in a total of 51 components.. means only 2 components are left in the end? Isn't that too little? I was putting dim to 20 because, I had the feeling ICA-AROMA is denoting out too many components. In the end my correlation for my bold signal seemed to be very high.

What would be your thoughts on that?

StephDocTUM commented 3 years ago

running ICA-AROMA after melodic gives the following error:

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

Step 1) MELODIC

maartenmennes commented 3 years ago

something is off either with your registration parameters or with the mixture modelling thresholding. Did you run melodic with the --Oalll and the --Ostats option?

StephDocTUM commented 3 years ago

Yes, I tried that as well. The registration looks fine of the functional bold image.

maartenmennes commented 3 years ago

based on this: "The MELODIC directory does not contain the required 'stats' folder. Mixture modeling on the Z-statistical maps will be run." it looks like you're not providing the melodic run with the --Oall or the --Ostats option?

StephDocTUM commented 3 years ago

With that option it changed to:

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

Step 1) MELODIC

maartenmennes commented 3 years ago

is there a way for you to send me a copy of this data? Preferably the preprocessed data with everything tarred up into a single archive.

StephDocTUM commented 3 years ago

I could post screenshots if that would help?

maartenmennes commented 3 years ago

no, I would want to take a look and run a couple of things myself. If you can host on dropbox or something alike - password protected. Shoot me an email on m dot mennes at donders dot ru dot nl

StephDocTUM commented 3 years ago

did u receive it? It works now. I masked the input data for ICA-AROMA. But one question: ICA-AROMA often finds 90% of the ICs as head motion and regresses them out. (e.g. 18 out of 20). Aren't there too little ICs left in the of m bold signal?