mantidimaging.core.operations.flat_fielding.flat_fielding module

class mantidimaging.core.operations.flat_fielding.flat_fielding.FlatFieldFilter[source]

Bases: BaseFilter

Uses the flat (open beam) and dark images to normalise a stack of images (radiograms, projections), and to correct for a beam profile, scintillator imperfections and/or detector inhomogeneities. This operation produces images of transmission values.

In practice, several open beam and dark images are averaged in the flat-fielding process.

Intended to be used on: Projections

When: As one of the first pre-processing steps

Caution: Make sure the correct stacks are selected for flat and dark.

Caution: Check that the flat and dark images don’t have any very bright pixels, or this will introduce additional noise in the sample. Remove outliers before flat-fielding.

static execute_wrapper(flat_before_widget: DatasetSelectorWidgetView, flat_after_widget: DatasetSelectorWidgetView, dark_before_widget: DatasetSelectorWidgetView, dark_after_widget: DatasetSelectorWidgetView, selected_flat_fielding_widget: QComboBox, use_dark_widget: QCheckBox) 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, flat_before: Images | None = None, flat_after: Images | None = None, dark_before: Images | None = None, dark_after: Images | None = None, selected_flat_fielding: str | None = None, use_dark: bool = True, cores=None, chunksize=None, progress=None) Images[source]

Do background correction with flat and dark images.

  • images – Sample data which is to be processed. Expected in radiograms

  • flat_before – Flat (open beam) image to use in normalization, collected before the sample was imaged

  • flat_after – Flat (open beam) image to use in normalization, collected after the sample was imaged

  • dark_before – Dark image to use in normalization, collected before the sample was imaged

  • dark_after – Dark image to use in normalization, collected after the sample was imaged

  • selected_flat_fielding – Select which of the flat fielding methods to use, just Before stacks, just After stacks or combined.

  • use_dark – Whether to use dark frame subtraction

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

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


Filtered data (stack of images)

filter_name = 'Flat-fielding'
static group_name() FilterGroup[source]
static register_gui(form, on_change, view) 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.

  • 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

static validate_execute_kwargs(kwargs)[source]
mantidimaging.core.operations.flat_fielding.flat_fielding.enable_correct_fields_only(selected_flat_fielding_widget, flat_before_widget, flat_after_widget, dark_before_widget, dark_after_widget, use_dark_frame)[source]