Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question about isovalue in Matlab's isosurface

780 views
Skip to first unread message

Alfred Zhong

unread,
May 3, 2011, 1:38:07 AM5/3/11
to
Hi, As I read from the Matlab help, the isosurface() takes the form of fv = isosurface(V,isovalue)

V is the volume data,

I think a isosurface should plot the surface have the value of 'isovalue'.

However, as I tried myself, it looks like Matlab plots all the data points with value > isovalue rather than data points with value == isovalue

This is so confusing. Is this "isovalue" actually a threshold value?!

Thanks a lot!

Steven_Lord

unread,
May 3, 2011, 9:51:13 AM5/3/11
to

"Alfred Zhong" <alfred...@gmail.com> wrote in message
news:ipo4bv$643$1...@fred.mathworks.com...


> Hi, As I read from the Matlab help, the isosurface() takes the form of fv
> = isosurface(V,isovalue)
>
> V is the volume data,
>
> I think a isosurface should plot the surface have the value of 'isovalue'.

Yes. Basically ISOSURFACE is the 3D equivalent of CONTOUR, and the isovalue
is the 3D equivalent of a contour level.

> However, as I tried myself, it looks like Matlab plots all the data points
> with value > isovalue rather than data points with value == isovalue
>
> This is so confusing. Is this "isovalue" actually a threshold value?!

Do you have a (small) example that you can post to the newsgroup and/or send
to Technical Support that demonstrates this behavior?

--
Steve Lord
sl...@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Alfred Zhong

unread,
May 3, 2011, 12:08:05 PM5/3/11
to
Thanks a lot for replying, Steven!

I am trying to understand how this isosurface works. Therefore, I created a small data set for this, here is the script

------------------------------------------
%init the test volume data test
test(10,10,10) = 0;
%small cube at lower
test(3:6,3:6,3:5)=50;

%large cube at higher
test(5:9,5:9,6:9)=60;

%isosurface
isosurface(test,1);
-----------------------------------------------

This is like 2 cubes, a small one at the bottom, a larger one on the top.

isosurface(test,1) will plot both of them out
isosurface(test,49) will plot both of them out
isosurface(test,50) will plot the top joint with the upper surface of the bottom smaller cube, however the body of the smaller cube is the not plot out
isosurface(test,55) will plot the same as50
isosurface(test,60) plots nothing.

I guess when the specified isovalue doesn't form a surface, maybe form a volume instead, the behavior is strange.

This can be seen at
contour(test(:,:,5)), it still plots a gradient of contours, however, there are only 2 values in total

image(test(:,:,5)) can verified this

Any idea about this?

Thanks a lot,
Alfred

"Steven_Lord" <sl...@mathworks.com> wrote in message <ipp18h$kn1$1...@fred.mathworks.com>...

Steven_Lord

unread,
May 3, 2011, 1:28:07 PM5/3/11
to

"Alfred Zhong" <alfred...@gmail.com> wrote in message

news:ipp995$l9s$1...@fred.mathworks.com...


> Thanks a lot for replying, Steven!
>
> I am trying to understand how this isosurface works. Therefore, I created
> a small data set for this, here is the script
>
> ------------------------------------------
> %init the test volume data test
> test(10,10,10) = 0;
> %small cube at lower
> test(3:6,3:6,3:5)=50;
>
> %large cube at higher
> test(5:9,5:9,6:9)=60;
>
> %isosurface
> isosurface(test,1);
> -----------------------------------------------
>
> This is like 2 cubes, a small one at the bottom, a larger one on the top.
>
> isosurface(test,1) will plot both of them out
> isosurface(test,49) will plot both of them out
> isosurface(test,50) will plot the top joint with the upper surface of the
> bottom smaller cube, however the body of the smaller cube is the not plot
> out
> isosurface(test,55) will plot the same as50
> isosurface(test,60) plots nothing.

You have a function v(x, y, z) where v has value 50 inside the small cube,
60 inside the large cube, and 0 everywhere else. ISOSURFACE looks for the
surface where your function takes on the specified value; in order to do so
it interpolates.

An analogy may be useful: think about your two cubes as heat sources. The
temperatures on the surface of your heat sources are the specified
temperatures, but the temperatures between the two sources will be somewhere
between 50 and 60 degrees. Do you agree? If you asked ISOSURFACE for the
surface where the temperature was 55 degrees, that surface would consist of
some "shell" around the 60 degree heat source (where the air has cooled down
enough to drop to 55 degrees.) The surface of the 50 degree cube is too
cool. If you lower the temperature (the isosurface value) eventually that
"shell" will encompass the 50 degree heat source as well.

Now of course, you don't just have two heat sources in your data set; you
have lots of little chunks of ice (the points in test with value 0) and that
affects the shape of the shell as well.

> I guess when the specified isovalue doesn't form a surface, maybe form a
> volume instead, the behavior is strange.
>
> This can be seen at
> contour(test(:,:,5)), it still plots a gradient of contours, however,
> there are only 2 values in total

You didn't specify a contour value (the 2D equivalent of an isovalue) and so
CONTOUR chose its own values, and the values it chose required some
interpolation. Try plotting contours at 0, 1, 25, 49, and 50.

contour(test(:, :, 5), [0 1 25 49 50])

You should see the 1 contour just a little bit inside the 0 contour (since
the temperature is going to be just above 0 when you're next to but not
touching the ice) and the 49 contour will be just outside the 50 contour
(for the same reason.) The 25 contour should be (roughly) halfway between
the points with value 0 and the points with value 50.

Is this a bit clearer?

Alfred Zhong

unread,
May 3, 2011, 2:22:21 PM5/3/11
to
Hi Steven,
I think that makes sense.

However, I am still confused about something.
1. that isosurface(data,60) doesn't plot anything is strange. I can image the surface of the 60 degree heat source is cooled down a little bit by the surrounding "ices", how ever, inside the body of the cube should have some place is still 60.

2. is there any way to plot the isosurface without interpolation? Just show the exact value specified in isovalue?

Thanks!
Alfred

"Steven_Lord" <sl...@mathworks.com> wrote in message <ippdv7$cf7$1...@fred.mathworks.com>...

0 new messages