I am trying to apply the brain mask generated by fmriprep to the smoothed preprocessed output of ICA-AROMA. However, the following error is thrown
WARNING:: Inconsistent orientations for individual images in pipeline!
Will use voxel-based orientation which is probably incorrect - *PLEASE CHECK*!
Image Exception : #3 :: Attempted to multiply images of different sizes
terminate called after throwing an instance of 'std::runtime_error'
what(): Attempted to multiply images of different sizes
2_apply-mask.bash: line 22: 115991 Aborted fslmaths $file -mas $intMask $intOutput
When checking the file info (fslinfo) the following is this:
I had thought to resample using flirt but the centering still seems off, as it is more than just the voxel dimensions that differ. Has anyone encountered a solution for this?
Ah… no. I think the BOLD timeseries is resampled in the MNI152NLin2009cAsym space. So, I guess the mask is coming from a different MNI space. How could I align the two?
To know in which space the files are processed into, you need to look at the tag _space- in the file name.
Check if by any chance fmriprep did not already produced brain masks files in the MNI152NLin6Asym space. If not, I see two possibilities for you:
1/ Re-run fmriprep by adding MNI152NLin6Asym after --output-spaces to be sure that fmriprep produces all the processed output in that space.
2/ You may combine the two transform: sub-XX_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5 and sub-XX_from-T1w_to-MNI152NLin6Asym_mode-image_xfm.h5 (with antsApplyTransforms) to convert your brain mask file from MNI152NLin2009cAsym space to MNI152NLin6Asym (using NearestNeighboras interpolation method).
Ah okay. Thank you for the suggestions! I am trying them both in parallel (as fmriprep takes so long to run), but I am having issues with antsApplyTransforms. When I try to run ants I get the following error…
command: sudo ant
error:
Buildfile: build.xml does not exist!
Build failed
I have tried running from the specific directory and from root (as it was installed using sudo apt-get), but both throw this error. Have you encountered this issue?
I also reran on subject in fmriprep specifying the MNI152NLin6Asym as the --output-space. However, the files still seem to have different dimensions even though they are registered in the same space?
When I try to apply the mask to the preprocessed image I get this error:
WARNING:: Inconsistent orientations for individual images in pipeline!
Will use voxel-based orientation which is probably incorrect - *PLEASE CHECK*!
Image Exception : #3 :: Attempted to multiply images of different sizes
terminate called after throwing an instance of 'std::runtime_error'
what(): Attempted to multiply images of different sizes
2_apply-mask.bash: line 30: 193081 Aborted fslmaths $file -mas $intMask $intOutput
Thank you for those details. It looks like AROMA is producing outputs in space: MNI152NLin6Asym upsampled to 2mm resolution (see discussion here) while the command --output-spaces MNI152NLin6Asym produces outputs in native resolution (which looks like it is 3x3x3.3mm in your case).
Again, I see two choices:
1/ either you re-run again fmriprep ( if you re-use the working directory (option -w) not everything will be re-run again) with --output-spaces MNI152NLin6Asym:res-2 (more details on this option here)
2/ you can resample the bold mask in the 2mm resolution. Several possibilities:
using FSLeyes: load the two images, the mask and the smoothed aroma image, then highlight the mask image and click on: Tools > Resample image and on the top right select the smoothed aroma image, choosing “nearest neighbor” for interpolation: voilà!