Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bin and back project #6

Closed
rb643 opened this issue Mar 2, 2017 · 2 comments
Closed

Bin and back project #6

rb643 opened this issue Mar 2, 2017 · 2 comments
Assignees

Comments

@rb643
Copy link

rb643 commented Mar 2, 2017

Binning the principal gradient into 10 percentile block and create nifti's for each. Then compare each bin against the same neurosynth keywords as were used in the original paper.

@rb643
Copy link
Author

rb643 commented Mar 2, 2017

This is the bit of code that plots the entire principal gradient:

def rebuild_nii_individ(num):

onlyfiles = [f for f in listdir_nohidden('./data/Outputs/Regs/') if isfile(join('./data/Outputs/Regs/', f))]

for sub in onlyfiles:

    data = np.load('./data/Outputs/Regs/%s' % sub)
    a = data[:,num].copy()
    nim = nib.load('cc400_roi_atlas.nii')
    imdat=nim.get_data()
    imdat_new = imdat.copy()

    for n, i in enumerate(np.unique(imdat)):
        if i != 0:
            imdat_new[imdat == i] = a[n-1] * 10 # scaling factor. Could also try to get float values in nifti...

    nim_out = nib.Nifti1Image(imdat_new, nim.get_affine(), nim.get_header())
    nim_out.set_data_dtype('float32')
    # to save:
    nim_out.to_filename('res.nii')
    nilearn.plotting.plot_epi(nim_out, cut_coords=(0,0,0))

@rb643
Copy link
Author

rb643 commented Mar 2, 2017

num == gradient number

@rb643 rb643 closed this as completed Mar 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants