parcellate_right_left#

petpal.preproc.segmentation_tools.parcellate_right_left(segmentation_numpy: numpy.ndarray, region: int, new_right_region: int, new_left_region: int) numpy.ndarray#

Divide a region within a segmentation image into right and left values. Assumes left and right sides are neatly subdivided by the image midplane, with right values below the mean value of the x-axis (zeroth axis) and left values above the mean value of the x-axis (zeroth axis).

Intended to work with FreeSurfer segmentations on images loaded with nibabel. Use outside of these assumptions at your own risk.

Parameters:
  • segmentation_numpy (np.ndarray) – Segmentation image array loaded with Nibabel, RAS+ orientation

  • region (int) – Region index in segmentation image to be split into left and right.

  • new_right_region (int) – Region on the right side assigned to previous region.

  • new_left_region (int) – Region on the left side assined to previous region.

Returns:

split_segmentation (np.ndarray)

Original segmentation image array with new left and right

values.