> ## 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.

Abstract interface for tissue mask providers.

Defines the `TissueMaskProvider` abstract base class that `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`, which receives an **open** `WSIReader` and returns a 2-D `uint8` binary mask where `1` = tissue.

`TileExtractor` depends only on this interface, so any concrete provider — algorithmic, model-based, or pre-computed — can be plugged in.

**Example** 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" type="WSIReader" required>
  An **open** WSI reader.
</ParamField>

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

<ResponseField name="returns" type="np.ndarray">
  A `uint8` mask of shape `(H, W)` with values in `{0, 1}` where `1` = tissue.
</ResponseField>
