Open tsalo opened 3 years ago
Is it really necessary to implement the mixture modelling step? AFAIK, the spatial criteria only require to compute the percentage of the spatial variance in the ventricles or the edges of the brain. If mixture modelling is not required, then we can use the same ICA implementation as in TEDANA. Regardless, the point is whether we really want to substitute the Probabilitic ICA algorithm in MELODIC for the ICA decomposition because that would really alter the results.
I think that mixture modeling is necessary based on the blockers I came up against the last time I tried this conversion, but (1) I can't be sure I did the conversion correctly and (2) the official version of the code is, unfortunately, nearly unreadable. It should be easier for us to see if mixture modeling is necessary once we have thoroughly refactored the code.
Definitely. Once the code is refactored, it will be much easier to see what's missing and what our next steps should be.
I think the most important remaining FSL code is:
MELODIC
for ICA and mixture modeling.FLIRT
for applying linear transforms from native-space data to standard space.apply_warp
for applying warps from native space to standard space.fsl_regfilt
for denoising (see Brainhack-Donostia/ica-aroma-org#37).I think the rest of the remaining non-Python code could be replaced fairly easily.
I guess we could use nitransforms
to replace FLIRT
.
I guess we could use
nitransforms
to replaceFLIRT
.
I'm trying to see how we can do this.
I believe we have to do something like this for the affine:
xfm = nt.linear.Affine(afnixfm.to_ras(reference=new, moving=new), reference=new)
nt_with_afni = xfm.apply(new, order=0)
and I guess we can create the iso one ourselves and give it as input:
xfm = nt.linear.Affine(T)
moved = xfm.apply(new, order=0)
I will start a PR and work on this.
Do you know if nitransforms
can handle nonlinear transforms?
I think it can but I would have to look into that.
Now that we're planning to drop transforms (see Brainhack-Donostia/ica-aroma-org#45) for the immediate future, I think all we need to do now is figure out how to replace MELODIC's mixture modeling.
I think we can also leverage tedana
in replacing MELODIC. Something like the following:
tedana
's MAPCA function in tedana to get number of components and dimensionally-reduced data.tedana
's TEDICA function to get component time series and maps.tedana
's computefeats2()
to get component z-statistic maps. (We need the fixed version for this.)nipy
's GMM to threshold component maps.tedana
's plotting code to get the component power spectra.
The current version uses
fslmaths
for a number of steps that could very easily be done withnilearn
ornibabel
+numpy
.The only difficult part that I can think of is handling MELODIC's mixture modeling. We can either (1) assume the MELODIC data are in BIDS format already and work from there or (2) try to "implement" the mixture modeling method with a Python-based ICA algorithm.