How to find the mask boundaries?

조회 수: 1 (최근 30일)
John
John 2025년 2월 14일
편집: Matt J 2025년 2월 14일
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!

채택된 답변

Matt J
Matt J 2025년 2월 14일
편집: Matt J 2025년 2월 14일
[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))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by