Commit a7ed4b2e339671452ccc41291c136490f509335b
1 parent
cc42ca92
ivote updates
Showing
2 changed files
with
14 additions
and
6 deletions
Show diff stats
stim/image/image.h
... | ... | @@ -54,8 +54,6 @@ class image{ |
54 | 54 | allocate(); //allocate memory |
55 | 55 | } |
56 | 56 | |
57 | - size_t bytes(){ return size() * sizeof(T); } | |
58 | - | |
59 | 57 | inline size_t idx(size_t x, size_t y, size_t c = 0) const { |
60 | 58 | return y * R[0] * R[1] + x * R[0] + c; |
61 | 59 | } |
... | ... | @@ -82,6 +80,8 @@ class image{ |
82 | 80 | |
83 | 81 | public: |
84 | 82 | |
83 | + size_t bytes() { return size() * sizeof(T); } | |
84 | + | |
85 | 85 | /// Default constructor - creates an empty image object |
86 | 86 | image(){ init(); } //initialize all variables to zero, don't allocate any memory |
87 | 87 | |
... | ... | @@ -116,7 +116,7 @@ public: |
116 | 116 | free(img); |
117 | 117 | } |
118 | 118 | |
119 | - ///Resize an image | |
119 | + ///Resize an image - this function looks like it hasn't been implemented | |
120 | 120 | void resize(size_t x, size_t y, size_t c = 1) { |
121 | 121 | allocate(x, y, c); |
122 | 122 | } |
... | ... | @@ -384,6 +384,15 @@ public: |
384 | 384 | |
385 | 385 | } |
386 | 386 | |
387 | + /// invert the image, given a specified maximum value (ex. maxval = 255, I' = 255 - I) | |
388 | + /*image<T> invert(T maxval) { | |
389 | + image<T> result(width(), height(), channels()); //create a new image | |
390 | + size_t N = size(); //get the number of elements in the image | |
391 | + for (size_t n = 0; n < N; n++) | |
392 | + result.data()[n] = maxval - img[n]; //perform the inversion and save the result to the new image | |
393 | + return result; | |
394 | + }*/ | |
395 | + | |
387 | 396 | /// Stretch the contrast of the image such that the minimum and maximum intensity match the given values |
388 | 397 | image<T> stretch(T low, T high) { |
389 | 398 | T maxval = maxv(); |
... | ... | @@ -540,7 +549,6 @@ public: |
540 | 549 | } |
541 | 550 | |
542 | 551 | image<T> convolve2(image<T> mask){ |
543 | - | |
544 | 552 | std::cout<<"ERROR stim::image::convolve2 - function has been broken, and shouldn't really be in here."<<std::endl; |
545 | 553 | exit(1); |
546 | 554 | } | ... | ... |
stim/math/filters/gauss2.cuh
... | ... | @@ -33,10 +33,10 @@ namespace stim { |
33 | 33 | for (size_t yi = 0; yi < ky; yi++) |
34 | 34 | gy[yi] = gauss1d((K)yi, muy, stdy); |
35 | 35 | |
36 | - std::vector< stim::image<T> > IN = in.split(); //split the input image into channels | |
36 | + std::vector< stim::image<T> > clist = in.split(); //split the input image into channels | |
37 | 37 | std::vector< stim::image<T> > R = r.split(); //split the output image into channels |
38 | 38 | for (size_t c = 0; c < in.channels(); c++) //for each channel |
39 | - cpu_sepconv2(R[c].data(), IN[c].data(), gx, gy, IN[c].width(), IN[c].height(), kx, ky); | |
39 | + cpu_sepconv2(R[c].data(), clist[c].data(), gx, gy, clist[c].width(), clist[c].height(), kx, ky); | |
40 | 40 | |
41 | 41 | r.merge(R); //merge the blurred channels into the final image |
42 | 42 | return r; | ... | ... |