mantidimaging.core.operations.arithmetic.arithmetic module

class mantidimaging.core.operations.arithmetic.arithmetic.ArithmeticFilter[source]

Bases: mantidimaging.core.operations.base_filter.BaseFilter

Add, subtract, multiply, or divide all grey values of an image with the given values.

Intended to be used on: Any

When: If you want to offset or rescale an image.

static execute_wrapper(mult_input_widget: PyQt5.QtWidgets.QDoubleSpinBox, div_input_widget: PyQt5.QtWidgets.QDoubleSpinBox, add_input_widget: PyQt5.QtWidgets.QDoubleSpinBox, sub_input_widget: PyQt5.QtWidgets.QDoubleSpinBox) functools.partial[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(images:, div_val: float = 1.0, mult_val: float = 1.0, add_val: float = 0.0, sub_val: float = 0.0, cores: Optional[int] = None, progress=None)[source]

Apply arithmetic operations to the pixels. :param images: The Images object. :param mult_val: The multiplication value. :param div_val: The division value. :param add_val: The addition value. :param sub_val: The subtraction value. :param cores: The number of cores that will be used to process the data. :param progress: The Progress object isn’t used. :return: The processed Images object.

filter_name = 'Arithmetic'
static register_gui(form: PyQt5.QtWidgets.QFormLayout, on_change: Callable, 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