> ## 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.preprocess.wsi.provider.base

Abstract interface for tissue mask providers.

Defines the [`TissueMaskProvider`](/sdk-reference/preprocess/wsi/provider/base#tissuemaskprovider) abstract base class that [`TileExtractor`](/sdk-reference/extraction/wsi/tile_extraction#tileextractor) depends on for obtaining binary tissue masks.

## TissueMaskProvider

```python theme={null}
class TissueMaskProvider(ABC)
```

Abstract base class for tissue mask providers.

Every provider must implement [`generate`](/sdk-reference/preprocess/wsi/provider/base#generate), which receives an **open** [`WSIReader`](/sdk-reference/io/wsi/interface#wsireader) and returns a 2-D `uint8` binary mask where `1` = tissue.

[`TileExtractor`](/sdk-reference/extraction/wsi/tile_extraction#tileextractor) depends only on this interface, so any concrete provider — algorithmic, model-based, or pre-computed — can be plugged in.

**Example**:

```python theme={null}
class MyCustomMask(TissueMaskProvider):
    def generate(self, reader):
        return load_from_database(reader.path)
```

***

#### generate

```python theme={null}
@abstractmethod
def generate(reader: WSIReader, *, show_progress: bool = True) -> np.ndarray
```

Generates a binary tissue mask for the given slide.

<ParamField body="reader">
  An **open** WSI reader.
</ParamField>

<ParamField body="show_progress">
  Whether to display a progress bar. Defaults to `True`.
</ParamField>

**Returns**:

* `np.ndarray` - A `uint8` mask of shape `(H, W)` with values in `{0, 1}` where `1` = tissue.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.