Skip to content

Orientation

linc_convert.utils.orientation

Orientation of an array of voxels with respect to world space.

orientation_ensure_3d

orientation_ensure_3d(orientation)

Convert an ND orientation string to a 3D orientation string.

Parameters:

Name Type Description Default
orientation str

A 2D or 3D orientation string, such as "RA" or "RAS".

required

Returns:

Name Type Description
orientation str

A 3D orientation string compatible with the input orientaition

orientation_to_affine

orientation_to_affine(orientation, vxw=1, vxh=1, vxd=1)

Build an affine matrix from an orientation string and voxel size.

Parameters:

Name Type Description Default
orientation str

Orientation string

required
vxw float

Width voxel size

1
vxh float

Height voxel size

1
vxd float

Depth voxel size

1

Returns:

Name Type Description
affine (4, 4) array

Affine orientation matrix

center_affine

center_affine(affine, shape)

Ensure that the center of the field-of-view has world coordinate (0,0,0).

The input affine is NOT modified in-place

Parameters:

Name Type Description Default
affine array

Orientation affine matrix

required
shape list[int]

Shape of the array of voxels

required

Returns:

Name Type Description
affine array

Modified affine matrix.