pyhrf.boldsynth.spatialconfig module¶
-
class
pyhrf.boldsynth.spatialconfig.
Mapper1D
(mapping, expandedShape)¶ Handles a mapping between a nD coordinate space (expanded) and a 1D coordinate space (flatten). Can be applied to numpy.ndarray objects
-
createExpandedArray
(flatShape, type, mappedAxis=0, fillValue=0)¶
-
expandArray
(a, mappedAxis=0, dest=None, fillValue=0)¶ Expand dimensions of ‘a’ following predefined mapping. ‘mappedAxis’ is the axis index to be expanded in ‘a’. If dest is not None the map values from ‘a’ to dest. If dest is None then return a new array and fill positions not involved in mapping with ‘fillValue’.
-
flattenArray
(array, firstMappedAxis=0)¶ Reduce dimensions of ‘array’. ‘firstMappedAxis’ is index of the axis to be reduced (other mapped axes are assumed to follow this one).
-
-
class
pyhrf.boldsynth.spatialconfig.
NeighbourhoodSystem
(neighboursSets)¶ -
static
fromLattice
(latticeIndexes, kerMask=None, depth=1, torusFlag=False)¶ Creates a NeighbourhoodSystem instance from a n-dimensional lattice
-
static
fromMesh
(polygonList)¶
-
getMaxIndex
()¶
-
getMaxNeighbours
()¶
-
getNeighbours
(nodeId)¶
-
getNeighboursArrays
()¶
-
getNeighboursLists
()¶
-
getNeighboursSets
()¶
-
kerMask2D_4n
= array([[-1, 0], [ 1, 0], [ 0, 1], [ 0, -1]])¶
-
kerMask3D_6n
= array([[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1], [-1, 0, 0], [ 0, -1, 0], [ 0, 0, -1]])¶
-
sub
(nodeIds)¶
-
static
-
class
pyhrf.boldsynth.spatialconfig.
PottsField
(classNames, spConf, initProps=None)¶
-
class
pyhrf.boldsynth.spatialconfig.
RegularLatticeMapping
(shape=None, mapping=None, order=1, depth=1)¶ Bases:
pyhrf.boldsynth.spatialconfig.SpatialMapping
Define a SpatialMapping on a 3D regular lattice.
-
buildNeighboursCoordLists
()¶
-
buildNeighboursIndexLists
()¶
-
c
= [1, 1, 1]¶
-
static
createFromGUI
(GUIobject)¶ Creates the actual object based on the parameters
-
getClosestNeighboursIndexes
(idVoxel)¶
-
getCoord
(index)¶
-
getIndex
(coord)¶
-
getMapping
()¶
-
getNbCliques
()¶
-
getNbVoxels
()¶
-
getNdArrayMask
()¶
-
getNeighboursCoordLists
()¶
-
getNeighboursCoords
(idvoxel)¶
-
getNeighboursIndexLists
()¶
-
getNeighboursIndexes
(idVoxel)¶
-
getRoiMask
()¶ Return a binary or n-ary 3D mask which has the shape of the target data
-
getTargetAxesNames
()¶
-
mapVoxData
(data, fillValue=0)¶
-
nbNeighboursOrder1
= 6¶
-
nbNeighboursOrder2
= 26¶
-
order1Mask
= array([[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1], [-1, 0, 0], [ 0, -1, 0], [ 0, 0, -1]])¶
-
order2Mask
= array([[ 0, 0, -1], [ 0, 0, 1], [ 0, -1, 0], [ 0, -1, -1], [ 0, -1, 1], [ 0, 1, 0], [ 0, 1, -1], [ 0, 1, 1], [-1, 0, 0], [-1, 0, -1], [-1, 0, 1], [-1, -1, 0], [-1, -1, -1], [-1, -1, 1], [-1, 1, 0], [-1, 1, -1], [-1, 1, 1], [ 1, 0, 0], [ 1, 0, -1], [ 1, 0, 1], [ 1, -1, 0], [ 1, -1, -1], [ 1, -1, 1], [ 1, 1, 0], [ 1, 1, -1], [ 1, 1, 1]])¶
-
-
class
pyhrf.boldsynth.spatialconfig.
RegularLatticeMapping2
(maskLattice, kerMask=None, nsDepth=1, parentMapping=None, torusFlag=False)¶ Bases:
pyhrf.boldsynth.spatialconfig.SpatialMapping2
-
flattenData
(data, firstMappedAxis=0)¶
-
mapData
(data, mappedAxis=0, fillValue=0)¶
-
-
class
pyhrf.boldsynth.spatialconfig.
SpatialMapping
¶ Interface specification for the handling of a mapping between integer indexes and positions in a 3D space.
-
getCoord
(index)¶ Return coord mapped with ‘index’
-
getIndex
(coord)¶ Return index mapped with ‘coord’
-
getMapping
()¶ Return a mapping object (list or dict) which maps an integer index to its 3D coordinates.
-
getNbVoxels
()¶ Return the total number of mapped position
-
getNdArrayMask
()¶ Return the set of mapped 3D coordinates in a tuple usable as a mask for numpy.ndarray
-
getNeighboursCoordLists
()¶ Get lists of neighbours for all positions @param idVoxel: index of the voxel @return: a mapping object (list or dict) which maps each integer index to a list of 3D coordinates (the neighbours).
-
getNeighboursCoords
(idVoxel)¶ @param idVoxel: index of the voxel @return: the list of 3D coordinates corresponding to the neighbours of the specified voxel.
-
getNeighboursIndexLists
()¶ Get lists of neighbours for all positions @param idVoxel: index of the voxel @return: a mapping object (list or dict) which maps each integer index to a list of integer indexes (the neighbours).
-
getNeighboursIndexes
(idVoxel)¶ @param idVoxel: index of the voxel @return: the list of integer indexes corresponding to the neighbours of the specified voxel.
-
getRoiMask
()¶ Return a binary or n-ary mask which has the shape of the target data
-
-
class
pyhrf.boldsynth.spatialconfig.
SpatialMapping2
(positions, ns, parentMapping=None, parentIndex=None)¶ -
static
fromLattice
(lattice, kerMask=None, nsDepth=1, torusFlag=False)¶
-
static
fromMesh
(triangles, positions)¶
-
getPositions
()¶
-
sub
(nodeIds)¶
-
static
-
class
pyhrf.boldsynth.spatialconfig.
StateField
(classNames, spConf, initProps=None)¶ Class handling a field of states : a set of integers (ie labels) whose ranks can be spatially mapped to 3D coordinates. Each label refers to a class wich is identified by an ID and a name.
-
generate
()¶ Generate values for every states. By default : if initProportions is set, generate values according to it. State values will be ordered by class ID
-
getClassId
(className)¶ Return the class id corresponding to the string ‘className’
-
getClassName
(classId)¶ Return the class name corresponding to the integer ‘classId’
-
getClassNames
()¶ Return all the class names
-
getFieldValues
()¶ Return all field values.
-
getMappedFieldValues
()¶
-
getNbClasses
()¶
-
getSize
()¶ Return to size of the field.
-
randomize
()¶ Randomize state values with a ramdom permutation.
-
setFieldValues
(values, mask=None)¶ Copy the content of ‘values’ to state values masked by ‘mask’.
-
setFieldValues0
(values, mask=None)¶ Copy the content of ‘values’ to state values masked by ‘mask’.
-
updateClassCounts
()¶ Compute the size of every classes.
-
-
class
pyhrf.boldsynth.spatialconfig.
UnboundSpatialMapping
(nbVoxels=100)¶ Bases:
pyhrf.boldsynth.spatialconfig.SpatialMapping
Convinient class to provide an implementation of SpatialMapping when there is no mapping.
-
static
createFromGUI
(GUIobject)¶ Creates the actual object based on the parameters
-
getCoord
(index)¶
-
getIndex
(coord)¶
-
getMapping
()¶
-
getNbVoxels
()¶
-
getNdArrayMask
()¶
-
getNeighboursCoordLists
()¶
-
getNeighboursCoords
(idVoxel)¶
-
getNeighboursIndexLists
()¶
-
getNeighboursIndexes
(idVoxel)¶
-
getRoiMask
()¶ Return a binary or n-ary 3D mask which has the shape of the target data
-
static
-
pyhrf.boldsynth.spatialconfig.
flattenElements
(l)¶
-
pyhrf.boldsynth.spatialconfig.
getRotationMatrix
(axis, angle)¶ Compute the 3x3 matrix for the 3D rotation defined by ‘angle’ and the direction ‘axis’.
-
pyhrf.boldsynth.spatialconfig.
hashMask
(m)¶
-
pyhrf.boldsynth.spatialconfig.
lattice_indexes
(mask)¶
-
pyhrf.boldsynth.spatialconfig.
maskToMapping
(m)¶
-
pyhrf.boldsynth.spatialconfig.
mask_to_coords
(m)¶