httomolibgpu.misc.rescale
#
Module for data rescaling. For more detailed information see Data rescale module.
- httomolibgpu.misc.rescale.rescale_to_int(data: typing.Union[<cp.ndarray>, <cp.ndarray>], perc_range_min: float = 0.0, perc_range_max: float = 100.0, bits: typing.Literal[8, 16, 32] = 8, glob_stats: typing.Optional[typing.Tuple[float, float, float, int]] = None) Union[<cp.ndarray>, <cp.ndarray>] [source]#
Rescales the data given as float32 type and converts it into the range of an unsigned integer type with the given number of bits. For more detailed information and examples, see Rescale to integers.
- Parameters
data (Union[np.ndarray, cp.ndarray]) – Input data as a numpy or cupy array (the function is cpu-gpu agnostic)
perc_range_min (float, optional) – The lower cutoff point in the input data, in percent of the data range (defaults to 0). The lower bound is computed as min + perc_range_min/100*(max-min)
perc_range_max (float, optional) – The upper cutoff point in the input data, in percent of the data range (defaults to 100). The upper bound is computed as min + perc_range_max/100*(max-min)
bits (Literal[8, 16, 32], optional) – The number of bits in the output integer range (defaults to 8). Allowed values are: - 8 -> uint8 - 16 -> uint16 - 32 -> uint32
glob_stats (tuple, optional) – Global statistics of the full dataset (beyond the data passed into this call). It’s a tuple with (min, max, sum, num_items). If not given, the min/max is computed from the given data.
- Returns
The original data, clipped to the range specified with the perc_range_min and perc_range_max, and scaled to the full range of the output integer type
- Return type
Union[np.ndarray, cp.ndarray]