Created
April 18, 2020 23:11
-
-
Save caglorithm/72aa9b3dab1040c20de73fb63a6af608 to your computer and use it in GitHub Desktop.
neurolib - convert brain matrix from LRLR to LLRR ordering
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
plt.rcParams['image.cmap'] = 'plasma' | |
import matplotlib.pyplot as plt | |
from neurolib.utils.loadData import Dataset | |
ds = Dataset("hcp") | |
mat_orig = ds.Cmats[0] | |
N = mat_orig.shape[0] | |
# mapping from LRLR ordering to LLRR | |
lrlr_to_llrr_idx = np.hstack((np.arange(0, N, step=2), np.arange(1, N, step=2))) | |
mat = mat_orig | |
mat = mat[lrlr_to_llrr_idx] | |
mat = mat.T | |
mat = mat[lrlr_to_llrr_idx] | |
mat = mat.T | |
fig, axs = plt.subplots(1, 2, figsize=(8, 4), dpi=75) | |
axs[0].set_title("LRLR ordering") | |
axs[0].imshow(mat_orig) | |
axs[1].set_title("LLRR ordering") | |
axs[1].imshow(mat) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment