or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

color.mddata.mddrawing.mdexposure.mdfeatures.mdfiltering.mdindex.mdio.mdmeasurement.mdmorphology.mdrestoration.mdsegmentation.mdtransform.mdutilities.md

drawing.mddocs/

0

# Drawing

1

2

Drawing primitives and shape generation functions for creating geometric shapes, annotations, and synthetic test patterns on images.

3

4

## Capabilities

5

6

### Line Drawing

7

8

```python { .api }

9

def line(r0, c0, r1, c1):

10

"""Generate line pixel coordinates."""

11

12

def line_aa(r0, c0, r1, c1):

13

"""Anti-aliased line coordinates."""

14

15

def bezier_curve(r0, c0, r1, c1, r2, c2, weight):

16

"""Quadratic Bézier curve coordinates."""

17

```

18

19

### Shape Drawing

20

21

```python { .api }

22

def circle_perimeter(r, c, radius, method='bresenham', shape=None):

23

"""Circle perimeter coordinates."""

24

25

def disk(center, radius, shape=None):

26

"""Filled disk coordinates."""

27

28

def ellipse(r, c, r_radius, c_radius, shape=None, rotation=0):

29

"""Filled ellipse coordinates."""

30

31

def ellipse_perimeter(r, c, r_radius, c_radius, orientation=0, shape=None):

32

"""Ellipse perimeter coordinates."""

33

34

def rectangle(start, end=None, extent=None, shape=None):

35

"""Filled rectangle coordinates."""

36

37

def polygon(r, c, shape=None):

38

"""Filled polygon coordinates."""

39

```

40

41

### Drawing Utilities

42

43

```python { .api }

44

def set_color(image, coords, color, alpha=1):

45

"""Set pixel colors at coordinates."""

46

47

def random_shapes(image_shape, max_shapes, min_shapes=1, min_size=2, max_size=None, multichannel=True, num_channels=3, shape=None, intensity_range=None, allow_overlap=False, num_trials=100, random_seed=None, channel_axis=-1):

48

"""Generate random geometric shapes."""

49

```

50

51

## Types

52

53

```python { .api }

54

from typing import Tuple, Union

55

from numpy.typing import NDArray

56

import numpy as np

57

58

Coordinates = NDArray[np.integer]

59

Color = Union[float, Tuple[float, ...]]

60

ShapeCoords = Tuple[NDArray[np.integer], NDArray[np.integer]]

61

```