Level— Pyramid level index (0 = highest resolution).MPP— Microns per pixel (µm/pixel).Magnification— Objective power (e.g., 20x).WSIDims— Width and height dimensions.WSIBounds— A bounding box for tissue regions.MeasurementUnit— Enum for pixels or microns.RegionLocation— X/Y coordinates of a region.RegionShape— Dimensions and units of a region.RegionSpec— Full specification (Location + Shape + Resolution).Region— Container for PIL image data and its RegionSpec.
Level
int
The pyramid level index (0-based).
ValueError— Ifindexis negative.
- Level 0 is the highest resolution.
- Higher indices correspond to lower resolution levels in the pyramid.
- This class stores the level index as a primitive integer and is immutable.
MPP
float
The pixel size in microns to represent as MPP.
ValueError— Ifvalueis not positive.
Magnification
- 10x: low-resolution overview
- 20x: standard diagnostic resolution
- 40x: high-resolution for detailed analysis
float
The objective power.
ValueError— Ifvalueis not positive.
WSIDims
int
The width of the image in pixels.
int
The height of the image in pixels.
WSIBounds
int
The X coordinate of the top-left corner.
int
The Y coordinate of the top-left corner.
int
The width of the bounding box.
int
The height of the bounding box.
dims
WSIDims
The dimensions of the bounding box.
MeasurementUnit
has_value
str
required
The string to check.
bool
True if valid, False otherwise.
RegionLocation
int
The top coordinate of the top-left corner of the region.
int
The left coordinate of the top-left corner of the region.
int
The width of the region in pixels.
int
The height of the region in pixels.
x
y
RegionShape
int
The width of the region in pixels.
int
The height of the region in pixels.
MeasurementUnit
The unit of measurement for the shape dimensions (e.g., PIXELS, UM).
shape
tuple[int, int]
tuple[int, int]: A tuple containing (width, height).
to_um
float
The pixel count to convert.
MPP
required
The microns-per-pixel scale.
float
The length in microns.
to_pixels
float
The length in microns to convert.
MPP
required
The microns-per-pixel scale.
float
The length in pixels.
RegionMaskSpec
float
Pixels belonging to the mask relative to the total region area.
np.ndarray | None
The mask applied to the region, or
None if mask storage was not requested.RegionSpec
RegionLocation
The location of the region within the slide.
RegionShape
The shape of the region.
Resolution
The resolution at which the region is defined (Level, MPP, or Magnification).
Region
PIL.Image.Image
The pixel data of the region as a PIL Image.
RegionSpec
The specifications of the region, including location, shape, resolution, and mask.
location
shape
resolution
measurement_unit
mask
Union[np.ndarray, None]
np.ndarray | None: The mask array, or
None if mask storage was not requested during extraction.
