comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: 3D array from surfaces?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: 3D array from surfaces? [message #60380] Wed, 14 May 2008 07:06
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mike writes:

> Will IDLanROI work for ROI's with vertices that are not contained in a
> single plane?

I've never used it that way, but it looks to me like it
takes XYZ data points. Worth some exploration, probably.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: 3D array from surfaces? [message #60381 is a reply to message #60380] Wed, 14 May 2008 07:01 Go to previous message
Mike[2] is currently offline  Mike[2]
Messages: 99
Registered: December 2005
Member
On May 13, 5:54 pm, David Fanning <n...@dfanning.com> wrote:

> Most of the time if you have the opposite of what you
> want, you are just about all the way home. :-)

Absolutely!

>> Couldn't you use an IDLanROI object to tell you
> if you were inside the volume or out?

Will IDLanROI work for ROI's with vertices that are not contained in a
single plane?

Mike
Re: 3D array from surfaces? [message #60382 is a reply to message #60381] Wed, 14 May 2008 06:43 Go to previous message
Mike[2] is currently offline  Mike[2]
Messages: 99
Registered: December 2005
Member
On May 13, 10:53 pm, Karl <Karl.W.Schu...@gmail.com> wrote:

> It isn't super clear to me either, and the only way I can make sense
> of it is if all the surfaces were closed, like spheres. Otherwise,
> you could have points that you could not decide are inside or outside.

I'll try to clarify: I've got surface models from a nice piece of
commercial software that is very good at segmenting medical data. It
creates a bitmask identifying points in the data that are inside the
organ of interest and then saves the enclosing mesh as an stl file. I
want to use the commercial software for the segmentation, but for my
analysis purposes, I want the bit map, rather than the surface.

What I'm doing to calculate a bit map is

1 - load vertices from STL file
2 - for each plane in containing volume
- find vertices on or near this plane
- use region_grow and/or polyfillv to find inside points

This works well since there are many, many vertices in these models.
I'll take a look at David's IDLanROI suggestion as well.

Mike
Re: 3D array from surfaces? [message #60386 is a reply to message #60382] Tue, 13 May 2008 19:53 Go to previous message
Karl[1] is currently offline  Karl[1]
Messages: 79
Registered: October 2005
Member
On May 13, 5:52 pm, Rick Towler <rick.tow...@nomail.noaa.gov> wrote:
> Mike wrote:
>> On May 13, 1:00 pm, David Fanning wrote:
>
>>> Maybe you can get some inspiration from this article:
>
>>> http://www.dfanning.com/graphics_tips/mesh.html
>
>> Yep - That is just the opposite of what I want to do. What I'm
>> looking for is the inverse of Shade_Volume. I suppose this really
>> boils down to finding the intersection of a plane and a mesh
>> surface... I'll mull it over tonight and see what comes up...
>
> I have to admit that I am a bit confused as to what exactly you need but
> you'll probably want to look here:
>
> http://www.realtimerendering.com/int/
>
> My guess is that you'll want to sweep a plane orthogonal to the z axis
> from min(z) to max(z) testing for tri/plane intersections. Looking at
> that page, the code for tri/plane intersection testing isn't online but
> there are at least a few for tri/tri so you could simply use one of
> those and make the one tri really big.
>
> HTH's
>
> -Rick

It isn't super clear to me either, and the only way I can make sense
of it is if all the surfaces were closed, like spheres. Otherwise,
you could have points that you could not decide are inside or outside.

Assuming the surfaces are closed:

For each sample in the 3D volume, shoot a ray in any direction until
it hit something or leaves the volume. If it leaves the volume, mark
it as "outside". Determine the "side" of the triangle it hit
otherwise, by the relative direction of the ray and the triangle's
normal. (dot product? it's late) Then set inside or outside
accordingly.

Yes, and then running ISOSURFACE or ShadeVolume on the result should
give you back the surfaces you started with, or something close.

Karl
Re: 3D array from surfaces? [message #60389 is a reply to message #60386] Tue, 13 May 2008 16:52 Go to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
Mike wrote:
> On May 13, 1:00 pm, David Fanning wrote:
>
>> Maybe you can get some inspiration from this article:
>>
>> http://www.dfanning.com/graphics_tips/mesh.html
>
> Yep - That is just the opposite of what I want to do. What I'm
> looking for is the inverse of Shade_Volume. I suppose this really
> boils down to finding the intersection of a plane and a mesh
> surface... I'll mull it over tonight and see what comes up...

I have to admit that I am a bit confused as to what exactly you need but
you'll probably want to look here:

http://www.realtimerendering.com/int/

My guess is that you'll want to sweep a plane orthogonal to the z axis
from min(z) to max(z) testing for tri/plane intersections. Looking at
that page, the code for tri/plane intersection testing isn't online but
there are at least a few for tri/tri so you could simply use one of
those and make the one tri really big.

HTH's

-Rick
Re: 3D array from surfaces? [message #60394 is a reply to message #60389] Tue, 13 May 2008 14:54 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mike writes:

> Yep - That is just the opposite of what I want to do. What I'm
> looking for is the inverse of Shade_Volume. I suppose this really
> boils down to finding the intersection of a plane and a mesh
> surface... I'll mull it over tonight and see what comes up...

Most of the time if you have the opposite of what you
want, you are just about all the way home. :-)

Couldn't you use an IDLanROI object to tell you
if you were inside the volume or out?

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: 3D array from surfaces? [message #60395 is a reply to message #60394] Tue, 13 May 2008 14:47 Go to previous message
Mike[2] is currently offline  Mike[2]
Messages: 99
Registered: December 2005
Member
On May 13, 1:00 pm, David Fanning <n...@dfanning.com> wrote:

> Maybe you can get some inspiration from this article:
>
> http://www.dfanning.com/graphics_tips/mesh.html

Yep - That is just the opposite of what I want to do. What I'm
looking for is the inverse of Shade_Volume. I suppose this really
boils down to finding the intersection of a plane and a mesh
surface... I'll mull it over tonight and see what comes up...

Mike
Re: 3D array from surfaces? [message #60405 is a reply to message #60395] Tue, 13 May 2008 10:00 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mike writes:

> Anybody know a simple/sensible way to create a 3D array from a
> collection of surfaces?
>
> I have a series of surfaces defined by vertexes in STL files. I need
> to make a 3D bit mask with the value of the each element depending on
> if the element is inside or outside of each surface - the opposite of
> the segmentation process that generated the STL files. This data
> comes from external software that uses these bit masks as an
> intermediate step, but of course cannot save them since it is obvious
> that no one would ever need that intermediate data ;-).
>
> As usual, I'd rather not reinvent the wheel if someone has already put
> together reasonably round one...

Maybe you can get some inspiration from this article:

http://www.dfanning.com/graphics_tips/mesh.html

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: varimax rotation
Next Topic: Re: how to "check" checkbox state?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:13:41 PDT 2025

Total time taken to generate the page: 0.00622 seconds