1 #ifndef boxm2_refine_block_function_h 2 #define boxm2_refine_block_function_h 3 //: 4 // \file 5 6 #include <iostream> 7 #include <boxm2/boxm2_data_traits.h> 8 #include <boxm2/cpp/algo/boxm2_cast_ray_function.h> 9 #include <boxm2/cpp/algo/boxm2_mog3_grey_processor.h> 10 #include <boct/boct_bit_tree.h> 11 #include <vnl/vnl_vector_fixed.h> 12 #ifdef _MSC_VER 13 # include <vcl_msvc_warnings.h> 14 #endif 15 #include <boxm2/io/boxm2_cache.h> 16 17 class boxm2_refine_block_function 18 { 19 public: 20 typedef unsigned char uchar; 21 typedef unsigned short ushort; 22 typedef vnl_vector_fixed<uchar, 16> uchar16; 23 typedef vnl_vector_fixed<uchar, 8> uchar8; 24 typedef vnl_vector_fixed<ushort, 4> ushort4; 25 26 //: "default" constructor 27 boxm2_refine_block_function() = default; 28 29 //: initialize generic data base pointers as their data type 30 bool init_data(const boxm2_scene_sptr& scene, boxm2_block* blk, std::vector<boxm2_data_base*> & datas, float prob_thresh); 31 32 //: refine function; 33 bool refine(); 34 bool refine_deterministic(std::vector<boxm2_data_base*>& datas); 35 36 //: refine bit tree 37 boct_bit_tree refine_bit_tree(boct_bit_tree& curr_tree, 38 int buff_offset, 39 bool is_random=true); 40 41 //: move data into new location 42 int move_data(boct_bit_tree& unrefined_tree, 43 boct_bit_tree& refined_tree, 44 float* alpha_cpy, 45 uchar8* mog_cpy, 46 ushort4* num_obs_cpy ); 47 48 //: helper method 49 int free_space(int startPtr, int endPtr); 50 51 private: 52 boxm2_scene_sptr scene_; 53 boxm2_block* blk_; 54 55 float* alpha_; 56 uchar8* mog_; 57 ushort4* num_obs_; 58 59 //block max level 60 int max_level_; 61 int MAX_INNER_CELLS_; 62 int MAX_CELLS_; 63 64 //max alpha integrated 65 float max_alpha_int_; 66 67 //length of data buffer 68 int data_len_; 69 70 //length of one side of a sub block 71 double block_len_; 72 73 int num_split_; 74 }; 75 76 //////////////////////////////////////////////////////////////////////////////// 77 //MAIN REFINE FUNCTION 78 //////////////////////////////////////////////////////////////////////////////// 79 void boxm2_refine_block( const boxm2_scene_sptr& scene, 80 boxm2_block* blk, 81 std::vector<boxm2_data_base*> & datas, 82 float prob_thresh, 83 bool is_random = true); 84 85 #endif 86