Commit 9b766f1f95ba972e641d3f787fa98ba4cbfd5da7
1 parent
1a224b6a
completed merge fixes, fixed linux filelist problems
Showing
8 changed files
with
52 additions
and
12 deletions
Show diff stats
stim/cuda/branch_detection.cuh
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | #include <stim/cuda/cuda_texture.cuh> | 7 | #include <stim/cuda/cuda_texture.cuh> |
8 | #include <stim/cuda/filter.cuh> | 8 | #include <stim/cuda/filter.cuh> |
9 | typedef unsigned int uint; | 9 | typedef unsigned int uint; |
10 | -typedef unsigned int uchar; | 10 | +//typedef unsigned int uchar; |
11 | 11 | ||
12 | 12 | ||
13 | std::vector< stim::vec<float> > | 13 | std::vector< stim::vec<float> > |
stim/cuda/spider_cost.cuh
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | 3 | ||
4 | #include <assert.h> | 4 | #include <assert.h> |
5 | #include <cuda.h> | 5 | #include <cuda.h> |
6 | -#include <cuda_runtime.h> | 6 | +//#include <cuda_runtime.h> |
7 | #include <stdio.h> | 7 | #include <stdio.h> |
8 | #include <stim/visualization/colormap.h> | 8 | #include <stim/visualization/colormap.h> |
9 | #include <sstream> | 9 | #include <sstream> |
stim/grids/image_stack.h
@@ -68,7 +68,7 @@ public: | @@ -68,7 +68,7 @@ public: | ||
68 | stim::image<T> I(file_list[i].str()); | 68 | stim::image<T> I(file_list[i].str()); |
69 | 69 | ||
70 | //retrieve the interlaced data from the image - store it in the grid | 70 | //retrieve the interlaced data from the image - store it in the grid |
71 | - I.data_interleaved(&ptr[ i * R[0] * R[1] * R[2] ]); | 71 | + I.get_interleaved_rgb(&ptr[ i * R[0] * R[1] * R[2] ]); |
72 | 72 | ||
73 | } | 73 | } |
74 | } | 74 | } |
stim/image/image.h
@@ -148,7 +148,7 @@ public: | @@ -148,7 +148,7 @@ public: | ||
148 | if(C() == 1) | 148 | if(C() == 1) |
149 | memcpy(buffer, img, bytes()); | 149 | memcpy(buffer, img, bytes()); |
150 | else if(C() == 3) | 150 | else if(C() == 3) |
151 | - data_interleaved_bgr(buffer); | 151 | + get_interleaved_bgr(buffer); |
152 | cv::Mat cvImage((int)Y(), (int)X(), cv_type(), buffer); | 152 | cv::Mat cvImage((int)Y(), (int)X(), cv_type(), buffer); |
153 | cv::imwrite(filename, cvImage); | 153 | cv::imwrite(filename, cvImage); |
154 | } | 154 | } |
@@ -170,7 +170,7 @@ public: | @@ -170,7 +170,7 @@ public: | ||
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
173 | - void data_interleaved_bgr(T* data){ | 173 | + void get_interleaved_bgr(T* data){ |
174 | 174 | ||
175 | //for each channel | 175 | //for each channel |
176 | for(size_t y = 0; y < Y(); y++){ | 176 | for(size_t y = 0; y < Y(); y++){ |
@@ -182,6 +182,11 @@ public: | @@ -182,6 +182,11 @@ public: | ||
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | + void get_interleaved_rgb(T* data){ | ||
186 | + memcpy(data, img, bytes()); | ||
187 | + } | ||
188 | + | ||
189 | + | ||
185 | image<T> channel(size_t c){ | 190 | image<T> channel(size_t c){ |
186 | 191 | ||
187 | //create a new image | 192 | //create a new image |
stim/math/circle.h
stim/parser/filename.h
@@ -22,6 +22,9 @@ | @@ -22,6 +22,9 @@ | ||
22 | #include <iostream> | 22 | #include <iostream> |
23 | 23 | ||
24 | #include "../parser/parser.h" | 24 | #include "../parser/parser.h" |
25 | +#ifdef BOOST_PRECOMPILED | ||
26 | +#include <boost/filesystem.hpp> | ||
27 | +#endif | ||
25 | namespace stim{ | 28 | namespace stim{ |
26 | 29 | ||
27 | //filename class designed to work with both Windows and Unix | 30 | //filename class designed to work with both Windows and Unix |
@@ -234,8 +237,40 @@ public: | @@ -234,8 +237,40 @@ public: | ||
234 | } | 237 | } |
235 | return file_list; | 238 | return file_list; |
236 | #else | 239 | #else |
237 | - std::cout<<"File lists aren't currently supported on Unix/Linux systems."<<std::endl; | ||
238 | - exit(1); | 240 | + |
241 | + boost::filesystem::path p(dir()); //create a path from the current filename | ||
242 | + std::vector<stim::filename> file_list; | ||
243 | + if(boost::filesystem::exists(p)){ | ||
244 | + if(boost::filesystem::is_directory(p)){ | ||
245 | + typedef std::vector<boost::filesystem::path> vec; // store paths, | ||
246 | + vec v; // so we can sort them later | ||
247 | + std::copy(boost::filesystem::directory_iterator(p), boost::filesystem::directory_iterator(), back_inserter(v)); | ||
248 | + std::sort(v.begin(), v.end()); // sort, since directory iteration | ||
249 | + // is not ordered on some file systems | ||
250 | + //compare file names to the current template (look for wild cards) | ||
251 | + for (vec::const_iterator it(v.begin()), it_end(v.end()); it != it_end; ++it) | ||
252 | + { | ||
253 | + //if the filename is a wild card *or* it matches the read file name | ||
254 | + if( prefix == "*" || prefix == (*it).filename().stem().string()){ | ||
255 | + //if the extension is a wild card *or* it matches the read file extension | ||
256 | + if( ext == "*" || "." + ext == (*it).filename().extension().string()){ | ||
257 | + file_list.push_back((*it).string()); //include it in the final list | ||
258 | + } | ||
259 | + | ||
260 | + } | ||
261 | + | ||
262 | + | ||
263 | + | ||
264 | + } | ||
265 | + | ||
266 | + } | ||
267 | + | ||
268 | + } | ||
269 | + return file_list; | ||
270 | + | ||
271 | + | ||
272 | +// std::cout<<"File lists aren't currently supported on Unix/Linux systems."<<std::endl; | ||
273 | +// exit(1); | ||
239 | #endif | 274 | #endif |
240 | } | 275 | } |
241 | //************************************************************************************************** | 276 | //************************************************************************************************** |
stim/visualization/cylinder.h
@@ -164,7 +164,7 @@ class cylinder | @@ -164,7 +164,7 @@ class cylinder | ||
164 | ///Returns the number of points on the cylinder centerline | 164 | ///Returns the number of points on the cylinder centerline |
165 | 165 | ||
166 | unsigned int size(){ | 166 | unsigned int size(){ |
167 | - return pos.size(); | 167 | + return e.size(); |
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
@@ -231,7 +231,7 @@ class cylinder | @@ -231,7 +231,7 @@ class cylinder | ||
231 | /// Adds a new magnitude value to all points | 231 | /// Adds a new magnitude value to all points |
232 | /// @param m is the starting value for the new magnitude | 232 | /// @param m is the starting value for the new magnitude |
233 | void add_mag(T m = 0){ | 233 | void add_mag(T m = 0){ |
234 | - for(unsigned int p = 0; p < pos.size(); p++) | 234 | + for(unsigned int p = 0; p < e.size(); p++) |
235 | mags[p].push_back(m); | 235 | mags[p].push_back(m); |
236 | } | 236 | } |
237 | 237 | ||
@@ -317,7 +317,7 @@ class cylinder | @@ -317,7 +317,7 @@ class cylinder | ||
317 | T len = L[0]; //allocate space for the segment length | 317 | T len = L[0]; //allocate space for the segment length |
318 | 318 | ||
319 | //for every consecutive point in the cylinder | 319 | //for every consecutive point in the cylinder |
320 | - for(unsigned p = 1; p < pos.size(); p++){ | 320 | + for(unsigned p = 1; p < e.size(); p++){ |
321 | 321 | ||
322 | //p1 = pos[p]; //get the position and magnitude for the next point | 322 | //p1 = pos[p]; //get the position and magnitude for the next point |
323 | m1 = mags[p][m]; | 323 | m1 = mags[p][m]; |
@@ -347,7 +347,7 @@ class cylinder | @@ -347,7 +347,7 @@ class cylinder | ||
347 | 347 | ||
348 | std::vector< vec<T> > result; | 348 | std::vector< vec<T> > result; |
349 | 349 | ||
350 | - vec<T> p0 = e[i].P; //initialize p0 to the first point on the centerline | 350 | + vec<T> p0 = e[0].P; //initialize p0 to the first point on the centerline |
351 | vec<T> p1; | 351 | vec<T> p1; |
352 | unsigned N = size(); //number of points in the current centerline | 352 | unsigned N = size(); //number of points in the current centerline |
353 | 353 |
stim/visualization/obj.h
@@ -158,6 +158,7 @@ protected: | @@ -158,6 +158,7 @@ protected: | ||
158 | using std::vector<triplet>::size; | 158 | using std::vector<triplet>::size; |
159 | using std::vector<triplet>::at; | 159 | using std::vector<triplet>::at; |
160 | using std::vector<triplet>::push_back; | 160 | using std::vector<triplet>::push_back; |
161 | + using std::vector<triplet>::resize; | ||
161 | 162 | ||
162 | geometry(){} | 163 | geometry(){} |
163 | 164 |