How to remove black slices from 3D binary image ?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello,
I read a 3D binary image. I would like to remove all black slices from the image. I don't know how can I do it ... Could someone help me please ?
I would appreciate for any help/advice please.
댓글 수: 0
채택된 답변
Image Analyst
2016년 7월 10일
Try this:
[rows, columns, slices] = size(array3d);
slicesToRemove = false(1, slices);
for slice = 1 : slices
thisSlice = array3d(:, :, slice);
if all(all(thisSlice == 0))
slicesToRemove(slice) = true;
end
end
array3d(:, :, slicesToRemove) = [];
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!