필터 지우기
필터 지우기

bwlabeln 3D connections not a subset of its 2D connections

조회 수: 3 (최근 30일)
Brian Frost
Brian Frost 2022년 5월 17일
댓글: Brian Frost 2022년 5월 18일
Hi all -
I am trying to use bwlabeln to connect a single flat membrane apparent in a large OCT volume scan. When I use bwconnect on cross-section, or bwlabeln with either 4 or 8 as the connect parameter, all is well. Of course, this is undesirable as it means my connected regions are only in-plane.
However, when I use 6, 26 or any other 3D parameter for connect, I do not get the desired result. I find this confusing, because my understanding is that if two pixels are connected in 2D, they ought still be connected in 3D. As such, the connected region using '4' should be a subset of that using '6'. Am I incorrect here? How can I achieve the desired result.
Here is my code, and the figures generated. I have labeled the membrane I want to connect.
label4 = bwlabeln(VThresh2,4);
label26 = bwlabeln(VThresh2,26);
figure;
subplot(3,2,1)
imagesc(VThresh2(:,:,256))
colormap('gray')
title('Slice 256 Binary Image')
subplot(3,2,2)
imagesc(VThresh2(:,:,257))
colormap('gray')
title('Slice 257 Binary Image')
subplot(3,2,[3 5])
imagesc(label4(:,:,256))
title('Slice 256 Connected Regions using connect=4')
subplot(3,2,[4 6])
imagesc(label26(:,:,256))
title('Slice 256 Connected Regions using connect=26')

채택된 답변

Matt J
Matt J 2022년 5월 18일
편집: Matt J 2022년 5월 18일
My guess is that the 4-connected regions are indeed subsets of the 26-connected regions, as you expect. However, in the 26-connected case, you now have a wider range of labels per slice. Therefore, the grayscale range of your image displays is wider, thereby hiding some of the blobs.
  댓글 수: 1
Brian Frost
Brian Frost 2022년 5월 18일
I am a bit embarrassed, but you are correct! In the image, it not only shows up dark but the index literally shows as zero when you hover over it, really hiding the fact that it was present. When I ask it to spit out the pixel value at a point in the blob, it reads 5 -- the smallest number in the world.
Thanks so much!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2022년 5월 18일
If an blob is 4-connected to a voxel then it will be 6-connected to the same voxel. However the converse is not true. A blob that is 6-connected in 3-D may not appear to have any 4-connected blobs if you look at just a single slice. A slice may have two separate, unconnected blobs in that particular slice, however you may be connected vertically by a, let's call it, "bridge" in adjacent slices. Like there may be a path up from the centroid of blob 2 in that slice up to the slice above and then a path over to just above the blob #1 and then goes down to blob #1 to make them connected. So the one slice it seems like there are 2 unconnected blobs but because of bridge connecting them in other slices, they are still 6-connected in 3-D.

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by