Inheritance diagram for nipy.algorithms.registration.affine:
Bases: nipy.algorithms.registration.transform.Transform
Methods
apply(xyz) | |
as_affine([dtype]) | |
compose(other) | Compose this transform onto another |
copy() | |
from_matrix44(aff) | Convert a 4x4 matrix describing an affine transform into a 12-sized vector of natural affine parameters: translation, rotation, log-scale, pre-rotation (to allow for shearing when combined with non-unitary scales). |
inv() | Return the inverse affine transform. |
Compose this transform onto another
Parameters : | other : Transform
|
---|---|
Returns : | composed_transform : Transform
|
Convert a 4x4 matrix describing an affine transform into a 12-sized vector of natural affine parameters: translation, rotation, log-scale, pre-rotation (to allow for shearing when combined with non-unitary scales). In case the transform has a negative determinant, set the _direct attribute to False.
Return the inverse affine transform.
Bases: nipy.algorithms.registration.affine.Affine
Methods
apply(xyz) | |
as_affine([dtype]) | |
compose(other) | Compose this transform onto another |
copy() | |
from_matrix44(aff) | Convert a 4x4 matrix describing an affine transform into a 12-sized vector of natural affine parameters: translation, rotation, log-scale, pre-rotation (to allow for shearing when combined with non-unitary scales). |
inv() | Return the inverse affine transform. |
Compose this transform onto another
Parameters : | other : Transform
|
---|---|
Returns : | composed_transform : Transform
|
Convert a 4x4 matrix describing an affine transform into a 12-sized vector of natural affine parameters: translation, rotation, log-scale, pre-rotation (to allow for shearing when combined with non-unitary scales). In case the transform has a negative determinant, set the _direct attribute to False.
Return the inverse affine transform.
Bases: nipy.algorithms.registration.affine.Affine
Methods
apply(xyz) | |
as_affine([dtype]) | |
compose(other) | Compose this transform onto another |
copy() | |
from_matrix44(aff) | Convert a 4x4 matrix describing a rigid transform into a 12-sized vector of natural affine parameters: translation, rotation, log-scale, pre-rotation (to allow for pre-rotation when combined with non-unitary scales). |
inv() | Return the inverse affine transform. |
Compose this transform onto another
Parameters : | other : Transform
|
---|---|
Returns : | composed_transform : Transform
|
Convert a 4x4 matrix describing a rigid transform into a 12-sized vector of natural affine parameters: translation, rotation, log-scale, pre-rotation (to allow for pre-rotation when combined with non-unitary scales). In case the transform has a negative determinant, set the _direct attribute to False.
Return the inverse affine transform.
Bases: nipy.algorithms.registration.affine.Rigid
Methods
apply(xyz) | |
as_affine([dtype]) | |
compose(other) | Compose this transform onto another |
copy() | |
from_matrix44(aff) | Convert a 4x4 matrix describing a rigid transform into a 12-sized vector of natural affine parameters: translation, rotation, log-scale, pre-rotation (to allow for pre-rotation when combined with non-unitary scales). |
inv() | Return the inverse affine transform. |
Compose this transform onto another
Parameters : | other : Transform
|
---|---|
Returns : | composed_transform : Transform
|
Convert a 4x4 matrix describing a rigid transform into a 12-sized vector of natural affine parameters: translation, rotation, log-scale, pre-rotation (to allow for pre-rotation when combined with non-unitary scales). In case the transform has a negative determinant, set the _direct attribute to False.
Return the inverse affine transform.
Bases: nipy.algorithms.registration.affine.Affine
Methods
apply(xyz) | |
as_affine([dtype]) | |
compose(other) | Compose this transform onto another |
copy() | |
from_matrix44(aff) | Convert a 4x4 matrix describing a similarity transform into a 12-sized vector of natural affine parameters: translation, rotation, log-scale, pre-rotation (to allow for pre-rotation when combined with non-unitary scales). |
inv() | Return the inverse affine transform. |
Compose this transform onto another
Parameters : | other : Transform
|
---|---|
Returns : | composed_transform : Transform
|
Convert a 4x4 matrix describing a similarity transform into a 12-sized vector of natural affine parameters: translation, rotation, log-scale, pre-rotation (to allow for pre-rotation when combined with non-unitary scales). In case the transform has a negative determinant, set the _direct attribute to False.
Return the inverse affine transform.
Bases: nipy.algorithms.registration.affine.Similarity
Methods
apply(xyz) | |
as_affine([dtype]) | |
compose(other) | Compose this transform onto another |
copy() | |
from_matrix44(aff) | Convert a 4x4 matrix describing a similarity transform into a 12-sized vector of natural affine parameters: translation, rotation, log-scale, pre-rotation (to allow for pre-rotation when combined with non-unitary scales). |
inv() | Return the inverse affine transform. |
Compose this transform onto another
Parameters : | other : Transform
|
---|---|
Returns : | composed_transform : Transform
|
Convert a 4x4 matrix describing a similarity transform into a 12-sized vector of natural affine parameters: translation, rotation, log-scale, pre-rotation (to allow for pre-rotation when combined with non-unitary scales). In case the transform has a negative determinant, set the _direct attribute to False.
Return the inverse affine transform.
Computes a scaling vector pc such that, if p=(u,r,s,q) represents affine transformation parameters, where u is a translation, r and q are rotation vectors, and s is the vector of log-scales, then all components of (p/pc) are roughly comparable to the translation component.
To that end, we use a radius parameter which represents the ‘typical size’ of the object being registered. This is used to reformat the parameter vector (translation+rotation+scaling+pre-rotation) so that each element roughly represents a variation in mm.
Rotation vector from rotation matrix R
Parameters : | R : (3,3) array-like
|
---|---|
Returns : | vec : (3,) array
|
The rotation matrix is given by the Rodrigues formula:
R = Id + sin(theta)*Sn + (1-cos(theta))*Sn^2
with:
0 -nz ny
-ny | nx 0 |
where n = r / ||r||
In case the angle ||r|| is very small, the above formula may lead to numerical instabilities. We instead use a Taylor expansion around theta=0:
R = I + sin(theta)/tetha Sr + (1-cos(theta))/teta2 Sr^2
leading to:
R = I + (1-theta2/6)*Sr + (1/2-theta2/24)*Sr^2
To avoid numerical instabilities, an upper threshold is applied to the angle. It is chosen to be a multiple of 2*pi, hence the resulting rotation is then the identity matrix. This strategy warrants that the output matrix is a continuous function of the input vector.
t is a vector of affine transformation parameters with size at least 6.
size < 6 ==> error size == 6 ==> t is interpreted as translation + rotation size == 7 ==> t is interpreted as translation + rotation + isotropic scaling 7 < size < 12 ==> error size >= 12 ==> t is interpreted as translation + rotation + scaling + pre-rotation