title: How does the scipy distance_transform_edt function work?
body: <p><a href="https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.ndimage.morphology.distance_transform_edt.html" rel="noreferrer">https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.ndimage.morphology.distance_transform_edt.html</a></p>
  
  <p>I'm having trouble understanding how the Euclidean distance transform function works in Scipy. From what I understand, it is different than the Matlab function (bwdist). As an example, for the input:</p>
  
  <pre><code>[[ 0.  0.  0.  0.  0.]
   [ 0.  1.  0.  0.  0.]
   [ 0.  0.  0.  0.  0.]
   [ 0.  0.  0.  1.  0.]
   [ 0.  0.  0.  0.  0.]]
  </code></pre>
  
  <p>The scipy.ndimage.distance_transform_edt function returns the same array:</p>
  
  <pre><code>[[ 0.  0.  0.  0.  0.]
   [ 0.  1.  0.  0.  0.]
   [ 0.  0.  0.  0.  0.]
   [ 0.  0.  0.  1.  0.]
   [ 0.  0.  0.  0.  0.]]
  </code></pre>
  
  <p>But the matlab function returns this:</p>
  
  <pre><code>1.4142    1.0000    1.4142    2.2361    3.1623
  1.0000         0    1.0000    2.0000    2.2361
  1.4142    1.0000    1.4142    1.0000    1.4142
  2.2361    2.0000    1.0000         0    1.0000
  3.1623    2.2361    1.4142    1.0000    1.4142
  </code></pre>
  
  <p>which makes more sense, as it is returning the "distance" to the nearest one.</p>