mantidimaging.core.operations.nan_removal.nan_removal module

class mantidimaging.core.operations.nan_removal.nan_removal.NaNRemovalFilter[source]

Bases: mantidimaging.core.operations.base_filter.BaseFilter

Replaces the NaNs with a specified value or the median of neighbouring pixels.

Intended to be used on: Projections

When: To remove NaNs before reconstruction.

Note that the median method cannot remove continuous blocks of NaNs.

MODES = ['Constant', 'Median']
static execute_wrapper(mode_field=None, replace_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, replace_value=None, mode_value='Constant', cores=None, chunksize=None, progress=None)[source]
  • data – The input data.

  • mode_value – Values to replace NaNs with. One of [“Constant”, “Median”]

  • replace_value – In constant mode, the value to replace NaNs with.

  • cores – The number of cores that will be used to process the data.

  • chunksize – The number of chunks that each worker will receive.

  • progress – The optional Progress object.


The Images object with the NaNs replaced.

filter_name = 'NaN Removal'
static register_gui(form: PyQt5.QtWidgets.QFormLayout, on_change:, view: mantidimaging.gui.mvp_base.view.BaseMainWindowView) Dict[str, PyQt5.QtWidgets.QWidget][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

mantidimaging.core.operations.nan_removal.nan_removal.enable_correct_fields_only(mode_field, replace_value_field)[source]