For my research I am creating an image (cross section of an artery). In that image some 'regions' can clearly be seen. I would like to write some code that can (semi) automatically create regions out of the image. Maybe my explanation is not so clear, so I included a visual representation of what I'd like. My question is, can anyone help with finding a strategy how to device this. I've tried some tricks but up until now these are not satisfactory.
The result I have up until now:
What I would like to have:
So it needs to be 'cleaned' up and the missing connections need to be connected once more (as shown in red). I am not really worried about the lines in the center, but if they are also effected by the code that's fine. I have found a function that draws brezier curves (https://nl.mathworks.com/matlabcentral/fileexchange/33828-generalised-bezier-curve-matlab-code), so the red parts could be manually added if that helps.
Thank you in advance