Surveillance refers to the task of observing a scene, often for lengthy periods in search of particular objects or particular behaviour. This task has many applications, foremost among them is security (monitoring for undesirable behaviour such as theft or vandalism), but increasing numbers of others in areas such as agriculture also exist. Historically, closed circuit TV (CCTV) surveillance has been mundane and labour Intensive, involving personnel scanning multiple screens, but the advent of reasonably priced fast hardware means that automatic surveillance is becoming a realistic task to attempt in real time. Several attempts at this are underway.
Surveillance refers to the task of observing a scene, often for lengthy periods in search of particular objects or particular behaviour. This task has many applications, foremost among them is security (monitoring for undesirable behaviour such as theft or vandalism), but increasing numbers of others in areas such as agriculture also exist. Historically, closed circuit TV (CCTV) surveillance has been mundane and labour Intensive, involving personnel scanning multiple screens, but the advent of reasonably priced fast hardware means that automatic surveillance is becoming a realistic task to attempt in real time. Several attempts at this are underway.
Website Designing Company is fastest growing company in the IT market in the world for the website design and website layout. we are best website designing company in India as well as in USA we are based in Noida and Delhi NCR. Website designing company is powered by Css Founder.com
Corisco is a method for monocular camera orientation estimation in anthropic environments using edgels. This is my doctorate defense presentation, updated and translated to english.
Mathematics (from Greek μάθημα máthēma, “knowledge, study, learning”) is the study of topics such as quantity (numbers), structure, space, and change. There is a range of views among mathematicians and philosophers as to the exact scope and definition of mathematics
Integration Made Easy!
The derivative of a function can be geometrically interpreted as the slope of the curve of the mathematical function f(x) plotted as a function of x. But its implications for the modeling of nature go far deeper than this simple geometric application might imply. After all, you can see yourself drawing finite triangles to discover slope, so why is the derivative so important? Its importance lies in the fact that many physical entities such as velocity, acceleration, force and so on are defined as instantaneous rates of change of some other quantity. The derivative can give you a precise intantaneous value for that rate of change and lead to precise modeling of the desired quantity.
Website Designing Company is fastest growing company in the IT market in the world for the website design and website layout. we are best website designing company in India as well as in USA we are based in Noida and Delhi NCR. Website designing company is powered by Css Founder.com
Corisco is a method for monocular camera orientation estimation in anthropic environments using edgels. This is my doctorate defense presentation, updated and translated to english.
Mathematics (from Greek μάθημα máthēma, “knowledge, study, learning”) is the study of topics such as quantity (numbers), structure, space, and change. There is a range of views among mathematicians and philosophers as to the exact scope and definition of mathematics
Integration Made Easy!
The derivative of a function can be geometrically interpreted as the slope of the curve of the mathematical function f(x) plotted as a function of x. But its implications for the modeling of nature go far deeper than this simple geometric application might imply. After all, you can see yourself drawing finite triangles to discover slope, so why is the derivative so important? Its importance lies in the fact that many physical entities such as velocity, acceleration, force and so on are defined as instantaneous rates of change of some other quantity. The derivative can give you a precise intantaneous value for that rate of change and lead to precise modeling of the desired quantity.
ALEXANDER FRACTIONAL INTEGRAL FILTERING OF WAVELET COEFFICIENTS FOR IMAGE DEN...sipij
The present paper, proposes an efficient denoising algorithm which works well for images corrupted with
Gaussian and speckle noise. The denoising algorithm utilizes the alexander fractional integral filter which
works by the construction of fractional masks window computed using alexander polynomial. Prior to the
application of the designed filter, the corrupted image is decomposed using symlet wavelet from which only
the horizontal, vertical and diagonal components are denoised using the alexander integral filter.
Significant increase in the reconstruction quality was noticed when the approach was applied on the
wavelet decomposed image rather than applying it directly on the noisy image. Quantitatively the results
are evaluated using the peak signal to noise ratio (PSNR) which was 30.8059 on an average for images
corrupted with Gaussian noise and 36.52 for images corrupted with speckle noise, which clearly
outperforms the existing methods.
International Journal of Engineering Research and Applications (IJERA) is an open access online peer reviewed international journal that publishes research and review articles in the fields of Computer Science, Neural Networks, Electrical Engineering, Software Engineering, Information Technology, Mechanical Engineering, Chemical Engineering, Plastic Engineering, Food Technology, Textile Engineering, Nano Technology & science, Power Electronics, Electronics & Communication Engineering, Computational mathematics, Image processing, Civil Engineering, Structural Engineering, Environmental Engineering, VLSI Testing & Low Power VLSI Design etc.
It gives detailed description about Points, Lines, Attributes of Output Primitives, Line Functions, Line Drawing Algorithms, DDA Line drawing algorithms, Bresenham’s Line Algorithm, Circle Generating Algorthims
International Journal of Engineering Research and Applications (IJERA) is an open access online peer reviewed international journal that publishes research and review articles in the fields of Computer Science, Neural Networks, Electrical Engineering, Software Engineering, Information Technology, Mechanical Engineering, Chemical Engineering, Plastic Engineering, Food Technology, Textile Engineering, Nano Technology & science, Power Electronics, Electronics & Communication Engineering, Computational mathematics, Image processing, Civil Engineering, Structural Engineering, Environmental Engineering, VLSI Testing & Low Power VLSI Design etc.
Website Designing Company is fastest growing company in the IT market in the world for the website design and website layout. we are best website designing company in India as well as in USA we are based in Noida and Delhi NCR. Website designing company is powered by Css Founder.com
This includes different line drawing algorithms,circle,ellipse generating algorithms, filled area primitives,flood fill ,boundary fill algorithms,raster scan fill approaches.
Similar to TAO Fayan_X-Ray and MIP volume rendering (20)
1. X-RAY AND MIP VOLUME RENDERING
FAYAN TAO (1509853F-II20-0019)
1. Introduction
Ray casting[1] is an image-order direct volume rendering algorithm, which uses straight-
forward numerical evaluation of the volume rendering integral. For each pixel of the image,
a single ray is cast into the scene. At equi-spaced intervals along the ray, the discrete volume
data are resampled, usually using trilinear interpolation as reconstruction filter. That is, for
each resampling location, the scalar values of eight neighboring voxels are weighted according
to their distance to the actual location for which a data value is needed. After resampling,
the scalar data value is mapped to optical properties via a lookup table, which yields an
RGBA quadruplet that subsumes the corresponding emission and absorption coefficients for
this location. The solution of the volume rendering integral is then approximated via alpha
blending in either front-to-back or back-to-front order, where usually the former is used in
ray casting.
In this project, we just consider X-Ray and maximum intensity projection (MIP) volume
rendering. And the scalar values are grey values.
2. Design outline
We follow that two main algorithms about X-Ray and MIP provided in section 2 to
implement X-Ray and MIP volume rendering, respectively, which is based on orthographic
projection. Rotation and scaling the image are implemented in this project.
2.1. Underlying theorems–Continuous forms. •X-Ray projection
In order to get the intensity Ii,j of the image on the location(i, j), we should accumulate
(integrate) the volumetric function f(x, y) along the ray in the continuous forms.
Ii,j =
L
0
f(Pi,j + t · ri,j)dt
•MIP
To find the maximum of f(x, y) along the ray and write it to image location(i, j), we
employ following formula.
Ii,j = max(f(Pi,j + t · ri,j))
2.2. Underlying theorems–Discrete forms. Since volumetric integrals that cannot be
solved in closed form (i.e. analytically) and therefore must be approximated by discrete rays.
•X-Ray projection
1
2. 2 FAYAN TAO (1509853F-II20-0019)
Ii,j =
L/ t
k=0
f(Pi,j + k · k · ri,j) · t
Sample the volumetric function f(x, y) at equi-spaced distances t along the ray accu-
mulate the samples and write the resulting intensity Ii,j to the image at location (i, j).
•MIP
Ii,j = max(f(Pi,j + k · k · ri,j))(0 ≤ k ≤ L/ k)
Find the maximum of f(x, y) along the ray and write it to image location(i, j).
2.3. Trilinear interpolation. As the ray sample points do not always fall onto the known
grid points, in fact, most often they fall somewhere inbetween. So we need to estimate the
values of the ray samples from the existing grid points. In this project, we choose trilinear
interpolation to calculate related values of samples.
2.4. Volume bounding box. In order to approximate the volume rendering integral by
using a volume bounding box, which has the front-to-back order, we limit volume data in
the volume bounding box. The detailed key code of this part is shown in the following
section 2.
2.5. Scaling. We try to control the image size by changing i and j, where i = H
Ni−1
,
j = W
Nj−1
, (0 ≤ i < Ni, 0 ≤ j < Nj); W, H is the screen width and hight in world
coordinates; Ni, Nj is the image dimensions in pixels.
We set a variable k, let k · i, k · j as the new value of i and j, respectively.
if 0 < k < 1, then the image will be enlarged, while k > 1, the image will become small.
Please refer to X-Ray Rendering Algorithm and MIP Rendering Algorithm in section 2
for a better understanding of i and j.
2.6. Rotation. A new position of the image plane can be defined in terms of three rotation
angle θ, α, β with respect to x, y, z axes and X, Y andZ rotation matrix.
X =
1 0 0
0 cosθ sinθ
0 −sinθ cosθ
, Y =
cosα 0 sinα
0 1 0
−sinα 0 cosα
, Z =
cosβ sinβ 0
−sinβ cosβ 0
0 0 1
Assuming the original view vector is u = [0, 0, 1], then the new view vector new u becomes:
new u = u · X · Y · Z
In order to implement the function of rotation, we try to rotate the view direction vector
ray by means of rotation matrix X, Y andZ with rotation angle θ, α, β, respectively.
In this project, we also use another way to rotate the image at any angle. The main idea
is to make the volume cube fixed, and rotate the view direction ray at any angle. the start
point(eye) of the ray is controlled by mouse. We regard the point that mouse point to in
the image plane as the start point of the ray. The ray always pointing to the center (p0) of
cube. In order to get the height and width of image plane, we compute the length of each
body diagonal’s projection of that cube(bounding box), then choose the largest two as the
height and width. Besides, to get the orthonormal vector v and u on the image plane, we
choose two points c and d on cube, find two parallel vectors of ray (n1 and n2), where run
3. X-RAY AND MIP VOLUME RENDERING 3
through two points m and n on image plane and two points c and d on cube. In this case,
v = (eye.x − m.x, eye.y − m.y, eye.z − m.z), u = (eye.x − n.x, eye.y − n.y, eye.z − n.z).
This part is shown as following codes.
4. 4 FAYAN TAO (1509853F-II20-0019)
1 // f o r the menu ”XRay” to display XRay
2 i n t CVolumeRender : : XRay( f l o a t s t e p S i z e )
3 {
4 // eye i s the s t a r t point of ray on image plane
5 this −>s t e p S i z e = s t e p S i z e ;
6 this −>ray = this −>pointO − this −>eye ;
7 f l o a t mRay = this −>ray . Magnitude ( ) ;
8 this −>ray . Normalize ( ) ;
9
10 this −>IntersectRaywithVolumeBoundingBox ( this −>eye ) ;
11 // vector c , d i s p a r a l l e l to ray
12 f l o a t xc , yc , zc ;
13 xc = this −>eye .X() − this −>pointO .X() + this −>voxelWidth ;
14 yc = this −>eye .Y() − this −>pointO .Y() + 0;
15 zc = this −>eye . Z() − this −>pointO . Z() + this −>voxelDepth ;
16 Vector3 c ( xc , yc , zc ) ;
17 f l o a t xd , yd , zd ;
18 xd = this −>eye .X() − this −>pointO .X() + 0;
19 yd = this −>eye .Y() − this −>pointO .Y() + 0;
20 zd = this −>eye . Z() − this −>pointO . Z() + this −>voxelDepth ;
21 Vector3 d(xd , yd , zd ) ;
22 // u , v are on the image plane , and u , v , ray are orthnormal image plane vectors
23 Vector3 u , v ;
24 u = this −>eye − c ;
25 v = this −>eye − d ;
26 // four body diagonals on cube : dig1 , dig2 , dig3 , dig4 ; eight points on cube :
27 //v00 , v100 , v101 , v001 , v010 , v110 , v111 , v011//
28 Vector3 dig1 , dig2 , dig3 , dig4 ;
29 Vector3 v000 (0 , 0 , 0 ) ;
30 Vector3 v100 ( this −>voxelWidth , 0 , 0 ) ;
31 Vector3 v101 ( this −>voxelWidth , 0 , this −>voxelDepth ) ;
32 Vector3 v001 (0 , 0 , this −>voxelDepth ) ;
33 Vector3 v010 (0 , this −>voxelHeigth , 0 ) ;
34 Vector3 v110 ( this −>voxelWidth , this −>voxelHeigth , 0 ) ;
35 Vector3 v111 ( this −>voxelWidth , this −>voxelHeigth , this −>voxelDepth ) ;
36 Vector3 v011 (0 , this −>voxelHeigth , this −>voxelDepth ) ;
37 dig1 = v111 − v000 ;
38 dig2 = v011 − v100 ;
39 dig3 = v010 − v101 ;
40 dig4 = v110 − v001 ;
41 // the length of each body diagonal //
42 f l o a t mDig1 = dig1 . Magnitude ( ) ;
43 f l o a t mDig2 = dig2 . Magnitude ( ) ;
44 f l o a t mDig3 = dig3 . Magnitude ( ) ;
45 f l o a t mDig4 = dig4 . Magnitude ( ) ;
46 // compute the p r o j e c t i o n length of each body diagonal on image plane //
47 f l o a t r1 = fabs ( this −>ray ∗ dig1 ) / ( dig1 . Magnitude ()∗ this −>ray . Magnitude ( ) ) ;
48 f l o a t r2 = fabs ( this −>ray ∗ dig2 ) / ( dig2 . Magnitude ()∗ this −>ray . Magnitude ( ) ) ;
49 f l o a t r3 = fabs ( this −>ray ∗ dig3 ) / ( dig3 . Magnitude ()∗ this −>ray . Magnitude ( ) ) ;
50 f l o a t r4 = fabs ( this −>ray ∗ dig4 ) / ( dig4 . Magnitude ()∗ this −>ray . Magnitude ( ) ) ;
51 f l o a t ang1 = acos ( r1 ) ;
52 f l o a t ang2 = acos ( r2 ) ;
53 f l o a t ang3 = acos ( r3 ) ;
54 f l o a t ang4 = acos ( r4 ) ;
55 f l o a t length1 = dig1 . Magnitude ()∗ cos ( PI / 2 − ang1 ) ;
56 f l o a t length2 = dig2 . Magnitude ()∗ cos ( PI / 2 − ang2 ) ;
57 f l o a t length3 = dig3 . Magnitude ()∗ cos ( PI / 2 − ang3 ) ;
58 f l o a t length4 = dig4 . Magnitude ()∗ cos ( PI / 2 − ang4 ) ;
59 f l o a t lengthA [ 4 ] = { length1 , length2 , length3 , length4 };
60 std : : s o r t ( lengthA , lengthA + 4 ) ;
61 // the height and width of image plane //
62 this −>screenWidth = lengthA [ 2 ] + 1;
63 this −>screenHeight = lengthA [ 3 ] + 1;
64 this −>I n i t S c r e e n (&CVolumeRender : : xrayLoop ) ;
65 return 0;
66
5. X-RAY AND MIP VOLUME RENDERING 5
3. Algorithms and key code fragments
In this section, we will show details about X-Ray and MIP Rending Algorithms. Besides,
we will also provide the related key codes fragments.
3.1. X-Ray and MIP Rendering Algorithms. Following two tables shows algorithms
about X-Ray and MIP volume rendering.
X-Ray Rendering Algorithm
RenderXRay(volume V, int stepSize, Image I)
ray = v×u
|v×u|
; ∗ for orthographic projection ∗
∗ ray: the view direction vector; v, uray: orthonormal image plane vectors ∗
i = H
Ni−1
, j = W
Nj−1
(0 ≤ i < Ni, 0 ≤ j < Nj);
∗ W, H: screen width, hight in world coordinates; Ni, Nj: image dimensions in pixels ∗
for each image pixel(i, j)
∗ scan the image row by row, column by column: ∗
P(i, j) = P(0, 0) + i · v · i + j · u · j;
∗ P(i, j): Location of image pixel(i, j) in the world space, which is a point on the ray direction ∗
∗ P(0, 0): image origin in world space ∗
sum = 0;
IntersectRayWithV olumeBoundingBox(V, ray, t front, t back);
for(t = t front; t <= t back; t+ = stepSize)
sampleLoc = P(i, j) + t · ray;
intV al = Interpolate(V, sampleLoc);
sum+ = intV al · stepSize;
I(i, j) = sum;
NormalizeImage(I);
6. 6 FAYAN TAO (1509853F-II20-0019)
MIP Rendering Algorithm
RenderMIP(volume V, int stepSize, Image I)
ray = v×u
|v×u|
; ∗ for orthographic projection ∗
∗ ray: the view direction vector; v, uray: orthonormal image plane vectors ∗
i = H
Ni−1
, j = W
Nj−1
(0 ≤ i < Ni, 0 ≤ j < Nj);
∗ W, H: screen width, hight in world coordinates; Ni, Nj: image dimensions in pixels ∗
for each image pixel(i, j)
∗ scan the image row by row, column by column: ∗
P(i, j) = P(0, 0) + i · v · i + j · u · j;
∗ P(i, j): Location of image pixel(i, j) in the world space, which is a point on the ray direction ∗
∗ P(0, 0): image origin in world space ∗
max = 0;
IntersectRayWithV olumeBoundingBox(V, ray, t front, t back);
for(t = t front; t <= t back; t+ = stepSize)
sampleLoc = P(i, j) + t · ray;
intV al = Interpolate(V, sampleLoc);
if(intV al > max)
max = intV al; sum+ = intV al · stepSize;
I(i, j) = max;
3.2. Key code fragments. Now, we will show the key code for setting volume bounding
box, trilinear interpolation, scaling and rotation.
code for volume bounding box:
1 //p i s the s t a r t point of ray
2 void CVolumeRender : : IntersectRaywithVolumeBoundingBox ( Vector3 p)
3 {
4 f l o a t bbx [ 2 ] , bby [ 2 ] , bbz [ 2 ] ;
5
6 bbx [ 1 ] = this −>voxelWidth ;
7 bby [ 1 ] = this −>voxelHeigth ;
8 bbz [ 1 ] = this −>voxelDepth ;
9
10 bbx [ 0 ] = 0;
11 bby [ 0 ] = 0;
12 bbz [ 0 ] = 0;
13
14 f l o a t bbx0 , bbx1 , bby0 , bby1 , bbz0 , bbz1 ; // bounding box
15 f l o a t dev ;
16 f l o a t t1 , t2 , mint , maxt ;
17
18 t f r o n t = 0.0 f ;
19 t back = 1000.0 f ;
20 dev = 0.0 f ;
7. X-RAY AND MIP VOLUME RENDERING 7
1 i n t useBoundingBox = 1;
2 i f ( useBoundingBox )
3 {
4 bbx0 = bbx [ 0 ] + dev ; bbx1 = bbx [ 1 ] − dev ;
5 bby0 = bby [ 0 ] + dev ; bby1 = bby [ 1 ] − dev ;
6 bbz0 = bbz [ 0 ] + dev ; bbz1 = bbz [ 1 ] − dev ;
7
8 }
9 e l s e
10 {
11 bbx0 = 0 + dev ; bbx1 = this −>voxelWidth − 1 − dev ;
12 bby0 = 0 + dev ; bby1 = this −>voxelHeigth − 1 − dev ;
13 bbz0 = 0 + dev ; bbz1 = this −>voxelDepth − 1 − dev ;
14 }
15
16 // i f p i s outside box , we w i l l not consider i t
17 i f ( fabs ( ray .X( ) ) <= 1e−5)
18 {
19 i f (p . Z()<bbx0 && p . Z()>bbx1 )
20 {
21 return ;
22 }
23 }
24 i f ( fabs ( ray .Y( ) ) <= 1e−5)
25 {
26 i f (p .Y()<bby0 && p .Y()>bby1 )
27 {
28 return ;
29 }
30 }
31 i f ( fabs ( ray . Z ( ) ) <= 1e−5)
32 {
33 i f (p . Z()<bbz0 && p . Z()>bbz1 )
34 {
35 return ;
36 }
37
38 }
39
40
41 // consider X value
42 i f ( fabs ( ray .X( ) ) > 1e−5)
43 { // i n t e r s e c t with bbx
44 t1 = ( bbx0 − p . Z ( ) ) / ray .X( ) ;
45 t2 = ( bbx1 − p .Y( ) ) / ray .X( ) ;
46 mint = std : : min( t1 , t2 ) ;
47 maxt = std : : max( t1 , t2 ) ;
48 t f r o n t = std : : max( mint , t f r o n t ) ;
49 t back = std : : min(maxt , t back ) ;
50 }
51 // consider Y value
52 i f ( fabs ( ray .Y( ) ) > 1e−5)
53 { // i n t e r s e c t with bby
54 t1 = ( bby0 − p .Y( ) ) / ray .Y( ) ;
55 t2 = ( bby1 − p .Y( ) ) / ray .Y( ) ;
56 mint = std : : min( t1 , t2 ) ;
57 maxt = std : : max( t1 , t2 ) ;
58 t f r o n t = std : : max( mint , t f r o n t ) ;
59 t back = std : : min(maxt , t back ) ;
60 }
61 // consider Z value
62 i f ( fabs ( ray . Z ( ) ) > 1e−5)
63 { // i n t e r s e c g t with bbz
64 t1 = ( bbz0 − p . Z ( ) ) / ray . Z ( ) ;
65 t2 = ( bbz1 − p . Z ( ) ) / ray . Z ( ) ;
66 mint = std : : min( t1 , t2 ) ;
8. 8 FAYAN TAO (1509853F-II20-0019)
•Code for Trilinear Interpolation
1
2 i n t CVolumeRender : : TriLinear ( f l o a t x , f l o a t y , f l o a t z )
3 // (x , y , z ) i s the l o c a t i o n of a ray sample point .
4 {
5 f l o a t u , v , w;
6 u = x − ( i n t ) x ;
7 v = y − ( i n t ) y ;
8 w = z − ( i n t ) ;
9 i f ( 0 . 0 f == u && 0.0 f == v && 0.0 f == w)
10 {
11 return this −>GetVoxelVal ( x0 , y0 , z0 ) ;
12 }
13
14 // find the eight neighboring samples of (x , y , z )//
15 i n t p000 , p001 , p011 , p010 ;
16 i n t p100 , p101 , p111 , p110 ;
17
18 // get voxel value of each neighboring sample //
19 p100 = this −>GetVoxelVal ( x0 , y0 , z0 ) ;
20 p101 = this −>GetVoxelVal ( x0 + 1 , y0 , z0 ) ;
21 p111 = this −>GetVoxelVal ( x0 + 1 , y0 + 1 , z0 ) ;
22 p110 = this −>GetVoxelVal ( x0 , y0 + 1 , z0 ) ;
23
24 p000 = this −>GetVoxelVal ( x0 , y0 , z0 + 1 ) ;
25 p001 = this −>GetVoxelVal ( x0 + 1 , y0 , z0 + 1 ) ;
26 p011 = this −>GetVoxelVal ( x0 + 1 , y0 + 1 , z0 + 1 ) ;
27 p010 = this −>GetVoxelVal ( x0 , y0 + 1 , z0 + 1 ) ;
28
29 // get voxel value of sample point by using f o l l o w i n g formula //
30 i n t intVal = (1 − w) ∗ ((1 − v) ∗ (u ∗ p001 + (1 − u) ∗ p000 ) +
31 v ∗ (u ∗ p011 + (1 − u) ∗ p010 )) +w ∗ ((1 − v) ∗ (u ∗ p101 + (1 − u) ∗ p100 )
32 + v ∗ (u ∗ p111 + (1 − u) ∗ p110 ) ) ;
33
34 return intVal ;
35 }
36
37 // function f o r g e t t i n g voxel value of sample point to the p o s i t i o n (x , y , z )//
38 i n t CVolumeRender : : GetVoxelVal ( i n t x , i n t y , i n t z )
39 {
40 i n t width = this −>voxelWidth ;
41 i n t height = this −>voxelHeigth ;
42 i f (x <0||y <0|| z <0||x>width −1||y>height −1|| z>this −>voxelDepth −1)
43 {
44 return 0;
45 }
46 e l s e
47 {
48 return this −>voxelData [ z∗ height ∗width + y∗width + x ] ;
49 }
50 }
•Code for Scaling
9. X-RAY AND MIP VOLUME RENDERING 9
1
2 //// s c a l i n g : xxrayLoop () f o r XRay. ////
3 // We s e t a v a r i a b l e s c a l i n g k : the image w i l l be enlarge when s c a l i n g k i s between 0 and 1//
4 //and the image w i l l become smaller when s c a l i n g k i s l a r g e r than 1.//
5
6 // f o r each p i x e l in image plane , using volume bounding box to do volume rendering //
7 i n t CVolumeRender : : xxrayLoop ( i n t x , i n t y )
8 {
9 f l o a t new x = x ∗ this −>s c a l i n g k ∗ d e l t a I ∗ o r i v [ 0 ] + y ∗ this −>s c a l i n g k
10 ∗ deltaJ ∗ o r i u [ 0 ] ;
11 f l o a t new y = x ∗ this −>s c a l i n g k ∗ d e l t a I ∗ o r i v [ 1 ] + y ∗ this −>s c a l i n g k
12 ∗ deltaJ ∗ o r i u [ 1 ] ;
13 f l o a t new z = x ∗ this −>s c a l i n g k ∗ d e l t a I ∗ o r i v [ 2 ] + y ∗ this −>s c a l i n g k
14 ∗ deltaJ ∗ o r i u [ 2 ] ;
15
16 //// the value of l a y e r r e p r e s e n t s the number of voxel value on the ray //
17 //from f r o n t to back on bounding box .//
18 f l o a t l a y e r = ( 1 . 0 f / ( this −>voxelDepth / this −>s t e p S i z e ) ) ;
19 f l o a t sum = 0.0 f ;
20 f o r ( f l o a t t = this −>t f r o n t ; t < this −>t back ; t += 15.0) // t += s t e p S i z e
21 {
22 Vector3 temp = this −>ray ∗ t ;
23 temp . Set (temp .X() + new x , temp .Y() + new y , temp . Z() + new z ) ;
24 sum += this −>TriLinear (temp .X( ) , temp .Y( ) , temp . Z ( ) ) ;
25 }
26
27 // Here , ”sum ∗ l a y e r ” i s to make the value in each p i x e l between 0 and 255. //
28 this −>screen [ y∗ this −>voxelWidth + x ] = sum ∗ l a y e r ;
29 return 0;
30 }
•Code for Rotation
10. 10 FAYAN TAO (1509853F-II20-0019)
1
2
3
4 // way2 : r o t a t i o n f o r MIP by using r o t a t i o n matrix //
5 i n t CVolumeRender : : MIPRotate ( Vector3 eye , f l o a t xDeg , f l o a t yDeg , f l o a t zDeg )
6 {
7 // //” eye ” i s the s t a r t point of ray in the image plane , n=(0 ,0 ,1) ,
8 // n and ray i s perpendicular , n i s a l s o perpendicular with image plane . //
9 //That i s to say , n i s perpendicular with vector o r i v and o r i u . //
10 // ray , ori v , o r i u are orthonormal image plane vectors .//
11 this −>eye = eye ;
12 Vector3 ori v , o r i u ; //
13 this −>ray = this −>pointO − this −>eye ;
14 o r i v . CrossProduct ( this −>ray , this −>n , o r i v ) ;
15 o r i u . CrossProduct ( this −>ray , this −>ori v , o r i u ) ;
16 this −>rotateMatrix . RotateX (xDeg ) ; // r o t a t i o n with x axis
17 this −>rotateMatrix . RotateY (yDeg ) ; // r o t a t i o n with y axis
18 this −>rotateMatrix . RotateZ ( zDeg ) ; // r o t a t i o n with z axis
19
20 // get the new eye p o s i t i o n a f t e r r o t a t i o n with x−degree , y−degree and z−degree .//
21 this −>eye = this −>eye ∗ this −>rotateMatrix ∗ this −>rotateMatrix . RotateY (yDeg)
22 ∗ this −>rotateMatrix . RotateZ ( zDeg ) ;
23
24 this −>ray . Normalize ( ) ;
25 this −>IntersectRaywithVolumeBoundingBox ( this −>eye ) ;
26
27 // make the image s i z e with 512 width and 512 height //
28 this −>screenWidth = 512;
29 this −>screenHeight = 512;
30 this −>I n i t S c r e e n (&CVolumeRender : : mipLoop ) ;
31 return 0;
32 }
4. Simple guideline on using program
When the program is compiled successfully, we will see the main window, which has a pop-
up menu with ”Read Volume File”, ”X-Ray” and ”MIP”. Please click MIDDLE button
of mouse to choose each one.
”Read Volume File” : This button provides us to choose a volume file, after selecting a file, the main
window will show the original image of that volume file.
”X-Ray” : After reading a file, choosing this button will allow us to observe the rotation of X-
ray volume render. What we have to do is moving mouse by clicking LEFT button,
then we will see different images from different perspectives.
”MIP” : After reading a file, choosing this button will allow us to observe the rotation of MIP
volume render. When we move mouse by clicking RIGHT button, various images
from different viewing angles will be shown. (Notes: As the algorithm I designed in
this rotation part is not so well, so you had better choose those points on the top-left
in the main window, otherwise, the result may be not so good.)
”+” and ”-” : Zoom out and zoom in for MIP volume rendering. We have to combine this function
with the menu ”MIP”. That is to say, when we click the menu button ”MIP”, we
can use ”+” and ”-” to control the size of image.
11. X-RAY AND MIP VOLUME RENDERING 11
”l” and ”s” : Make the image larger and smaller for X-Ray volume rendering. This function is
related to the menu ”X-Ray”. If we choose the menu button ”X-Ray”, we can use
”l” and ”s” to enlarge or shrink the image.
up, down, left, right” : rotate image plane with X and Y axis. These four keyboard keys are only used
to rotate image plane rather than image itself. The key ”up and down” are used
to rotate image plane with X axis, while key ”left and right” are used to rotate
image plane with Y axis.
5. Experimental results
Here, I show the related experimental results, including original images, X-Ray and MIP
volume rendering images.
6. Feelings about this project
I tried to use linear interpolation to scale the image, but failed. I think the idea is
executable, but I did not find out faults for my following source code. So I choose to turn
to change i and j to change image size.
1 // I plan to use t h i s part to s c a l e the image , but f a i l e d . so I choose change dethaI and dethaJ //
2 i n t CVolumeRender : : B i l i n e a r ( f l o a t x , f l o a t y)
3 { // (x , y ) i s the point l o c a t i o n in image plane a f t e r s c a l i n g //
4 i n t i = ( i n t )x ;
5 i n t j = ( i n t )y ;
6 f l o a t u = x − i , v = y − j ;
7 return (1 − u )∗(1 − v)∗ this −>GetScreenVal ( i , j ) + (1 − u)∗v∗ this −>GetScreenVal ( i , j + 1) +
8 u∗(1 − v)∗ this −>GetScreenVal ( i + 1 , j ) + u∗v∗ this −>GetScreenVal ( i + 1 , j + 1 ) ;
9 }
For the interpolation, I feel that it will make the edge becomes rough and fuzzy.
In deed, After completing this project, I have a better knowledge on OpenGL and volume
rendering. Though it is not easy for me to start especially at the beginning. As I am not
familiar with C + +, even though I know those underlying mathematics of those algorithms,
I cannot implement it by C + + in a short time. Thanks to my classmates Zhang Qiaoyang,
Lin Jiaming, Lu junyi and Chen Yuqing who are familiar with C++, I turn to them quite
often, so that I am able to complete this project. However, there are still some drawbacks
in the program, I will try to solve them in the following days.
Many thanks for Dr. Wong giving such fantastic lectures. I feel that OpenGL is a quite
powerful and useful tool. I want to learn more about it.
References
[1] Hadwiger M, Ljung P, Salama C R, et al. Advanced illumination techniques for GPU volume raycast-
ing[C]//ACM Siggraph Asia 2008 Courses. ACM, 2008: 1.
[2] https:www.opengl.org/discussion boards/showthread.php/191078-Volume-Rendering-with-3D-
Textures
[3] http:cg.alexandra.dk/?p = 107
[4] http:graphicsrunner.blogspot.com/2009/01/volume-rendering-102-transfer-functions.html
12. 12 FAYAN TAO (1509853F-II20-0019)
(a) ctHead
(b) engine
(c) footComplete
Figure 1. Original Figures