mantidimaging.core.operations.rescale.rescale module#

class mantidimaging.core.operations.rescale.rescale.RescaleFilter[source]#

Bases: BaseFilter

Rescales the image data to a new [0, maximum output] range.

Intended to be used on: Any

When: Automatically used when saving as unsigned integer image formats, to avoid clipping negative values

static compute_function(index: int, array: ndarray, params: dict)[source]#
static execute_wrapper(min_input_widget: QDoubleSpinBox, max_input_widget: QDoubleSpinBox, max_output_widget: QDoubleSpinBox, preset_widget: QComboBox) 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_array(image: ndarray, min_input: float, max_input: float, max_output: float) ndarray[source]#
static filter_func(images: ImageStack, min_input: float = 0.0, max_input: float = 10000.0, max_output: float = 256.0, progress=None) ImageStack[source]#
Parameters:
  • min_input – The Minimum value of the data that will be used. Anything below this will be clipped to 0.

  • max_input – Maximum value of the data that will be used. Anything above it will be clipped to 0.

  • max_output – Maximum value of the OUTPUT images. They will be rescaled to range [0, MAX OUTPUT].

Returns:

The ImageStack object scaled to a new range.

filter_name = 'Rescale'#
static register_gui(form, on_change, view: FiltersWindowView) dict[str, Any][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

static validate_execute_kwargs(kwargs: dict[str, Any]) bool[source]#