How to : Include Volume Rendering

How to: Make a volume using OsgVolume

Dicom Files :

 

This page needs to be updated : 

 

Create a script as below substituting .tif for the image type you are using ie: .jpg .png etc. 

 

To create the script open a new document in BBedit and paste the following text into it

 

(Note from Robert Osfield, currently the .ive format does not support the osgVolume NodeKit so you can't save volumes as .ive files, instead you must use .osg.  A future release of the OpenSceneGraph will add osgVolume support to .ive, but for now one must use .osg for saving volumes).

 

 

#!/bin/sh

 

osgvolume --images *.tif --num-components 1 --r_maxTextureSize 512 -n --zMultiplier -1.0 -o volume.osg

 

echo make volume complete

 

exit 0

 

 

 

and save it into the directory where your image files are, with a name like:

 

make_volume

 

then change permissions of the file - use terminal and go to the directory and do:

 

 

chmod +x make_volume

 

Now if you type :

 

 

./make_volume

 

this will create a file called volume.osg and a volume.dss image file.  Both the .osg and .dds file will need to be used together.  One loads the volume.osg file, and this volume.osg will reference the volume.dds file for you.

 

 

 

You can also do part volumes by using the following and changing the **** part:

 

 

 

Other options

 

for help :

 

osgvolume --help

Usage: osgvolume [options] filename ...

 

Options:

 

-h or --help Display this information

 

-s <numSlices> Number of slices to create.

 

-n Create normal map for per voxel lighting.

 

 

--clip <ratio> clip volume as a ratio, 0.0 clip all, 1.0 clip none.

 

--compressed Enable the usage of compressed textures.

 

--compressed-arb Enable the usage of OpenGL ARB compressed textures.

 

--compressed-dxt1 Enable the usage of S3TC DXT1 compressed textures.

 

--compressed-dxt3 Enable the usage of S3TC DXT3 compressed textures.

 

 

--compressed-dxt5 Enable the usage of S3TC DXT5 compressed textures.

 

 

--images [filenames] Specify a stack of 2d images to build the 3d volume from.

 

 

--maxTextureSize <size> Set the texture maximum resolution in the s,t,r (x,y,z) dimensions.

 

 

--num-components <num> Set the number of components to in he target image.

 

 

 

--r_maxTextureSize <size> Set the texture maximum resolution in the r (z) dimension.

 

 

--s_maxTextureSize <size> Set the texture maximum resolution in the s (x) dimension.

 

 

--t_maxTextureSize <size> Set the texture maximum resolution in the t (y) dimension.

 

 

--modulate-alpha-by-luminance For each pixel multiply the alpha value by the luminance.

 

--replace-alpha-with-luminance For each pixel m Set the alpha value to the luminance.

 

 

 

--shader Use OpenGL Shading Language.

 

 

--xMultiplier <multiplier> Tex coord x mulitplier.

 

--yMultiplier <multiplier> Tex coord y mulitplier.

 

--zMultiplier <multiplier> Tex coord z mulitplier.

 

 

--xSize <size> Relative width of rendered brick.

 

--ySize <size> Relative length of rendered brick.

 

--zSize <size> Relative height of rendered brick.

 

 

____

 

Using in Present3D

 

You can load and view the resulting volume either by creating a P3D xml file with your volume and other data or just by using present3D on the command line, so type :

 

 

present3D volume.ive

 

and this will load your volume. You can now use the the a, t and k keys along with mouse movement, to interact with the volume, try it :-)