Present3D : Working with Volumes

How to: Include Volume Rendering in P3D

Volumes can be created from many different types of data, usually by recombining images that have been taken at set intervals through a 3D object, either by using a scanning technology like CT, MRI etc; or by physically slicing an object up and imaging each slice as in the Visible Human project. But there is no reason why it should be limited to this, anything from a series of frames of a movie, to images created in photoshop, could be used to create a volume.

  • Creating Volumes from DICOM Files.
  • Including Volumes in P3D
  • Including Volumes created from an Image Series (.jpg, png, .tif)
  • Including Volumes created from a Movie file

 

Using Volumes in Present3D

Some data types can be loaded directly using the <volume> tag, while others can be preprocessed using OsgVolume and then either loaded using the <volume> or <model> tags depending on how the data has been saved. More on this later. 

You will find more information on using OsgVolume to view and preprocess volume data here, but a short summary follows :

Using OsgVolume with DICOM Files. 

To view a volume from a folder (directory) of dicom files you will use the osgvolume cmd.

First, in your shell, you will need to navigate to the directory that has the folder that you want to use...

cd main_volume_directory/directory_that contains_the_folder_of _dicom_files

Then use osgvolume to load the folder you want use..

osgvolume folder_with_dicom_files

This will allow you to test that the dataset is working as expected before going any further. If you don't get the expected results, then open the folder and check how many files/slices there are. Your graphics card might be limiting the number of slices that can be used to 256, 512, 1024 or larger... make a copy of the folder and reduce the number of files to each of these limits in turn, until it works. Currently the ATI 4870 on the Mac should display 1024 slices.

To create a .dds, .osg or .ive from the folder do the same command but add -o and the name you want to use for the new volume and using the extension for the data type you want to create...

osgvolume folder_with_dicom_files -o volume.dds

osgvolume folder_with_dicom_files -o volume.osg

osgvolume folder_with_dicom_files -o volume.ive

For more information on using OsgVolume please go here.

 

Including Volumes in P3D 

There are two main methods of including a volume dataset in P3D.

<volume>  </volume>  

or

<model> </model> 

The volume tag is used to load a folder of dicom files or a .dds volume file. For example :

<volume> volumes/test_volume</volume>  

<volume> volumes/test_volume.dds</volume>  

Where test_volume is the folder that contains the .dcm dicom files and is within the folder volumes relative to this Present3D .xml file. Similarly, test_volume.dds is a volume file previously created in OsgVolume and also saved within the volumes folder

The model tag can be used to load a .osg or .ive volume file. 

<model>volumes/test_volume.osg</model> 

 

The Volume Tag

Currently, using the volume tag directly with a folder/directory of dicom files enables more features, so we will deal with that first. It is hoped that the same features will be available for the other methods of loading volumes in the near future.

Below is code for an example slide showing the volume tag being used....

<!-- sample volume -->

<slide>

<background>BLACK</background>

<title>Test Volume</title>

<duration>18</duration>

<key></key>

<layer>

<volume    tf-255="clut/colour.tf"  alpha="0.9"  cutoff="0.1"  sampleDensity="0.0007"   sampleDensityWhenMoving="0.004"  technique="light"  region="0.0 0.0 0.0 1.0 1.0 1.0">folder_with dicom_files  </volume>

</layer>

</slide> 

 

So lets go through the various properties that have been applied here :

 

tf-255="clut/colour.tf"

This is the transfer function property, there are two versions "tf" where colour and alpha values are set between 0 and 1, and "tf-255" where they are set between 0 and 255, as this allows you to use a RGB colour picker in say photoshop, find the colour you want and just grab the rgb values and enter them into the .tf text file. So lets have look at a bit of the colour.tf file...

 

36       0  0  0               0   Description can be included here

37       203 202 198   0   

45       145 143 143   0  

46       110 9 14         0   

60       86 8 12          30   

100    153 8 8           60   

101    183 35 84       200   

150    183 35 84       150

250    244 240 210   50

300    132 85 35       80

400    255 208 117   200 Bone Shown as cream colour

1000  255 185 117   255

1001  0  0  0               0

1500  0  0  0               0

 

The first column is the density in Hounsfield Units (hu), this allows you select which parts of the data the colour or alpha values that follow, will be applied to. 

The second, third and fourth columns are colour using 0-255 range (RGB). So, in the above example, bone, which is between 400 - 1,000 hu  has been coloured 255 208 117 changing to 255 185 117.

The fifth column is the alpha value also set using 0-255 range. o, in the above example, the alpha for the range 400 - 1,000 hu has been set to go from 200 to 255(full on).

The remaining space on the line can be used to give a description of the region that has been selected and perhaps a description/name of the colour.

Information on Hounsfield Unitshttp://www.medcyclopaedia.com/library/topics/volume_iii_1/h/hounsfield_unit.aspx

Some sample tf-255  colour.tf (CLUT) files :  colour_255.zip

Sample Colour chart : .jpg  : volumeColours.jpg

 

An alternative to using tf-255 tag is to use the  tf tag.

tf="colour.tf"

This is used in the same way, as shown above, but the CLUT values in the .tf file must all be between 0 and 1.0. 

 

alpha="0.9"

The "alpha" property is the alpha value that controls transparency/blending, 1.0 is the default.

Default is : ON : value 1.0

 

cutoff="0.1"

The "cutoff" property is the alpha value below which fragments are automatically discarded, 0.1 is the default.

Default is : ON : value 0.1

 

sampleDensity="0.0007"

The "sampleDensity" property is the sample density used in the ray tracing, the lower the value the higher the quality the result, but the slower it is.

Default is : ON : value 0.002

 

sampleDensityWhenMoving="0.004"

The "sampleDensityWhenMoving" property allows a lower sample density to be specified when the volume is moving or being manipulated. This allows large datasets to be viewed at high quality while static and still be able to be moved interactively, although at lower visual quality.  

Default is : ON : value 0.02

 

region="0.0 0.0 0.0 1.0 1.0 1.0" 

The "region" property is the "xmin ymin zmin xmax ymax zmax" region of the volume that is displayed on screen, the range is 0.0 to 1.0. Note, that in this case, as with rotate and rotation y the second and fifth value is in/out of the screen and z is up/down. The above values will show the complete volume where as

region="0.15 0.0 0.0 0.5 1.0 1.0" 

will clip both left and right sides of the data, cutting the dataset in half vertically.

Default is : whole volume visible : value 0 0 0 1 1 1

 

technique="light" 

The  "technique" property selects which of the rendering options to use and equates to pressing the v key in P3D. There are four options :

 technique="default" 

 technique="light" 

 technique="iso" 

 technique="mip" 

Default is :  technique= "default"

 

Other Properties  

You can also include, position, rotate and rotation properties as usual.

position="0.5 0.5 0.15"

rotate="30 0 0 1"

rotate1="30 0 0 1"

rotate2="60 0 1 0"

rotation="20 0 0 1"

 

Including Volumes from a Non Dicom Image Series

Currently, to include a volume that is not created from a series of dicom images, you will need to use OsgVolume to create a volume as either a .dds, .osg or .ive file. The instructions for creating these files can be found here.

 

Including a Volume created from a Movie File

The process for creating a volume using a movie file to provide a sequence of images is the same as for the non dicom images above, except that first you will need to export the desired frames of the movie as an image sequence. So, for Quicktime 7 Pro you would open the edited movie file, the go to the File menu and select Export. In the dialogue box that opens name the new image sequence and place in new folder and using the pop up menu beside Export, select Export Movie as Image Sequence. You can also experiment with alternative options by clicking on the Options button.

 

Known Issues

 

 

 

Coming soon :<volume dragger="box">CardiacCT</volume>

 

#993366;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 17px; font-family: inherit; vertical-align: baseline; color: rgb(153, 51, 102); ">sampleDensity="0.004"

 
The "sampleDensity" property is the sample density used in the ray tracing, the lower the value the higher the quality the result, but the slower it is.

 

#993366;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 17px; font-family: inherit; vertical-align: baseline; color: rgb(153, 51, 102); ">region="0.0 0.0 0.0 1.0 1.0 1.0" 

 

The "region" property is the "xmin ymin zmin xmax ymax zmax" region of the volume that is displayed on screen, the range is 0.0 to 1.0. Note, that in this case, as with rotate and rotation y the second and fifth value is in/out of the screen and z is up/down. The above values will show the complete volume where as
 

#444444; padding: 0px; border: 0px initial initial;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: bold; font-style: inherit; font-size: 17px; font-family: 'Segoe UI', 'Lucida Grande', Arial, sans-serif; vertical-align: baseline; line-height: 1.25em; color: rgb(68, 68, 68); font: normal normal bold 20px/normal Arial; "> #993366; padding: 0px; margin: 0px; border: 0px initial initial;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 17px; font-family: inherit; vertical-align: baseline; color: rgb(153, 51, 102); ">region="0.15 0.0 0.0 0.5 1.0 1.0" 

 

will clip both left and right sides of the data, cutting the dataset in half vertically.

 

 

#993366;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 17px; font-family: inherit; vertical-align: baseline; color: rgb(153, 51, 102); ">technique="light" 

 

The  "technique" property selects which of the rendering options to use and equates to pressing the v key in P3D. There are four options :

 

 technique="default" 

 

 technique="light" 

 

 technique="iso" 

 

 technique="mip" 

 

 

 



 

Other Properties  

 

You can also include, position, rotate and rotation properties as usual.

 

#993366;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 13px; font-family: inherit; vertical-align: baseline; line-height: 1.2em; color: rgb(153, 51, 102); ">position="0.5 0.5 0.15"

 

#993366;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 13px; font-family: inherit; vertical-align: baseline; line-height: 1.2em; color: rgb(153, 51, 102); ">rotate="30 0 0 1"

 

#993366;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 13px; font-family: inherit; vertical-align: baseline; line-height: 1.2em; color: rgb(153, 51, 102); ">rotate1="30 0 0 1"

 

#993366;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 13px; font-family: inherit; vertical-align: baseline; line-height: 1.2em; color: rgb(153, 51, 102); ">rotate2="60 0 1 0"

 

#993366;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 13px; font-family: inherit; vertical-align: baseline; line-height: 1.2em; color: rgb(153, 51, 102); ">rotation="20 0 0 1"

 


 

Known Issues

 

 

 

 


 

Coming soon :

 

<volume dragger="box">CardiacCT</volume>

 

#993366;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 17px; font-family: inherit; vertical-align: baseline; color: rgb(153, 51, 102); ">sampleDensity="0.004"

 
The "sampleDensity" property is the sample density used in the ray tracing, the lower the value the higher the quality the result, but the slower it is.

 

#993366;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 17px; font-family: inherit; vertical-align: baseline; color: rgb(153, 51, 102); ">region="0.0 0.0 0.0 1.0 1.0 1.0" 

 

The "region" property is the "xmin ymin zmin xmax ymax zmax" region of the volume that is displayed on screen, the range is 0.0 to 1.0. Note, that in this case, as with rotate and rotation y the second and fifth value is in/out of the screen and z is up/down. The above values will show the complete volume where as
 

#444444; padding: 0px; border: 0px initial initial;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: bold; font-style: inherit; font-size: 17px; font-family: 'Segoe UI', 'Lucida Grande', Arial, sans-serif; vertical-align: baseline; line-height: 1.25em; color: rgb(68, 68, 68); font: normal normal bold 20px/normal Arial; "> #993366; padding: 0px; margin: 0px; border: 0px initial initial;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 17px; font-family: inherit; vertical-align: baseline; color: rgb(153, 51, 102); ">region="0.15 0.0 0.0 0.5 1.0 1.0" 

 

will clip both left and right sides of the data, cutting the dataset in half vertically.

 

 

#993366;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 17px; font-family: inherit; vertical-align: baseline; color: rgb(153, 51, 102); ">technique="light" 

 

The  "technique" property selects which of the rendering options to use and equates to pressing the v key in P3D. There are four options :

 

 technique="default" 

 

 technique="light" 

 

 technique="iso" 

 

 technique="mip" 

 

 

 



 

Other Properties  

 

You can also include, position, rotate and rotation properties as usual.

 

#993366;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 13px; font-family: inherit; vertical-align: baseline; line-height: 1.2em; color: rgb(153, 51, 102); ">position="0.5 0.5 0.15"

 

#993366;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 13px; font-family: inherit; vertical-align: baseline; line-height: 1.2em; color: rgb(153, 51, 102); ">rotate="30 0 0 1"

 

#993366;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 13px; font-family: inherit; vertical-align: baseline; line-height: 1.2em; color: rgb(153, 51, 102); ">rotate1="30 0 0 1"

 

#993366;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 13px; font-family: inherit; vertical-align: baseline; line-height: 1.2em; color: rgb(153, 51, 102); ">rotate2="60 0 1 0"

 

#993366;" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 13px; font-family: inherit; vertical-align: baseline; line-height: 1.2em; color: rgb(153, 51, 102); ">rotation="20 0 0 1"

 


 

Known Issues

 

 

 

 


 

Coming soon :

 

<volume dragger="box">CardiacCT</volume>

 

AttachmentSize
volumeColours.jpg122.34 KB
colour_255.zip9.23 KB