[SciPy-user] Bug in find_objects? (Was: Re: image processing)

Gary Ruben gruben at bigpond.net.au
Thu Nov 2 07:22:22 CST 2006


Hi Vincent,
I noticed noone replied to your email so I just tried your script and 
here's the output I get with scipy 0.5.0.2033:

[[0 1 1 0 0 0]
  [0 1 1 0 1 0]
  [0 0 0 1 1 1]
  [0 0 0 0 1 0]]

[[0 1 1 0 0 0]
  [0 1 1 0 2 0]
  [0 0 0 2 2 2]
  [0 0 0 0 2 0]]
2

Furthermore, if I add these lines to your script:

print f
print [objects[i] for i in f]

I get:

[(slice(0, 2, None), slice(1, 3, None)), (slice(1, 4, None), slice(3, 6, 
None))]
[array([[1, 1],
        [1, 1]]), array([[0, 1, 0],
        [1, 1, 1],
        [0, 1, 0]])]

Vicent Mas (V+) wrote:
> El Tuesday, 24 de October de 2006 13:41, Gary Ruben escribió:
>> I haven't actually tried this, but I think you should take a look at
>> scipy.ndimage.measurements.label
>> followed by
>> scipy.ndimage.measurements.find_objects
>> and
>> scipy.ndimage.measurements.maximum
>>
>> These sound like they will do what you want.
>>
>> Gary R.
>>
>> Carlos Medrano wrote:
>>> Vicent Mas (V+ <vmas <at> carabos.com> writes:
>>>> Hello,
>>>>
>>>> I'm a newcomer to process image and scipy. I'm trying to process a
>>>> binary image in order to get the biggest connected component. In
>>>> matlab one can use the bwareaopen to achieve this goal but I don't
>>>> know how to do it with scipy.  I've been looking at scipy.ndimage
>>>> module with no luck. Could you help me, please?
>>>>
>>>> Thanks in advance.
>>> [...]
> 
> Hello,
> 
> 
> I'm trying to use Gary's receipt (thanks Gary, and sorry for answering 
> so slowly :-( but I get the following error (as can be seen running the 
> attached script):
> 
> Traceback (most recent call last):
>   File "finder.py", line 13, in ?
>     measurements.find_objects(label_matrix)
>   
> File "/usr/local/lib/python2.4/site-packages/scipy/ndimage/measurements.py", 
> line 89, in find_objects
>     return _nd_image.find_objects(input, max_label)
> RuntimeError: data type not supported
> 
> 
> It seems to be a bug. Am I right? Or am I doing something stupid?
> 
> Thanks in advance for your help.


More information about the SciPy-user mailing list