Inheritance diagram for nipy.neurospin.group.displacement_field:
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 |
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])
Generate self.inner_blocks, index of blocks which are “far from” the borders of the lattice.
Called by class constructor
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’
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’
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.
One-dimensional Squared Gaussian filter.
The standard-deviation of the Gaussian filter is given by sigma.