omni.affine#
Functions that pertain to affine matrix manipulation.
Functions
|
Convert multiple lines of afni transforms to rigid body |
|
Converts input affine to output affine of another type. |
|
Load and deoblique image. |
|
Generates a rigid-body transformation. |
- omni.affine.afni_affine_to_rigid_body(affines: ndarray) ndarray [source]#
Convert multiple lines of afni transforms to rigid body
- Parameters:
- affines: np.ndarray
n x 16 matrix of affine transforms
- Returns:
- np.ndarray
n x 6 matrix of rigid body transforms
- omni.affine.convert_affine(input_affine: ndarray, input_atype: str, output_atype: str, invert: bool = False, target: Optional[Nifti1Image] = None, source: Optional[Nifti1Image] = None) ndarray [source]#
Converts input affine to output affine of another type.
- Parameters:
- input_affine: np.ndarray
4x4 affine matrix to convert.
- input_atype: str
Type of affine that is input (omni/afni/fsl).
- output_atype: str
Type of affine to output (omni/afni/fsl).
- invert: bool
Controls whether the affine should be inverted.
- target: nib.Nifti1Image
Target image affine is transformed to (required for fsl conversion).
- source: nib.Nifti1Image
Source image affine is applying transform to (required for fsl conversion).
- Returns:
- np.ndarray
4x4 affine matrix in output_atype format.
- omni.affine.deoblique(in_img: Nifti1Image, **kwargs) Nifti1Image [source]#
Load and deoblique image.
- Parameters:
- in_img: nib.Nifti1Image
Input image to deoblique.
- Returns:
- nib.Nifti1Image
Deobliqued image.
- omni.affine.generate_rigid_transform(ang_x: float = 0, ang_y: float = 0, ang_z: float = 0, translate: Tuple[float, float, float] = [0, 0, 0]) ndarray [source]#
Generates a rigid-body transformation.
- Parameters:
- ang_x: float
Angle over x-axis (degrees).
- ang_y: float
Angle over y-axis (degrees).
- ang_z: float
Angle over z-axis (degrees).
- translate: Tuple[float, float, float]
Length 3 tuple specifying translation (mm) for x, y, and z-axis.
- Returns:
- np.ndarray
4x4 affine matrix for given rigid-bdy transform.