NIPY logo

Site Navigation

NIPY Community

Table Of Contents

This Page

neurospin.registration.spacetime_registration

Module: neurospin.registration.spacetime_registration

Inheritance diagram for nipy.neurospin.registration.spacetime_registration:

Classes

Image4d

class nipy.neurospin.registration.spacetime_registration.Image4d(array, to_world, 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 acquired on a slice-by-slice basis.

Methods

from_time
z_to_slice
__init__(array, to_world, 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

from_time(zv, t)
tv = from_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.neurospin.registration.spacetime_registration.Realign4d(im4d, speedup=4, optimizer='powell', transforms=None)

Bases: object

__init__(im4d, speedup=4, optimizer='powell', transforms=None)
correct_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)
safe_variance(t)
No need to invoke self.init_motion_detection.
variance(t)

Functions

nipy.neurospin.registration.spacetime_registration.grid_coords(xyz, affine, from_world, to_world)
nipy.neurospin.registration.spacetime_registration.interp_slice_order(Z, slice_order)
nipy.neurospin.registration.spacetime_registration.realign4d(runs, within_loops=2, between_loops=5, speedup=4, optimizer='powell', align_runs=True)
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.neurospin.registration.spacetime_registration.resample4d(im4d, transforms=None)