Displaying a 3D structuring element with isosurface

조회 수: 7 (최근 30일)
Tony Pryse
Tony Pryse 2017년 3월 30일
편집: Carl 2017년 4월 5일
I want to create some 3D structuring elements (such as an oblate spheroid) to use with imdilate. I'd like to see them with isosurface and I've tried the examples in the isosurface documentation, e.g.,
BW = false(100,100,100);
BW(25,25,25) = true;
BW(75,75,75) = true;
se = strel('sphere',25);
dilatedBW = imdilate(BW,se);
figure
isosurface(dilatedBW);
which works just fine:
However, if I make the sphere smaller (se = strel('sphere',20);) then the figure shows nothing:
(even if I change the all the axis ranges to 1:100.) In fact, any sphere smaller than 24 does not display, but larger spheres (30, for example) display properly. In a similar vein, if I start with just one initial point in BW and dilate, some initial points display properly (BW(25,25,25) = true;) but others (BW(50,50,50) = true;) don't! I've tried changing the colormaps, adjusting the axis ranges - what an I missing?
(Using version 2016a)
Thanks for any advice ...

답변 (1개)

Carl
Carl 2017년 4월 3일
편집: Carl 2017년 4월 3일
This seems to be a bug with the 'isosurface' function. If you run the following code,
fv = isosurface(dilatedBW)
You can see that the output matrices are empty when the figure shows nothing. This is why changing the axes and other display elements are not solving the issue - the 'isosurface' function is not returning the isosurface data in the first place.
I have submitted this issue to its respective MathWorks development team.
  댓글 수: 2
Tony Pryse
Tony Pryse 2017년 4월 3일
Thanks, Carl. I spent quite a few hours trying to figure out where I was going wrong. I hope the development team fixes it soon!
Carl
Carl 2017년 4월 5일
편집: Carl 2017년 4월 5일
I'd like to amend my previous answer. It turns out calling 'isosurface' without providing an isovalue is not the recommended workflow (although, as you saw, it does show up in some examples). When you do not provide an isovalue, the function will try to determine one for you, and this might not always work as desired.
The following code, with an isovalue provided, should graph the surface correctly:
se = strel('sphere',20);
isosurface(dilatedBW, 0.5)

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

카테고리

Help CenterFile Exchange에서 Scalar Volume Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by