Esempio n. 1
0
def interp_corr(locs,
                corrs,
                width=10,
                vox_size=10,
                outfile=None,
                save_nii=None):
    nii = se.load('std', vox_size=vox_size)
    full_locs = nii.get_locs().values
    W = np.exp(_log_rbf(full_locs, locs, width=width))
    interp_corrs = np.dot(corrs, W.T)
    bo_nii = se.Brain(data=interp_corrs, locs=full_locs)
    nii_bo = _brain_to_nifti(bo_nii, nii)
    ni_plt.plot_glass_brain(nii_bo,
                            colorbar=True,
                            threshold=None,
                            vmax=1,
                            vmin=0)
    #ni_plt.plot_glass_brain(nii_bo, colorbar=True, threshold=None, vmax=1, vmin=0, display_mode='lyrz')

    if save_nii:
        nii_bo.save(save_nii)

    if not outfile is None:
        plt.savefig(outfile)
    else:
        plt.show()
Esempio n. 2
0
def test_log_rbf():
    weights = _log_rbf(locs, locs[:10])
    assert isinstance(weights, np.ndarray)
    assert np.allclose(np.diag(weights), 0)