I divided the image into objects (fragments), using the method kindly provided by unutbu and Joe Kington, to this question: The rectangular bounding box around the drop in a monochrome image using python and have a list of these objects that takes the following form:
the_blobs = [(slice(dy.start, dy.stop, None), slice(dx.start, dx.stop, None))]
dy.start gives the initial y-pixel value, and dy.stop gives the final y-pixel value and the same deal for dx.
Inside the list there are some objects that overlap, i.e. one tiny object (square) is inside a larger object, such as a circle. When this happens, I want to remove the βclosedβ object from the list (since the circle has already included it), for example.
current list
the_blobs = [(slice(100L, 1000L, None), slice(100L, 1000L, None)), (slice(150L, 220L, None), slice(150L, 220L, None)), (slice(1001L, 2000L, None), slice(1500L, 1700L, None)), (slice(2001L, 2200L, None), slice(1800L, 1890L, None))]
perfect list (with deleted object)
the_blobs = [(slice(100L, 1000L, None), slice(100L, 1000L, None)), (slice(1001L, 2000L, None), slice(1500L, 1700L, None)), (slice(2001L, 2200L, None), slice(1800L, 1890L, None))]
It should be noted that within the framework of the above question, it was proposed to use the following code:
data_slices = ndimage.find_objects(coded_paws) for s in data_slices: filled[s] = True coded_paws, num_paws = ndimage.label(filled) data_slices = ndimage.find_objects(coded_paws)
However, this does not work in 100% of cases, and it really was a contribution slightly beyond the scope of the original question, so I re-open this part as a separate specific question.
Any ideas on how I can achieve this?

EDIT: Here is an example of an actual image that does not work with the above code.

processing returns

and

Ideally, I would like to remove the last image from the list of fragments