Melodic ICA error with CIFTI input

Summary of what happened:

Hi experts, happy new year!
I want to run melodic ICA with CIFTI files. However, an error happened at the beginning of this analysis. The filename added the extension ‘.nii’ automatically, which means the filename became ‘xx.gii.nii’. As a result, the CIFTI data can’t be read. Did I use a wrong command? Or the input filetype should not be ‘.gii’?
Thank you very much!!! :slight_smile:

Command used:

melodic -i input_files.txt -o groupICA15 --tr=0.72 --CIFTI --nobet --nomask -a concat --report --Oall -d 15

Version:

fsl 6.0.7.6

input_files.txt:

/fMRI_Surface_32k/413934_413934_1_BOLD_1_Atlas.cWGSR.BandPass_Scrubbing.sm6.L.func.gii
/fMRI_Surface_32k/414229_414229_1_BOLD_1_Atlas.cWGSR.BandPass_Scrubbing.sm6.L.func.gii
/fMRI_Surface_32k/424939_424939_1_BOLD_1_Atlas.cWGSR.BandPass_Scrubbing.sm6.L.func.gii
……

error:

error opening file '/fMRI_Surface_32k/424939_424939_1_BOLD_1_Atlas.cWGSR.BandPass_Scrubbing.sm6.L.func.gii.nii'

Hi @Shulk,

I don’t think FSL can work with ciftis/giftis. You would probably be better off doing this in volumetric space and then projecting to the surface.

Best,
Steven

It seems you are right!
Thank you! :slight_smile:

Cross-posted to the FSL mailing list. melodic can work with CIfTI time series (.dtseries.nii), but it looks like the problem here is that the input files are GIfTI files (.func.gii).

1 Like

Thanks for your reply!!! :slight_smile:
Yes, you are right!
I 've been told that the input file type should be .dtseries.nii. Then I converted my GIFTI files to CIFTI through wb_command, which combines the left and right hemisphere. However, another error happened and the process stopped after MIGP.

error:

error: sort (): given object has non-finite elements

terminate called after throwing an instance of 'std::logic_error'
  what () :    sort () :  given object has non-finite elements
melodic.sh: line 1: 52199 Aborted
(core dumped) melodic -i input_files.txt -o groupICA15 --CIFTI --nobet --nomask -a concat --report --Oall -d 15

the log ended at:

  ......
  Removing mean image ... done
  Removing mean image ... done
  Reducing data matrix to a  2399 dimensional subspace 
  Removing mean image ... done
  Removing mean image ... done
  Reducing data matrix to a  2399 dimensional subspace 
  Normalising by voxel-wise variance ... done

  Data size : 2399 x 64984

the command to convert GIFTI to CIFTI:

    output_file="${output_dir}/${base_name}.dtseries.nii"
    wb_command -cifti-create-dense-timeseries "$output_file" \
        -left-metric "$left_file" \
        -right-metric "$right_file"

Any hint or advice would be deeply appreciated!!!

Hello, everyone! :slight_smile:
I’ve just solved the problem above. The error happened because the vertex values of some time points are all NaN or 0, which came from interpolation during scrubbing. After deleting these time points,the process of ICA worked correctly.
However, there is still one more issue left. The output file type of CIFTI ICA is still .nii, not .dscalar.nii. How should I change the output file type?
Thank you very much!!!

error:

Hi @Shulk, it appears that the --report option cannot be used when you are processing CIfTI files (JISCMail - FSL Archives). And melodic is also badly behaved in that it saves the outputs as .nii rather than (e.g.) .dscalar.nii, so you may need to rename the output files before they can be opened with Connectome workbench viewer.

I’m afraid that support for CIfTI files in FSL is very limited, so you are probably better off using workbench or the HCP pipeline scripts wherever possible.

Renaming the file manually did solve this problem.
Thanks!