当前位置:网站首页>VTK volume rendering program design of 3D scanned volume data

VTK volume rendering program design of 3D scanned volume data

2022-07-07 00:19:00 biyezuopinvip

Resource download address :https://download.csdn.net/download/sheziqiong/85926449
Resource download address :https://download.csdn.net/download/sheziqiong/85926449
pick want
With the continuous development of science and Technology , electronic technique 、 Computer technology 、 The wide application of network technology in the field of Surveying and mapping , The ability and means to obtain data have been greatly enriched . In the face of explosive growth in the amount of data , How to display and process these data more effectively on the basis of preserving the original details of the data , It has become the focus of future research . The main content of this paper is to introduce the scientific visualization method of volume rendering , Its advantages over traditional bin rendering methods are analyzed , Then several different volume rendering algorithms and their characteristics are introduced . Then it introduces VTK The relevant structure and functions of the visualization software package , And use VTK Write a program to realize volume rendering , Finally, the obtained result image is analyzed .
key word : Volume rendering ; Scientific visualization ; 3D volume data
ABSTRACT
With the continuous development of science and technology, electronic technology, computer technology, network technology is widely used in the field of surveying and mapping, data acquisition capability and means has been greatly enriched. To deal with those amount of data became more and more significant, how to be more effective in retaining the original details of the data on the display and processing of these data, it would be the focus of future research. The main content of this paper is to introduce the scientific visualization volume rendering method, analyzes its advantages compared to the traditional method of drawing bins, and then introduces several different volume rendering algorithm and its characteristics. Then introduced the VTK visualization related structure and function packages, and volume rendering using VTK write a program to be realized, the final analysis result of the image obtained.
Keywords: Volume data; Volume Render; scientific visualization
Objective record

1 The introduction 1
1.1 Research status and development trend of volume rendering 1
1.2 The source and significance of the research 2
1.3 The main content of the study 3
1.4 The main structure of the paper 4
2 Volume rendering principle 5
2.1 Shortcomings of traditional rendering methods 5
2.2 Introduction to several algorithms of volume rendering 6
2.2.1 Ray casting 6
2.2.2 Snowball throwing method 7
2.2.3 Crosscutting — Deformation method 8
2.2.4 Hardware based 3D texture mapping 9
2.3 Comparison of four volume rendering algorithms 10
2.3.1 Ray casting 10
2.3.2 Snowball algorithm 10
2.3.3 Crosscutting - Deformation method 10
2.3.4 Hardware based 3D texture mapping 10
3 Visualization Toolkit VTK 12
3.1 VTK Introduce 12
3.2 VTK Application architecture 12
3.2.1 VTK The main structure of 12
3.2.2 Visual pipeline 14
3.2.3 VTK Volume rendering visualization pipeline 15
3.3 VTK Reading and writing data of 15
3.3.1 VTK Data read / write structure 15
3.3.2 VTK The main steps of data reading and writing 16
3.3.3 VTK Introduction to specific classes of data reading and writing 16
3.3.4 Type conversion of image data 17
3.4 A simple VTK engineering 18
4 VTK Lower body rendering practice 20
4.1 Environment configuration 20
4.1.1 obtain VTK Source code 20
4.1.2 compile VTK Preparatory work 20
4.1.3 compile VTK Step by step 20
4.2 Program operation process 23
4.2.1 23
Main program Python Code 23
4.2.2 Program flow chart 26
4.3 Result analysis 26
4.3.1 Experimental data description 26
4.3.2 Program function description 27
4.3.3 Program result image 28
5 Conclusion 32
5.1 summary 32
5.2 expectation 32
reference 34
Cause thank 35
This paper is about volume rendering algorithm in scientific visualization , And the use of VTK Research on the implementation method of volume rendering program based on software library . The main work is to analyze the shortcomings of traditional bin rendering methods compared with volume rendering methods and the characteristics of various volume rendering algorithms , It introduces VTK The program architecture and main functions of the software library , The corresponding functions of its various modules , And the transfer relationship of its data flow in the visualization pipeline and rendering engine , Finally, use the latest VTK6.3.0 Version to build the programming environment and write the volume rendering program , The results obtained are analyzed .
This paper is roughly divided into five chapters :
The first chapter is the introduction , This paper introduces the research status of this topic at home and abroad , The source and significance of the topic and the main research content .
The second chapter analyzes the shortcomings of traditional bin rendering methods , And four main algorithm principles of volume rendering are introduced , The differences between these methods are discussed .
The third chapter is right VTK Introduction of software library , Its architecture and main functions are introduced , The function of each module and the characteristics of data reading and writing , Finally, with the help of a simple VTK The program introduces the structure of its volume rendering program code .
The fourth chapter is about using VTK Practice of Programming Volume Rendering , Use CMAKE The latest version of VTK The construction of programming environment , To write Python The program realizes the basic functions of volume rendering program , Finally, the result image of 3D data processing with the program is analyzed .
The fifth chapter is the conclusion , The content of the full text is sorted out and summarized , Put forward some prospects .

 Volume rendering program code :
```csharp
#!/usr/bin/env python
# *-* coding:utf-8 *-*

from vtk import *


# Read , It uses vtkMetaImageReader Class read MHD Format 
file_name = r"G:\graduate project\VolumeRenderData\backpack8.raw\backpack8.mhd"
reader = vtkMetaImageReader()
reader.SetFileName(file_name)

#vtkImageCast Data type conversion , Here it's converted into unsignedShort
cast = vtkImageCast()
cast.SetInputConnection(reader.GetOutputPort())
cast.SetOutputScalarTypeToUnsignedShort()
cast.Update()
output = cast.GetOutputPort()

'''
# Or use vtk Format read directly 
file_name = r"mummy.128.vtk"
reader = vtkStructuredPointsReader()
reader.SetFileName(file_name)
reader.Update()
output = reader.GetOutputPort()
'''

# Define volume rendering algorithm functions 
##rayCastFun = vtkVolumeRayCastCompositeFunction() # Ray casting 
##rayCastFun = vtkVolumeRayCastMIPFunction() # Maximum density method 
rayCastFun = vtkVolumeRayCastIsosurfaceFunction()  # Specific isosurface method 
rayCastFun.SetIsoValue(100)  # Value of specific isosurface 


# Set volume painting Mapper, There are two inputs 
volumeMapper = vtkVolumeRayCastMapper()
volumeMapper.SetInputConnection(output) # The first is to input image data 
volumeMapper.SetVolumeRayCastFunction(rayCastFun)  # The other is to set the ray casting function of volume rendering 


######### Next, it's time to set various attributes of volume painting www############################
'''
# Set the ray sampling distance 
volumeMapper.SetSampleDistance(volumeMapper.GetSampleDistance()*4)
# Set the image sampling step 
volumeMapper.SetAutoAdjustSampleDistances(0)
volumeMapper.SetImageSampleDistance(4)
'''
# Volume painting attribute settings 
volumeProperty = vtkVolumeProperty()
volumeProperty.SetInterpolationTypeToLinear()
volumeProperty.ShadeOn() # Turn shadow testing on or off 
volumeProperty.SetAmbient(0.4)
volumeProperty.SetDiffuse(0.6)
volumeProperty.SetSpecular(0.2)

# Gray opacity function 
compositeOpacity = vtkPiecewiseFunction()
compositeOpacity.AddPoint(70, 0.00)
compositeOpacity.AddPoint(90, 0.40)
compositeOpacity.AddPoint(180, 0.60)
volumeProperty.SetScalarOpacity(compositeOpacity) # Gray opacity function imports volume rendering attributes 

# Color transfer function 
color = vtkColorTransferFunction()
color.AddRGBPoint(0.000, 0.00, 0.00, 0.00)
color.AddRGBPoint(64.00, 1.00, 0.52, 0.30)
color.AddRGBPoint(190.0, 1.00, 1.00, 1.00)
color.AddRGBPoint(220.0, 0.20, 0.20, 0.20)
volumeProperty.SetColor(color) # Import color function 

# Gradient opacity function 
volumeGradientOpacity = vtkPiecewiseFunction()
volumeGradientOpacity.AddPoint(10, 0.0)
volumeGradientOpacity.AddPoint(90, 0.5)
volumeGradientOpacity.AddPoint(110, 1.0)
##volumeProperty.SetGradientOpacity(volumeGradientOpacity)# Import gradient opacity effect 

#vtkVolume type , is equivalent to vtkActor, Accept two inputs 
volume = vtkVolume()
volume.SetMapper(volumeMapper) # Set up Mapper object 
volume.SetProperty(volumeProperty) # Set the property object 


###################################### Render engine settings ############################

ren = vtkRenderer()
ren.SetBackground(1.0, 1.0, 1.0)
ren.AddVolume(volume)

renWin = vtkRenderWindow()
renWin.AddRenderer(ren)
renWin.Render()
renWin.SetWindowName("VolumeRenderingApp")

iren = vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
ren.ResetCamera()

renWin.Render()
iren.Start()







Resource download address :https://download.csdn.net/download/sheziqiong/85926449
Resource download address :https://download.csdn.net/download/sheziqiong/85926449
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
Resource download address :https://download.csdn.net/download/sheziqiong/85926449
Resource download address :https://download.csdn.net/download/sheziqiong/85926449

原网站

版权声明
本文为[biyezuopinvip]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207061644010176.html