How to realize volume rendering for medical use

92 views
Skip to first unread message

Yuhui Ren

unread,
Dec 22, 2019, 3:40:00 AM12/22/19
to OpenSceneGraph Users
I have a 3D medical application developed by OSG. I want to realize volume rendering of CT/MRI dataset. Refer to the figure below.  I can set different effects of rendering. I have browse the osgVolume. I find that the transfer functions are too few to realize the effect I want. So what I’m asking really if anybody has any advice. It would be really appreciated, thanks!

2019-12-21_193035.png


2019-12-22_163111.png



Robert Osfield

unread,
Dec 24, 2019, 10:58:17 AM12/24/19
to OpenSceneGraph Users
Hi Yuhui,


On Sunday, 22 December 2019 08:40:00 UTC, Yuhui Ren wrote:
I have a 3D medical application developed by OSG. I want to realize volume rendering of CT/MRI dataset. Refer to the figure below.  I can set different effects of rendering. I have browse the osgVolume. I find that the transfer functions are too few to realize the effect I want. So what I’m asking really if anybody has any advice. It would be really appreciated, thanks!

I don't know what you are looking for so can't provide any specific advice.  

What do you mean by "the transfer functions are too few"?  

What effect do you want?
 
Cheers,
Robert.

Yuhui Ren

unread,
Dec 24, 2019, 10:40:40 PM12/24/19
to OpenSceneGraph Users
I want to show different parts of one man's head, such as brain, bones, blood vessel, muscle and other tissue, by using color functions and gradient opacity function. As the following pictures of reference software, I can get different effects by adjusting control points, including scalar color mapping, scalar opacity mapping and gradient opacity.

2019-12-25_111721.png2019-12-25_111539.png 

I have run the osgVolume demo of OSG. I try to find any transfer function to adjust effect I want. But I can't find more function besides "TransferFunction1D" and "AlphaFuncProperty". And the member functions of them are too less to realize the effects I want. This is some parts of my code.


osg::ref_ptr<osg::TransferFunction1D> transferFunction;
transferFunction = new osg::TransferFunction1D;
transferFunction->setColor(0.4, osg::Vec4(0.75,0.25,0.12,0.0));
transferFunction->setColor(0.5, osg::Vec4(0.975, 0.9, 0.82, 0.6));
transferFunction->setColor(0.6, osg::Vec4(1, 1, 1, 0.6));
transferFunction->setColor(1.0, osg::Vec4(0.9, 0.9, 0.9, 0.6));

float alphaFunc=0.02f;
osgVolume::AlphaFuncProperty* ap = new osgVolume::AlphaFuncProperty(alphaFunc);
osgVolume::CompositeProperty* cp = new osgVolume::CompositeProperty;
cp->addProperty(ap);


This is the result of my demo.

2019-12-25_112706.png




I'm confused with how to get better effect by OSG volume rendering. I have attached the source code file. Thanks.

main.cpp

Robert Osfield

unread,
Jan 9, 2020, 4:47:17 AM1/9/20
to OpenSceneGraph Users
I don't have time to look at your application right now, so have to provide some high level comments. 

The osgVolume NodeKit was written for volume rendering, and the effect you are looking for will be achievable with the right settings.

First up the blending of the volume texels is done based on the alpha value, in your transfer function you have an alpha of 0.0 or 0.6, I'd recommend that you try a gradient to see what results you get.

The OSG's tf plugin provides a native transfer function ascii file format that can help you set up and experiment with different transfer functions.  the file format is in the form:

 # comment
 intensity r g b a
 intensity r g b a
 intensity r g b a

You can pass in transfer functions to the osgvolume example via --tf myfile.tf



Reply all
Reply to author
Forward
0 new messages