TVL1Denoising

giant.image_processing.denoising:

class giant.image_processing.denoising.TVL1Denoising(options=None)[source]

Implements denoising using the total variation approach with a prime dual algorithm.

Essentially we minimize the following .. math:

\left\|\left\|\nabla \mathbf{I}\right\|\right\| + \lambda\sum_i\left\|\left\|\mathbf{I}-\mathbf{N}_i\right\|\right\|

where \(\mathbf{I}\) is the denoised image, \(\mathbf{N}_i\) are the input images, \(\nabla \mathbf{I}\) is the gradient of the smoothed image, \(\lambda\) is a tuning parameter balancing between smooth images (smaller) and crisp images (higher), and \(\left\|\left\|\bullet\right\|\right\|\) is the \(L_2\) norm operator.

Generally, this works ok for denoising but can easily mistake dim point sources for noise and can produce weird ring artifacts around point sources, therefore, for star/point source only images it is probably preferable to use something like the GaussianDenoising.

For more details on the algorithm see https://hal.science/hal-00437581v1

Parameters:

options (TVL1DenoisingOptions | None) – the options to configure the class with

allowed_dtypes: list[DTypeLike] = [<class 'numpy.uint8'>]

The allowed datatype.

lambda_p: float = 1.0

Lower values leads to more noise removal but more bluring.

Must be > 0

n_iter: int = 30

The number of iterations to run

property options_dict: Dict

Determine the options input to the dataclass.

This property method will ignore all internal properties and functions

property original_options: OptionsT

Get the original configuration options.

Returns:

OptionsT: The original options used during initialization.

Warning

Modifying the returned object will affect reset behavior.

Summary of Methods

apply_options

Update the options as attributes of the object class

comparison_dictionary

Compares each attribute of self to other and stores the result in a dict mapping the attribute to the comparison result.

local_vars

this is used to overwrite options in variables only used in __init__

override_options

This method is used for special cases when certain options should be overwritten

reset_settings

Resets the class to the state it was originally initialized with.