mantidimaging.core.operations.roi_normalisation.roi_normalisation module

class mantidimaging.core.operations.roi_normalisation.roi_normalisation.RoiNormalisationFilter[source]

Bases: BaseFilter

Normalises the image data by using the average value in a no-sample (air) region of interest (ROI) of the image. This scaling operation allows to account for beam fluctuations and different exposure times of projections.

Intended to be used on: Projections

When: Always, to ensure that any fluctuations in beam intensity are normalised.

Note: Beam fluctuations are visible by horizontal lines in the sinograms, as some projections are brighter/darker than the neighbours. This can be fixed with this operation.

static execute_wrapper(roi_field, norm_mode, flat_field)[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, region_of_interest: SensibleROI | None = None, normalisation_mode: str = 'Stack Average', flat_field: Images | None = None, cores=None, chunksize=None, progress=None)[source]

Normalise by beam intensity.

This does NOT do any checks if the Air Region is out of bounds! If the Air Region is out of bounds, the crop will fail at runtime. If the Air Region is in bounds, but has overlapping coordinates the crop give back a 0 shape of the coordinates that were wrong.

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

  • region_of_interest – The order is - Left Top Right Bottom. The air

region for which grey values are summed up and used for normalisation/scaling.

  • normalisation_mode

    Controls what the ROI counts are normalised to. ‘Preserve Max’ : Normalisation is scaled such that the maximum pixel value of the stack is equal before

    and after the operation.

    ’Stack Average’ : The mean value of the air region across all projections is preserved. ‘Flat Field’ : The mean value of the air regions in the projections is made equal to the mean value of the

    air region in the flat field image.

  • flat_field – Flat field to use if ‘Flat Field’ mode is enabled.

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

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

  • progress – Reference to a progress bar object


Filtered data (stack of images)

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

mantidimaging.core.operations.roi_normalisation.roi_normalisation.enable_correct_fields_only(text, flat_file_widget)[source]
mantidimaging.core.operations.roi_normalisation.roi_normalisation.modes() List[str][source]