Multiecho and -regress_ROI_PC

Hi folks,

I’ve noticed that when using the -regress_ROI_PC option with multiecho data that the principal components are extracted from the $fave_echo volreg dataset, rather than the combined or denoised data. I like that it is being extracted from the unsmoothed, volume registered data, but would it be better to extract the PCs from the combined/denoised data? It seems that this would better match the original implementation, that extracted the PCs from the data just prior to blurring and scaling. It is also likely that combining and denoising is altering the signal characteristics of these regions, as well. This would also bring it in line with the anaticor method, that extracts signals from the combined dataset. Perhaps I am overlooking something though - is there a particular reason the PCs are pulled from the volreg data in the multiecho case?

Thanks, as always, for the help

Thanks for the note on this, it is another aspect of the
ME processing that I simply have to gotten to yet, but will

If you notice any related steps, please let me know.
Thanks, and sorry for being slow on this!

  • rick

No worries at all, multiecho complicates things tremendously. I appreciate all the work thus far. I will add that I imagine this also applies to -regress_ROI, though I haven’t tested that.

Thanks again, and I’ll let you know if I notice anything else. It does appear that the multiecho pipeline is working quite well - data is looking quite good (though I do use the github me-ica tedana).

Does the github version of work with
I have not tried that yet.


  • rick

Yes, using -combine_tedana_path the github version works just fine. However, just using -combine_method tedana does not work. I receive the following error:

++ Computing T2* map
 + Writing file: s0v.nii ....done.
 + Writing file: t2sv.nii ....done.
 + Writing file: t2sF.nii ....done.
++ Doing ME-PCA and ME-ICA with MDP
-Computing PCA of optimally combined multi-echo data
Out shape is  (77, 92, 77, 445)
18.5351024208 92675.5121038
Out shape is  (77, 92, 77, 445)
Traceback (most recent call last):
  File "/home/dowdlelt/abin/meica.libs/", line 661, in <module>
    nc,dd = tedpca(options.ste)
  File "/home/dowdlelt/abin/meica.libs/", line 400, in tedpca
    none,ctb,betasv,v_T = fitmodels_direct(catd,v.T,eimum,t2s,tes,mmixN=vTmixN,full_sel=False)
  File "/home/dowdlelt/abin/meica.libs/", line 36, in fitmodels_direct
    if mmixN == None: mmixN=mmix
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
3dcopy tedana_r01/TED.r01/dn_ts_OC.nii pb05.testafnitedsub-8035ctbs_volm_dn_ted_anaticor_full.r01.combine
++ 3dcopy: AFNI version=AFNI_18.1.04 (Apr 12 2018) [64-bit]

you can see that everything up until the PCA portion works correctly, but then there is an issue with comparisons. I am wondering if this is related to the issue fixed here on the Meica Github version (and previously on bitbucket). It appears that perhaps nmixN == None: should be nmixN is None.

In any case, I know that development on ME-ICA has continued, albeit at a slightly slower pace recently. Perhaps there is a more stable version that could be brought over into AFNI?

Thanks, I think that is one of the issues when working
with newer versions of numpy.

Many of us here will be discussing which version of meica
to distribute with AFNI, if any. But we have not done so yet.

In any case, I will apply that patch locally, and try to test it
with a newer version of numpy.

Thanks again!

  • rick

Hey Rick, hit another speed bump, appears to be a similar issue with the AFNI tedana distribution. The previous patch worked, so now it broke a little further along.

Convergence after 249 steps

Convergence criterium:  1.47637380654e-06
Out shape is  (102, 102, 102, 445)
 + Writing file: .cc_temp.nii.gz ....done.
 + Writing file: __clin.nii.gz ....done.
Traceback (most recent call last):
  File "/home/dowdlelt/abin/meica.libs/", line 664, in <module>
    seldict,comptable,betas,mmix = fitmodels_direct(catd,mmix_orig,mask,t2s,tes,options.fout,reindex=True)
  File "/home/dowdlelt/abin/meica.libs/", line 175, in fitmodels_direct
    Br_clmaps_R2[:,i] = spatclust(rankvec(tsoc_Babs[:,i]),mask,csize,max(tsoc_Babs.shape)-countsigFR2,head,aff)
  File "/home/dowdlelt/abin/meica.libs/", line 92, in spatclust
    if data!=None and len(np.squeeze(data).shape)>1 and dindex+tindex==0: addopts="-doall"
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

If I compare again to the github version of located here, the corresponding line (98) in the spatclust function is

if data is not None and len(np.squeeze(data).shape)>1 and dindex+tindex==0: addopts="-doall"

Looks like another comparison issue that was corrected, ‘data !=’ vs ‘data is not’ I’ll do a quick test when I get a chance to let you know if that ‘solves’ the problem.

Okay, I have made a conda environment to do some testing
on this and will try to address whatever comes up. I had been
trying to stay away from the meica tree, as others are more
focused there. But dealing with numpy should be quick and
should match what others are doing.

Note that the ROI[_PC] functionality still has not been added,
nor has application with -import_mask. Time is hard to come by…

Thanks for all your effort on this!

  • rick