Image Segmentation and Labeling

조회 수: 16 (최근 30일)
RFM
RFM 2020년 8월 15일
댓글: Image Analyst 2022년 5월 25일
Dear All,
I am working on DICOM Images provided in the Mendeley Dataset [Source (https://data.mendeley.com/datasets/zbf6b4pttk/2)]. I have done following:-
a. Extracted Mid-Sagittal Views for both T1 and T2 Weighted Images.
b. Performed basic pre-processing for Image preparation.
c. Created BW (Mask) as well as Pseudo Colored Image.
Now I am trying to:-
a. Segment out the Lumbar Vertebrates and Sacrum Vertebrates (Using regionprops)
b. Mark the Centroids on the Lumbar and Sacrum Bones.
c. Assign labels to Image like L1, L2..L5 (Lumbar) and S for Sacrum (I am assuming S1 as Sacrum Bone and ignoring other levels of Sacrum vertebrates).
d. Input the labelled images to Deep Network for training followed by testing/validation, purposes.
Please suggest the best possible practices for image segmentation for this particular problem.
  댓글 수: 1
Image Analyst
Image Analyst 2020년 9월 16일
Original question attached in case he deletes his post.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2020년 8월 15일
What I'd do is first call bwareafilt() to get blobs only with a certain area range. Then ask regionprops() for the bounding box and centroid. If the bounding box height and width are not both in a reasonable range, then throw out those blobs. Hopefully what remains is the square vertebrae. Then you can identify the individual vertebra by the y coordinate of the centroids. Pretty easy but let me know if you can't figure it out.
labeledImage = bwlabel(mask);
props = regionprops(labeledImage, 'Area', 'Centroid', 'BoundingBox');
allAreas = [props.Area] % Inspect this to find the area1 and area2
mask = bwareafilt(mask, [area1, area2]);
props = regionprops(mask, 'Centroid', 'BoundingBox');
bb = vertcat(props.BoundingBox)
widths = bb(:, 3)
heights = bb(:, 4)
aspectRatios = widths ./ heights
keepers = (widths > width1 & widths < width2) & (heights > height1 & heights < height2);
mask = ismember(labeledImage, find(keepers));
labeledImage = bwlabel(mask);
props = regionprops(labeledImage, 'Centroid');
xy = vertcat(props.Centroid)
y = xy(:, 2)
[sortedY, sortOrder] = sort(y, 'ascend')
% Sort x and props the same way, from top to bottom based on y
props = props(sortOrder);
x = props(xy(:, 1));
% Label them with a number
for k = 1 : length(props)
xt = x(k);
yt = sortedY(k);
str = sprintf('Blob #%d', k);
text(xt, yt, str, 'Color', 'r', 'FontSize', 20, 'FontWeight', 'bold')
end
So you can see it's pretty easy. It's untested but only requires a few things to be figured out. Figure out the parameters for width1, etc. and plug them in. Let me know if you have any trouble.
You can use ismember to extract a binary image of only a particular vertebra, like the 3rd one, 4th one, etc. and then save those with imwrite for a training set for your deep learning network for that particular vertebra. Like
thisVertebra = ismember(labeledImage, sortOrder(k));
filename = whatever....
imwrite(filename, thisVertebra);
or whatever.
  댓글 수: 13
Hamza Ayari
Hamza Ayari 2022년 5월 25일
can you send the mask code for it ?
thank you
Image Analyst
Image Analyst 2022년 5월 25일
@Hamza Ayari I don't know what code you're asking for. I don't have any vertebrae-finding code.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by