zetta_utils.geometry

  1. autoclass:: zetta_utils.geometry.bbox.BBox3D

zetta_utils.geometry.bbox.BBox3D.from_slices(slices, resolution=(1, 1, 1), unit='nm')

Create a BBox3D from slices at the given resolution.

Parameters
  • slices (tuple[slice, slice, slice]) – Tuple of slices representing a bounding box.

  • resolution (Sequence[float]) – Resolution at which the slices are given. If not given, assumed to be unit resolution.

  • unit (str) – Unit name (decorative purposes only).

Return type

BBox3D

zetta_utils.geometry.bbox.BBox3D.from_coords(start_coord, end_coord, resolution=(1, 1, 1), unit='nm')

Create a BBox3D from start and end coordinates at the given resolution.

Parameters
  • start_coord (Sequence[float]) – Start coordinate.

  • end_coord (Sequence[float]) – End coordinate.

  • resolution (Sequence[float]) – Resolution at which the coordinates are given. If not given, assumed to be unit resolution.

  • unit (str) – Unit name (decorative purposes only).

Return type

BBox3D

BBox3D.ndim
Return type

int

zetta_utils.geometry.bbox.BBox3D.get_slice(self, dim, resolution, allow_slice_rounding=False, round_to_int=True)

Represent the bounding box as a slice along the given dimension.

Parameters
  • dim (int) – Dimension along which the slice will be taken.

  • resolution (Union[int, float, Sequence[float]]) – Resolution at which the slice will be taken.

  • allow_slice_rounding (bool) – Whether to allow representing bounding box with non-integer slice start/end at the given resolution.

  • round_to_int (bool) – Whether the slices should be returned as an int or whether they should be returned as raw. If set to False, takes precedence over allow_slice_rounding.

Return type

slice

Returns

Slice representing the bounding box.

zetta_utils.geometry.bbox.BBox3D.to_slices(self, resolution, allow_slice_rounding=False, round_to_int=True)

Represent the bounding box as a tuple of slices.

Parameters
  • resolution (Sequence[float]) – Resolution at which the slices will be taken.

  • allow_slice_rounding (bool) – Whether to allow representing bounding box with non-integer slice start/end at the given resolution.

  • round_to_int (bool) – Whether the slices should be returned as an int or whether they should be returned as raw. If set to False, takes precedence over allow_slice_rounding.

Return type

tuple[slice, slice, slice]

Returns

Slices representing the bounding box.

zetta_utils.geometry.bbox.BBox3D.padded(self, pad, resolution)

Create a padded (i.e. expanded) version of this bounding box.

Parameters
Return type

BBox3D

Returns

Padded bounding box.

zetta_utils.geometry.bbox.BBox3D.translated(self, offset, resolution)

Create a translated version of this bounding box.

Parameters
  • offset (Sequence[float]) – Specification of how much to translate along each dimension.

  • resolution (Sequence[float]) – Resolution at which offset specification was given.

Return type

BBox3D

Returns

Translated bounding box.

class zetta_utils.geometry.BBoxStrider
zetta_utils.geometry.BBoxStrider.get_all_chunk_bboxes(self)

Get all of the chunks.

Return type

List[BBox3D]

zetta_utils.geometry.BBoxStrider.get_nth_chunk_bbox(self, n)

Get nth chunk bbox, in order.

Parameters

n (int) – Integer chunk index.

Return type

BBox3D

Returns

Volumetric index for the chunk, including self.desired_resolution and the slice representation of the region at self.index_resolution.