mantidimaging.core.operations.arithmetic.arithmetic module

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

Bases: 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: QDoubleSpinBox, div_input_widget: QDoubleSpinBox, add_input_widget: QDoubleSpinBox, sub_input_widget: QDoubleSpinBox) 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: Images, div_val: float = 1.0, mult_val: float = 1.0, add_val: float = 0.0, sub_val: float = 0.0, cores: int | None = None, progress=None) Images[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: QFormLayout, on_change: Callable, view: BaseMainWindowView) Dict[str, 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.

Parameters:
  • view

  • form – the layout to create input widgets in

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

Returns:

the widgets bound as kwargs which are needed to call execute_wrapper