- spatialdata.get_extent(e, coordinate_system='global', exact=True, has_images=True, has_labels=True, has_points=True, has_shapes=True, elements=None)#
Get the extent (bounding box) of a SpatialData object or a SpatialElement.
- Return type:
The minimum coordinate of the bounding box.
The maximum coordinate of the bounding box.
The names of the dimensions of the bounding box
If True, the extent is computed exactly. If False, an approximation faster to compute is given. The approximation is guaranteed to contain all the data, see notes for details.
If True, images are included in the computation of the extent.
If True, labels are included in the computation of the extent.
If True, points are included in the computation of the extent.
If True, shapes are included in the computation of the extent.
If not None, only the elements with the given names are included in the computation of the extent.
The extent of a SpatialData object is the extent of the union of the extents of all its elements. The extent of a SpatialElement is the extent of the element in the coordinate system specified by the argument
exactis False, first the extent of the SpatialElement before any transformation is computed. Then, the extent is transformed to the target coordinate system. This is faster than computing the extent after the transformation, since the transformation is applied to extent of the untransformed data, as opposed to transforming the data and then computing the extent.
The exact and approximate extent are the same if the transformation doesn’t contain any rotation or shear, or in the case in which the transformation is affine but all the corners of the extent of the untransformed data (bounding box corners) are part of the dataset itself. Note that this is always the case for raster data.
An extreme case is a dataset composed of the two points (0, 0) and (1, 1), rotated anticlockwise by 45 degrees. The exact extent is the bounding box [minx, miny, maxx, maxy] = [0, 0, 0, 1.414], while the approximate extent is the box [minx, miny, maxx, maxy] = [-0.707, 0, 0.707, 1.414].