# Path: neurosynth/base/imageutils.py
# def get_sphere(coords, r=4, vox_dims=(2, 2, 2), dims=(91, 109, 91)):
# def map_peaks_to_image(peaks, r=4, vox_dims=(2, 2, 2), dims=(91, 109, 91),
#                        header=None):
# def load_imgs(filenames, masker, nan_to_num=True):
# def save_img(data, filename, masker, header=None):
# def threshold_img(data, threshold, mask=None, mask_out='below'):
# def create_grid(image, scale=4, apply_mask=True, save_file=None):
# 
# Path: neurosynth/analysis/stats.py
# def pearson(x, y):
# def two_way(cells):
# def one_way(data, n):
# def fdr(p, q=.05):


import logging
import numpy as np
from scipy.stats import norm
from neurosynth.base import imageutils
from neurosynth.analysis import stats
from os.path import join, exists
from os import makedirs
            vox_to_exclude = np.where(pA < min_studies)[0]  # Create mask
            # Mask each image
            for k in self.images:
                self.images[k][vox_to_exclude] = 0

    def save_results(self, output_dir='.', prefix='', prefix_sep='_',
                     image_list=None):
        """ Write out any images generated by the meta-analysis.
        Args:
            output_dir (str): folder to write images to
            prefix (str): all image files will be prepended with this string
            prefix_sep (str): glue between the prefix and rest of filename
            image_list (list): optional list of images to save--e.g.,
                ['pFgA_z', 'pAgF']. If image_list is None (default), will save
                all images.
        """

        if prefix == '':
            prefix_sep = ''

        if not exists(output_dir):
            makedirs(output_dir)

        logger.debug("Saving results...")
        if image_list is None:
            image_list = self.images.keys()
        for suffix, img in self.images.items():
            if suffix in image_list:
                filename = prefix + prefix_sep + suffix + '.nii.gz'
                outpath = join(output_dir, filename)

# Path: neurosynth/base/imageutils.py
# def get_sphere(coords, r=4, vox_dims=(2, 2, 2), dims=(91, 109, 91)):
# def map_peaks_to_image(peaks, r=4, vox_dims=(2, 2, 2), dims=(91, 109, 91),
#                        header=None):
# def load_imgs(filenames, masker, nan_to_num=True):
# def save_img(data, filename, masker, header=None):
# def threshold_img(data, threshold, mask=None, mask_out='below'):
# def create_grid(image, scale=4, apply_mask=True, save_file=None):
# 
# Path: neurosynth/analysis/stats.py
# def pearson(x, y):
# def two_way(cells):
# def one_way(data, n):
# def fdr(p, q=.05):


# Path: neurosynth/analysis/meta.py
import logging
import numpy as np
from scipy.stats import norm
from neurosynth.base import imageutils
from neurosynth.analysis import stats
from os.path import join, exists
from os import makedirs

            vox_to_exclude = np.where(pA < min_studies)[0]  # Create mask
            # Mask each image
            for k in self.images:
                self.images[k][vox_to_exclude] = 0

    def save_results(self, output_dir='.', prefix='', prefix_sep='_',
                     image_list=None):
        """ Write out any images generated by the meta-analysis.
        Args:
            output_dir (str): folder to write images to
            prefix (str): all image files will be prepended with this string
            prefix_sep (str): glue between the prefix and rest of filename
            image_list (list): optional list of images to save--e.g.,
                ['pFgA_z', 'pAgF']. If image_list is None (default), will save
                all images.
        """

        if prefix == '':
            prefix_sep = ''

        if not exists(output_dir):
            makedirs(output_dir)

        logger.debug("Saving results...")
        if image_list is None:
            image_list = self.images.keys()
        for suffix, img in self.images.items():
            if suffix in image_list:
                filename = prefix + prefix_sep + suffix + '.nii.gz'
                outpath = join(output_dir, filename)

                imageutils.save_img(img, outpath, self.dataset.masker)