Segmentation shoulder X-ray image
2 views (last 30 days)
Show older comments
I have humeral of shoulder x-ray image. I have segmented the original image to image segmentation as shown below by image segmenter matlab app.But I want segment like it automatically.
is there anyone can help me to segment the humeral only without background automatically?
to
1 Comment
Rik
on 25 Nov 2019
What steps did you use in the segmenter app? That is probably a strategy that would work if you can automate the user interaction.
Answers (3)
Constantino Carlos Reyes-Aldasoro
on 29 Nov 2019
Ok, here is the solution, following the ideas I had previously described. I downloaded your edges so it may not be exaclty the same as yours, I called that boneSegments:
Then I followed these steps
% label so that each segment can be identified
boneSegments_Lab = bwlabel(boneSegments);
% obtain the size of each segment
boneSegments_props = regionprops(boneSegments_Lab,'area');
% discard all those segments that are smaller than 200
contourBones = ismember(boneSegments_Lab,find([boneSegments_props.Area]>200));
% As the area is open in the bottom, add one line to create a closed region
contourBones(end,:) =1;
% clean by a) morphological closing to connect regions, b) thinning to keep a skeleton,
% c) removing spurious edges (the top)
contourBones_clean = bwmorph(bwmorph(imclose(contourBones,ones(3)),'thin','inf'),'spur',15);
% this can then be filled
fillBones = imfill(contourBones_clean,'holes');
% Display
imagesc(fillBones)
Problem solved. Hope that helps.
0 Comments
Constantino Carlos Reyes-Aldasoro
on 25 Nov 2019
Not trivial as the intensity is high on the top and right side of the image. Otherwise a thresholding after low pass filtering could be applied. Have you tried detecting edges with canny?
https://uk.mathworks.com/help/images/ref/edge.html?searchHighlight=edge&s_tid=doc_srchtitle
6 Comments
Image Analyst
on 28 Nov 2019
That edge detection is actually not bad. You can use bwareafilt() to keep only the longer segments, then close it with an edge-linking algorithm. There aren't any in MATLAB yet, but I'm working on one (it's not finished yet). Then call imfill(mask, 'holes').
Image Analyst
on 23 Jan 2020
OK, I think it's finished now. It's attached. edge_linking_points lets you click points on graph and then connects them, while edge_linking_image does it with an edge filtered image (as shown in the figure below). There are several options, like how close the endpoints need to be, and if you want to connect only one other point to an endpoint, or ALL others that are closer than some specified distance.
Constantino Carlos Reyes-Aldasoro
on 26 Nov 2019
Ok, this is a good start, try the following, assuming that your image is a
b = edge(a,'Canny',[],3);
So what you showed was b. Then do
c = bwlabel(b);
d = regionprops(c,'area');
That should label all the edges and then get their length. Then you should be able to discard all the small edges by using ismember based on the regionprops.
Once you have only one or two, which are the boundary of the bone, then you can use cumsum along the horizontal dimension so that each line will be something like this
0 0 0 0 0 ... 1 1 1 1 1 1 ... 2 2 2 2
where 0 is the left side before the first edge, the 1 is the central region and the 2 is the right side after the second edge. Then select the region == 1 and you should have the bone region.
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!