Last active
August 29, 2015 13:58
-
-
Save bthirion/9982582 to your computer and use it in GitHub Desktop.
Issue with nibabel.read_img_data
This file contains hidden or 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
from os import path | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from nibabel import load | |
from nibabel.loadsave import read_img_data | |
# Local import to $NIPY/examples/labs/need_data | |
from get_data_light import DATA_DIR, get_first_level_dataset | |
####################################### | |
# Data and analysis parameters | |
####################################### | |
# volume mask | |
# This dataset is large | |
get_first_level_dataset() | |
img_path = path.join(DATA_DIR, 's12069_swaloc1_corr.nii.gz') | |
img = load(img_path) | |
im1 = img.get_data()[:, :, :, 0] | |
im2 = read_img_data(img)[:, :, :, 0] | |
# affine = img.get_affine() | |
plt.figure() | |
plt.subplot(121) | |
plt.imshow(im1[:, :, 20]) | |
plt.subplot(122) | |
plt.imshow(im2[:, :, 20]) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment