This module defines the Region object, whose instances define regions of interest in images.

class islatu.region.Region(x_start, x_end, y_start, y_end)[source]

Bases: object

Instances of this class define regions of interest.

classmethod from_dict(region_dict: dict)[source]
Instantiates a Region from a dictionary with keys in:

[‘x’, ‘y’, ‘width’, ‘height’].

This is to help loading dictionarys that are generated by calling json.loads on the NXcollections found in I07 nexus files as of 27/04/2022.

property num_pixels

returns the number of pixels in the region.

property x_length

Returns the length of the region in the x-direction.

property y_length

Returns the length of the region in the y-direction.