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..
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.
The volume tag is used to load a folder of dicom files or a .dds volume file. For example :
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.
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 -->
<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>
So lets go through the various properties that have been applied here :
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 Units : http://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.
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.
The "alpha" property is the alpha value that controls transparency/blending, 1.0 is the default.
Default is : ON : value 1.0
Default is : ON : value 0.1
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
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
The "technique" property selects which of the rendering options to use and equates to pressing the v key in P3D. There are four options :
Default is : technique= "default"
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.
Coming soon :<volume dragger="box">CardiacCT</volume>
The Digital Learning Foundation is a registered Educational Charity, SC036588 and a Non-Profit Company Limited by Guarantee, SC282280.
The DLF is dedicated to assisting educators and students adopt new technologies and integrate them into everyday teaching and learning, while inspiring, motivating and making it fun!
- Video Editing
- How to : Access iDisk Public Folder
- How to : Set up iChat Ports
- How to : Fix a Locked Hard Disk
- How to : Hide the Menu Bar or Dock in OS X
- General OS X Help
- How to : Create Multi Channel Audio with QuickTime Pro
- How to : edit or create stereo movies in FCP
- WideWindow Config Files
Recent blog posts
- Making Maths Education Relevant : Conrad Wolfram
- The Beauty Of A Second : Competition
- Feet CT Scan Present3D Volume Render
- Preview : The Story of Electricity : BBC
- New Messenger Data From Mercury
- Prof John Ellis Interview
- drawing (on) riverside : the process
- Kepler Finds First Planet Candiates In Habitable Zone
- How to : Looping Video on iPod
- Opportunity Celebrates 7 years on Mars
- Dietary fructose causes liver damage in animal model, study finds
- A new model -- and possible treatment -- for staph bone infections
- U of M researchers identify risk and protective factors for youth involved in bullying
- Neurosurgery publishes findings of 3 important studies in June issue
- Fate of the heart: Researchers track cellular events leading to cardiac regeneration
- A shot in the arm for old antibiotics
- New technology reduces, controls CT radiation exposure in children
- Study shows probiotic Lactobacillus reuteri NCIMB 30242 significantly increased vitamin D levels
- UMass Amherst researchers develop powerful new technique to study protein function
- Metamorphosis of moon's water ice explained