Commit feb0c9dde9bbda9a2ecfa3bc30893610801fb001
1 parent
16d171c9
network processing for distance fields - debugging
Showing
3 changed files
with
54 additions
and
61 deletions
Show diff stats
stim/image/image.h
@@ -76,17 +76,6 @@ class image{ | @@ -76,17 +76,6 @@ class image{ | ||
76 | /// Returns the value for "white" based on the dynamic range (assumes white is 1.0 for floating point images) | 76 | /// Returns the value for "white" based on the dynamic range (assumes white is 1.0 for floating point images) |
77 | T white(){ | 77 | T white(){ |
78 | return std::numeric_limits<T>::max(); | 78 | return std::numeric_limits<T>::max(); |
79 | - //if(typeid(T) == typeid(unsigned char)) return UCHAR_MAX; | ||
80 | - //if(typeid(T) == typeid(unsigned short)) return SHRT_MAX; | ||
81 | - //if(typeid(T) == typeid(unsigned)) return UINT_MAX; | ||
82 | - //if(typeid(T) == typeid(unsigned long)) return ULONG_MAX; | ||
83 | - //if(typeid(T) == typeid(unsigned long long)) return ULLONG_MAX; | ||
84 | - //if(typeid(T) == typeid(float)) return 1.0f; | ||
85 | - //if(typeid(T) == typeid(double)) return 1.0; | ||
86 | - | ||
87 | - std::cout<<"ERROR in stim::image::white - no white value known for this data type"<<std::endl; | ||
88 | - exit(1); | ||
89 | - | ||
90 | } | 79 | } |
91 | 80 | ||
92 | 81 |
stim/parser/arguments.h
@@ -13,6 +13,44 @@ | @@ -13,6 +13,44 @@ | ||
13 | #include <Windows.h> | 13 | #include <Windows.h> |
14 | #endif | 14 | #endif |
15 | 15 | ||
16 | +/**The arglist class implements command line arguments. | ||
17 | + Example: | ||
18 | + | ||
19 | + 1) Create an arglist instance: | ||
20 | + | ||
21 | + stim::arglist args; | ||
22 | + | ||
23 | + 2) Add arguments: | ||
24 | + | ||
25 | + args.add("help", "prints this help"); | ||
26 | + args.add("foo", "foo takes a single integer value", "", "[intval]"); | ||
27 | + args.add("bar", "bar takes two floating point values", "", "[value1], [value2]"); | ||
28 | + | ||
29 | + 3) Parse the command line: | ||
30 | + | ||
31 | + args.parse(argc, argv); | ||
32 | + | ||
33 | + 4) You generally want to immediately test for help and output available arguments: | ||
34 | + | ||
35 | + if(args["help"].is_set()) | ||
36 | + std::cout<<args.str(); | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + 5) Retrieve values: | ||
41 | + | ||
42 | + int foo; | ||
43 | + float bar1, bar2; | ||
44 | + if(args["foo"]) | ||
45 | + foo = args["foo"].as_int(); | ||
46 | + if(args["bar"]){ | ||
47 | + bar1 = args["bar"].as_float(0); | ||
48 | + bar2 = args["bar"].as_float(1); | ||
49 | + } | ||
50 | + | ||
51 | + | ||
52 | +**/ | ||
53 | + | ||
16 | namespace stim{ | 54 | namespace stim{ |
17 | 55 | ||
18 | class cmd_option | 56 | class cmd_option |
@@ -258,10 +296,12 @@ namespace stim{ | @@ -258,10 +296,12 @@ namespace stim{ | ||
258 | flag = true; | 296 | flag = true; |
259 | } | 297 | } |
260 | 298 | ||
261 | - bool is_set() | ||
262 | - { | 299 | + bool is_set() const{ |
263 | return flag; | 300 | return flag; |
264 | } | 301 | } |
302 | + operator bool() const{ | ||
303 | + return is_set(); | ||
304 | + } | ||
265 | 305 | ||
266 | }; | 306 | }; |
267 | 307 | ||
@@ -271,43 +311,7 @@ namespace stim{ | @@ -271,43 +311,7 @@ namespace stim{ | ||
271 | size_t index; | 311 | size_t index; |
272 | }; | 312 | }; |
273 | 313 | ||
274 | - /**The arglist class implements command line arguments. | ||
275 | - Example: | ||
276 | - | ||
277 | - 1) Create an arglist instance: | ||
278 | - | ||
279 | - stim::arglist args; | ||
280 | - | ||
281 | - 2) Add arguments: | ||
282 | 314 | ||
283 | - args.add("help", "prints this help"); | ||
284 | - args.add("foo", "foo takes a single integer value", "", "[intval]"); | ||
285 | - args.add("bar", "bar takes two floating point values", "", "[value1], [value2]"); | ||
286 | - | ||
287 | - 3) Parse the command line: | ||
288 | - | ||
289 | - args.parse(argc, argv); | ||
290 | - | ||
291 | - 4) You generally want to immediately test for help and output available arguments: | ||
292 | - | ||
293 | - if(args["help"].is_set()) | ||
294 | - std::cout<<args.str(); | ||
295 | - | ||
296 | - | ||
297 | - | ||
298 | - 5) Retrieve values: | ||
299 | - | ||
300 | - int foo; | ||
301 | - float bar1, bar2; | ||
302 | - if(args["foo"]) | ||
303 | - foo = args["foo"].as_int(); | ||
304 | - if(args["bar"]){ | ||
305 | - bar1 = args["bar"].as_float(0); | ||
306 | - bar2 = args["bar"].as_float(1); | ||
307 | - } | ||
308 | - | ||
309 | - | ||
310 | - **/ | ||
311 | 315 | ||
312 | class arglist | 316 | class arglist |
313 | { | 317 | { |
@@ -528,21 +532,21 @@ namespace stim{ | @@ -528,21 +532,21 @@ namespace stim{ | ||
528 | std::vector<std::string> arg_vector(){ | 532 | std::vector<std::string> arg_vector(){ |
529 | return args; | 533 | return args; |
530 | } | 534 | } |
531 | - ///Returns an object describing the argument | ||
532 | - | ||
533 | - /// @param _name is the name of the requested argument | ||
534 | - cmd_option operator[](std::string _name){ | ||
535 | - std::vector<cmd_option>::iterator it; | ||
536 | - it = find(opts.begin(), opts.end(), _name);// - opts.begin(); | 535 | + ///Returns an object describing the argument |
537 | 536 | ||
538 | - if(it == opts.end()){ | ||
539 | - std::cout<<"ERROR - Unspecified parameter name: "<<_name<<std::endl; | ||
540 | - exit(1); | ||
541 | - } | 537 | + /// @param _name is the name of the requested argument |
538 | + cmd_option operator[](std::string _name){ | ||
539 | + std::vector<cmd_option>::iterator it; | ||
540 | + it = find(opts.begin(), opts.end(), _name);// - opts.begin(); | ||
542 | 541 | ||
543 | - return *it; | 542 | + if(it == opts.end()){ |
543 | + std::cout<<"ERROR - Unspecified parameter name: "<<_name<<std::endl; | ||
544 | + exit(1); | ||
544 | } | 545 | } |
545 | 546 | ||
547 | + return *it; | ||
548 | + } | ||
549 | + | ||
546 | 550 | ||
547 | }; | 551 | }; |
548 | 552 |
stim/structures/kdtree.cuh
@@ -457,7 +457,7 @@ namespace stim { | @@ -457,7 +457,7 @@ namespace stim { | ||
457 | //bb.init(&h_reference_points[0]); | 457 | //bb.init(&h_reference_points[0]); |
458 | //aaboundingboxing<T, D>(bb, h_reference_points, reference_count); | 458 | //aaboundingboxing<T, D>(bb, h_reference_points, reference_count); |
459 | 459 | ||
460 | - std::vector <kdtree::point<T, D>> reference_points(reference_count); // restore the reference points in particular way | 460 | + std::vector < typename kdtree::point<T, D> > reference_points(reference_count); // restore the reference points in particular way |
461 | for (size_t j = 0; j < reference_count; j++) | 461 | for (size_t j = 0; j < reference_count; j++) |
462 | for (size_t i = 0; i < D; i++) | 462 | for (size_t i = 0; i < D; i++) |
463 | reference_points[j].dim[i] = h_reference_points[j * D + i]; | 463 | reference_points[j].dim[i] = h_reference_points[j * D + i]; |