# sdmap¶

Syntax: sdmap(seeds, geometry, output, connectivity)

Calculates seeded distance map of a binary image. For each pixel in the image, finds the shortest pixel-by-pixel path to nearest seed region such that the path does not pass through regions that are marked as obstacles. The output is the length of the shortest path, calculated as sum of pixel-to-pixel steps that must be taken to follow the path. This is in contrast to the dmap command where the distance to the seed region is direct Euclidean distance and no separate obstacles are supported. Please note that comparing the output of dmap and sdmap commands might lead to surprising results due to the different definition of distance.

This command cannot be used in the distributed processing mode. If you need it, please contact the authors.

## Arguments¶

### seeds [input]¶

Data type: uint8 image, uint16 image, uint32 image, uint64 image, int8 image, int16 image, int32 image, int64 image, float32 image

Seed image that contains the set of pixels where the distance is zero. The set is marked with nonzero values, i.e. the distance map will propagate to pixels that have zero value in this image. This image is not modified.

### geometry [input]¶

Data type: uint8 image, uint16 image, uint32 image, uint64 image, int8 image, int16 image, int32 image, int64 image, float32 image

Image containing the geometry in which to calculate the distances. Regions marked with zero pixel value are ‘unpassable obstacles’. The distance transform will only proceed to pixels whose color in this image matches the color of the seed point (in this image). This image is not modified.

### output [output]¶

Data type: float32 image

Output image that will contain the distance to the nearest seed region, not passing through zero regions in the geometry image.

### connectivity [input]¶

Data type: connectivity

Default value: All

Connectivity of the distance map. Can be Nearest for connectivity to nearest neighbours only, or All for connectivity to all neighbours.