cosanlab / nltools

Python toolbox for analyzing imaging data
https://nltools.org
MIT License
120 stars 42 forks source link

Plotting thresholded data doesn't work reliably #372

Open ejolly opened 3 years ago

ejolly commented 3 years ago

Related to #304. It looks like recent versions of nilearn now raise errors on transformed data that isn't nsamples x nvoxels. So whenever we run brain.ttest(threshold_dict=...) plotting and saving (to nifti) the thresholded t map produces TypeErrors, like

~/anaconda3/lib/python3.8/site-packages/nilearn/masking.py in _unmask_3d(X, mask, order)
    831     n_features = mask.sum()
    832     if X.shape[0] != n_features:
--> 833         raise TypeError('X must be of shape (samples, %d).' % n_features)
    834
    835     data = np.zeros(

TypeError: X must be of shape (samples, 51029).

@ljchang This is another example where we should prioritize revisiting #304 I'm not seeing an advantage of changing the shape of a brain data object ever, as oppose to just setting voxels to 0 whenever we threshold. And this new error supports the opting for the latter approach across our toolbox.