resomapper.processing.preprocessing

Functions

denoise(nifti_file_path, modality, output_folder[, ...])

select_denoising_filter(modality)

info_and_ask_denoising_params(filter_name, params)

Print a message indicating the selected filter and ask the user to input the

show_denoised_output(original_image, denoised_image[, ...])

Display the denoised output and residuals of the denoising process.

non_local_means_denoising(image, params[, check_params])

Apply non local means denoising to an image using specified parameters.

non_local_means_2_denoising(image, params[, check_params])

Apply non local means denoising to an image using specified parameters.

ascm_denoising(image, params[, check_params])

Apply Adapative Soft Coefficient Matching denoising to an image using

local_pca_denoising(image, gtab, params[, check_params])

Apply local PCA denoising to the given image using specified parameters.

mp_pca_denoising(image, params[, check_params])

Apply Marcenko-Pastur PCA denoising to an image using specified parameters.

patch2self_denoising(image, bvals, params[, check_params])

Apply patch2self denoising to the given image using specified parameters.

gibbs_suppress(nifti_file_path[, ...])

show_bias_field_correction_ask(original_image, ...)

n4_bias_field_correct(nifti_file_path[, ...])

Module Contents

resomapper.processing.preprocessing.denoise(nifti_file_path, modality, output_folder, params=None, selected_filter=None)
resomapper.processing.preprocessing.select_denoising_filter(modality)
resomapper.processing.preprocessing.info_and_ask_denoising_params(filter_name, params)

Print a message indicating the selected filter and ask the user to input the neccesary parameters.

Parameters:
  • filter_name (str) – Name of the selected filter.

  • params (dict) – Dictionary containing the parameter names along with a list that contains the predetermined value and a brief description

Returns:

Dictionary containing the selected values for each parameter name.

Return type:

dict

resomapper.processing.preprocessing.show_denoised_output(original_image, denoised_image, ask_user='Denoising')

Display the denoised output and residuals of the denoising process.

This method takes the original image and its denoised counterpart and displays them side by side along with the residual image obtained by computing the element-wise squared difference between the original and denoised images. A middle slice is shown.

Parameters:
  • original_image (numpy.ndarray) – The original 3D or 4D image to be denoised.

  • denoised_image (numpy.ndarray) – The denoised version of the original image.

Returns:

A boolean value indicating whether the user wants to change the

denoising parameters.

Return type:

bool

resomapper.processing.preprocessing.non_local_means_denoising(image, params, check_params=True)

Apply non local means denoising to an image using specified parameters. This version uses the skimage library implementation of this filter.

Parameters:
  • image (numpy.ndarray) – Input 3D/4D image array to be denoised.

  • params (dict or None) – Dictionary containing the denoising parameters to be used. If None, the user will be prompted to select the parameters.

Returns:

A tuple containing the denoised image and the selected denoising

parameters.

Return type:

tuple

resomapper.processing.preprocessing.non_local_means_2_denoising(image, params, check_params=True)

Apply non local means denoising to an image using specified parameters. This version uses Dipy’s implementation of this filter.

Parameters:
  • image (numpy.ndarray) – Input 3D/4D image array to be denoised.

  • params (dict or None) – Dictionary containing the denoising parameters to be used. If None, the user will be prompted to select the parameters.

Returns:

A tuple containing the denoised image and the selected denoising

parameters.

Return type:

tuple

resomapper.processing.preprocessing.ascm_denoising(image, params, check_params=True)

Apply Adapative Soft Coefficient Matching denoising to an image using specified parameters.

Parameters:
  • image (numpy.ndarray) – Input 3D/4D image array to be denoised.

  • params (dict or None) – Dictionary containing the denoising parameters to be used. If None, the user will be prompted to select the parameters.

Returns:

A tuple containing the denoised image and the selected denoising

parameters.

Return type:

tuple

resomapper.processing.preprocessing.local_pca_denoising(image, gtab, params, check_params=True)

Apply local PCA denoising to the given image using specified parameters.

Parameters:
  • image (numpy.ndarray) – Input 3D/4D image array to be denoised.

  • gtab (numpy.ndarray) – B-values and gradient directions associated with the input image.

  • params (dict or None) – Dictionary containing the denoising parameters to be used. If None, the user will be prompted to select the parameters.

Returns:

A tuple containing the denoised image and the selected denoising

parameters.

Return type:

tuple

resomapper.processing.preprocessing.mp_pca_denoising(image, params, check_params=True)

Apply Marcenko-Pastur PCA denoising to an image using specified parameters.

Parameters:
  • image (numpy.ndarray) – Input 3D/4D image array to be denoised.

  • params (dict or None) – Dictionary containing the denoising parameters to be used. If None, the user will be prompted to select the parameters.

Returns:

A tuple containing the denoised image and the selected denoising

parameters.

Return type:

tuple

resomapper.processing.preprocessing.patch2self_denoising(image, bvals, params, check_params=True)

Apply patch2self denoising to the given image using specified parameters.

Parameters:
  • image (numpy.ndarray) – Input 3D/4D image array to be denoised.

  • bvals (numpy.ndarray) – B-values associated with the input image.

  • params (dict or None) – Dictionary containing the denoising parameters to be used. If None, the user will be prompted to select the parameters.

Returns:

A tuple containing the denoised image and the selected denoising

parameters.

Return type:

tuple

resomapper.processing.preprocessing.gibbs_suppress(nifti_file_path, unringed_nii_output_path=None, check_params=True)
resomapper.processing.preprocessing.show_bias_field_correction_ask(original_image, corrected_image, log_bias_field)
resomapper.processing.preprocessing.n4_bias_field_correct(nifti_file_path, corrected_nii_output_path=None, params=None, check_params=True)