> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bioptimus.com/llms.txt
> Use this file to discover all available pages before exploring further.

# bioptimus.extraction.wsi

WSI extraction sub-package.

Provides tile-based and mega-tile-based region extraction from Whole Slide Images with tissue-mask filtering and multiple export formats.

Classes: TileExtractor: Grid-based tile extractor with tissue-mask filtering. TileSpec: Tile size, stride, resolution, and unit specification. MegaTileExtractor: Mega-tile (grid-of-tiles) extractor. MegaTileSpec: Mega-tile grid shape, layout, stride, and ratio bounds. MegaTileRegion: Container for an extracted mega tile and its tiles. GridLayout: Rectangular or hexagonal layout enum.

**Example**:

```python theme={null}
>>> from bioptimus.extraction.wsi import TileExtractor, TileSpec
>>> from bioptimus.extraction.wsi import MegaTileExtractor, MegaTileSpec, GridLayout
>>> from bioptimus.io.wsi.types import Level, MeasurementUnit
>>> spec = TileSpec(size=(256, 256), stride=(256, 256),
...                 resolution=Level(0), unit=MeasurementUnit.PIXELS)
>>> extractor = TileExtractor(tile_spec=spec)
```
