Commit 0730bd0415d46852d166ba3c97955996fc32b19c
1 parent
087cecd2
Revert "removed some unused variables that cause the generation of warnings"
This reverts commit 9474c2835439c325ea2025a94879f7b311830f61.
Showing
5 changed files
with
51 additions
and
41 deletions
Show diff stats
stim/cuda/cuda_texture.cuh
... | ... | @@ -134,15 +134,15 @@ namespace stim |
134 | 134 | void |
135 | 135 | UnmapCudaTexture() |
136 | 136 | { |
137 | - // HANDLE_ERROR( | |
138 | - // cudaGraphicsUnmapResources(1, &resource) | |
139 | - // ); | |
140 | - // HANDLE_ERROR( | |
141 | - // cudaGraphicsUnregisterResource(resource) | |
142 | - // ); | |
143 | - // HANDLE_ERROR( | |
144 | - // cudaDestroyTextureObject(tObj) | |
145 | - // ); | |
137 | + HANDLE_ERROR( | |
138 | + cudaGraphicsUnmapResources(1, &resource) | |
139 | + ); | |
140 | + HANDLE_ERROR( | |
141 | + cudaGraphicsUnregisterResource(resource) | |
142 | + ); | |
143 | + HANDLE_ERROR( | |
144 | + cudaDestroyTextureObject(tObj) | |
145 | + ); | |
146 | 146 | // HANDLE_ERROR( |
147 | 147 | // cudaFreeArray(srcArray) |
148 | 148 | // ); | ... | ... |
stim/cuda/filter.cuh
... | ... | @@ -7,7 +7,6 @@ |
7 | 7 | #include <stdio.h> |
8 | 8 | #include <stim/visualization/colormap.h> |
9 | 9 | #include <sstream> |
10 | -#include <stim/math/constants.h> | |
11 | 10 | #include <stim/cuda/cudatools/devices.h> |
12 | 11 | #include <stim/cuda/cudatools/threads.h> |
13 | 12 | #include <stim/cuda/cuda_texture.cuh> |
... | ... | @@ -15,6 +14,7 @@ |
15 | 14 | #include <stim/cuda/arraymath.cuh> |
16 | 15 | |
17 | 16 | #define IMAD(a,b,c) ( __mul24((a), (b)) + (c) ) |
17 | +#define M_PI 3.141592654f | |
18 | 18 | |
19 | 19 | |
20 | 20 | namespace stim |
... | ... | @@ -73,7 +73,7 @@ namespace stim |
73 | 73 | idx = j*kl+i; |
74 | 74 | x = i - kr - 0.5; |
75 | 75 | y = j - kr - 0.5; |
76 | - LoG[idx] = (-1.0/PI/powf(sigma, 4))* (1 - (powf(x,2)+powf(y,2))/2.0/powf(sigma, 2)) | |
76 | + LoG[idx] = (-1.0/M_PI/powf(sigma, 4))* (1 - (powf(x,2)+powf(y,2))/2.0/powf(sigma, 2)) | |
77 | 77 | *expf(-(powf(x,2)+powf(y,2))/2/powf(sigma,2)); |
78 | 78 | t +=LoG[idx]; |
79 | 79 | } |
... | ... | @@ -98,7 +98,7 @@ namespace stim |
98 | 98 | int y = blockIdx.y; |
99 | 99 | int xi = threadIdx.x; |
100 | 100 | int yi = threadIdx.y; |
101 | - // float val = 0; | |
101 | + float val = 0; | |
102 | 102 | float tu = (x-kr+xi)/(float)DIM_X; |
103 | 103 | float tv = (y-kr+yi)/(float)DIM_Y; |
104 | 104 | shared[xi][yi] = gpuLoG[yi*kl+xi]*(255.0-(float)tex2D<unsigned char>(texIn, tu, tv)); |
... | ... | @@ -111,7 +111,7 @@ namespace stim |
111 | 111 | //y = min(y, height - 1); |
112 | 112 | |
113 | 113 | int idx = y*DIM_X+x; |
114 | - // int k_idx; | |
114 | + int k_idx; | |
115 | 115 | for(unsigned int step = blockDim.x/2; step >= 1; step >>= 1) |
116 | 116 | { |
117 | 117 | __syncthreads(); | ... | ... |
stim/cuda/ivote/down_sample.cuh
... | ... | @@ -44,7 +44,7 @@ namespace stim{ |
44 | 44 | unsigned int y_ds = (y/sigma_ds + (y %sigma_ds == 0 ? 0:1)); |
45 | 45 | |
46 | 46 | //get the number of pixels in the image |
47 | -// unsigned int pixels_ds = x_ds * y_ds; | |
47 | + unsigned int pixels_ds = x_ds * y_ds; | |
48 | 48 | |
49 | 49 | unsigned int max_threads = stim::maxThreadsPerBlock(); |
50 | 50 | dim3 threads(max_threads, 1); |
... | ... | @@ -97,4 +97,4 @@ namespace stim{ |
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
100 | 100 | -#endif |
101 | +#endif | |
101 | 102 | \ No newline at end of file | ... | ... |
stim/gl/gl_spider.h
... | ... | @@ -14,7 +14,6 @@ |
14 | 14 | #include <stim/math/vec3.h> |
15 | 15 | #include <stim/math/rect.h> |
16 | 16 | #include <stim/math/matrix.h> |
17 | -#include <stim/math/constants.h> | |
18 | 17 | #include <stim/cuda/spider_cost.cuh> |
19 | 18 | #include <stim/cuda/cudatools/glbind.h> |
20 | 19 | #include <stim/cuda/arraymath.cuh> |
... | ... | @@ -370,7 +369,7 @@ class gl_spider : public virtual gl_texture<T> |
370 | 369 | ///Stored in a display list. |
371 | 370 | ///uses the default d vector <0,0,1> |
372 | 371 | void |
373 | - genDirectionVectors(float solidAngle = M_PI/2) | |
372 | + genDirectionVectors(float solidAngle = 5/M_PI*4) | |
374 | 373 | { |
375 | 374 | |
376 | 375 | //Set up the vectors necessary for Rectangle creation. |
... | ... | @@ -585,7 +584,7 @@ class gl_spider : public virtual gl_texture<T> |
585 | 584 | glDeleteFramebuffers(1, &framebufferID); |
586 | 585 | glGenFramebuffers(1, &framebufferID); |
587 | 586 | glBindFramebuffer(GL_FRAMEBUFFER, framebufferID); |
588 | -// int numChannels = 1; | |
587 | + int numChannels = 1; | |
589 | 588 | // unsigned char* texels = new unsigned char[width * height * numChannels]; |
590 | 589 | glGenTextures(1, &textureID); |
591 | 590 | glBindTexture(GL_TEXTURE_2D, textureID); |
... | ... | @@ -610,7 +609,7 @@ class gl_spider : public virtual gl_texture<T> |
610 | 609 | { |
611 | 610 | glGenFramebuffers(1, &fboID); |
612 | 611 | glBindFramebuffer(GL_FRAMEBUFFER, fboID); |
613 | -// int numChannels = 1; | |
612 | + int numChannels = 1; | |
614 | 613 | // unsigned char* texels = new unsigned char[width * height * numChannels]; |
615 | 614 | glGenTextures(1, &texbufferID); |
616 | 615 | glBindTexture(GL_TEXTURE_2D, texbufferID); |
... | ... | @@ -939,7 +938,7 @@ class gl_spider : public virtual gl_texture<T> |
939 | 938 | network_time = 0; |
940 | 939 | hit_time = 0; |
941 | 940 | #endif |
942 | - stepsize = 2.5; | |
941 | + stepsize = 3.0; | |
943 | 942 | t_length = 16.0; |
944 | 943 | |
945 | 944 | srand(100); |
... | ... | @@ -1387,7 +1386,7 @@ class gl_spider : public virtual gl_texture<T> |
1387 | 1386 | void |
1388 | 1387 | MonteCarloDirectionVectors(int nSamples, float solidAngle = 2*M_PI) |
1389 | 1388 | { |
1390 | - float PHI[2], Z[2]; | |
1389 | + float PHI[2], Z[2], range; | |
1391 | 1390 | PHI[0] = asin(solidAngle/2); |
1392 | 1391 | PHI[1] = asin(0); |
1393 | 1392 | |
... | ... | @@ -1397,6 +1396,9 @@ class gl_spider : public virtual gl_texture<T> |
1397 | 1396 | |
1398 | 1397 | range = Z[0] - Z[1]; |
1399 | 1398 | |
1399 | + | |
1400 | + float z, theta, phi; | |
1401 | + | |
1400 | 1402 | std::vector<stim::vec3<float> > vecsUni; |
1401 | 1403 | for(int i = 0; i < numSamplesPos; i++) |
1402 | 1404 | { |
... | ... | @@ -1488,6 +1490,8 @@ class gl_spider : public virtual gl_texture<T> |
1488 | 1490 | void |
1489 | 1491 | trace(int min_cost) |
1490 | 1492 | { |
1493 | + bool sEmpty = true; | |
1494 | + float lastmag = 16.0;; | |
1491 | 1495 | stim::vec3<float> curSeed; |
1492 | 1496 | stim::vec3<float> curSeedVec; |
1493 | 1497 | float curSeedMag; |
... | ... | @@ -1523,7 +1527,7 @@ class gl_spider : public virtual gl_texture<T> |
1523 | 1527 | gpuStartTimer(); |
1524 | 1528 | #endif |
1525 | 1529 | |
1526 | -// float s = 3.0; | |
1530 | + float s = 3.0; | |
1527 | 1531 | GLuint selectBuf[2048]; |
1528 | 1532 | GLint hits; |
1529 | 1533 | glSelectBuffer(2048, selectBuf); |
... | ... | @@ -1537,17 +1541,17 @@ class gl_spider : public virtual gl_texture<T> |
1537 | 1541 | CHECK_OPENGL_ERROR |
1538 | 1542 | //What would that vessel see in front of it. |
1539 | 1543 | camSel.setPosition(loc); |
1540 | - camSel.setFocalDistance(mag/stepsize); | |
1541 | - camSel.LookAt((loc[0]+dir[0]*mag/stepsize), | |
1542 | - (loc[1]+dir[1]*mag/stepsize), | |
1543 | - (loc[2]+dir[2]*mag/stepsize)); | |
1544 | + camSel.setFocalDistance(mag/s); | |
1545 | + camSel.LookAt((loc[0]+dir[0]*mag/s), | |
1546 | + (loc[1]+dir[1]*mag/s), | |
1547 | + (loc[2]+dir[2]*mag/s)); | |
1544 | 1548 | ps = camSel.getPosition(); |
1545 | 1549 | ups = camSel.getUp(); |
1546 | 1550 | ds = camSel.getLookAt(); |
1547 | 1551 | glMatrixMode(GL_PROJECTION); |
1548 | 1552 | glPushMatrix(); |
1549 | 1553 | glLoadIdentity(); |
1550 | - glOrtho(-mag/stepsize/2.0, mag/stepsize/2.0, -mag/stepsize/2.0, mag/stepsize/2.0, 0.0, mag/stepsize/2.0); | |
1554 | + glOrtho(-mag/s/2.0, mag/s/2.0, -mag/s/2.0, mag/s/2.0, 0.0, mag/s/2.0); | |
1551 | 1555 | glMatrixMode(GL_MODELVIEW); |
1552 | 1556 | glPushMatrix(); |
1553 | 1557 | glLoadIdentity(); |
... | ... | @@ -1593,11 +1597,21 @@ class gl_spider : public virtual gl_texture<T> |
1593 | 1597 | int |
1594 | 1598 | processHits(GLint hits, GLuint buffer[]) |
1595 | 1599 | { |
1596 | - GLuint *ptr; | |
1600 | + GLuint names, *ptr; | |
1601 | + //printf("hits = %u\n", hits); | |
1597 | 1602 | ptr = (GLuint *) buffer; |
1603 | + // for (int i = 0; i < hits; i++) { /* for each hit */ | |
1604 | + names = *ptr; | |
1605 | + // printf (" number of names for hit = %u\n", names); | |
1598 | 1606 | ptr++; |
1599 | 1607 | ptr++; //Skip the minimum depth value. |
1600 | 1608 | ptr++; //Skip the maximum depth value. |
1609 | + // printf (" the name is "); | |
1610 | + // for (int j = 0; j < names; j++) { /* for each name */ | |
1611 | + // printf ("%u ", *ptr); ptr++; | |
1612 | + // } | |
1613 | + // printf ("\n"); | |
1614 | + // } | |
1601 | 1615 | |
1602 | 1616 | |
1603 | 1617 | if(hits == 0) |
... | ... | @@ -1661,18 +1675,11 @@ class gl_spider : public virtual gl_texture<T> |
1661 | 1675 | } |
1662 | 1676 | |
1663 | 1677 | #ifdef TIMING |
1664 | - double nt = (std::clock() - s) / (double) CLOCKS_PER_SEC; | |
1665 | - network_time += nt * 1000.0; | |
1678 | + double network_time = (std::clock() - s) / (double) CLOCKS_PER_SEC; | |
1679 | + network_time += network_time * 1000.0; | |
1666 | 1680 | #endif |
1667 | 1681 | } |
1668 | 1682 | |
1669 | -// void | |
1670 | -// addToNetwork(pair<stim::fiber<float>, int> in, stim::vec3<float> spos, | |
1671 | -// stim::vec<float> smag, stim::vec3<float> sdir) | |
1672 | -// { | |
1673 | -// | |
1674 | -// } | |
1675 | - | |
1676 | 1683 | |
1677 | 1684 | void |
1678 | 1685 | printSizes() |
... | ... | @@ -1776,6 +1783,9 @@ class gl_spider : public virtual gl_texture<T> |
1776 | 1783 | } |
1777 | 1784 | } |
1778 | 1785 | } |
1786 | + | |
1787 | + | |
1788 | + | |
1779 | 1789 | }; |
1780 | 1790 | } |
1781 | 1791 | #endif | ... | ... |
stim/math/matrix.h
... | ... | @@ -53,13 +53,13 @@ struct matrix |
53 | 53 | |
54 | 54 | template<typename Y> |
55 | 55 | vec<Y> operator*(vec<Y> rhs){ |
56 | - unsigned int M = rhs.size(); | |
56 | + unsigned int N = rhs.size(); | |
57 | 57 | |
58 | 58 | vec<Y> result; |
59 | - result.resize(M); | |
59 | + result.resize(N); | |
60 | 60 | |
61 | - for(int r=0; r<M; r++) | |
62 | - for(int c=0; c<M; c++) | |
61 | + for(int r=0; r<N; r++) | |
62 | + for(int c=0; c<N; c++) | |
63 | 63 | result[r] += (*this)(r, c) * rhs[c]; |
64 | 64 | |
65 | 65 | return result; | ... | ... |