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 compute_function(i: int, array: ndarray, params: Dict[str, float])[source]
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.

classmethod filter_func(images: ImageStack, div_val: float = 1.0, mult_val: float = 1.0, add_val: float = 0.0, sub_val: float = 0.0, progress=None) ImageStack[source]

Apply arithmetic operations to the pixels. :param images: The ImageStack 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 progress: The Progress object isn’t used. :return: The processed ImageStack 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.

  • 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