Skip to content

ldctbench.hub.utils

denoise_dicom(dicom_path, savedir, method, device=None, disable_progress=False)

Denoise a single DICOM or multiple DICOMs in a folder with a model from the model hub

Parameters:

  • dicom_path (str) –

    Path to a single DICOM file or a folder containig one or more DICOM files

  • savedir (str) –

    Foldername where to store denoised DICOM file(s) in

  • method (Union[Literal[RESNET, CNN10, DUGAN, QAE, REDCNN, TRANSCT, WGANVGG, BILATERAL], str]) –

    Enum item or string, specifying model to load. See ldctbench.hub.methods.Methods for more info.

  • device (Optional[device], default: None ) –

    torch.device, optional

  • disable_progress (bool, default: False ) –

    Disable progress bar (if denoising multiple DICOM files), by default False

Raises:

  • ValueError

    If provided path is neither a DICOM file nor a folder containing at least one DICOM file

Examples:

A comprehensive example using this function is provided in [Getting Started][denoise-dicom-using-pretrained-models].

denoise_numpy(x, method, device=None, num_slices_parallel=6, is_normalized=False)

Denoise a numpy array with a model from the model hub

Parameters:

  • x (ndarray) –

    Input numpy array. Must be either 2d (single slice) or 3d (with slices-first) order

  • method (Union[Literal[RESNET, CNN10, DUGAN, QAE, REDCNN, TRANSCT, WGANVGG, BILATERAL], str, Module]) –

    Enum item or string, specifying model to load. See ldctbench.hub.methods.Methods for more info. You can also pass a nn.Module directly.

  • device (Optional[device], default: None ) –

    torch.device, optional

  • num_slices_parallel (int, default: 6 ) –

    Number of slices to process in parallel, by default 6

  • is_normalized (bool, default: False ) –

    Whether data in array is already normalized for the model, by default False

Returns:

  • ndarray

    Prediction of the network

Raises:

  • ValueError

    If input is not a 2d or 3d array