I am actually trying to connect the centroids in the form of a curved line and only want to keep the regions along the line.
Input Binary Image.
labeledImage = labelmatrix(bwconncomp(binaryImage,8));
props = regionprops(labeledImage, 'All');
allCentroids = vertcat(props.Centroid);
allCentroids = sortrows(allCentroids,1);
regions_to_keep = ????
binaryImage = ismember(labeledImage, find(regions_to_keep));
The Centroids and Line (OUTPUT):
- Here I am coming across a problem in which false regions are joined with the vertebral column. How to get rid of this problem?
The Desired Output?
- So far I have manually done this Image, as a last resort I am planning to call for user input and select/reject the regions based on user input.
So, in summary, I am facing the difficulty as follows:-
- Plotting the Curved Line Across Centroids (ONLY ALONG THE VERTERBAL COLUMN)
- False Regions merging into the Vertebral Column.