[Scipy-tickets] [SciPy] #954: ndimage.distance_transform_edt(False) Crashes

SciPy Trac scipy-tickets@scipy....
Thu May 3 13:53:02 CDT 2012


#954: ndimage.distance_transform_edt(False) Crashes
---------------------------+------------------------------------------------
 Reporter:  luispedro      |       Owner:  somebody    
     Type:  defect         |      Status:  needs_review
 Priority:  normal         |   Milestone:  Unscheduled 
Component:  scipy.ndimage  |     Version:  0.7.0       
 Keywords:                 |  
---------------------------+------------------------------------------------
Changes (by jjhelmus):

 * cc: jjhelmus@… (added)
  * status:  new => needs_review


Comment:

 In the file ndimage/morphology.py, line 2155 (0.9.0) or 2163 (github):
 {{{
 input = numpy.where(input, 1, 0).astype(numpy.int8)
 }}}
 Creates a zero length array when input is False (or 0, 1, etc) which is
 expected to be at least length one.  Changing this to:
 {{{
 input = numpy.atleast_1d(numpy.where(input, 1, 0).astype(numpy.int8))
 }}}
 solves this problem.  Attached patch implements this change.

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/954#comment:2>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list