mantidimaging.core.operations.clip_values.clip_values module

class mantidimaging.core.operations.clip_values.clip_values.ClipValuesFilter[source]

Bases: BaseFilter

Clips grey values of the image based on the parameters. Can be used to remove outliers and noise (e.g. negative values) from reconstructed images.

Intended to be used on: Projections and reconstructed slices

When: To remove a range of pixel values from the data.

Caution: Make sure the value range does not clip information from the sample.

static execute_wrapper(clip_min_field=None, clip_max_field=None, clip_min_new_value_field=None, clip_max_new_value_field=None)[source]

Should construct a partial call to _filter_func using values taken from the widgets passed to this function as kwargs. :param kwargs: widgets which contain values required for _filter_func. :return: a partial call to _filter_func using parameters taken from the input widgets.

static filter_func(data, clip_min=None, clip_max=None, clip_min_new_value=None, clip_max_new_value=None, progress=None) Images[source]

Clip values below the min and above the max pixels.

  • data – Input data as a 3D numpy.ndarray.

  • clip_min – The minimum value to be clipped from the data. If None is provided then no lower threshold is used.

  • clip_max – The maximum value to be clipped from the data. If None is provided then no upper threshold is used.

  • clip_min_new_value – The value to use when replacing values less than clip_min. If None is provided then the value of clip_min is used.

  • clip_max_new_value – The value to use when replacing values greater than clip_max. If None is provided then the value of clip_max is used.


The processed 3D numpy.ndarray.

filter_name = 'Clip Values'
static register_gui(form, on_change, view)[source]

Adds any required input widgets to the given form and returns references to them.

The return values should be in a dict which can be unpacked as kwargs for a call to the operations execute_wrapper.

  • view

  • form – the layout to create input widgets in

  • on_change – the filter view action to be bound to all created inputs


the widgets bound as kwargs which are needed to call execute_wrapper