Inheritance diagram for nipy.core.reference.spaces:
Useful neuroimaging coordinate map makers and utilities
Bases: nipy.core.reference.spaces.SpaceError
x.__init__(...) initializes x; see help(type(x)) for signature
Bases: nipy.core.reference.spaces.SpaceError
x.__init__(...) initializes x; see help(type(x)) for signature
Bases: nipy.core.reference.spaces.SpaceError
x.__init__(...) initializes x; see help(type(x)) for signature
Return True if the coordap has an xyz affine
Parameters : | coordmap : CoordinateMap instance
name2xyz : None or mapping
|
---|---|
Returns : | tf : bool
|
Examples
>>> cmap = vox2mni(np.diag([2,3,4,5,1]))
>>> cmap
AffineTransform(
function_domain=CoordinateSystem(coord_names=('i', 'j', 'k', 'l'), name='array', coord_dtype=float64),
function_range=CoordinateSystem(coord_names=('mni-x', 'mni-y', 'mni-z', 't'), name='mni', coord_dtype=float64),
affine=array([[ 2., 0., 0., 0., 0.],
[ 0., 3., 0., 0., 0.],
[ 0., 0., 4., 0., 0.],
[ 0., 0., 0., 5., 0.],
[ 0., 0., 0., 0., 1.]])
)
>>> is_xyz_affable(cmap)
True
>>> time0_cmap = cmap.reordered_domain([3,0,1,2])
>>> time0_cmap
AffineTransform(
function_domain=CoordinateSystem(coord_names=('l', 'i', 'j', 'k'), name='array', coord_dtype=float64),
function_range=CoordinateSystem(coord_names=('mni-x', 'mni-y', 'mni-z', 't'), name='mni', coord_dtype=float64),
affine=array([[ 0., 2., 0., 0., 0.],
[ 0., 0., 3., 0., 0.],
[ 0., 0., 0., 4., 0.],
[ 5., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 1.]])
)
>>> is_xyz_affable(time0_cmap)
False
Return voxel to XYZ affine for coordmap
Parameters : | coordmap : CoordinateMap instance name2xyz : None or mapping
|
---|---|
Returns : | xyz_aff : (4,4) array
|
Raises : | SpaceTypeError : if this is not an affine coordinate map AxesError : if not all of x, y, z recognized in coordmap range AffineError : if axes dropped from the affine contribute to x, y, z coordinates : |
Examples
>>> cmap = vox2mni(np.diag([2,3,4,5,1]))
>>> cmap
AffineTransform(
function_domain=CoordinateSystem(coord_names=('i', 'j', 'k', 'l'), name='array', coord_dtype=float64),
function_range=CoordinateSystem(coord_names=('mni-x', 'mni-y', 'mni-z', 't'), name='mni', coord_dtype=float64),
affine=array([[ 2., 0., 0., 0., 0.],
[ 0., 3., 0., 0., 0.],
[ 0., 0., 4., 0., 0.],
[ 0., 0., 0., 5., 0.],
[ 0., 0., 0., 0., 1.]])
)
>>> xyz_affine(cmap)
array([[ 2., 0., 0., 0.],
[ 0., 3., 0., 0.],
[ 0., 0., 4., 0.],
[ 0., 0., 0., 1.]])
Vector of orders for sorting coordsys axes in xyz first order
Parameters : | coordsys : CoordinateSystem instance name2xyz : None or mapping
|
---|---|
Returns : | xyz_order : list
|
Raises : | AxesError : if there are not all of x, y and z axes |
Examples
>>> from nipy.core.api import CoordinateSystem
>>> xyzt_cs = mni_cs(4) # coordsys with t (time) last
>>> xyzt_cs
CoordinateSystem(coord_names=('mni-x', 'mni-y', 'mni-z', 't'), name='mni', coord_dtype=float64)
>>> xyz_order(xyzt_cs)
[0, 1, 2, 3]
>>> tzyx_cs = CoordinateSystem(xyzt_cs.coord_names[::-1], 'reversed')
>>> tzyx_cs
CoordinateSystem(coord_names=('t', 'mni-z', 'mni-y', 'mni-x'), name='reversed', coord_dtype=float64)
>>> xyz_order(tzyx_cs)
[3, 2, 1, 0]