1 // This is brl/bseg/bvxm/pro/processes/bvxm_save_occupancy_vff_process.cxx 2 #include "bvxm_save_occupancy_vff_process.h" 3 //: 4 // \file 5 #include <bprb/bprb_func_process.h> 6 #include <brdb/brdb_value.h> 7 #include <bprb/bprb_parameters.h> 8 9 #include <bvxm/bvxm_voxel_world.h> 10 #include <bvxm/bvxm_image_metadata.h> 11 #include <bvxm/bvxm_mog_grey_processor.h> 12 bvxm_save_occupancy_vff_process_cons(bprb_func_process & pro)13bool bvxm_save_occupancy_vff_process_cons(bprb_func_process& pro) 14 { 15 using namespace bvxm_save_occupancy_vff_process_globals; 16 // process takes 3 inputs: 17 //input[0]: The voxel world 18 //input[1]: The filename to write to 19 //input[2]: Scale Index 20 21 std::vector<std::string> input_types_(n_inputs_); 22 input_types_[0] = "bvxm_voxel_world_sptr"; 23 input_types_[1] = "vcl_string"; 24 input_types_[2] = "unsigned"; 25 return pro.set_input_types(input_types_); 26 } 27 bvxm_save_occupancy_vff_process(bprb_func_process & pro)28bool bvxm_save_occupancy_vff_process(bprb_func_process& pro) 29 { 30 using namespace bvxm_save_occupancy_vff_process_globals; 31 32 //check number of inputs 33 if (pro.n_inputs() < n_inputs_) 34 { 35 std::cout << pro.name() << " The input number should be " << n_inputs_<< std::endl; 36 return false; 37 } 38 39 //get the inputs 40 unsigned i = 0; 41 bvxm_voxel_world_sptr world = pro.get_input<bvxm_voxel_world_sptr>(i++); 42 std::string filename = pro.get_input<std::string>(i++); 43 auto scale_idx = pro.get_input<unsigned>(i++); 44 45 if ( !world ){ 46 std::cout << pro.name() <<" :-- Input 0 is not valid!\n"; 47 return false; 48 } 49 50 return world->save_occupancy_vff(filename,scale_idx); 51 } 52