mantidimaging.core.operations.crop_coords.crop_coords module

class mantidimaging.core.operations.crop_coords.crop_coords.CropCoordinatesFilter[source]

Bases: BaseFilter

Crop a region of interest from the image.

Intended to be used on: A stack of projections, or reconstructed slices

When: To select part of the image that is to be processed further; this reduces memory usage and can greatly improve the speed of reconstruction.

Caution: Make sure the region of cropping does not crop parts of the sample during the rotation of the sample in the dataset.

static execute_wrapper(roi_field: QLineEdit) 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, region_of_interest: List[int] | List[float] | SensibleROI | None = None, progress=None) Images[source]

Execute the Crop Coordinates by Region of Interest filter. This does NOT do any checks if the Region of interest is out of bounds!

If the region of interest is out of bounds, the crop will FAIL at runtime.

If the region of interest is in bounds, but has overlapping coordinates the crop give back a 0 shape of the coordinates that were wrong.

  • images – Input data as a 3D numpy.ndarray

  • region_of_interest – Crop original images using these coordinates. The selection is a rectangle and expected order is - Left Top Right Bottom.


The processed 3D numpy.ndarray

filter_name = 'Crop Coordinates'
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.crop_coords.crop_coords.execute_single(data, roi, progress=None, out=None)[source]