Create custom volume from slices

Started by gerferra, August 23, 2010, 03:19:37 PM

Previous topic - Next topic

gerferra

Hi.

I'm evaluating jpct to use it internally in a personal project. My principal requirement is being able to show a volume in 3D given a set of "slices" of the volume in the form of polygons separated by a regular interval.

How easy/difficult it is to do this with jpct?

Thank you very much.

Regards,
Germain.

EgonOlsen

I'm not sure if i get what you mean. Do you have a screen shot or a drawing to illustrate it?

gerferra

Hi. Thank you for your response.

This image, which I found via google, shows the kind of "slices" I'm talking about:

http://www.mlahanas.de/MOEA/HDRMOGA/Image134.gif

Regards,
Germán.

gerferra

To clarify, the picture has slices for two distinct volumes. I couldn't find a better picture to show what I mean.

Thank you.
Germán.

EgonOlsen

And you only want to visualize such a situation or you do want to create the slices out of some geometry on the fly?

gerferra

I have the polygons corresponding to each slice. I want to visualize the slices like in the picture posted but also I'm looking for a way to generate an estimation of the original volume from which the slices were taken.

Thank you.



gerferra


Well, I want two different but somewhat complementary things. The first thing I want to display are some slices much like in the brain example you posted, but simpler because I only want to show the outline of each slice (my slices are polygons).

The second thing is more complicated. In the brain example, I would like to generate some suface that estimates the "skin" of the head from which the slices were taken. I would like to show a solid volume estimating the head from which the slices were taken. Note that in my case the slices are  polygons.

Thank you for the time spent on this. This is one of the moments when I wish I had taken some more english classes, I can't express myself as I would like...

Thank you.

EgonOlsen

I think i got more or less...yes, you can do this with jPCT, but you have to compute the hull of your slices by yourself. There's no magic method in jPCT that does this. I'm not sure about the slices themselves...that "they are polygons" means that they already are somekind of 3D mesh or that they are nothing but a vectorized outline? In the latter case, you'll need some kind of tessellator (not sure if this is the right word for it...) that creates a triangle mesh from your outline. Or do you just want to render the outline?

gerferra

Ok. I was looking for some magic method to generate the hull and don't have to do it by myself. The slices are a vectorized outline, yes, that's what I was trying to say. I only want to render the outline.

Do you know of some free library that can help me to generate the hull?

Thanks

EgonOlsen

#10
As long as the slices all have the same number of points that define the outline, it should be pretty easy to create the hull object. Do they?

gerferra

No. The slices are defined by a user by hand and can have arbitrary points.

EgonOlsen

I see. I don't know of any library that does this albeit i'm pretty sure that something has to exist for this task. However, i always like to write my own stuff, so this is my idea on this:


  • iterate over the slices to find the one with the most points
  • tessellate all other slices's vectors so that you end up with an identical number of points for each slice (even if some or all fall onto one point in space)
  • find a starting point on each slice. I would start with a random one of the first slice and take the closest one from the next slice and so on
  • take slice n and n+1, start at the starting point and create triangles that connect the points and create the hull
  • continue with n+1 and n+2...until the last slice has been processed

IMHO, this should give you a good enough hull. But maybe i'm missing something...it sounds just too easy... ;)

gerferra

Thank you  :).  I'll keep this on mind, I can't tell if its too simple or not
Can you give me a list of the principal api elements I would need to study in order to try this? (ie, to represent and render the vectorized outlines and the hull).

Thanks again.

EgonOlsen

Render the outlines with jPCT might feel a bit strange, because there's no line drawing method or something. The basic primitive in jPCT is the triangle. Everything you want to render has to be composed out of triangles. What you basically have to do is to create an Object3D from each vector of your outline giving it a real "body", i.e a kind of tube or prism. I would take the outline and create an Object3D from each vector by hand using the addTriangle()-method.