dosma.core.numpy_routines.around
- dosma.core.numpy_routines.around(x, decimals=0, affine=False)[source]
Round medical image pixel data (and optionally affine) to the given number of decimals.
- Parameters:
x (MedicalVolume) – A medical image.
decimals (int, optional) – Number of decimal places to round to. If decimals is negative, it specifies the number of positions to the left of the decimal point.
affine (bool, optional) – If
True, rounds affine matrix.
- Returns:
The rounded medical image.
- Return type:
Examples
>>> mv = MedicalVolume(10*np.random.rand(3,4,5), affine=np.eye(4)) >>> mv_rounded = np.round(mv, decimals=3)