stouputils.data_science.data_processing.image.bias_field_correction module#
- bias_field_correction_image(image: ndarray[Any, dtype[Any]], ignore_dtype: bool = False) ndarray[Any, dtype[Any]] [source]#
Apply a bias field correction to an image. (N4 Filter)
- Parameters:
image (NDArray[Any]) – Image to apply the bias field correction (can’t be 8-bit unsigned integer)
ignore_dtype (bool) – Ignore the dtype check
- Returns:
Image with the curvature flow filter applied
- Return type:
NDArray[Any]
>>> ## Basic tests >>> image = np.random.randint(0, 255, size=(10,10), dtype=np.uint8) / 255 >>> corrected = bias_field_correction_image(image) >>> corrected.shape == image.shape True >>> corrected.dtype == np.float64 True
>>> ## Test invalid inputs >>> bias_field_correction_image("not an image") Traceback (most recent call last): ... AssertionError: Image must be a numpy array