NIPY logo

Site Navigation

NIPY Community

Table Of Contents

Previous topic

algorithms.registration.grid_transform

This Page

algorithms.registration.groupwise_registration

Module: algorithms.registration.groupwise_registration

Inheritance diagram for nipy.algorithms.registration.groupwise_registration:

Classes

FmriRealign4d

class nipy.algorithms.registration.groupwise_registration.FmriRealign4d(images, slice_order, interleaved, tr=None, tr_slices=None, start=0.0, time_interp=True, affine_class=<class 'nipy.algorithms.registration.affine.Rigid'>)

Bases: nipy.algorithms.registration.groupwise_registration.Realign4d

__init__(images, slice_order, interleaved, tr=None, tr_slices=None, start=0.0, time_interp=True, affine_class=<class 'nipy.algorithms.registration.affine.Rigid'>)
estimate(iterations=2, between_loops=None, align_runs=True)
resample(align_runs=True)

Return a list of 4d nibabel-like images corresponding to the resampled runs.

Image4d

class nipy.algorithms.registration.groupwise_registration.Image4d(array, affine, tr, tr_slices=None, start=0.0, slice_order='ascending', interleaved=False, slice_axis=2)

Bases: object

Class to represent a sequence of 3d scans (possibly acquired on a slice-by-slice basis).

Methods

grid_time
z_to_slice
__init__(array, affine, tr, tr_slices=None, start=0.0, slice_order='ascending', interleaved=False, slice_axis=2)

Configure fMRI acquisition time parameters.

tr : inter-scan repetition time, i.e. the time elapsed
between two consecutive scans

tr_slices : inter-slice repetition time, same as tr for slices start : starting acquisition time respective to the implicit

time origin

slice_order : string or array

grid_time(zv, t)

tv = grid_time(zv, t) zv, tv are grid coordinates; t is an actual time value.

z_to_slice(z)

Account for the fact that slices may be stored in reverse order wrt the scanner coordinate system convention (slice 0 == bottom of the head)

Realign4d

class nipy.algorithms.registration.groupwise_registration.Realign4d(images, affine_class=<class 'nipy.algorithms.registration.affine.Rigid'>)

Bases: object

__init__(images, affine_class=<class 'nipy.algorithms.registration.affine.Rigid'>)
estimate(iterations=2, between_loops=None, align_runs=True)
resample(align_runs=True)

Return a list of 4d nibabel-like images corresponding to the resampled runs.

Realign4d_Algorithm

class nipy.algorithms.registration.groupwise_registration.Realign4d_Algorithm(im4d, speedup=4, optimizer='powell', affine_class=<class 'nipy.algorithms.registration.affine.Rigid'>, transforms=None, time_interp=True)

Bases: object

__init__(im4d, speedup=4, optimizer='powell', affine_class=<class 'nipy.algorithms.registration.affine.Rigid'>, transforms=None, time_interp=True)
estimate_motion()
init_motion_detection(t)

The idea is to compute the global variance using the following decomposition:

V = (n-1)/n V1 + (n-1)/n^2 (x1-m1)^2
= alpha + beta d2,

with alpha=(n-1)/n V1, beta = (n-1)/n^2, d2 = (x1-m1)^2.

Only the second term is variable when one image moves while all other images are fixed.

msid(t)

Mean square intensity difference

resample()
resample_all_inmask()
resample_inmask(t)

x,y,z,t are “ideal grid” coordinates X,Y,Z,T are “acquisition grid” coordinates

safe_variance(t)

No need to invoke self.init_motion_detection.

variance(t)

Functions

nipy.algorithms.registration.groupwise_registration.grid_coords(xyz, affine, from_world, to_world)
nipy.algorithms.registration.groupwise_registration.interp_slice_order(Z, slice_order)
nipy.algorithms.registration.groupwise_registration.realign4d(runs, within_loops=2, between_loops=5, speedup=4, optimizer='powell', align_runs=True, time_interp=True, affine_class=<class 'nipy.algorithms.registration.affine.Rigid'>)
Parameters :

runs : list of Image4d objects

Returns :

transforms : list

nested list of rigid transformations

transforms map an ‘ideal’ 4d grid (conventionally aligned with the :

first scan of the first run) to the ‘acquisition’ 4d grid for each :

run :

nipy.algorithms.registration.groupwise_registration.resample4d(im4d, transforms=None, time_interp=True)
nipy.algorithms.registration.groupwise_registration.single_run_realign4d(im4d, loops=2, speedup=4, optimizer='powell', time_interp=True)
Parameters :im4d : Image4d instance
nipy.algorithms.registration.groupwise_registration.split_affine(a)