neurosynth/base/mask.py
def add(self, layers, above=None, below=None):
        """ Add one or more layers to the stack of masking layers.
        Args:
            layers: A string, NiBabel image, list, or dict. If anything other
                than a dict is passed, assigns sequential layer names based on
                the current position in stack; if a dict, uses key as the name
                and value as the mask image.
        """

        def add_named_layer(name, image):
            image = self.get_image(image, output='vector')
            if above is not None:
                image[image < above] = 0.
            if below is not None:
                image[image > below] = 0.
            self.layers[name] = image
            self.stack.append(name)

        if isinstance(layers, dict):
            for (name, image) in layers.items():
                add_named_layer(name, image)

        else:
            if not isinstance(layers, list):
                layers = [layers]
            for image in layers:
                name = 'layer_%d' % len(self.stack)
                add_named_layer(name, image)

        self.set_mask()
def add(self, layers, above=None, below=None):
        """ Add one or more layers to the stack of masking layers.
        Args:
            layers: A string, NiBabel image, list, or dict. If anything other
                than a dict is passed, assigns sequential layer names based on
                the current position in stack; if a dict, uses key as the name
                and value as the mask image.
        """

        def add_named_layer(name, image):
            image = self.get_image(image, output='vector')
            if above is not None:
                image[image < above] = 0.
            if below is not None:
                image[image > below] = 0.
            self.layers[name] = image
            self.stack.append(name)

        if isinstance(layers, dict):
            for (name, image) in layers.items():
                add_named_layer(name, image)

        else:
            if not isinstance(layers, list):
                layers = [layers]
            for image in layers:
                name = 'layer_%d' % len(self.stack)
                add_named_layer(name, image)

        self.set_mask()
def add ( self , layers , above = None , below = None ) : def add_named_layer ( name , image ) : image = self . get_image ( image , output = 'vector' ) if above is not None : image [ image < above ] = 0. if below is not None : image [ image > below ] = 0. self . layers [ name ] = image self . stack . append ( name ) if isinstance ( layers , dict ) : for ( name , image ) in layers . items ( ) : add_named_layer ( name , image ) else : if not isinstance ( layers , list ) : layers = [ layers ] for image in layers : name = 'layer_%d' % len ( self . stack ) add_named_layer ( name , image ) self . set_mask ( )
Add one or more layers to the stack of masking layers.
        Args:
            layers: A string, NiBabel image, list, or dict. If anything other
                than a dict is passed, assigns sequential layer names based on
                the current position in stack; if a dict, uses key as the name
                and value as the mask image.
Add one or more layers to the stack of masking layers . Args : layers : A string NiBabel image list or dict . If anything other than a dict is passed assigns sequential layer names based on the current position in stack ; if a dict uses key as the name and value as the mask image .