neuralib.atlas.ccf.matrix.slice_transform_helper
- neuralib.atlas.ccf.matrix.slice_transform_helper(raw_image, trans_matrix, *, plane_type='coronal', flip_lr=False, flip_ud=False)[source]
Transforms an input image according to the specified transformation matrix, plane orientation, and optional flipping parameters. This function reads a raw image, optionally flips it horizontally or vertically, applies a transformation matrix, and resizes it to a defined dimension based on the plane type. The result is a tuple containing the raw image and the transformed image.
- Parameters:
raw_image (str | Path | PathLike[str] | ndarray) – Path to the raw input image or image array.
trans_matrix (ndarray | str | Path | PathLike[str]) – Transformation matrix to apply to the image. It can be a numpy array or the path to a valid file containing the matrix. Supported files are .mat for MATLAB files and .npy for NumPy files.
plane_type (Literal['coronal', 'sagittal', 'transverse']) – Defines the anatomical plane for transformation. Defaults to ‘coronal’.
flip_lr (bool) – Boolean flag to determine whether to flip the image horizontally (left to right).
flip_ud (bool) – Boolean flag to determine whether to flip the image vertically (up to down).
- Returns:
A tuple containing two numpy arrays: the raw image as processed, and the transformed image.
- Return type:
tuple[ndarray, ndarray]