Example #1
0
import nipy.algorithms.statistics.empirical_pvalue as en

# Local import
from get_data_light import DATA_DIR, get_second_level_dataset


# parameters
verbose = 1
theta = float(st.t.isf(0.01, 100))

# paths
mask_image = os.path.join(DATA_DIR, 'mask.nii.gz')
input_image = os.path.join(DATA_DIR, 'spmT_0029.nii.gz')
if (not os.path.exists(mask_image)) or (not os.path.exists(input_image)):
    get_second_level_dataset()

# Read the mask
nim = load(mask_image)
mask = nim.get_data()

# read the functional image
rbeta = load(input_image)
beta = rbeta.get_data()
beta = beta[mask > 0]

mf = plt.figure(figsize=(13, 5))
a1 = plt.subplot(1, 3, 1)
a2 = plt.subplot(1, 3, 2)
a3 = plt.subplot(1, 3, 3)
Example #2
0
File: viz.py Project: Naereen/nipy
try:
    import matplotlib.pyplot as plt
except ImportError:
    raise RuntimeError("This script needs the matplotlib library")

from nibabel import load

from nipy.labs import viz
from nipy.utils import example_data

# Local import
from get_data_light import get_second_level_dataset

# get the data
data_dir = get_second_level_dataset()

# First example, with a anatomical template
img = load(os.path.join(data_dir, 'spmT_0029.nii.gz'))
data = img.get_data()
affine = img.get_affine()

viz.plot_map(data, affine, cut_coords=(-52, 10, 22),
                        threshold=2.0, cmap=viz.cm.cold_hot)
plt.savefig('ortho_view.png')

# Second example, with a given anatomical image slicing in the Z direction
try:
    anat_img = load(example_data.get_filename('neurospin', 'sulcal2000',
                                              'nobias_anubis.nii.gz'))
    anat = anat_img.get_data()
Example #3
0
from nibabel import load
import nipy.algorithms.statistics.empirical_pvalue as en
import get_data_light


# parameters
verbose = 1
theta = float(st.t.isf(0.01, 100))

# paths
data_dir = os.path.expanduser(os.path.join('~', '.nipy', 'tests', 'data'))
mask_image = os.path.join(data_dir, 'mask.nii.gz')
input_image = os.path.join(data_dir, 'spmT_0029.nii.gz')
if (not os.path.exists(mask_image)) or (not os.path.exists(input_image)):
    get_data_light.get_second_level_dataset()

# Read the mask
nim = load(mask_image)
mask = nim.get_data()

# read the functional image
rbeta = load(input_image)
beta = rbeta.get_data()
beta = beta[mask > 0]

mf = mp.figure(figsize=(13, 5))
a1 = mp.subplot(1, 3, 1)
a2 = mp.subplot(1, 3, 2)
a3 = mp.subplot(1, 3, 3)
Example #4
0
try:
    import matplotlib.pyplot as plt
except ImportError:
    raise RuntimeError("This script needs the matplotlib library")

from nibabel import load

from nipy.labs import viz
from nipy.utils import example_data

# Local import
from get_data_light import get_second_level_dataset

# get the data
data_dir = get_second_level_dataset()

# First example, with a anatomical template
img = load(os.path.join(data_dir, 'spmT_0029.nii.gz'))
data = img.get_data()
affine = img.get_affine()

viz.plot_map(data,
             affine,
             cut_coords=(-52, 10, 22),
             threshold=2.0,
             cmap=viz.cm.cold_hot)
plt.savefig('ortho_view.png')

# Second example, with a given anatomical image slicing in the Z direction
try: