[Scipy-tickets] [SciPy] #1498: scipy.ndimage.grey_dilation does not work with structure as only element.

SciPy Trac scipy-tickets@scipy....
Mon Aug 22 10:39:54 CDT 2011


#1498: scipy.ndimage.grey_dilation does not work with structure as only element.
---------------------------+------------------------------------------------
 Reporter:  pjay           |       Owner:  somebody   
     Type:  defect         |      Status:  new        
 Priority:  normal         |   Milestone:  Unscheduled
Component:  scipy.ndimage  |     Version:  0.9.0      
 Keywords:                 |  
---------------------------+------------------------------------------------
 In scipy.ndimage, these functions are present:
 grey_erosion(), grey_dilation(), grey_closing(), grey_opening()
 I want to use them with a non-flat structuring element. This works OK for
 grey_erosion(), but fails for grey_dilation() and the others.

 Here is a quick reproduction:

 {{{
 #!python
 >>> inputvals = range(20)
 >>> inputarray = numpy.array(inputvals)
 >>> s = numpy.array([2, 1, 0, 1, 2])
 >>> inputarray
 array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
        17, 18, 19])
 >>> scipy.ndimage.grey_erosion(inputarray, structure = s)
 array([-1, -2, -2, -1,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12,
        13, 14, 15])
 >>> scipy.ndimage.grey_dilation(inputarray, structure = s)

 Traceback (most recent call last):
   File "<pyshell#25>", line 1, in <module>
     scipy.ndimage.grey_dilation(inputarray, structure = s)
   File "C:\Python26\lib\site-packages\scipy\ndimage\morphology.py", line
 1416, in grey_dilation
     sz = size[ii]
 TypeError: 'NoneType' object is unsubscriptable
 }}}

 The grey_erode function calls filters._min_or_max_filter() immediately,
 where grey_dilate first does some calculation based on size and footprint
 parameters.

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


More information about the Scipy-tickets mailing list