Skip to content

Commit

Permalink
Merge b063dfd into 8ff3178
Browse files Browse the repository at this point in the history
  • Loading branch information
Ying Luo committed Dec 14, 2015
2 parents 8ff3178 + b063dfd commit 7d6406c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
12 changes: 12 additions & 0 deletions code/stat159lambda/reproduction/analyze_similarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ def save_correlation_percentiles(aggregation):


def correlation_brain_image(outside_brain_value):
"""
Uses a mask to plot only the areas that are the brain itself and saves
that image into the figures folder.
Parameters
----------
outside_brain_values : int
Returns
-------
None
"""
if outside_brain_value < 0:
title = 'light'
else:
Expand Down
35 changes: 35 additions & 0 deletions code/stat159lambda/reproduction/brain_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@


def plot_vol_mean_histogram(subj_num):
"""
Plots the mean volume for a particular subject and saves that histogram
into the figures folder
Parameters
----------
subj_num : int
Returns
-------
None
"""
data = np.load(dp.get_concatenated_path(subj_num))[...,
NUM_OFFSET_VOLUMES:]
mean_vol = np.mean(data, axis=-1)
Expand All @@ -18,6 +30,17 @@ def plot_vol_mean_histogram(subj_num):


def get_brain_mask():
"""
Retrieves the path to the brain mask and loads that data
Parameters
----------
None
Returns
-------
brain_mask : array
"""
brain_mask_path = dp.get_brain_mask_path()
if not exists(brain_mask_path):
data = np.load(dp.get_concatenated_path(1))
Expand All @@ -28,6 +51,18 @@ def get_brain_mask():


def plot_brain_mask(slice):
"""
Plots the brain mask at a particular slice and saves that into the figures
folder
Parameters
----------
slice : int
Returns
-------
None
"""
image = get_brain_mask()[:, :, slice]
plt.imshow(image, cmap='gray')
plot_path = '{0}/figures/brain_mask.png'.format(REPO_HOME_PATH)
Expand Down

0 comments on commit 7d6406c

Please sign in to comment.