N4 Bias Correction

n4_bias_correction.n4_bias_corrector

class brainles_preprocessing.n4_bias_correction.n4_bias_corrector.N4BiasCorrector

Bases: ABC

_abc_impl = <_abc._abc_data object>
abstract correct(input_img_path: Any, output_img_path: Any) None

n4_bias_correction.sitk

class brainles_preprocessing.n4_bias_correction.sitk.sitk_n4_bias_corrector.SitkN4BiasCorrector(mask_func: Callable[[Image], Image] | None = None, n_max_iterations: int | None = None, n_fitting_levels: int = 3)

Bases: N4BiasCorrector

_abc_impl = <_abc._abc_data object>
compute_mask(img_itk: Image) Image

Compute the mask for the input image using the provided mask function.

Parameters:

img_itk (SimpleITK.Image) – The input image in SimpleITK format.

Returns:

The computed mask.

Return type:

SimpleITK.Image

correct(input_img_path: str | Path, output_img_path: str | Path) None

Correct the bias field of the input image using SimpleITK.

Parameters:
  • input_img_path (Union[str, Path]) – Path to the input image.

  • output_img_path (Union[str, Path]) – Path where the corrected image will be saved.

Returns:

None