Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 36 additions & 44 deletions brainiak/searchlight/searchlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"""

__all__ = [
"Searchlight",
"Searchlight", "Shape", "Cube", "Diamond"
]


Expand All @@ -38,36 +38,32 @@ class Shape:

mask_ : a 3D boolean numpy array of size (2*rad+1,2*rad+1,2*rad+1)
which is set to True within the boundaries of the desired shape
"""

def __init__(self, rad):
"""Constructor
Parameters
----------

Parameters
----------
rad: radius, in voxels, of the sphere inscribed in the
searchlight cube, not counting the center voxel

rad: radius, in voxels, of the sphere inscribed in the
searchlight cube, not counting the center voxel
"""

"""
def __init__(self, rad):
self.rad = rad


class Cube(Shape):
"""Cube

Searchlight shape which is a cube of size (2*rad+1,2*rad+1,2*rad+1)
"""
def __init__(self, rad):
"""Constructor

Parameters
----------
Parameters
----------

rad: radius, in voxels, of the sphere inscribed in the
searchlight cube, not counting the center voxel
rad: radius, in voxels, of the sphere inscribed in the
searchlight cube, not counting the center voxel

"""
"""
def __init__(self, rad):
super().__init__(rad)
self.rad = rad
self.mask_ = np.ones((2*rad+1, 2*rad+1, 2*rad+1), dtype=np.bool)
Expand All @@ -80,17 +76,15 @@ class Diamond(Shape):
inscribed in a cube of size (2*rad+1,2*rad+1,2*rad+1).
Any location in the cube which has a Manhattan distance of less than rad
from the center point is set to True.
"""
def __init__(self, rad):
"""Constructor

Parameters
----------
Parameters
----------

rad: radius, in voxels, of the sphere inscribed in the
searchlight cube, not counting the center voxel
rad: radius, in voxels, of the sphere inscribed in the
searchlight cube, not counting the center voxel

"""
"""
def __init__(self, rad):
super().__init__(rad)
self.mask_ = np.zeros((2*rad+1, 2*rad+1, 2*rad+1), dtype=np.bool)
for r1 in range(2*self.rad+1):
Expand All @@ -109,30 +103,28 @@ class Searchlight:

Optionally, users can define a block function which runs over
larger portions of the volume called blocks.
"""
def __init__(self, sl_rad=1, max_blk_edge=10, shape=Cube,
min_active_voxels_proportion=0):
"""Constructor

Parameters
----------
Parameters
----------

sl_rad: radius, in voxels, of the sphere inscribed in the
searchlight cube, not counting the center voxel
sl_rad: radius, in voxels, of the sphere inscribed in the
searchlight cube, not counting the center voxel

max_blk_edge: max edge length, in voxels, of the 3D block
max_blk_edge: max edge length, in voxels, of the 3D block

shape: brainiak.searchlight.searchlight.Shape indicating the
shape in voxels of the searchlight region
shape: brainiak.searchlight.searchlight.Shape indicating the
shape in voxels of the searchlight region

min_active_voxels_proportion: float
If a searchlight region does not have more than this minimum
proportion of active voxels in the mask, it is not processed by the
searchlight function. The mask used for the test is the
intersection of the global (brain) mask and the `Shape` mask. The
seed (central) voxel of the searchlight region is taken into
consideration.
"""
min_active_voxels_proportion: float
If a searchlight region does not have more than this minimum
proportion of active voxels in the mask, it is not processed by the
searchlight function. The mask used for the test is the
intersection of the global (brain) mask and the `Shape` mask. The
seed (central) voxel of the searchlight region is taken into
consideration.
"""
def __init__(self, sl_rad=1, max_blk_edge=10, shape=Cube,
min_active_voxels_proportion=0):
self.sl_rad = sl_rad
self.max_blk_edge = max_blk_edge
self.min_active_voxels_proportion = min_active_voxels_proportion
Expand Down