Thresholding zmaps with Nilearn

Hi :slight_smile:

I’m fairly new to MRI analysis and processing, so bare with me and my simple questions :wink:

I’m thresholding my zmaps before plotting and just want to make sure I’m doing this properly with nilearn.

If I understand correctly, it is common to first threshold the zmaps without correction (i.e. using nilearn.image.threshold_image) and then use thresholding with correction on the voxels that survived the previous thresholding (e.g. using threshold_stats_img).

I’m wondering if threshold_stats_img automatically takes into account only non-zero voxels (from previous threshold)?

This is my code:

contrast = 'negposReward'
pre_thres = 1

if pre_thres == 1:
    z_map = threshold_img(
        z1_2lvl[contrast],
        threshold=3.29,
    )
else:
    z_map = zALL_2lvl[contrast]
    
title_str = fName + '_' + contrast

thisimg1, threshold1 = threshold_stats_img(
    z_map,
    alpha=.001,
    height_control='fpr',
    cluster_threshold=10,
    two_sided=True,
)

print('The FDR=.001 threshold is %.3g' % threshold1)
nilearn.plotting.view_img(thisimg1, black_bg=True, title=title_str)

Thanks :slight_smile:

Max

Hi Max,

Not quite. The thresholding can be how you correct for the comparisons. Your z_map threshold of 3.29 is the same as thresholding at an alpha of 0.001 (so your threshold_stats_img is actually not really doing anything, since the input has already been thresholded). This strict alpha/z-score threshold is a way of accounting for the false positive rate (fpr) across all voxels, which is why we do not threshold at the conventional alpha=0.05. There are other ways to correct for multiple comparisons too in Nilearn (such as FDR correction).

Hope this helps,
Steven

Got you, that makes more sense! Thanks :slight_smile: