def disp_slopes(mask, ls_fit, prop): """ Prepares and displays the slopes in a mosaic. Parameters ---------- mask: 3 dimensional array Brain mask of the data ls_fit: 1 dimensional array An array with the results from the least squares fit Returns ------- slopeProp_all: 3 dimensional array Slope of the desired property across b values at each voxel """ prop_dict = {'FA':'FA', 'MD':'MD', 'mean diffusivity':'MD', 'fractional anisotropy':'FA', 'dispersion index':'DI', 'DI':'DI','SNR':'SNR', 'signal-to-noise ratio':'SNR', 'signal to noise ratio':'SNR'} slopeProp_all = np.zeros_like(mask) slopeProp_all[np.where(mask)] = np.squeeze(np.array(ls_fit[0,:][np.isfinite(ls_fit[0,:])])) if prop_dict[prop] is 'SNR': fig = mpl.mosaic(slopeProp_all, cmap=matplotlib.cm.bone) fig.set_size_inches([20,10]) else: fig = mpl.mosaic(slopeProp_all, cmap=matplotlib.cm.PuOr_r, vmin = -0.75, vmax = 0.75) fig.set_size_inches([20,10]) return slopeProp_all
def display(data): """ Displays the snr across the brain as a mosaic Saves the data as a nifti file Parameters ---------- snr_data: 3 dimensional array SNR at each voxel """ fig = mpl.mosaic(data, cmap=matplotlib.cm.bone) fig.set_size_inches([20, 10]) return mean_snr
def display(data): """ Displays the snr across the brain as a mosaic Saves the data as a nifti file Parameters ---------- snr_data: 3 dimensional array SNR at each voxel """ fig = mpl.mosaic(data, cmap=matplotlib.cm.bone) fig.set_size_inches([20,10]) return mean_snr
def disp_sqrd_err(sum_sqrd_err, mask): """ Prepares and displays the squared error in a mosaic. Parameters ---------- sum_sqrd_err: 1 dimensional array An array with the sum squared error at each voxel mask: 3 dimensional array Brain mask of the data Returns ------- sqrd_err_all: 3 dimensional array Squared error from model fit at each voxel """ sqrd_err_all = np.zeros_like(mask) sqrd_err_all[np.where(mask)] = sum_sqrd_err fig = mpl.mosaic(sqrd_err_all, cmap=matplotlib.cm.bone, vmax = 1) fig.set_size_inches([20,10]) return sqrd_err_all
def plot_slopes(mask, ls_fit): """ Prepares and plots arrays in a mosaic. Parameters ---------- mask: 3 dimensional array Brain mask of the data ls_fit: 1 dimensional array An array with the results from the least squares fit Returns ------- slopeProp_all: 3 dimensional array Slope of the desired property across b values at each voxel """ idx_mask = np.where(mask) slopeProp_all = np.zeros_like(mask) slopeProp_all[idx_mask] = np.squeeze(np.array(ls_fit[0, :][np.isfinite(ls_fit[0, :])])) fig = mpl.mosaic(slopeProp_all, cmap=matplotlib.cm.bone) fig.set_size_inches([20, 10]) return slopeProp_all