Analysis of Direct Volume Rendering in VTK Analysis of Direct Volume Rendering in VTK

Analysis of Direct Volume Rendering in VTK

  • 期刊名字:中国生物医学工程学报(英文版)
  • 文件大小:772kb
  • 论文作者:WEI jun,ZHAO Hai-tao,TIAN yun,
  • 作者单位:College of Electronic Information,Department of Radiology
  • 更新时间:2020-11-22
  • 下载次数:
论文简介

Chinese Joumal of Biomedical Engineering( English Fdition) Volume 15 Number 3,September.2006Analysis of Direct Volume Rendering in VTK *WEI jun' , ZHAO Hai-tao' , TIAN yun' ,PAN wei' ,HE Gui-qing' , HAO Chong yang'Abstract: This paper introduces the techniques of direct volume rendering inVTK and discusses ray-casting- -the most popular technique of direct volume ren-dering. The visualizations for medical volumetric data by three functions of ray-casting are offered. Visualization effects prove that VTK is easy to get satisfied re-sults with good quality in short time.Key words : Direct volume rendering, Ray-casting, VTKINTRODUCTIONMedical volumetric data is the 3D volumetric data gained by the medical scanning devices such asCT、MRI and ultrasound scanners. According to the human' s vision characteristic and computationalprocessing by computers, we can visualize medical volumetric data to show the inner details. In thiscase, much more information is presented. Techniques of visualization for medical volumetric data aredivided to surface rendering and direct volume rendering.Theory of surface rendering is to pick up the surface o{ interested object firstly, and then change thevolumetric data to a series of isosurfaces which are made of polygons. Afer this work, we can gain thevisualized image based on iluminated models、 light and shade models. We have to distinguish thatwhether voxels are in the rendering surface or not in the case that we use surface rending to visualize themedical volumetric data. The shortcoming of surface rendering is that it is difficult to classify he compli-caled and boundary-blurried tissues. As a result, wrong surfaces and surfaces with empty are appeared.To gain better visualized images, at the end of 80s,the concept of direct volume rendering was pul for-ward .Direct volume rendering, which is called volume rendering for short, is a term used to describe arendering process applied to 3D data where information exists throughout a 3D space instead of simply on2D surfaces defined in 3D space. This method shades and lights the volumetric data directly to gain thevisualized image, avoids constructing the isosurfaces by polygons in surface rendering. Comparing withsurface rendering, volume rendering can render directly without segmentation, which is good at keepingthe details in medical volumetrie data, and make the visualized, imace look good. The bottle-neck of中国煤化工1. Clle of Eectronice Ifomation, Northwerterm Plstechnical University, Xi' an,71007H. C N M H G210102 080 M1606.,This work is supported by a grant fur PH. D) Site frum Chinese Educational Depurtment (20040699015). The authors ure thankful wo Guiqing He, PrI) ardChongyang Hao, profesor for many bhelp and interesting disianse.s-127-CHINESE J. BIOMED. ENC. VOL. 15 NO.3 ,SEP. 2006volume rendering is the speed because it must check all voxels in the volumetric dala. Recently, the re-search of accelerated volume rendering and the development of mainframe compuler and acceleratinghardware make the volume rendering to be applied widely.In so many domestic and overseas visualization softwares, VTK( Visualization Toolkit) is so goodthat it is widely used in the field of scientifie visualzation. It is a free C+ + class library and exploitedby the company of Kitware in USA. VTK is an open-source , portable ,object-oriented soflware system for3D computer graphics , visualization ,and image processing. Implemented in C+ +,VTK also supportsTcl, Pythod, and Java language bindings ,permitting complex applications ,rapid application prototy-ping,and simple scripts. VTK can realize surface rendering and volume rendering easily, and free the .users from writing the codes of algorithms.VOLUME RENDERING IN VTKVTK was designed to be used in the medicine field, so it is especially good at visualizing the medi-cal volumetric data. The commonly used visualization algorithms such as MC( Marching Cubes) and ray-casting are implemented in the C+ + core. It' s easy to realize visualization by using this C+ + core.VTK currently supports three types of volume rendering- -ray-casting, 2D texture mapping, and amethod thal uses the VolumePro graphics board. Although the example in this paper uses the ray-castingapproach, you can change it to use an altermative method only with minor modifications.Ray-casting, based on the image space scanning, is the typical method in the volume rendering. Ilcan gain high-quality visualized images. The theory is projecting rays from screen to shoot the volumetricdata,sampling according to the given step , computing the color and opacity of each spots in data, untilthe rays is absorbed or drilled through the data. Fig. 1 shows the process of ray- casting. This method canrepresent the property , sharp and arrangement of tissues by using phone rmodel and other optical models.[ Volumetric data 6jK)H Dila petreatmetColor MappingOpacity Mappingqij,k)0(ij.k),| Re-sumpling| Re-samplingColor C(j,k)| Opacity 0(ij.k) |+[ Compose Properties ].Visualized Image]Fig.1 Ray-casting algorithmThe method of 2D texture mapping based on the object space scanning is different from ray-casting.Search all data spots in the object space, cormpute heir contributions to the screen pixels , and then com-posite them to screen to obtain the visualixed image. The speed of this method is higher than ray-castingabout5~ 10 times, but its image' s quality is much lower sthag rpur-castingWhat's more, when the中国煤化工view camera is changed, the image might become faked.The method that uses the VolumePro graphics boardMYH. CNM H. Gdering mehod inthree methods offered by VTK. It can render images at least 20 frames per second. Is image' s quality is-128-Chinese Jourmal of Biomedical Engineering( English Edition) Volume 15 Number 3 ,September.2006lower than ray casting, but higher than 2D texture mapping. The lack of the VolumCPro graphics board isits high price.It is not always easy to predict which method will work best- -ray casting may out-perforrm texturemapping if the image size is reduced , more processors become available, or the graphics hardware is thebotle -neck to the rendering rate. These are things that can change continuously at run time. In addition,due to its compulational complexity, most volume rendering techniques only produce an approximation ofthe desired rendering equation. For example,techniques which take samples through the volume andcomposite them with an alpha blending function are only approximating the true integral through the vol-ume. Under different cireumstances,different techniques perform better or worse than others in terms ofboth quality and speed. What 's more , some techniques work only under certain special conditions. Forexample, the VolumePro rendering board only support parallel camera projections while ray-casting andtexture mapping both supports parallel and perspective camera transformations. Users should choose themost right method according to the actual needs. Presently, the ray-casting in VTK is used mostly. Thereason is not only its high imaging quality, but also its rendering speed is improved by the research of ac-celerated volume rendering algorithms and the development of mainframe computer and accelerating hard-ware. The use of 2D texture mapping is limited by its imaging quality and graphics hardware. High pricemakes the V olumePro graphics board to be seldom used.RAY-CASTING IN VTK .VTK currently offers users three functions based on ray-casting to visualize. There are isosurfacefunction, MIP function and composite function. In isosurface function, rays drill through the interestedisosurface in the volumetric data, and then parameters of color and shade are defined in volume property.Users can visuadlize a certain tissue such as skin, bone by initialzing the certain isosurface. The visual-ized image is similar to that visualized by surface rendering. MIP ( Maximum Intensity Projection) func-tion is considered to be the simplest volume rendering approach, because its visualized image is gainedby computing the maxima! intensity in the route of rays. MIP function can offer intuitinistic visualizedimage like X-ray image, so it is often used for blood vessel visualizalion. As the X - ray image,imagesgained by MIP function can not offer the information of depth and arrangement in tissues. Composilefunction is the most common approach in VTK. In this approach, users define transfer function to mapthe scalar value into a color and an opacity which are used in the VTK volume property. At last, theproperties are composite to formn the visualized image. In order to control the appearance of a 3D volumeof scalar values and obtain best imaging quality, three transfer functions must be defined. They are :1 )Scalar Opacity Transfer Function. The function maps the scalar value into an opacily or an opaci-ty per unit length value.2) Color Transfer Function. 'The function maps the scalar value into a color.3) Gradient Opacity Transfer Function. The function maps she maenitude of eradient of the scalar中国煤化工value into an opacity multiplier.Any of these mappings can be defined as a single valFYHCNMHGwhichcanbere-presented with a vtkPiecewiseFunction. For the scalar value to color mapping, a vtkColorTransferF unc-一129一CHINESE J. BIOMED. ENG. VOL. I5 N0.3 ,SEP.2006tion can also be used to define RGB and grey-scale colors.At the beginning of visualization , users must use vtk V olumel6Reader to read the medical volumetricdata just like this:vtk Volumel6Reader * reader = vuk Volumel6Reader: :New( ); //create the reader for the datareader- > SetDataDimensions (64 ,64) ;reader- > SetImageRange (1 ,93);reader- > SetFilePrefix( " E://Data/headsq/quarter");reader- > SetDataSpacing (1.0, 1.0, 0.48);The SetDataSpacing( ) method of vtk Volume16Reader sets the space of the volumetric data. TheSetlmageRange( )sets the number of read images. Users then define the transfer functions.vtkPiecewiseFunction * opaciyTransferFunction = vkPiecewisePunction:: New ( ); //Scalar OpacityTransferopacityTransferFunction- > AddPoint(0, 0. 0);//FunctionopacityTransferFunction- > AddPoint(500, 0. 0);opacityTransferFunction- > AddSegment (600, 0.73, 900, 0.9);opacityTransferFunction- > AddPoint( 1300, 2. 0);vtkColorTransferFunction * ColorfTransferFunction = vtkColorTransferFunction : :New( ) ;//Color Trans-fer FunctioncolorTransferFunction- > AddRGBPoint(0,0,0,0);.colorTransferF unction- > AddRGBPoint(600, 0.7, 0.7, 0.7);color'TransferFunction- > AddRGBPoint(900, 0. 85, 0. 85, 0.85);colorTransferFunction- > AddRCBPoint(1300, 1.0, 1.0, 1.0);vtkPiecewiseFunction * gradientTransferFunction = vtkPiecewiseFunction: : New( ) ;//Gradient Trans-gradienfTransferFunction- > AddPoint(0, 0.0);gradientTransferFunction- > AddPoinl(3, 0.0);gradientTransferFunction- > AddPoint(6, 1.0);gradientTransferFunction- > AddPoint(255, 0.1);From a user' s point of view, vtkPiecewiseF unction has two types of methods- -those that add infor-mation to the mapping, and those that clear out information from the mapping. W hen information is add-ed to a mapping, it is considered to be a point sarmple o[ the mapping with linear inlerpolation used todetermine values between the specified ones. In addition lo adding a single point, an AddSegment( ) canbe added which will define two mapping points. As an example, Fig. 2 shows pictorial representations ofthe scalar opacity transfer function.Typically, defining the transfer function is the hardest nart nf achieving an efertive volume visual-ization since users are esentially performing a classificati中国煤化工sers to understandthe meaning of the underlying data values.TYHCNMHGFor rendering techniques that map a pixel to a single location in the volume ( such as an isosurface-130-Chinese Joumal of Biomedical Engineering( English Edition) Volume 15 Number 3 ,Septembcr. 2006rendering or a maximum intensity projection) the ScalarOpacity transfer function maps the scalar valuc toan opacity. When a compositing technique is used,the ScalarOpacity function maps scalar value to an 0-pacity that is accumulated per unit length for a hormogenous region of that value. Compositing is per-formed by approximating the continuously changing value through the volume with a large number ofsmall homogeneous regions , where the opacity per unit length is transforned based on the size of theseregions.Opacity2↑1500 600 9001300 Scalar.ValueFig.2 Chart of scalar opacity transfer functionThe ScalarOpacity and Color transfer functions are typically used to perform a simple classificationof the data. Scalar values that are part of the background , or considered“ noise”are mapped lo an opac-ity of 0.0, eliminating them from contributing to the image. The remaining scalar values can be dividedinto different “materials”which have different opacities and colors. For example, medical data acquiredfrom a CT scanner can often be categorized as air ( values below 20),soft tissue ( values from 20 to80), or bone ( values above 80) based on the density value contained in the data.GradientTransferFunction eliminates nearly homogeneous regions by defining an opacity multiplier of0.0 for any gradient magnitude less than 3. This multiplier follows a linear ramp from0.0 to1.0 on gra-dient magnitudes between 3 and 6, and no change in the opacity value is performed on samples withmagmitudes above 6.Next users create the objects specific to ray-casting- -a vtkVolumeRayCastCompositeFunction thatperforms the compositing of samples along the ray, and a vtk VolumeRayCaslMapper that performs someof the basic ray-casting operations such as transformations and clipping. Users sel the input of the map-per to the data that read by vtk Volumel6Reader, create a vtk Volume to hold the mapper and properly.vtkV olumeProperty * volumeProperty = vtkVolumeProperty:: New( ) ;//The property describes how thedata will lookvolumeProperty- > SetColor( colorTransferFunction) ;volumeProperty- > SelScalarOpacity( opacity'TransferFunction);volumeProperty- > SetGradientOpacity( gadientTransferFunction) ;vtkVolumeRayCastCompositeFunction * compositeRaycastFunction = vtkVolumeRayCastCompositeFunc-tion: :New();vtkVolumeRayCastMapper * volumeMapper = vtiVolumeF中国煤化工volumeMapper- > SetVolumeRayCastFunction( con:MYHCNMHG.volumeMapper- > SetInput( reader- > GetOutput());-131-CHINESE J. BIOMED. ENG. VOL. I5 N0.3 ,SEP.2006vlkVolume * volume = vtk Volume ::New( ) ;// The volume holds the mapper and the propertyvolume- > SetMapper( volumeMapper);volume- > SetProperty( volumeProperty);Then, users create the renderer ,the render window and interactors to render and control the vol-ume.vtkRenderer * aRender = vtkRenderer; : New( ); //Create the readerervtkRenderWindow * renWin = vtkRenderWindow::New( ); // Create the reader windowrenWin- > AddRenderer( aRender) ;vtkRenderW indowInteractor * iRen = vtkRenderW indowInteractor: :New( ) ;//InteractoriRen- > SetRenderW indow( renWin);Finally, users create the standard graphics display objects, add the volume to the renderer, andrender the scene.aRender- > AddVolume( volume); //Add the volume to the rendereraRender- > SetBackground(0, 0, 0); //Set the color of backgroundrenWin- > SetSize(500, 500); //Set the size of render windowrenWin- > Render( );iRen- > Initialize(); iRen- > Start();If users decide to implement the above seript with a 2D texture mapping approach inslead of ray-casting, the bolded portion of scripl would instead be:vtkVolumeTextureMapper2D * volumeMapper = vtkVolumeTextureMapper2D: :New();If users have a VolumePro volume rendering board on the system, and have compiled in the supportfor this device, users could use the following script fragment lo replace the ray-casting specific sectionwith a VolumePro volume mapper:vtkVolumeProMapper * volumeMapper = vtkVolumeProMapper: :New();lf users want to gain isosurface or MIP rendering image, what need to do is just to creale the objectspecific to vtkVolumeRayCastIsosurfaceFunction or vtk VolumeRayCastMIPFunction, then map them intothe vtk VolumeRayCastMapper.Fig. 3 shows the images rendered by composite function, isosurface function and MIP function. Thedata are supported by Kitware Company.中国煤化工YH口(a) Rendered by composite function(b) Rendered by isosurCNM H Ged by MP fuotionFig.3Volume rendering for medical volumetric data by different ray-casting functions-132一Chinese Joumal of Biomnedical Engineering( English Edition) Volume 15 Number 3 ,Seplember. 2006CONCLUSIONSWe develop our own software for medical volumetric data visualization by using VTK. As anticipa-ted, we have found VTK is easy to use, extend, and maintain, and find that applications are portableacross UNIX and PC's.REFERENCES1 Schroeder WJ, Avila IS, Martin KM. The visualization tolkit user' s guide. GE Corporate Research & Developrnent2 Schroeder W , Martin K ,Lorensen W. The visualization toolkit: An object-oriented approach lo 3D graphies. 2nd ed,Prentice-Hall, Old Tappan, N.J.,19983 Schroeder W, Martin K, lorensen B. The visualization tolkit. 3rd Edition , Kiware ,20034 Max N. Optical models for direct volume rendering. EE Transactions on Visualization and Compuler Graphics,1995, 1(2): 99~ 1085 Schroeder WJ, Avila LS, Hofman W. Visualizing with VTK: A tutorial. IEEE Conputer Craphics and Applications ,September/October ,2000 ,20 ~27 .6 Schroeder WJ, Martin KM, Lorensen WE. "The design and implementation of an objec-oriented toolkit for 3D graph-ics and visualization. GE Corporate Research & Development中国煤化工MYHCNMHG一133-

论文截图
版权:如无特殊注明,文章转载自网络,侵权请联系cnmhg168#163.com删除!文件均为网友上传,仅供研究和学习使用,务必24小时内删除。