<commit_before>distance-transform
==================
[Distance transforms](http://en.wikipedia.org/wiki/Distance_transform) for [Lp metrics](https://en.wikipedia.org/wiki/Lp_space) on binary [ndarrays](https://github.com/mikolalysenko/ndarray).  This code is based on Meijster's algorithm.  For more information see:

* https://github.com/parmanoir/Meijster-distance
* http://dissertations.ub.rug.nl/FILES/faculties/science/2004/a.meijster/c2.pdf


Example
=======

```javascript
//Generate some shape as a binary voxel image
var x = require("ndarray").zeros([256, 256])
x.set(128, 128, 1)

//Distance transform x in the Euclidean metric
require("distance-transform")(x)

//Save result
require("save-pixels")(x, "png").pipe(process.stdout)
```

Which creates the following image:

<img src="example/example.png">

Install
=======

    npm install distance-transform
    
## `require("distance-transform")(array[, p])`
Performs a distance transform of `array` in place using Meijster's algorithm.

* `array` is the array to transform
* `p` is the exponent for the metric.  (Default 2)

For different values of p you get different transforms

* `p = 1` gives the Manhattan/taxicab distance metric
* `p = 2` gives the Euclidean distance metric
* `p = Infinity` gives the Chebyshev/chessboard distance metric
* Other values of p give various interpolants

`array` is updated in place and gets the distance values.

Credits
=======
(c) 2013 <NAME>. MIT License.
<commit_msg>fixed image url<commit_after>distance-transform
==================
[Distance transforms](http://en.wikipedia.org/wiki/Distance_transform) for [Lp metrics](https://en.wikipedia.org/wiki/Lp_space) on binary [ndarrays](https://github.com/mikolalysenko/ndarray).  This code is based on Meijster's algorithm.  For more information see:

* https://github.com/parmanoir/Meijster-distance
* http://dissertations.ub.rug.nl/FILES/faculties/science/2004/a.meijster/c2.pdf


Example
=======

```javascript
//Generate some shape as a binary voxel image
var x = require("ndarray").zeros([256, 256])
x.set(128, 128, 1)

//Distance transform x in the Euclidean metric
require("distance-transform")(x)

//Save result
require("save-pixels")(x, "png").pipe(process.stdout)
```

Which creates the following image:

<img src="https://raw.github.com/mikolalysenko/distance-transform/master/example/example.png">

Install
=======

    npm install distance-transform
    
## `require("distance-transform")(array[, p])`
Performs a distance transform of `array` in place using Meijster's algorithm.

* `array` is the array to transform
* `p` is the exponent for the metric.  (Default 2)

For different values of p you get different transforms

* `p = 1` gives the Manhattan/taxicab distance metric
* `p = 2` gives the Euclidean distance metric
* `p = Infinity` gives the Chebyshev/chessboard distance metric
* Other values of p give various interpolants

`array` is updated in place and gets the distance values.

Credits
=======
(c) 2013 <NAME>. MIT License.

{'fraction_non_alphanumeric': 0.14385614385614387, 'fraction_numerical': 0.016650016650016652, 'mean_word_length': 4.8671875, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4240762', 'n_tokens_mistral': 995, 'n_tokens_neox': 895, 'n_words': 288}