crop_image ============================================= .. py:function:: petpal.preproc.image_operations_4d.crop_image(input_image_path: str, out_image_path: str, x_dim: int = 256, y_dim: int = 256) Crops an image in the X and Y axes to exclude voxels outside of the head. This is done to reduce the size of the image for faster processing, while preserving scientifically valuable information. Preserves dimension along Z and time axes. The returned, cropped image is centered on the "center of mass" computed using :py:func:`scipy.ndimage.center_of_mass`. If the image is 3D, the center of mass is computed directly on the image array. If the image is 4D, the image is first averaged over the time axis before computing the center of mass. :param input_image_path: Path to input image to be cropped. :type input_image_path: str :param out_image_path: Path to which cropped image is saved. :type out_image_path: str :param x_dim: Size of the X axis of the returned image. Default value 256. :type x_dim: int :param y_dim: Size of the Y axis of the returned image. Default value 256. :type y_dim: int :returns: *cropped_image (nibabel.nifti1.Nifti1Image)* -- The cropped image.