PDA

View Full Version : Calculate Volume?

cpb
05-11-2003, 08:21 AM
Hello,

I have a more mathematical question:

I have extracted the isosurface from a image stack... how is it possible to calculate the volume of the extracted object?

That means how do I calculate the volume from a point cloud? I would very appreciate if you could help me (links, suggestions,...)

chris.

05-11-2003, 11:44 AM
Originally posted by cpb:
Hello,

I have a more mathematical question:

I have extracted the isosurface from a image stack... how is it possible to calculate the volume of the extracted object?

That means how do I calculate the volume from a point cloud? I would very appreciate if you could help me (links, suggestions,...)

chris.

I suck at math, but I know how to google for "volume of isosurface".

http://www.iavsc.org/repository/avs5/output.html#compute_volume

I think it's C code, and it's in a .ZIP format. Let me know if you have any problems with those. ;-)

I hope it helps you out. It took google 0.09 seconds to find it, and I bet you waited over an hour for this reply. ;-)

/Henrik

[This message has been edited by CAD_Swede (edited 05-11-2003).]

oliii
05-11-2003, 02:19 PM
convex hull? delaunay trianglulation?

[This message has been edited by oliii (edited 05-11-2003).]

JustHanging
05-12-2003, 12:48 AM
Hi,

Can't you just count the number of points with their value over the isovalue from the image stack? Well in some cases maybe not, but maybe...

-Ilkka

cpb
05-12-2003, 03:04 AM
Uhhh,

seems to be a general problem... I don`t get any further! The problem with the posted program is, that I don't know which format the data has to be!

c.

dorbie
05-12-2003, 08:53 AM
I'd say you want to divide the volume into tetrahedra, then sum the volumes of the tets.

Either that or take several slices through the volume, calculate their area and interpolate volumes between slices. It's a linear difference between slices if the interpolation is linear as it is with a tri mesh so just average the areas of two slices and multiply by the separation between the sices. You need to make sure your have a slice at each vertex position along your slice axis for total accuracy (this guarantees all surface reconstruction interpolations between your chosen slices are linear).

cass
05-12-2003, 09:53 PM
Yeah, seems like if you computed the isosurface from an algorithm like marching cubes or marching tetrahedra, then you'd just want to keep a running total of the volume as you traverse the grid.

Depending on mesh density, the suggestion (by JustHanging) of doing a Riemann sum could also be reasonable.

cpb
05-13-2003, 03:06 AM
what do you mean by using the rieman sum... going back to the actual image???

cass
05-13-2003, 04:37 AM
Originally posted by cpb:
what do you mean by using the rieman sum... going back to the actual image???

Essentially, I mean, compute the sum:

sum = 0
for all i, j, and k
if scalar[i][j][j] > threshold
sum += cell_size

This is a reasonable zeroth order approxmation, and zeroth order may be sufficient if you have a high grid density and/or you only need a coarse approximation.

cpb
05-15-2003, 10:51 PM
Hello,

Since you all wrote the reply on volume calculation from an object file, I was thinking how I could approach this problem… and I didn’t come to any conclusion. Therefore I was thinking if you might help me further… I will attach you 1 Object from the generated isosurface as an object file (or I just paste it).

Could you help me further; I am kind of desperate because this is an important issue for me and I have to solve it!

c.

Here the object:

V are the actual vertices
F are the faces (ex. f 1 2 3 means vertex 1,2,3 form a triangle)

v 57.600002 19.980001 25.200001
v 57.600002 19.800001 26.775001
v 57.780002 19.800001 25.200001
v 57.600002 19.800001 26.775001
v 57.600002 19.980001 25.200001
v 57.420002 19.800001 25.200001
v 57.600002 19.800001 26.775001
v 57.600002 19.440001 26.775001
v 57.960002 19.440001 26.775001
v 57.600002 19.800001 26.775001
v 57.960002 19.440001 26.775001
v 57.960002 19.620001 25.200001
v 57.780002 19.800001 25.200001
v 57.600002 19.800001 26.775001
v 57.960002 19.620001 25.200001
v 57.600002 19.800001 26.775001
v 57.420002 19.800001 25.200001
v 57.600002 19.440001 26.775001
v 57.780002 19.800001 25.200001
v 57.600002 19.800001 23.625001
v 57.600002 19.980001 25.200001
v 57.600002 19.980001 25.200001
v 57.600002 19.800001 23.625001
v 57.420002 19.800001 25.200001
v 57.960002 19.440001 23.625001
v 57.600002 19.800001 23.625001
v 57.780002 19.800001 25.200001
v 57.960002 19.620001 25.200001
v 57.960002 19.440001 23.625001
v 57.780002 19.800001 25.200001
v 57.600002 19.440001 26.775001
v 57.420002 19.800001 25.200001
v 57.420002 19.440001 25.200001
v 57.420002 19.800001 25.200001
v 57.600002 19.800001 23.625001
v 57.420002 19.440001 25.200001
v 57.960002 19.620001 25.200001
v 57.960002 19.440001 26.775001
v 58.140002 19.440001 25.200001
v 58.140002 19.440001 25.200001
v 57.960002 19.440001 26.775001
v 57.960002 19.260001 25.200001
v 57.600002 19.260001 25.200001
v 57.960002 19.440001 26.775001
v 57.600002 19.440001 26.775001
v 57.960002 19.260001 25.200001
v 57.960002 19.440001 26.775001
v 57.600002 19.260001 25.200001
v 57.600002 19.440001 26.775001
v 57.420002 19.440001 25.200001
v 57.600002 19.260001 25.200001
v 57.960002 19.440001 23.625001
v 57.960002 19.620001 25.200001
v 58.140002 19.440001 25.200001
v 57.960002 19.440001 23.625001
v 57.600002 19.440001 23.625001
v 57.600002 19.800001 23.625001
v 57.600002 19.800001 23.625001
v 57.600002 19.440001 23.625001
v 57.420002 19.440001 25.200001
v 57.960002 19.440001 23.625001
v 58.140002 19.440001 25.200001
v 57.960002 19.260001 25.200001
v 57.960002 19.440001 23.625001
v 57.960002 19.260001 25.200001
v 57.600002 19.440001 23.625001
v 57.600002 19.260001 25.200001
v 57.420002 19.440001 25.200001
v 57.600002 19.440001 23.625001
v 57.600002 19.440001 23.625001
v 57.960002 19.260001 25.200001
v 57.600002 19.260001 25.200001
f 1 2 3
f 4 5 6
f 7 8 9
f 10 11 12
f 13 14 15
f 16 17 18
f 19 20 21
f 22 23 24
f 25 26 27
f 28 29 30
f 31 32 33
f 34 35 36
f 37 38 39
f 40 41 42
f 43 44 45
f 46 47 48
f 49 50 51
f 52 53 54
f 55 56 57
f 58 59 60
f 61 62 63
f 64 65 66
f 67 68 69
f 70 71 72

Michael Steinberg
05-20-2003, 07:23 AM
We experimented and got quite perfect results with taking any pivot point, and creating tetrahedrons from this point to every triangle present. If the face is front-facing to the pivot we subtract the volume, if if it's back-facing we add the volume. Shouldn't be too hard to implement that.

Michael Steinberg
05-20-2003, 07:24 AM
Of course it needs to be a closed mesh in order to work.

Michael Steinberg
05-20-2003, 07:26 AM
Then again, what is the volume of a non-closed body? http://192.48.159.181/discussion_boards/ubb/smile.gif

dorbie
05-20-2003, 12:47 PM
Excellent, I like the negative volume subtraction. Makes everything very easy & very fast.