[SciPy-user] indices, lists and arrays

Emanuele Zattin emanuelez@gmail....
Wed Jun 6 09:13:06 CDT 2007


i have something like this:

sizes = ndimage.sum(bl_img, labels=bl_l, index=range(1,bl_n+1))
sizes = array(sizes)
bl_obj_indices = where(sizes<21)
bl_l[bl_objects[bl_obj_indices]] = 0

sizes was a list, but i converted it to an array in order to use the
function where on it
where returns an array of arrays, something like (array([14, 17]),)
bl_objects is the output of ndimage.find_objects and is a list. this means
that the assignment on the last row of the proposed code does not work.
is there an elegant solution to solve the problem?

list(bl_obj_indices) returns [array([14, 17])] so it does not do the trick.
i would need something like [14, 17]

any hint?

Emanuele
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20070606/a9c22ef9/attachment.html 


More information about the SciPy-user mailing list