How to find the mask boundaries?

2 Ansichten (letzte 30 Tage)
John
John am 14 Feb. 2025
Bearbeitet: Matt J am 14 Feb. 2025
In a 3D image, a mask represents the 'tumor volume.'
How can I easily find its pixel range: [Xmin, Xmax], [Ymin, Ymax], and [Zmin, Zmax]?
I know there is dumb way to do this, but I’m sure MATLAB has a smarter function to achieve this.
Could you suggest an efficient method?
Thanks for your help!

Akzeptierte Antwort

Matt J
Matt J am 14 Feb. 2025
Bearbeitet: Matt J am 14 Feb. 2025
[Y,X,Z]=find(Mask);
S=X+Y+Z;
[~,i]=min(S);
[~,j]=max(S);
[Xmin,Ymin,Zmin, Xmax,Ymax,Zmax] =deal( X(i), Y(i), Z(i), X(j), Y(j), Z(j))

Weitere Antworten (0)

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by