How to extract the main square, image window of the ultrasound image?
Show older comments
Hi
I need some help.
How do I extract/crop the main square of the ultrasound image. The image window that shows the valuable information and discard all the rest black and annotations.
Looking forward to your valuable help
Thanks
Accepted Answer
More Answers (2)
Constantino Carlos Reyes-Aldasoro
on 27 Sep 2019
0 votes
Hard to answer without knowing your data. Post a sample and we can try.
1 Comment
Stelios Fanourakis
on 27 Sep 2019
Constantino Carlos Reyes-Aldasoro
on 27 Sep 2019
*IF* all the images look like this, it is rather easy, EXCEPT for the fact that the bottom edge of the ultrasound is not very well defined.
The key is to find the background to determine the foreground, The background is black, so take only one channel (the image is RGB), compare against zero and that would give the background but with the annotations and bits you want to remove, so close the image with imclose with a structural element sufficiently large to cover those elements:
background =(imclose(A6__14_9N_(:,:,1)==0,ones(25)));
Then, you only need to take the complement and recover the ultrasound part
imagesc(A6__14_9N_.*(repmat(1-background,[1 1 3])))

If you compare with the original, it seems that the job is done.

5 Comments
Stelios Fanourakis
on 27 Sep 2019
Stelios Fanourakis
on 27 Sep 2019
Stelios Fanourakis
on 27 Sep 2019
Stelios Fanourakis
on 27 Sep 2019
Stelios Fanourakis
on 27 Sep 2019
Categories
Find more on Ultrasound Imaging 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!