neutompy.postproc.convert¶
-
neutompy.postproc.convert.
convert_to_uint
(arr, nbit=16, down=None, up=None, crop_roi=None)[source]¶ This function converts a floating point array to 8 or 16 bit unsigned integer array. The resampling can be performed in a user-specified dynamic range. The array can be also cropped by specifying the ROI coordinates.
Parameters: - arr (ndarray) – The floating point array to convert to unsigned integer array.
- nbit (int) – The number of bits of the returned array. In must be 8 or 16, for 8-bit or 16-bit unsigned integer, respectively. Default value is 16.
- down (float, optional) – The lower range limit. If None, the lower limit is computed as the minimum value of the input array.
- up (float, optional) – The upper range limit. If None, the upper limit is computed as the maximum value of the input array.
- crop_roi (tuple, optional) – Tuple defining the ROI of the array to crop. E.g. for a 3D stack (smin, smax, rmin, rmax, cmin, cmax), while for a 2D image (rmin, rmax, cmin, cmax). Default value is None, which disables the crop of the ROI.
Returns: m (ndarray) – The array resampled to 8-bit or 16-bit unsigned integer.