NIPY logo

Site Navigation

NIPY Community

Table Of Contents

This Page

neurospin.group.displacement_field

Module: neurospin.group.displacement_field

Inheritance diagram for nipy.neurospin.group.displacement_field:

Classes

displacement_field

class nipy.neurospin.group.displacement_field.displacement_field(XYZ, sigma, n=1, mask=None, step=None)

Bases: object

Sampling of multiple vector-valued displacement fields on a 3D-lattice. Displacement fields are generated as linear combinations of fixed displacements. The coefficients are random Gaussian variables.

Methods

compute_inner_blocks
init_displacement_blocks
sample
sample_all_blocks
__init__(XYZ, sigma, n=1, mask=None, step=None)

Input : XYZ (3,p) array of voxel coordinates sigma <float> standard deviate of Gaussian filter kernel

Each displacement block has length 4*sigma

n <int> number of generated displacement fields. mask (q,) displacement blocks are limited to mask The constructor creates the following fields : self.block List of N block masks (voxel index vectors) self.weights List of N block weights (same shape as the masks) self.U (3,n,N) Displacement coefficients self.V (3,n,p) Displacements self.W (3,n,p) Discretize displacements self.I (n,p) Displaced voxels index

(voxel k in the mask is displaced by field i to voxel self.I[i,k])
compute_inner_blocks()

Generate self.inner_blocks, index of blocks which are “far from” the borders of the lattice.

init_displacement_blocks()

Called by class constructor

sample(i, b, proposal='prior', proposal_std=None, proposal_mean=None)

Generates U, V, L, W, I, where U, V, W, I are proposals for self.U[:,i,b], self.V[:,i,block], self.W[:,i,L], self.I[i,L] if block = self.block[b]. W and I are given only in those voxels, indexed by L, where they differ from current values. Proposal is either ‘prior’, ‘rand_walk’ or ‘fixed’

sample_all_blocks(proposal_std=None, proposal_mean=None)

Generates U, V, W, I, proposals for self.U[:, i], self.V[:, i], self.W[:, i], self.I[i]. Proposal is either ‘prior’, ‘rand_walk’ or ‘fixed’

gaussian_random_field

class nipy.neurospin.group.displacement_field.gaussian_random_field(XYZ, sigma, n=1)

Bases: object

__init__(XYZ, sigma, n=1)
sample(i, std)

Functions

nipy.neurospin.group.displacement_field.square_gaussian_filter(input, sigma, output=None, mode='reflect', cval=0.0)

Multi-dimensional Squared Gaussian filter.

The standard-deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes.

Note: The multi-dimensional filter is implemented as a sequence of one-dimensional convolution filters. The intermediate arrays are stored in the same data type as the output. Therefore, for output types with a limited precision, the results may be imprecise because intermediate results may be stored with insufficient precision.

nipy.neurospin.group.displacement_field.square_gaussian_filter1d(input, sigma, axis=-1, output=None, mode='reflect', cval=0.0)

One-dimensional Squared Gaussian filter.

The standard-deviation of the Gaussian filter is given by sigma.