Find midline in binarized brain image using symmetry or otherwise
7 views (last 30 days)
Show older comments
I have processed CT brain images to create a binarized image in which vessels are visible (PFA).
The next step is to find the midline of the brain so that the left and right brain hemispheres can be compared in terms of area of vessels(white pixels in the image).
PS: The following methods I have tried and were not working for me.
- Find midline between two lines (but the image in my problem is not a two line problem).
- Then i came across a method to find symmetry in my image: Novel Method for Determining Symmetry of Skin Lesions using the Jaccard Index, However, this method could not find any symmetry for my image.
- I also tried on the proposed solution for finding line of symmetry. This also failed to generate any line of symmetry for the images in question.
The attached images are of the same patient, so we can find midline in any of these images, it can be applied to all images.
0 Comments
Accepted Answer
Image Analyst
on 27 Aug 2022
First of all get the convex hull then use regionprops to get the centroid and angle, from which you can get the midline. Here's a start (untested)
% Get mask of the whole group
mask = bwconvhull(mask, 'union');
% Find centroid and angle.
props = regionprops(mask, 'Orientation', 'Centroid');
[rows, columns] = size(mask);
% Fit a line through the centroid.
% (y - yctr) = slope * (x - xctr)
slope = atand(props.Orientation);
xCentroid = props.Centroid(1);
yCentroid = props.Centroid(2);
x = 1 : columns;
y = slope * (x - xCentroid) + yCentroid;
% Remove points outside the image.
outside = (y < 1) | (y > rows);
x(outside) = [];
y(outside) = [];
% Plot line over image.
hold on;
plot(x, y, 'r-', 'LineWidth', 2);
3 Comments
Image Analyst
on 28 Aug 2022
Attached is a full demo.
It looks like it's that your binarization is not that good. I think the centroid and midline should be computed on the original, pre-binarization image thresholded to take the whole thing, not just little parts of it.
An alternative is you could use radon to compute the angle of the convex hull image. I'm also attaching a demo of that.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1110060/image.png)
More Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!