SPM stats table in Nipype


Does anyone know how to get an SPM type stats table as an output when running a second level analysis via nipype? The output of the Threshold node provides the images but I am unclear as to how to get the associated pvalues?



Ahoi hoi @rob,

AFAIK nipype does not support this functionality as it’s a rather visual/interactive
thingy in SPM and a respective function would have to implemented.

There are several things (IMO) that you could try:

  1. Use the SPM.mat that you get from the nipype node within the SPM standalone version (also available as a BIDS App) --> maybe not so cool and reproducible

  2. Use nibabel or nilearn to extract the values through some lines of code --> maybe not super straightforward in doing what you want

  3. Use nistats for your analyses and use it’s amazing report function (see it in action here & here) --> get’s you what you want (table with values) easily and reproducible

  4. Use atlasreader to extract information --> cool and reproducible, maybe not exactly what you want

HTH, cheers, Peer

Thanks that is very helpful.

The one thing that I am after is the ‘cluster level statistics’ that spm provides (I’m aware of the Eklund paper and the potential pitfalls with this inference, but it is often requested)but I can’t seem to find a way to generate using nistats, atlasreader?



Ahoi hoi @rob,

ah I see. I think atlasreader should provide you with that information. More precisely, you can set the cluster_extent variable as shown here and within the outputs you’ll have information for voxels within a given cluster and the clusters themselves.

HTH, cheers, Peer

Thanks @PeerHerholz, unfortunately as far as I can see the outputs provide the peak and mean t-statistic of the cluster. The former of these would allow one to e.g. calculate the p value corresponding to the ‘peak level’ column of the SPM results table (see below), but I do not beleive the table has the information need to calculate the ‘cluster-level statistics’?

Ahoi hoi @rob,

hm, that’s true. I’m very sorry for not grasping it earlier.
I’m rather sure that a python package for that exists somewhere out there.
However, I don’t know of any specific resources that I could share here…
In the mean time: nistats should have the functionality you need to extract the
information you want in a few lines of code (e.g. based on this example).
Sorry for not being super helpful…

Maybe/hopefully other folks will post as well.

Best, Peer