rescale_image ================================================ .. py:function:: petpal.preproc.image_operations_4d.rescale_image(input_image: ants.core.ANTsImage, rescale_constant: float, op: str = '/') -> ants.core.ANTsImage Rescales a 3D or 4D ANTsImage intensity values by performing division or multiplication with a given constant. This function supports two operations: dividing the input image by a rescale constant or multiplying it by the constant. Division is only allowed with a positive rescale constant to avoid invalid operations. The operation is applied element-wise across the image data. :param input_image: Input image, given as an ANTsImage object. :type input_image: ants.core.ANTsImage :param rescale_constant: The constant to rescale the image intensities. For division (`op="/"`), this value must be greater than zero. :type rescale_constant: float :param op: Operation to perform, either `'/'` for division or `'*'` for multiplication. Default is `'/'`. :type op: str, optional :returns: *ants.core.ANTsImage* -- The rescaled ANTsImage with updated intensity values. :raises AssertionError: If `op` is not one of `'/'` or `'*'`. :raises AssertionError: If division (`op="/"`) is requested, but `rescale_constant` is not greater than zero. .. rubric:: Example .. code-block:: python import ants from petpal.preproc.image_operations_4d import rescale_image # Load a sample ANTsImage input_img = ants.image_read('example_image.nii') # Rescale intensities by division with a constant (e.g., 2.0) rescaled_img = rescale_image(input_image=input_img, rescale_constant=2.0, op='/') # Rescale intensities by multiplication with a constant (e.g., 1.5) rescaled_img = rescale_image(input_image=input_img, rescale_constant=1.5, op='*')