I am using MATLAB.
I have a three dimensional array filled with booleans. This array represents data about a cylinder with N uniformly formed, but arbitrary oriented brackets in it. The volume is sampled in voxels (3-dimensional pixels), and a logical “1” means “at this point in the cylinder IS is part of the bracket”, and “0” means “air at this point in the cylinder”. The following figure contains ONE two-dimensional fragment of the full volume. Imagine a full volume consisting of such slices. White means "1" and black means "0". 
To my problem now: I have to separate each clip as best as possible. The output products must be N three-dimensional arrays, with only voxels belonging to a particular staple being "1", and everything else is "0". So I have arrays containing only data of one binding.
The biggest problem is that “1 of the different staples can lie next to each other (touch and tangled) , which makes it difficult to decide which main object they belong to. The simplification is that the staple boundary voxels can be trimmed , I can work with any output array that preserves the approximate shape of the original stitching.
Perhaps some of you can give an idea of how you can solve such a problem or even call me algorithms that I can take a look at. Thanks in advance.
source share