darsia.AffineTransformation#
- class AffineTransformation(dim)[source]#
Bases:
BaseTransformationAffine map, restricted to translation, scaling, rotation, resulting in conservation of angles.
Constructor for identity encoded as affine transformation.
- Parameters:
- dim
int Dimension of the Euclidean space.
- dim
- Raises:
ValueErrorIf not sufficient input data is provided.
ValueErrorIf dimension not 2 or 3.
Methods
call_array(x)Application of map to arrays.
fit(pts_src, pts_dst[, fit_options])Least-squares fit of the forward and inverse map.
inverse(x)Apply inverse transformation to array.
Application of inverse of the map to arrays.
set_dtype(pts_src, pts_dst)Set array input and output type for generalized perspective transformation.
set_parameters([translation, scaling, rotation])Set-access of parameters of map.
set_parameters_as_vector(parameters)Wrapper for set_parameters.
Attributes
Dimension of the Euclidean space.
Translation vector.
Scaling factor.
Rotation matrix.
Inverse of rotation matrix.
Flag storing whether the underlying transformation is restricted to isometry.
input_dtypeType of input for generalized perspective transformation
output_dtypeType of output for generalized perspective transformation
input_array_dtypeType of input arrays for generalized perspective transformation
output_array_dtypeType of output arrays for generalized perspective transformation
- call_array(x)[source]#
Application of map to arrays.
- Parameters:
- x
np.ndarray (collection of) dim-dimensional Euclidean vector.
- x
- Returns:
np.ndarrayFunction values of affine map.
- fit(pts_src, pts_dst, fit_options={})[source]#
Least-squares fit of the forward and inverse map.
- Parameters:
- pts_src
VoxelArrayorCoordinateArray Source points.
- pts_dst
VoxelArrayorCoordinateArray Target points.
- fit_options
dict,optional "preconditioning"(bool) – precondition the optimisation with a better initial translation guess."tol"(float) – optimisation tolerance."maxiter"(int) – maximum optimisation iterations."isometry"(bool) – whether the transformation is an isometry.
- pts_src
- Returns:
- bool
Whether the fit succeeded.
- inverse_array(x)[source]#
Application of inverse of the map to arrays.
- Parameters:
- x
np.ndarray (collection of) dim-dimensional Euclidean vector,
- x
- Returns:
np.ndarrayFunction values of affine inverse map.
- set_parameters(translation=None, scaling=None, rotation=None)[source]#
Set-access of parameters of map.
- set_parameters_as_vector(parameters)[source]#
Wrapper for set_parameters.
- Parameters:
- parameters
array All parameters concatenated as array. In 2d, the length is either 3 (translation, rotation) or 4 (translation, scaling, rotation). In 3d, the length is either 6 (translation, rotation) or 7 (translation, scaling, rotation).
- parameters
- dim#
Dimension of the Euclidean space.
- isometry#
Flag storing whether the underlying transformation is restricted to isometry.
- rotation#
Rotation matrix.
- rotation_inv#
Inverse of rotation matrix.
- scaling#
Scaling factor.
- translation#
Translation vector.