@@ -1547,7 +1547,7 @@ Important differences from vigra and fastfilters:
15471547 largest → smallest. This matches ` fastfilters ` . To get vigra's
15481548 ascending order, reverse with ` result[..., ::-1] ` .
15491549- No IIR / recursive Gaussian, no ` convolve ` / ` recursiveFilter2D ` , no
1550- morphology, no distance transforms, no nonlinear diffusion, and no
1550+ morphology, no nonlinear diffusion, and no
15511551 non-local means in v1. Use ` scipy.ndimage ` , ` skimage ` , or the original
15521552 vigra/fastfilters bindings if you need those.
15531553
@@ -1562,6 +1562,48 @@ Implementation notes:
15621562 ` detail/threading.hxx::parallel_for_chunks ` without changing the
15631563 public API.
15641564
1565+ ### Distance Transforms
1566+
1567+ ` bioimage-cpp ` exposes exact binary Euclidean distance transforms under
1568+ ` bic.distance ` .
1569+
1570+ SciPy / vigra:
1571+
1572+ ``` python
1573+ from scipy import ndimage
1574+ dist = ndimage.distance_transform_edt(mask, sampling = (2.0 , 1.0 ))
1575+
1576+ import vigra.filters as vf
1577+ vec = vf.vectorDistanceTransform(mask)
1578+ ```
1579+
1580+ bioimage-cpp:
1581+
1582+ ``` python
1583+ import bioimage_cpp as bic
1584+
1585+ dist = bic.distance.distance_transform(mask, sampling = (2.0 , 1.0 ))
1586+ vec = bic.distance.vector_difference_transform(mask, sampling = (2.0 , 1.0 ))
1587+ ```
1588+
1589+ Name mapping:
1590+
1591+ | scipy / vigra name | bioimage-cpp name |
1592+ | --- | --- |
1593+ | ` scipy.ndimage.distance_transform_edt ` | ` distance_transform ` |
1594+ | ` vigra.filters.vectorDistanceTransform ` | ` vector_difference_transform ` |
1595+
1596+ Important differences:
1597+
1598+ - Distance-valued outputs are ` float32 ` , not SciPy's ` float64 ` .
1599+ - ` distance_transform ` follows SciPy's binary convention: nonzero values are
1600+ foreground and distances are measured to the nearest zero-valued element.
1601+ - ` vector_difference_transform ` returns ` float32 ` vectors with shape
1602+ ` mask.shape + (mask.ndim,) ` . Components are sampled displacements from each
1603+ foreground element to its nearest zero-valued element in NumPy axis order.
1604+ - The initial implementation prioritizes correctness and API coverage over
1605+ performance; benchmarks and optimized kernels are planned separately.
1606+
15651607## I/O and Build Dependencies
15661608
15671609` bioimage-cpp ` intentionally does not replace nifty or affogato I/O helpers.
0 commit comments