maartenmennes/ICA-AROMA

Using SPM 12 input

hldot opened this issue · 6 comments

hldot commented

Hi,

I'm attempting to run AROMA on resting state data that was preprocessed in SPM 12 (slice time corrected, functional data realigned to the mean volume, coregistered to structural, within normalize affine regularisation to ICBM space template for European brains with voxel size 2x2x2, then smoothed with 6.0 kernel). I then converted all of my volumes into a 4D nifti using SPM.

As suggested in the manual, for the mask option, I created a mask with BET based off of the 4D nii. MELODIC runs, but I get the following error:

Step 2) Automatic classification of the components

  • registering the spatial maps to MNI
  • extracting the CSF & Edge fraction features
    Traceback (most recent call last):
    File "##/ICA-AROMA-master/ICA_AROMA.py", line 200, in
    edgeFract, csfFract = aromafunc.feature_spatial(fslDir, outDir, scriptDir, melIC_MNI)
    File "##/ICA-AROMA-master/ICA_AROMA_functions.py", line 389, in feature_spatial
    '-V | awk '{print $1}''])))
    ValueError: invalid literal for int() with base 10: 'Mask and image must be the same size'.

Do I need to alter the resting nii in some way to match the dimensions of the classification masks?

Thank you in advance,
Hailey

yes, the bounding box between SPM and FSL is different, so you'd need to adjust for that. Easiest is to bring your data to the MNI152 template included with FSL, then estimate and classify the components, next denoise your original data using fslregfilt (look in ICA_AROMA_functions.py for the specific commands).

That said, your preferred pipeline depends a bit on how you want to proceed afterwards, i.e., do your group-level analysis in SPM or FSL 'space'...

We might have an adjustment for this in the script in the future...

Hi @maartenmennes,

We are getting this problem only for some files with fmriprep (nipreps/fmriprep#870). Will setting an appropriate mask (with -m) ease the problem?

We work with files in MNI space, but grid resolution is the same as in the original file (generally lower resolution than the 2mm^3 of MNI).

Any lights on this would be very much appreciated.

cc @chrisfilo

The issue is related to the matrix size of the masks provided as part of aroma (mask_csf.nii.gz, mask_edge.nii.gz, mask_out.nii.gz). They are all 91x109x91, the equivalent of MNI152 space as used in FSL. So indeed, if you specify files that are in MNI space but that have a different grid size it will fail. Better is to provide it with native space files and also supply the transformations so AROMA can transform data to standard space (with the appropriate grid size).

This is a design choice we made in order to ensure proper standardization of the masks. We did investigate bringing the masks to native space, but this was more complicated and yielded less optimal results.

What we should do however, is to implement a couple of checks so that you get a proper error message when the grid sizes do not match.

Could you give me some pointers for me to patch in adequate masks? Would that allow ICA-AROMA to perform normally?.

Are mask_edge.nii.gz and mask_out.nii.gz distributed with ICA-AROMA?

Ok, second question was obvious. I just needed to look at the root of the repo.

This error just popped up for me. The problem is that I've run literally thousands of scans that have been preprocessed with SPM12 (and not in a 91x109x91 grid) through AROMA previously and never saw this error. I'm not doing anything differently in terms of how I'm calling things this time around, so I can't figure out how things ran previously but won't run now.

I've run it on 3mm data in a 52x62x45 grid, as well as 2.4mm data in a 67x80x65 grid. Currently I'm trying to run it on 2mm data in a 79x95x79 grid but it's failing. Since the other images were not 2mm isotropic, is there a resampling that is happening that also fixes the grid, but now that I'm using 2mm data it's not doing the resampling?

Edit: Actually, I quickly think I answered my own question based on this comment from the code: "If no warp is defined either, it only resamples the data to 2mm isotropic if needed (i.e. it assumes that the data has been registered to a MNI152 template)."
And then it proceeds to check if it's 2mm data. Maybe just adding the ability to force a resample even if the voxel sizes match or else adding a check on the bounding box as well as the voxel size.