From 48437e3f454347c8348d4554d614cf2d27e545c3 Mon Sep 17 00:00:00 2001
From: Joseph Mundy <jlm@visionsystemsinc.com>
Date: Sat, 2 Feb 2019 10:43:26 -0500
Subject: [PATCH 9/9] removed the obsolete octree library boxm
---
contrib/brl/bseg/CMakeLists.txt | 12 -
contrib/brl/bseg/boxm/CMakeLists.txt | 52 -
...ee+short.bsta_num_obs+bsta_gauss_sf1--.cxx | 9 -
...ree+short.vnl_vector_fixed+double.10--.cxx | 9 -
...tree+short.vnl_vector_fixed+float.10--.cxx | 9 -
..._tree+short.vnl_vector_fixed+float.3--.cxx | 10 -
...ll+short.bsta_num_obs+bsta_gauss_sf1--.cxx | 9 -
.../boxm_block+boct_tree+short.bool--.cxx | 5 -
...e+short.bsta_num_obs+bsta_gauss_sf1---.cxx | 9 -
.../boxm_block+boct_tree+short.char--.cxx | 5 -
.../boxm_block+boct_tree+short.float--.cxx | 5 -
.../boxm_block+boct_tree+short.int--.cxx | 8 -
...boct_tree+short.vgl_point_3d+double---.cxx | 6 -
...ee+short.vnl_vector_fixed+double.10---.cxx | 17 -
...ree+short.vnl_vector_fixed+float.10---.cxx | 17 -
...tree+short.vnl_vector_fixed+float.3---.cxx | 17 -
..._block_iterator+boct_tree+short.bool--.cxx | 5 -
...e+short.bsta_num_obs+bsta_gauss_sf1---.cxx | 8 -
..._block_iterator+boct_tree+short.char--.cxx | 5 -
...block_iterator+boct_tree+short.float--.cxx | 5 -
...m_block_iterator+boct_tree+short.int--.cxx | 8 -
...boct_tree+short.vgl_point_3d+double---.cxx | 6 -
.../boxm_scene+boct_tree+short.bool--.cxx | 5 -
...e+short.bsta_num_obs+bsta_gauss_sf1---.cxx | 8 -
.../boxm_scene+boct_tree+short.char--.cxx | 5 -
.../boxm_scene+boct_tree+short.float--.cxx | 5 -
.../boxm_scene+boct_tree+short.int--.cxx | 8 -
...boct_tree+short.vgl_point_3d+double---.cxx | 6 -
.../brdb_value_t+boxm_scene_base_sptr-.cxx | 4 -
...3d+boxm_block+boct_tree+short.bool--~-.cxx | 11 -
...short.bsta_num_obs+bsta_gauss_sf1---~-.cxx | 10 -
...3d+boxm_block+boct_tree+short.char--~-.cxx | 11 -
...d+boxm_block+boct_tree+short.float--~-.cxx | 11 -
..._3d+boxm_block+boct_tree+short.int--~-.cxx | 14 -
...ct_tree+short.vgl_point_3d+double---~-.cxx | 12 -
.../vbl_array_3d+vsl_b_ifstream~-.cxx | 9 -
.../vbl_io_smart_ptr+boxm_scene_base-.cxx | 5 -
.../vbl_smart_ptr+boxm_scene_base-.cxx | 4 -
contrib/brl/bseg/boxm/algo/CMakeLists.txt | 38 -
.../boxm/algo/boxm_compute_scene_difference.h | 98 -
.../boxm/algo/boxm_compute_scene_statistics.h | 100 -
contrib/brl/bseg/boxm/algo/boxm_crop_scene.h | 95 -
.../brl/bseg/boxm/algo/boxm_fill_in_mesh.h | 316 ---
.../bseg/boxm/algo/boxm_fill_internal_cells.h | 80 -
contrib/brl/bseg/boxm/algo/boxm_init_scene.h | 60 -
.../bseg/boxm/algo/boxm_linear_operations.h | 60 -
contrib/brl/bseg/boxm/algo/boxm_merge_mog.cxx | 239 ---
contrib/brl/bseg/boxm/algo/boxm_merge_mog.h | 65 -
contrib/brl/bseg/boxm/algo/boxm_refine.h | 100 -
.../brl/bseg/boxm/algo/boxm_save_block_raw.h | 155 --
.../brl/bseg/boxm/algo/boxm_save_scene_raw.h | 277 ---
.../boxm/algo/boxm_save_scene_raw_general.h | 824 --------
.../bseg/boxm/algo/boxm_scene_levels_utils.h | 97 -
.../brl/bseg/boxm/algo/boxm_split_sample.h | 105 -
contrib/brl/bseg/boxm/algo/boxm_upload_mesh.h | 156 --
contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt | 40 -
.../bseg/boxm/algo/pro/boxm_algo_processes.h | 28 -
.../bseg/boxm/algo/pro/boxm_algo_register.cxx | 35 -
.../bseg/boxm/algo/pro/boxm_algo_register.h | 11 -
.../boxm_compute_entropy_process.cxx | 83 -
...m_compute_expected_color_scene_process.cxx | 83 -
.../boxm_compute_scene_difference_process.cxx | 91 -
.../boxm_create_scene_from_ply_process.cxx | 257 ---
.../processes/boxm_describe_scene_process.cxx | 106 -
.../boxm_explore_cells_at_level_process.cxx | 61 -
.../boxm_fill_internal_cells_process.cxx | 72 -
.../pro/processes/boxm_init_scene_process.cxx | 111 --
.../boxm_line_backproject_process.cxx | 259 ---
.../boxm_linear_combination_process.cxx | 102 -
.../processes/boxm_merge_mixtures_process.cxx | 90 -
.../processes/boxm_refine_scene_process.cxx | 119 --
.../processes/boxm_remove_level0_process.cxx | 87 -
...boxm_render_expected_edge_vrml_process.cxx | 149 --
.../boxm_replace_const_app_process.cxx | 95 -
.../pro/processes/boxm_roi_init_process.cxx | 195 --
.../boxm_roi_init_rational_camera_process.cxx | 310 ---
.../boxm_save_occupancy_raw_process.cxx | 229 ---
.../processes/boxm_save_scene_raw_process.cxx | 140 --
.../processes/boxm_split_scene_process.cxx | 97 -
.../bseg/boxm/algo/pro/tests/CMakeLists.txt | 2 -
.../bseg/boxm/algo/pro/tests/test_include.cxx | 4 -
contrib/brl/bseg/boxm/algo/rt/CMakeLists.txt | 46 -
...dge_tangent_updater+short.float.float-.cxx | 4 -
.../boxm_edge_updater+short.float.float-.cxx | 3 -
....BOXM_APM_MOG_GREY.BOXM_AUX_OPT2_GREY-.cxx | 4 -
...XM_APM_SIMPLE_GREY.BOXM_AUX_OPT2_GREY-.cxx | 4 -
...t.BOXM_APM_MOG_GREY.BOXM_APM_MOG_GREY-.cxx | 4 -
...OXM_APM_SIMPLE_GREY.BOXM_APM_MOG_GREY-.cxx | 4 -
...OXM_APM_MOG_GREY.BOXM_AUX_OPT_RT_GREY-.cxx | 4 -
..._APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx | 4 -
..._APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx | 3 -
..._APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx | 3 -
...or+short.boxm_inf_line_sample+float---.cxx | 7 -
.../boxm/algo/rt/boxm_change_3d_functor.h | 100 -
.../algo/rt/boxm_change_probability_functor.h | 83 -
.../rt/boxm_compute_num_rays_statistics.h | 65 -
.../boxm/algo/rt/boxm_edge_tangent_updater.h | 76 -
.../algo/rt/boxm_edge_tangent_updater.hxx | 291 ---
.../brl/bseg/boxm/algo/rt/boxm_edge_updater.h | 34 -
.../bseg/boxm/algo/rt/boxm_edge_updater.hxx | 110 -
.../boxm/algo/rt/boxm_expected_edge_functor.h | 53 -
.../rt/boxm_generate_edge_sample_functor.h | 65 -
...oxm_generate_edge_tangent_sample_functor.h | 78 -
.../rt/boxm_generate_opt2_sample_functor.h | 197 --
.../rt/boxm_generate_opt3_sample_functor.h | 219 --
.../rt/boxm_generate_opt_sample_functor.h | 164 --
.../rt/boxm_generate_shadow_sample_functor.h | 212 --
.../bseg/boxm/algo/rt/boxm_opt2_optimizer.h | 37 -
.../bseg/boxm/algo/rt/boxm_opt2_optimizer.hxx | 152 --
.../bseg/boxm/algo/rt/boxm_opt3_optimizer.h | 37 -
.../bseg/boxm/algo/rt/boxm_opt3_optimizer.hxx | 172 --
.../algo/rt/boxm_opt_appearance_estimator.h | 85 -
.../algo/rt/boxm_opt_rt_bayesian_optimizer.h | 36 -
.../rt/boxm_opt_rt_bayesian_optimizer.hxx | 151 --
.../boxm/algo/rt/boxm_pre_infinity_functor.h | 67 -
.../rt/boxm_render_expected_depth_functor.h | 109 -
.../boxm_render_expected_edge_image_functor.h | 109 -
...nder_expected_edge_tangent_image_functor.h | 126 --
.../rt/boxm_render_expected_image_functor.h | 103 -
...oxm_render_expected_shadow_image_functor.h | 120 --
.../bseg/boxm/algo/rt/boxm_rpc_registration.h | 447 -----
.../algo/rt/boxm_shadow_app_initializer.h | 45 -
.../algo/rt/boxm_shadow_app_initializer.hxx | 122 --
.../rt/boxm_shadow_appearance_estimator.h | 114 --
.../algo/rt/boxm_shadow_bayes_optimizer.h | 51 -
.../algo/rt/boxm_shadow_bayes_optimizer.hxx | 195 --
.../boxm/algo/rt/boxm_sun_vis_prob_functor.h | 103 -
.../boxm/algo/rt/boxm_update_image_functor.h | 172 --
contrib/brl/bseg/boxm/algo/rt/dummy.cxx | 0
.../brl/bseg/boxm/algo/rt/pro/CMakeLists.txt | 29 -
.../boxm/algo/rt/pro/boxm_algo_rt_processes.h | 29 -
.../algo/rt/pro/boxm_algo_rt_register.cxx | 33 -
.../boxm/algo/rt/pro/boxm_algo_rt_register.h | 11 -
.../boxm_change_probabilty_process.cxx | 120 --
.../processes/boxm_edge_update_process.cxx | 280 ---
.../boxm_estimate_camera_process.cxx | 199 --
.../boxm_generate_edge_samples_process.cxx | 139 --
.../boxm_generate_opt2_samples_process.cxx | 142 --
.../boxm_generate_opt3_samples_process.cxx | 114 --
.../boxm_generate_opt_samples_process.cxx | 102 -
.../processes/boxm_opt2_update_process.cxx | 153 --
.../processes/boxm_opt3_update_process.cxx | 153 --
.../boxm_opt_bayesian_update_process.cxx | 145 --
.../processes/boxm_ray_statistics_process.cxx | 107 -
.../boxm_render_expected_depth_rt_process.cxx | 114 --
.../boxm_render_expected_edge_process.cxx | 162 --
.../boxm_render_expected_rt_process.cxx | 143 --
.../boxm_rpc_registration_process.cxx | 119 --
.../pro/processes/boxm_update_rt_process.cxx | 136 --
.../boxm/algo/rt/pro/tests/CMakeLists.txt | 2 -
.../boxm/algo/rt/pro/tests/test_include.cxx | 4 -
.../bseg/boxm/algo/rt/tests/CMakeLists.txt | 16 -
.../algo/rt/tests/test_bayesian_optimizer.cxx | 102 -
.../bseg/boxm/algo/rt/tests/test_driver.cxx | 15 -
.../bseg/boxm/algo/rt/tests/test_edges.cxx | 26 -
.../bseg/boxm/algo/rt/tests/test_include.cxx | 30 -
.../algo/rt/tests/test_shadow_appearance.cxx | 72 -
.../algo/rt/tests/test_template_include.cxx | 9 -
contrib/brl/bseg/boxm/algo/sp/CMakeLists.txt | 22 -
.../algo/sp/boxm_compute_volume_visibility.h | 172 --
.../boxm/algo/sp/boxm_depth_image_triangle.h | 127 --
.../brl/bseg/boxm/algo/sp/boxm_render_image.h | 166 --
.../boxm/algo/sp/boxm_render_image_triangle.h | 167 --
contrib/brl/bseg/boxm/algo/sp/boxm_update.h | 374 ----
.../bseg/boxm/algo/sp/boxm_update_triangle.h | 356 ----
contrib/brl/bseg/boxm/algo/sp/dummy.cxx | 0
.../brl/bseg/boxm/algo/sp/pro/CMakeLists.txt | 27 -
...brdb_value_t+vil_image_view_base_sptr-.cxx | 10 -
.../boxm/algo/sp/pro/boxm_algo_sp_processes.h | 14 -
.../algo/sp/pro/boxm_algo_sp_register.cxx | 18 -
.../boxm/algo/sp/pro/boxm_algo_sp_register.h | 11 -
.../boxm_render_expected_process.cxx | 117 --
.../sp/pro/processes/boxm_update_process.cxx | 107 -
.../boxm_volume_visibility_process.cxx | 129 --
.../boxm/algo/sp/pro/tests/CMakeLists.txt | 2 -
.../boxm/algo/sp/pro/tests/test_include.cxx | 4 -
.../bseg/boxm/algo/sp/tests/CMakeLists.txt | 19 -
.../algo/sp/tests/test_compute_visibility.cxx | 90 -
.../bseg/boxm/algo/sp/tests/test_driver.cxx | 17 -
.../bseg/boxm/algo/sp/tests/test_include.cxx | 8 -
.../boxm/algo/sp/tests/test_render_image.cxx | 103 -
.../bseg/boxm/algo/sp/tests/test_update.cxx | 259 ---
.../algo/sp/tests/test_update_multi_bin.cxx | 262 ---
.../brl/bseg/boxm/algo/tests/CMakeLists.txt | 31 -
.../tests/test_boxm_fill_internal_cells.cxx | 112 --
.../boxm/algo/tests/test_boxm_scene_crop.cxx | 129 --
.../brl/bseg/boxm/algo/tests/test_driver.cxx | 23 -
.../boxm/algo/tests/test_fill_in_mesh.cxx | 121 --
.../brl/bseg/boxm/algo/tests/test_include.cxx | 17 -
.../algo/tests/test_linear_operations.cxx | 82 -
.../boxm/algo/tests/test_remove_level0.cxx | 54 -
.../boxm/algo/tests/test_save_scene_raw.cxx | 122 --
.../bseg/boxm/algo/tests/test_upload_mesh.cxx | 127 --
.../brl/bseg/boxm/algo/tests/test_utils.cxx | 71 -
contrib/brl/bseg/boxm/algo/tests/test_utils.h | 18 -
contrib/brl/bseg/boxm/basic/CMakeLists.txt | 21 -
...e+short.bsta_num_obs+bsta_gauss_sf1---.cxx | 8 -
...block_iterator+boct_tree+short.float--.cxx | 5 -
...m_block_iterator+boct_tree+short.int--.cxx | 5 -
...boct_tree+short.vgl_point_3d+double---.cxx | 6 -
...t_tree+short.boxm_edge_sample+float---.cxx | 6 -
...hort.boxm_edge_tangent_sample+float---.cxx | 13 -
...short.boxm_sample+BOXM_APM_MOB_GREY---.cxx | 7 -
...short.boxm_sample+BOXM_APM_MOG_GREY---.cxx | 7 -
...rt.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx | 7 -
..._sample_multi_bin+BOXM_APM_MOG_GREY---.cxx | 7 -
...boct_tree+short.vgl_point_3d+double---.cxx | 6 -
...boct_tree+short.vgl_point_3d+double---.cxx | 6 -
...terator+short.boxm_edge_sample+float--.cxx | 7 -
...short.boxm_edge_tangent_sample+float--.cxx | 6 -
...tor+short.boxm_inf_line_sample+float--.cxx | 6 -
...+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx | 6 -
...+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx | 6 -
...ort.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx | 6 -
...m_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx | 6 -
...h_iterator+short.vgl_point_3d+double--.cxx | 5 -
...brdb_value_t+boxm_array_1d_float_sptr-.cxx | 4 -
.../vbl_io_smart_ptr+boxm_array_1d_float-.cxx | 4 -
.../vbl_smart_ptr+boxm_array_1d_float-.cxx | 4 -
.../basic/boxm_block_vis_graph_iterator.h | 53 -
.../basic/boxm_block_vis_graph_iterator.hxx | 173 --
.../boxm/basic/boxm_block_vis_graph_node.h | 52 -
.../boxm/basic/boxm_cell_vis_graph_iterator.h | 54 -
.../basic/boxm_cell_vis_graph_iterator.hxx | 131 --
.../bseg/boxm/basic/boxm_num_rays_functor.h | 44 -
.../bseg/boxm/basic/boxm_raytrace_function.h | 618 ------
.../bseg/boxm/basic/boxm_seg_length_functor.h | 46 -
.../bseg/boxm/basic/boxm_util_data_types.cxx | 17 -
.../bseg/boxm/basic/boxm_util_data_types.h | 30 -
.../brl/bseg/boxm/basic/tests/CMakeLists.txt | 15 -
.../boxm/basic/tests/test_block_vis_graph.cxx | 48 -
.../boxm/basic/tests/test_cell_vis_graph.cxx | 54 -
.../brl/bseg/boxm/basic/tests/test_driver.cxx | 13 -
.../bseg/boxm/basic/tests/test_include.cxx | 9 -
.../basic/tests/test_template_include.cxx | 4 -
contrib/brl/bseg/boxm/boxm_apm_traits.cxx | 86 -
contrib/brl/bseg/boxm/boxm_apm_traits.h | 206 --
contrib/brl/bseg/boxm/boxm_aux_scene.h | 54 -
contrib/brl/bseg/boxm/boxm_aux_scene.hxx | 121 --
contrib/brl/bseg/boxm/boxm_aux_traits.h | 74 -
contrib/brl/bseg/boxm/boxm_block.h | 58 -
contrib/brl/bseg/boxm/boxm_block.hxx | 80 -
contrib/brl/bseg/boxm/boxm_export.h | 23 -
contrib/brl/bseg/boxm/boxm_io_scene_base.cxx | 25 -
contrib/brl/bseg/boxm/boxm_io_scene_base.h | 21 -
contrib/brl/bseg/boxm/boxm_scene.h | 559 ------
contrib/brl/bseg/boxm/boxm_scene.hxx | 1764 -----------------
contrib/brl/bseg/boxm/boxm_scene_base.cxx | 35 -
contrib/brl/bseg/boxm/boxm_scene_base.h | 85 -
contrib/brl/bseg/boxm/boxm_scene_parser.cxx | 277 ---
contrib/brl/bseg/boxm/boxm_scene_parser.h | 108 -
contrib/brl/bseg/boxm/pro/CMakeLists.txt | 29 -
..._tree+short.vnl_vector_fixed+float.3--.cxx | 10 -
...tree+short.vnl_vector_fixed+float.3---.cxx | 17 -
...tree+short.vnl_vector_fixed+float.3---.cxx | 6 -
.../brdb_value_t+boxm_scene_base_sptr-.cxx | 4 -
...ee+short.vnl_vector_fixed+float.3---~-.cxx | 12 -
contrib/brl/bseg/boxm/pro/boxm_processes.h | 16 -
contrib/brl/bseg/boxm/pro/boxm_register.cxx | 27 -
contrib/brl/bseg/boxm/pro/boxm_register.h | 11 -
.../boxm_camera_viewing_scene_process.cxx | 131 --
.../processes/boxm_clean_scene_process.cxx | 102 -
...oxm_construct_scene_from_image_process.cxx | 219 --
.../processes/boxm_create_scene_process.cxx | 218 --
.../boxm_force_write_blocks_process.cxx | 102 -
.../pro/processes/boxm_load_scene_process.cxx | 73 -
.../processes/boxm_proj_local_cam_process.cxx | 103 -
.../processes/boxm_upload_mesh_process.cxx | 148 --
.../brl/bseg/boxm/pro/tests/CMakeLists.txt | 2 -
.../brl/bseg/boxm/pro/tests/test_include.cxx | 4 -
contrib/brl/bseg/boxm/sample/CMakeLists.txt | 29 -
...ct_tree+short.boxm_edge_sample+float--.cxx | 5 -
...short.boxm_edge_tangent_sample+float--.cxx | 6 -
...ct_tree+short.boxm_opt2_sample+float--.cxx | 4 -
...boct_tree+short.boxm_rt_sample+float--.cxx | 4 -
...+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx | 5 -
...+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx | 12 -
...ort.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx | 9 -
...m_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx | 5 -
..._tree+short.boxm_scalar_sample+float--.cxx | 4 -
...ee_cell+short.boxm_edge_sample+float--.cxx | 5 -
...short.boxm_edge_tangent_sample+float--.cxx | 6 -
...ee_cell+short.boxm_opt2_sample+float--.cxx | 4 -
...tree_cell+short.boxm_rt_sample+float--.cxx | 4 -
...+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx | 6 -
...+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx | 11 -
...ort.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx | 10 -
...m_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx | 6 -
..._cell+short.boxm_scalar_sample+float--.cxx | 4 -
..._reader+short.boxm_edge_sample+float--.cxx | 8 -
...short.boxm_edge_tangent_sample+float--.cxx | 5 -
...der+short.boxm_inf_line_sample+float--.cxx | 5 -
..._reader+short.boxm_opt2_sample+float--.cxx | 5 -
...ll_reader+short.boxm_rt_sample+float--.cxx | 5 -
...+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx | 6 -
...+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx | 6 -
...eader+short.boxm_scalar_sample+float--.cxx | 5 -
...le+float-.boxm_aux_edge_sample+float--.cxx | 5 -
...loat-.boxm_edge_tangent_sample+float--.cxx | 7 -
...M_APM_MOB_GREY-.boxm_rt_sample+float--.cxx | 7 -
...APM_MOG_GREY-.boxm_opt2_sample+float--.cxx | 7 -
...M_APM_MOG_GREY-.boxm_rt_sample+float--.cxx | 7 -
....boxm_sample+BOXM_APM_MOG_GREY-.float-.cxx | 7 -
..._SIMPLE_GREY-.boxm_opt2_sample+float--.cxx | 7 -
...PM_SIMPLE_GREY-.boxm_rt_sample+float--.cxx | 7 -
...IMPLE_GREY-.boxm_scalar_sample+float--.cxx | 8 -
...xm_sample+BOXM_APM_SIMPLE_GREY-.float-.cxx | 7 -
...float.boxm_edge_tangent_sample+float--.cxx | 7 -
...t_tree+short.boxm_edge_sample+float---.cxx | 13 -
...hort.boxm_edge_tangent_sample+float---.cxx | 6 -
...ee+short.boxm_inf_line_sample+float---.cxx | 6 -
...t_tree+short.boxm_opt2_sample+float---.cxx | 9 -
...oct_tree+short.boxm_rt_sample+float---.cxx | 9 -
...short.boxm_sample+BOXM_APM_MOB_GREY---.cxx | 7 -
...short.boxm_sample+BOXM_APM_MOG_GREY---.cxx | 12 -
...rt.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx | 12 -
..._sample_multi_bin+BOXM_APM_MOG_GREY---.cxx | 7 -
...tree+short.boxm_scalar_sample+float---.cxx | 9 -
...t_tree+short.boxm_edge_sample+float---.cxx | 9 -
...hort.boxm_edge_tangent_sample+float---.cxx | 10 -
...short.boxm_sample+BOXM_APM_MOB_GREY---.cxx | 7 -
...short.boxm_sample+BOXM_APM_MOG_GREY---.cxx | 11 -
...rt.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx | 12 -
..._sample_multi_bin+BOXM_APM_MOG_GREY---.cxx | 7 -
.../Templates/boxm_edge_sample+float-.cxx | 4 -
.../boxm_edge_tangent_sample+float-.cxx | 3 -
.../Templates/boxm_inf_line_sample+float-.cxx | 3 -
.../Templates/boxm_opt2_sample+float-.cxx | 4 -
.../Templates/boxm_plane_obs+float-.cxx | 3 -
.../Templates/boxm_rt_sample+float-.cxx | 3 -
.../boxm_sample+BOXM_APM_MOB_GREY-.cxx | 7 -
.../boxm_sample+BOXM_APM_MOG_GREY-.cxx | 9 -
.../boxm_sample+BOXM_APM_SIMPLE_GREY-.cxx | 4 -
...xm_sample_multi_bin+BOXM_APM_MOG_GREY-.cxx | 4 -
.../Templates/boxm_scalar_sample+float-.cxx | 4 -
...t_tree+short.boxm_edge_sample+float---.cxx | 9 -
...hort.boxm_edge_tangent_sample+float---.cxx | 10 -
...t_tree+short.boxm_opt2_sample+float---.cxx | 6 -
...oct_tree+short.boxm_rt_sample+float---.cxx | 6 -
...short.boxm_sample+BOXM_APM_MOB_GREY---.cxx | 6 -
...short.boxm_sample+BOXM_APM_MOG_GREY---.cxx | 10 -
...rt.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx | 11 -
..._sample_multi_bin+BOXM_APM_MOG_GREY---.cxx | 6 -
...tree+short.boxm_scalar_sample+float---.cxx | 6 -
.../boxm_scene+boct_tree+short.int--.cxx | 5 -
...tree+short.boxm_edge_sample+float---~-.cxx | 16 -
...rt.boxm_edge_tangent_sample+float---~-.cxx | 17 -
...tree+short.boxm_opt2_sample+float---~-.cxx | 13 -
...t_tree+short.boxm_rt_sample+float---~-.cxx | 13 -
...ort.boxm_sample+BOXM_APM_MOB_GREY---~-.cxx | 13 -
...ort.boxm_sample+BOXM_APM_MOG_GREY---~-.cxx | 17 -
....boxm_sample+BOXM_APM_SIMPLE_GREY---~-.cxx | 18 -
...ample_multi_bin+BOXM_APM_MOG_GREY---~-.cxx | 13 -
...ee+short.boxm_scalar_sample+float---~-.cxx | 13 -
...mage_view+boxm_inf_line_sample+float--.cxx | 5 -
.../brl/bseg/boxm/sample/algo/CMakeLists.txt | 18 -
...t.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx | 5 -
...t.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx | 5 -
...t.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx | 6 -
...-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx | 7 -
...-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx | 7 -
....boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx | 10 -
.../boxm_opt3_sample+BOXM_APM_MOG_GREY-.cxx | 3 -
....boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx | 7 -
...oxm_opt3_sample+BOXM_APM_MOG_GREY---~-.cxx | 14 -
.../sample/algo/boxm_mob_grey_processor.cxx | 83 -
.../sample/algo/boxm_mob_grey_processor.h | 35 -
.../sample/algo/boxm_mog_grey_processor.cxx | 286 ---
.../sample/algo/boxm_mog_grey_processor.h | 50 -
.../sample/algo/boxm_sigma_normalizer.cxx | 104 -
.../boxm/sample/algo/boxm_sigma_normalizer.h | 43 -
.../algo/boxm_simple_grey_processor.cxx | 437 ----
.../sample/algo/boxm_simple_grey_processor.h | 86 -
.../boxm/sample/algo/tests/CMakeLists.txt | 11 -
.../boxm/sample/algo/tests/test_driver.cxx | 11 -
.../boxm/sample/algo/tests/test_include.cxx | 6 -
.../algo/tests/test_sigma_normalizer.cxx | 59 -
.../brl/bseg/boxm/sample/boxm_edge_sample.h | 97 -
.../brl/bseg/boxm/sample/boxm_edge_sample.hxx | 137 --
.../boxm/sample/boxm_edge_tangent_sample.h | 69 -
.../boxm/sample/boxm_edge_tangent_sample.hxx | 79 -
.../bseg/boxm/sample/boxm_inf_line_sample.h | 55 -
.../bseg/boxm/sample/boxm_inf_line_sample.hxx | 79 -
.../brl/bseg/boxm/sample/boxm_opt2_sample.h | 72 -
.../brl/bseg/boxm/sample/boxm_opt2_sample.hxx | 83 -
.../brl/bseg/boxm/sample/boxm_opt3_sample.h | 76 -
.../brl/bseg/boxm/sample/boxm_opt3_sample.hxx | 92 -
contrib/brl/bseg/boxm/sample/boxm_plane_obs.h | 45 -
.../brl/bseg/boxm/sample/boxm_plane_obs.hxx | 69 -
contrib/brl/bseg/boxm/sample/boxm_rt_sample.h | 70 -
.../brl/bseg/boxm/sample/boxm_rt_sample.hxx | 81 -
contrib/brl/bseg/boxm/sample/boxm_sample.h | 68 -
contrib/brl/bseg/boxm/sample/boxm_sample.hxx | 71 -
.../bseg/boxm/sample/boxm_sample_multi_bin.h | 63 -
.../boxm/sample/boxm_sample_multi_bin.hxx | 98 -
.../brl/bseg/boxm/sample/boxm_scalar_sample.h | 55 -
.../bseg/boxm/sample/boxm_scalar_sample.hxx | 70 -
.../brl/bseg/boxm/sample/boxm_update_sample.h | 17 -
.../boxm/sample/boxm_vis_implicit_sample.h | 16 -
contrib/brl/bseg/boxm/sample/dummy.cxx | 0
.../brl/bseg/boxm/sample/tests/CMakeLists.txt | 4 -
.../bseg/boxm/sample/tests/test_include.cxx | 14 -
.../sample/tests/test_template_include.cxx | 12 -
contrib/brl/bseg/boxm/tests/CMakeLists.txt | 32 -
contrib/brl/bseg/boxm/tests/camera0.txt | 104 -
contrib/brl/bseg/boxm/tests/frame_00000.txt | 7 -
.../brl/bseg/boxm/tests/test_binary_io.cxx | 75 -
.../brl/bseg/boxm/tests/test_block_iter.cxx | 47 -
.../bseg/boxm/tests/test_cell_iterator.cxx | 51 -
contrib/brl/bseg/boxm/tests/test_driver.cxx | 21 -
contrib/brl/bseg/boxm/tests/test_include.cxx | 10 -
.../tests/test_load_neighboring_blocks.cxx | 89 -
.../bseg/boxm/tests/test_region_finder.cxx | 80 -
.../bseg/boxm/tests/test_template_include.cxx | 5 -
contrib/brl/bseg/boxm/tests/test_utils.cxx | 72 -
contrib/brl/bseg/boxm/tests/test_utils.h | 17 -
contrib/brl/bseg/boxm/util/CMakeLists.txt | 23 -
...triangle_interpolation_iterator+float-.cxx | 3 -
.../bseg/boxm/util/boxm_cell_data_traits.cxx | 25 -
.../bseg/boxm/util/boxm_cell_data_traits.h | 89 -
.../brl/bseg/boxm/util/boxm_plane_ransac.h | 126 --
.../boxm/util/boxm_quad_scan_iterator.cxx | 188 --
.../bseg/boxm/util/boxm_quad_scan_iterator.h | 66 -
.../boxm/util/boxm_rational_camera_utils.cxx | 36 -
.../boxm/util/boxm_rational_camera_utils.h | 30 -
.../boxm/util/boxm_raytrace_operations.cxx | 232 ---
.../bseg/boxm/util/boxm_raytrace_operations.h | 452 -----
contrib/brl/bseg/boxm/util/boxm_test_util.cxx | 141 --
contrib/brl/bseg/boxm/util/boxm_test_util.h | 37 -
.../boxm_triangle_interpolation_iterator.h | 53 -
.../boxm_triangle_interpolation_iterator.hxx | 100 -
.../boxm/util/boxm_triangle_scan_iterator.cxx | 59 -
.../boxm/util/boxm_triangle_scan_iterator.h | 46 -
contrib/brl/bseg/boxm/util/boxm_utils.cxx | 1469 --------------
contrib/brl/bseg/boxm/util/boxm_utils.h | 168 --
contrib/brl/bseg/boxm/util/boxm_vrml_util.h | 214 --
.../brl/bseg/boxm/util/tests/CMakeLists.txt | 18 -
contrib/brl/bseg/boxm/util/tests/camera0.txt | 104 -
.../brl/bseg/boxm/util/tests/frame_00000.txt | 7 -
.../util/tests/test_boxm_plane_ransac.cxx | 79 -
.../tests/test_boxm_rational_camera_utils.cxx | 24 -
.../brl/bseg/boxm/util/tests/test_driver.cxx | 15 -
.../brl/bseg/boxm/util/tests/test_include.cxx | 12 -
.../boxm/util/tests/test_quad_interpolate.cxx | 117 --
.../boxm/util/tests/test_template_include.cxx | 3 -
contrib/brl/bseg/boxm_batch/CMakeLists.txt | 59 -
contrib/brl/bseg/boxm_batch/reg_boxm.cxx | 135 --
contrib/brl/bseg/boxm_batch/reg_boxm.h | 12 -
.../brl/bseg/boxm_batch/tests/CMakeLists.txt | 2 -
.../bseg/boxm_batch/tests/test_include.cxx | 3 -
contrib/brl/bseg/boxm_bridge/CMakeLists.txt | 25 -
.../boxm_bridge/boxm2_normails_to_boxm.cxx | 233 ---
.../brl/bseg/boxm_bridge/boxm2_to_boxm.cxx | 292 ---
contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.h | 24 -
.../boxm_bridge/boxm_normals_to_boxm2.cxx | 326 ---
.../brl/bseg/boxm_bridge/boxm_to_boxm2.cxx | 262 ---
contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.h | 30 -
.../brl/bseg/boxm_bridge/tests/CMakeLists.txt | 2 -
.../bseg/boxm_bridge/tests/test_include.cxx | 4 -
contrib/brl/bseg/bvpl/CMakeLists.txt | 1 -
.../brl/bseg/bvpl/bvpl_octree/CMakeLists.txt | 71 -
..._sample+bsta_num_obs+bsta_gauss_sf1---.cxx | 11 -
..._tree+short.bvpl_octree_sample+float--.cxx | 6 -
..._tree+short.bvpl_pca_basis_sample+10--.cxx | 6 -
..._tree+short.bvpl_taylor_basis2_sample-.cxx | 6 -
...sample+bsta_num_obs+bsta_gauss_sf1----.cxx | 20 -
...tree+short.bvpl_octree_sample+float---.cxx | 17 -
...tree+short.bvpl_pca_basis_sample+10---.cxx | 11 -
...tree+short.bvpl_taylor_basis2_sample--.cxx | 12 -
.../Templates/bvpl_global_pca+125-.cxx | 2 -
.../bvpl_global_taylor+double.10-.cxx | 3 -
.../Templates/bvpl_global_taylor+float.3-.cxx | 3 -
...l_smart_ptr+bvpl_discover_pca_kernels-.cxx | 4 -
.../vbl_smart_ptr+bvpl_global_corners-.cxx | 4 -
.../vbl_smart_ptr+bvpl_global_pca+125--.cxx | 5 -
...art_ptr+bvpl_global_taylor+double.10--.cxx | 5 -
.../vbl_smart_ptr+bvpl_pca_error_scenes-.cxx | 4 -
.../vbl_smart_ptr+bvpl_taylor_scenes_map-.cxx | 4 -
.../vnl_matrix_fixed+double.125.125-.cxx | 2 -
.../bvpl_octree/bvpl_block_kernel_operator.h | 134 --
.../bvpl_octree/bvpl_block_vector_operator.h | 146 --
.../bvpl/bvpl_octree/bvpl_cell_data_traits.h | 34 -
.../bvpl/bvpl_octree/bvpl_corner_detector.h | 299 ---
.../bvpl/bvpl_octree/bvpl_corner_functors.h | 68 -
.../bvpl_octree/bvpl_discover_pca_kernels.cxx | 1028 ----------
.../bvpl_octree/bvpl_discover_pca_kernels.h | 309 ---
.../bvpl_gauss3D_steerable_filters.cxx | 512 -----
.../bvpl_gauss3D_steerable_filters.h | 61 -
.../bvpl/bvpl_octree/bvpl_global_corners.cxx | 475 -----
.../bvpl/bvpl_octree/bvpl_global_corners.h | 71 -
.../bseg/bvpl/bvpl_octree/bvpl_global_pca.cxx | 5 -
.../bseg/bvpl/bvpl_octree/bvpl_global_pca.h | 153 --
.../bseg/bvpl/bvpl_octree/bvpl_global_pca.hxx | 1018 ----------
.../bvpl/bvpl_octree/bvpl_global_taylor.cxx | 12 -
.../bvpl/bvpl_octree/bvpl_global_taylor.h | 100 -
.../bvpl/bvpl_octree/bvpl_global_taylor.hxx | 645 ------
.../bvpl_octree/bvpl_octree_kernel_operator.h | 142 --
.../bvpl/bvpl_octree/bvpl_octree_neighbors.h | 78 -
.../bvpl_octree/bvpl_octree_vector_operator.h | 84 -
.../bvpl_octree_vector_operator_impl.h | 30 -
.../bvpl/bvpl_octree/bvpl_octree_vrml_util.h | 84 -
.../bvpl_octree/bvpl_pca_error_scenes.cxx | 50 -
.../bvpl/bvpl_octree/bvpl_pca_error_scenes.h | 39 -
.../bvpl_octree/bvpl_scene_kernel_operator.h | 213 --
.../bvpl_scene_neighborhood_operator.cxx | 6 -
.../bvpl_scene_neighborhood_operator.h | 97 -
.../bvpl_octree/bvpl_scene_statistics.cxx | 80 -
.../bvpl/bvpl_octree/bvpl_scene_statistics.h | 102 -
.../bvpl_octree/bvpl_scene_vector_operator.h | 178 --
.../bvpl/bvpl_octree/bvpl_taylor_basis.cxx | 258 ---
.../bseg/bvpl/bvpl_octree/bvpl_taylor_basis.h | 50 -
.../bvpl_octree/bvpl_taylor_scenes_map.cxx | 61 -
.../bvpl/bvpl_octree/bvpl_taylor_scenes_map.h | 41 -
.../bseg/bvpl/bvpl_octree/io/CMakeLists.txt | 20 -
...o_smart_ptr+bvpl_discover_pca_kernels-.cxx | 4 -
.../vbl_io_smart_ptr+bvpl_global_corners-.cxx | 4 -
...vbl_io_smart_ptr+bvpl_global_pca+125--.cxx | 6 -
...art_ptr+bvpl_global_taylor+double.10--.cxx | 6 -
...bl_io_smart_ptr+bvpl_pca_error_scenes-.cxx | 4 -
...l_io_smart_ptr+bvpl_taylor_scenes_map-.cxx | 4 -
.../io/bvpl_io_discover_pca_kernels.cxx | 50 -
.../io/bvpl_io_discover_pca_kernels.h | 43 -
.../bvpl_octree/io/bvpl_io_global_corners.cxx | 50 -
.../bvpl_octree/io/bvpl_io_global_corners.h | 44 -
.../bvpl_octree/io/bvpl_io_global_pca.cxx | 50 -
.../bvpl/bvpl_octree/io/bvpl_io_global_pca.h | 44 -
.../bvpl_octree/io/bvpl_io_global_taylor.h | 75 -
.../io/bvpl_io_pca_error_scenes.cxx | 50 -
.../bvpl_octree/io/bvpl_io_pca_error_scenes.h | 43 -
.../io/bvpl_io_taylor_scenes_map.cxx | 50 -
.../io/bvpl_io_taylor_scenes_map.h | 38 -
.../bvpl/bvpl_octree/io/tests/CMakeLists.txt | 2 -
.../bvpl_octree/io/tests/test_include.cxx | 8 -
.../bseg/bvpl/bvpl_octree/pro/CMakeLists.txt | 31 -
.../brdb_value_t+boxm_scene_base_sptr-.cxx | 4 -
...alue_t+bvpl_discover_pca_kernels_sptr-.cxx | 6 -
...brdb_value_t+bvpl_global_corners_sptr-.cxx | 6 -
...brdb_value_t+bvpl_global_pca_125_sptr-.cxx | 6 -
...db_value_t+bvpl_pca_error_scenes_sptr-.cxx | 6 -
...b_value_t+bvpl_taylor_scenes_map_sptr-.cxx | 6 -
...rt_ptr+bvpl_global_taylor+double.10---.cxx | 8 -
.../bvpl_octree/pro/bvpl_octree_processes.h | 61 -
.../bvpl_octree/pro/bvpl_octree_register.cxx | 81 -
.../bvpl_octree/pro/bvpl_octree_register.h | 11 -
.../bvpl_block_avg_value_process.cxx | 81 -
.../bvpl_block_kernel_operator_process.cxx | 208 --
.../bvpl_compute_gauss_gradients.cxx | 86 -
.../processes/bvpl_create_scene_process.cxx | 88 -
.../bvpl_grad_scene_to_bin_process.cxx | 136 --
.../processes/bvpl_nonmax_supp_process.cxx | 178 --
.../bvpl_plane_propagate_process.cxx | 209 --
.../pro/processes/bvpl_save_vrml_process.cxx | 89 -
.../bvpl_scene_histogram_process.cxx | 66 -
.../bvpl_scene_kernel_operator_process.cxx | 179 --
.../bvpl_scene_vector_operator_process.cxx | 151 --
.../bvpl_compute_beaudet_measure_process.cxx | 64 -
.../bvpl_compute_harris_measure_process.cxx | 65 -
.../bvpl_corner_statistics_process.cxx | 57 -
.../bvpl_load_global_corners_process.cxx | 50 -
.../bvpl_threshold_corners_process.cxx | 61 -
.../pca/bvpl_add_pca_errors_process.cxx | 94 -
...pl_combine_pairwise_statistics_process.cxx | 95 -
.../bvpl_compute_pca_error_block_process.cxx | 69 -
.../bvpl_compute_pca_error_scene_process.cxx | 132 --
.../bvpl_compute_pca_test_error_process.cxx | 59 -
.../bvpl_discover_pca_features_process.cxx | 98 -
.../processes/pca/bvpl_global_pca_process.cxx | 64 -
.../pca/bvpl_init_global_pca_process.cxx | 50 -
.../pca/bvpl_load_global_pca_process.cxx | 50 -
.../bvpl_load_pca_error_scenes_process.cxx | 58 -
.../pca/bvpl_load_pca_info_process.cxx | 55 -
...l_normalize_pca_training_error_process.cxx | 61 -
.../pca/bvpl_pca_global_add_error_process.cxx | 77 -
.../bvpl_pca_global_proj_error_process.cxx | 63 -
.../bvpl_pca_global_statistics_process.cxx | 75 -
.../pca/bvpl_pca_project_process.cxx | 63 -
.../bvpl_compute_sf_raw_response_process.cxx | 70 -
.../bvpl_init_sf_response_scene_process.cxx | 87 -
.../taylor/bvpl_add_taylor_errors_process.cxx | 90 -
...pl_compute_taylor_coefficients_process.cxx | 80 -
.../bvpl_compute_taylor_error_process.cxx | 78 -
...bvpl_explore_coefficient_scene_process.cxx | 77 -
.../bvpl_init_global_taylor_process.cxx | 68 -
.../bvpl_load_global_taylor_process.cxx | 52 -
.../bvpl_load_taylor_scenes_process.cxx | 72 -
.../bvpl_taylor_global_add_error_process.cxx | 77 -
.../bvpl_taylor_global_proj_error_process.cxx | 63 -
.../bvpl/bvpl_octree/pro/tests/CMakeLists.txt | 16 -
.../test_bvpl_plane_propagation_process.cxx | 144 --
.../bvpl_octree/pro/tests/test_driver.cxx | 10 -
.../bvpl_octree/pro/tests/test_include.cxx | 4 -
.../bvpl/bvpl_octree/python/pca/readme.txt | 7 -
.../pca/reconstruction_error/add_pca_error.py | 193 --
.../compute_pca_error_scene.py | 164 --
.../extract_pca_kernels.py | 61 -
.../python/pca/reconstruction_error/pca.sh | 68 -
.../pca/reconstruction_error/save_pca_raw.py | 108 -
.../pca/training_error/extract_pca_kernels.py | 66 -
.../normalized_training_error.py | 42 -
.../python/pca/training_error/pca.sh | 42 -
.../bseg/bvpl/bvpl_octree/python/readme.txt | 1 -
.../reconstruction_error/add_taylor_error.py | 183 --
.../compute_taylor_error_scene.py | 156 --
.../reconstruction_error/explore_histogram.py | 113 --
.../run_taylor_kernels.py | 98 -
.../reconstruction_error/save_taylor_raw.py | 146 --
.../taylor/reconstruction_error/taylor.sh | 67 -
.../taylor_kernel_threads.py | 72 -
.../bvpl/bvpl_octree/sample/CMakeLists.txt | 16 -
.../bsta_gaussian_sphere+float.1-.cxx | 3 -
...e_sample+bsta_num_obs+bsta_gauss_sf1--.cxx | 7 -
.../Templates/bvpl_octree_sample+float-.cxx | 3 -
.../Templates/bvpl_pca_basis_sample+10-.cxx | 3 -
.../bvpl_octree/sample/bvpl_octree_sample.h | 57 -
.../bvpl_octree/sample/bvpl_octree_sample.hxx | 70 -
.../sample/bvpl_pca_basis_sample.h | 57 -
.../sample/bvpl_pca_basis_sample.hxx | 72 -
.../sample/bvpl_taylor_basis_sample.cxx | 58 -
.../sample/bvpl_taylor_basis_sample.h | 59 -
.../bvpl_octree/sample/tests/CMakeLists.txt | 4 -
.../bvpl_octree/sample/tests/test_include.cxx | 5 -
.../sample/tests/test_template_include.cxx | 4 -
.../bvpl/bvpl_octree/tests/CMakeLists.txt | 35 -
.../bvpl/bvpl_octree/tests/test_driver.cxx | 19 -
.../tests/test_gauss3D_steerable_filters.cxx | 127 --
.../bvpl/bvpl_octree/tests/test_include.cxx | 24 -
.../tests/test_octree_kernel_operator.cxx | 352 ----
.../tests/test_octree_neighbors.cxx | 92 -
.../bvpl_octree/tests/test_pca_kernels.cxx | 304 ---
.../bvpl_octree/tests/test_taylor_basis.cxx | 143 --
.../tests/test_template_include.cxx | 4 -
.../bvpl/bvpl_octree/tests/test_utils.cxx | 94 -
.../bseg/bvpl/bvpl_octree/tests/test_utils.h | 20 -
.../brl/bseg/bvpl/kernels/pro/CMakeLists.txt | 2 +-
...b_value_t+bvpl_taylor_scenes_map_sptr-.cxx | 6 -
...l_io_smart_ptr+bvpl_taylor_scenes_map-.cxx | 4 -
.../kernels/pro/bvpl_kernels_register.cxx | 1 -
.../bvpl_load_taylor_responses_process.cxx | 53 -
.../brl/bseg/bvpl_octree_batch/CMakeLists.txt | 44 -
.../bvpl_octree_batch/reg_bvpl_octree.cxx | 61 -
.../bseg/bvpl_octree_batch/reg_bvpl_octree.h | 10 -
.../bvpl_octree_batch/tests/CMakeLists.txt | 2 -
.../bvpl_octree_batch/tests/test_include.cxx | 3 -
contrib/brl/bseg/bvxm/algo/CMakeLists.txt | 3 +-
.../brl/bseg/bvxm/algo/bvxm_boxm_convert.h | 152 --
contrib/brl/bseg/bvxm/algo/pro/CMakeLists.txt | 3 +-
.../bseg/bvxm/algo/pro/bvxm_algo_processes.h | 2 +-
.../bseg/bvxm/algo/pro/bvxm_algo_register.cxx | 2 +-
.../boxm_scene_to_bvxm_grid_process.cxx | 129 --
.../brl/bseg/bvxm/algo/tests/CMakeLists.txt | 3 -
.../tests/test_boxm_scene_to_bvxm_grid.cxx | 111 --
.../brl/bseg/bvxm/algo/tests/test_driver.cxx | 4 +-
.../brl/bseg/bvxm/algo/tests/test_include.cxx | 1 -
653 files changed, 7 insertions(+), 47919 deletions(-)
delete mode 100644 contrib/brl/bseg/boxm/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/Templates/boct_tree+short.bsta_num_obs+bsta_gauss_sf1--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+double.10--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+float.10--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+float.3--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boct_tree_cell+short.bsta_num_obs+bsta_gauss_sf1--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.bool--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.char--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.int--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vgl_point_3d+double---.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+double.10---.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.10---.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.3---.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.bool--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.char--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.int--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.vgl_point_3d+double---.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.bool--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.char--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.int--.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.vgl_point_3d+double---.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.bool--~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.char--~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.float--~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.int--~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.vgl_point_3d+double---~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_array_3d+vsl_b_ifstream~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_io_smart_ptr+boxm_scene_base-.cxx
delete mode 100644 contrib/brl/bseg/boxm/Templates/vbl_smart_ptr+boxm_scene_base-.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_compute_scene_difference.h
delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_compute_scene_statistics.h
delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_crop_scene.h
delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_fill_in_mesh.h
delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_fill_internal_cells.h
delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_init_scene.h
delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_linear_operations.h
delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_merge_mog.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_merge_mog.h
delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_refine.h
delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_save_block_raw.h
delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_save_scene_raw.h
delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_save_scene_raw_general.h
delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_scene_levels_utils.h
delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_split_sample.h
delete mode 100644 contrib/brl/bseg/boxm/algo/boxm_upload_mesh.h
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/boxm_algo_processes.h
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/boxm_algo_register.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/boxm_algo_register.h
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_entropy_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_expected_color_scene_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_scene_difference_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_create_scene_from_ply_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_describe_scene_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_explore_cells_at_level_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_fill_internal_cells_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_init_scene_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_line_backproject_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_linear_combination_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_merge_mixtures_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_refine_scene_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_remove_level0_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_render_expected_edge_vrml_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_replace_const_app_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_roi_init_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_roi_init_rational_camera_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_save_occupancy_raw_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_save_scene_raw_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/processes/boxm_split_scene_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/algo/pro/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_edge_tangent_updater+short.float.float-.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_edge_updater+short.float.float-.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt2_optimizer+short.BOXM_APM_MOG_GREY.BOXM_AUX_OPT2_GREY-.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt2_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT2_GREY-.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt3_optimizer+short.BOXM_APM_MOG_GREY.BOXM_APM_MOG_GREY-.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt3_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_APM_MOG_GREY-.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt_rt_bayesian_optimizer+short.BOXM_APM_MOG_GREY.BOXM_AUX_OPT_RT_GREY-.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt_rt_bayesian_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_shadow_app_initializer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/boxm_shadow_bayes_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/Templates/bpgl_camera_estimator+boxm_expected_edge_functor+short.boxm_inf_line_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_change_3d_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_change_probability_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_compute_num_rays_statistics.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_edge_tangent_updater.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_edge_tangent_updater.hxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_edge_updater.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_edge_updater.hxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_expected_edge_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_generate_edge_sample_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_generate_edge_tangent_sample_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt2_sample_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt3_sample_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt_sample_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_generate_shadow_sample_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_opt2_optimizer.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_opt2_optimizer.hxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_opt3_optimizer.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_opt3_optimizer.hxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_opt_appearance_estimator.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_opt_rt_bayesian_optimizer.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_opt_rt_bayesian_optimizer.hxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_pre_infinity_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_depth_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_edge_image_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_edge_tangent_image_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_image_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_shadow_image_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_rpc_registration.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_shadow_app_initializer.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_shadow_app_initializer.hxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_shadow_appearance_estimator.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_shadow_bayes_optimizer.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_shadow_bayes_optimizer.hxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_sun_vis_prob_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/boxm_update_image_functor.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/dummy.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_processes.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_register.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_register.h
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_change_probabilty_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_edge_update_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_estimate_camera_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_edge_samples_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt2_samples_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt3_samples_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt_samples_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt2_update_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt3_update_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt_bayesian_update_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_ray_statistics_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_depth_rt_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_edge_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_rt_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_rpc_registration_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_update_rt_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/pro/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/tests/test_bayesian_optimizer.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/tests/test_driver.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/tests/test_edges.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/tests/test_shadow_appearance.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/rt/tests/test_template_include.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/boxm_compute_volume_visibility.h
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/boxm_depth_image_triangle.h
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/boxm_render_image.h
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/boxm_render_image_triangle.h
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/boxm_update.h
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/boxm_update_triangle.h
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/dummy.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/Templates/brdb_value_t+vil_image_view_base_sptr-.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_processes.h
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_register.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_register.h
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_render_expected_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_update_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_volume_visibility_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/pro/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/tests/test_compute_visibility.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/tests/test_driver.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/tests/test_render_image.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/tests/test_update.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/sp/tests/test_update_multi_bin.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_boxm_fill_internal_cells.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_boxm_scene_crop.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_driver.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_fill_in_mesh.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_linear_operations.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_remove_level0.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_save_scene_raw.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_upload_mesh.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_utils.cxx
delete mode 100644 contrib/brl/bseg/boxm/algo/tests/test_utils.h
delete mode 100644 contrib/brl/bseg/boxm/basic/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.int--.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.vgl_point_3d+double---.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_edge_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_edge_tangent_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.vgl_point_3d+double---.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_node+boct_tree+short.vgl_point_3d+double---.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_edge_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_edge_tangent_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_inf_line_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.vgl_point_3d+double--.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/brdb_value_t+boxm_array_1d_float_sptr-.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/vbl_io_smart_ptr+boxm_array_1d_float-.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/Templates/vbl_smart_ptr+boxm_array_1d_float-.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_iterator.h
delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_iterator.hxx
delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_node.h
delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_cell_vis_graph_iterator.h
delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_cell_vis_graph_iterator.hxx
delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_num_rays_functor.h
delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_raytrace_function.h
delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_seg_length_functor.h
delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_util_data_types.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/boxm_util_data_types.h
delete mode 100644 contrib/brl/bseg/boxm/basic/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/basic/tests/test_block_vis_graph.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/tests/test_cell_vis_graph.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/tests/test_driver.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/boxm/basic/tests/test_template_include.cxx
delete mode 100644 contrib/brl/bseg/boxm/boxm_apm_traits.cxx
delete mode 100644 contrib/brl/bseg/boxm/boxm_apm_traits.h
delete mode 100644 contrib/brl/bseg/boxm/boxm_aux_scene.h
delete mode 100644 contrib/brl/bseg/boxm/boxm_aux_scene.hxx
delete mode 100644 contrib/brl/bseg/boxm/boxm_aux_traits.h
delete mode 100644 contrib/brl/bseg/boxm/boxm_block.h
delete mode 100644 contrib/brl/bseg/boxm/boxm_block.hxx
delete mode 100644 contrib/brl/bseg/boxm/boxm_export.h
delete mode 100644 contrib/brl/bseg/boxm/boxm_io_scene_base.cxx
delete mode 100644 contrib/brl/bseg/boxm/boxm_io_scene_base.h
delete mode 100644 contrib/brl/bseg/boxm/boxm_scene.h
delete mode 100644 contrib/brl/bseg/boxm/boxm_scene.hxx
delete mode 100644 contrib/brl/bseg/boxm/boxm_scene_base.cxx
delete mode 100644 contrib/brl/bseg/boxm/boxm_scene_base.h
delete mode 100644 contrib/brl/bseg/boxm/boxm_scene_parser.cxx
delete mode 100644 contrib/brl/bseg/boxm/boxm_scene_parser.h
delete mode 100644 contrib/brl/bseg/boxm/pro/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/pro/Templates/boct_tree+short.vnl_vector_fixed+float.3--.cxx
delete mode 100644 contrib/brl/bseg/boxm/pro/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.3---.cxx
delete mode 100644 contrib/brl/bseg/boxm/pro/Templates/boxm_scene+boct_tree+short.vnl_vector_fixed+float.3---.cxx
delete mode 100644 contrib/brl/bseg/boxm/pro/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx
delete mode 100644 contrib/brl/bseg/boxm/pro/Templates/vbl_array_3d+boxm_block+boct_tree+short.vnl_vector_fixed+float.3---~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/pro/boxm_processes.h
delete mode 100644 contrib/brl/bseg/boxm/pro/boxm_register.cxx
delete mode 100644 contrib/brl/bseg/boxm/pro/boxm_register.h
delete mode 100644 contrib/brl/bseg/boxm/pro/processes/boxm_camera_viewing_scene_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/pro/processes/boxm_clean_scene_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/pro/processes/boxm_construct_scene_from_image_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/pro/processes/boxm_create_scene_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/pro/processes/boxm_force_write_blocks_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/pro/processes/boxm_load_scene_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/pro/processes/boxm_proj_local_cam_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/pro/processes/boxm_upload_mesh_process.cxx
delete mode 100644 contrib/brl/bseg/boxm/pro/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/pro/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_edge_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_edge_tangent_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_opt2_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_rt_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_scalar_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_edge_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_edge_tangent_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_opt2_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_rt_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_scalar_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_edge_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_edge_tangent_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_inf_line_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_opt2_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_rt_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_scalar_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_edge_sample+float-.boxm_aux_edge_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_inf_line_sample+float-.boxm_edge_tangent_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOB_GREY-.boxm_rt_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_opt2_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_rt_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.float-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_opt2_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_rt_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_scalar_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.float-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.float.boxm_edge_tangent_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_edge_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_edge_tangent_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_inf_line_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_opt2_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_rt_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_scalar_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_edge_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_edge_tangent_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_edge_sample+float-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_edge_tangent_sample+float-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_inf_line_sample+float-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_opt2_sample+float-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_plane_obs+float-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_rt_sample+float-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_MOB_GREY-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_MOG_GREY-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_SIMPLE_GREY-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_sample_multi_bin+BOXM_APM_MOG_GREY-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scalar_sample+float-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_edge_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_edge_tangent_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_opt2_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_rt_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_scalar_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.int--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_edge_sample+float---~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_edge_tangent_sample+float---~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_opt2_sample+float---~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_rt_sample+float---~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_scalar_sample+float---~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/Templates/vil_image_view+boxm_inf_line_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree_cell+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree_cell_reader+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/boxm_block+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/boxm_opt3_sample+BOXM_APM_MOG_GREY-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/boxm_scene+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---~-.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.h
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.h
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.h
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/boxm_simple_grey_processor.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/boxm_simple_grey_processor.h
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/tests/test_driver.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/algo/tests/test_sigma_normalizer.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_edge_sample.h
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_edge_sample.hxx
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_edge_tangent_sample.h
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_edge_tangent_sample.hxx
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_inf_line_sample.h
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_inf_line_sample.hxx
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_opt2_sample.h
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_opt2_sample.hxx
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_opt3_sample.h
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_opt3_sample.hxx
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_plane_obs.h
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_plane_obs.hxx
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_rt_sample.h
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_rt_sample.hxx
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_sample.h
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_sample.hxx
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_sample_multi_bin.h
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_sample_multi_bin.hxx
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_scalar_sample.h
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_scalar_sample.hxx
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_update_sample.h
delete mode 100644 contrib/brl/bseg/boxm/sample/boxm_vis_implicit_sample.h
delete mode 100644 contrib/brl/bseg/boxm/sample/dummy.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/sample/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/boxm/sample/tests/test_template_include.cxx
delete mode 100644 contrib/brl/bseg/boxm/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/tests/camera0.txt
delete mode 100644 contrib/brl/bseg/boxm/tests/frame_00000.txt
delete mode 100644 contrib/brl/bseg/boxm/tests/test_binary_io.cxx
delete mode 100644 contrib/brl/bseg/boxm/tests/test_block_iter.cxx
delete mode 100644 contrib/brl/bseg/boxm/tests/test_cell_iterator.cxx
delete mode 100644 contrib/brl/bseg/boxm/tests/test_driver.cxx
delete mode 100644 contrib/brl/bseg/boxm/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/boxm/tests/test_load_neighboring_blocks.cxx
delete mode 100644 contrib/brl/bseg/boxm/tests/test_region_finder.cxx
delete mode 100644 contrib/brl/bseg/boxm/tests/test_template_include.cxx
delete mode 100644 contrib/brl/bseg/boxm/tests/test_utils.cxx
delete mode 100644 contrib/brl/bseg/boxm/tests/test_utils.h
delete mode 100644 contrib/brl/bseg/boxm/util/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/util/Templates/boxm_triangle_interpolation_iterator+float-.cxx
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_cell_data_traits.cxx
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_cell_data_traits.h
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_plane_ransac.h
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_quad_scan_iterator.cxx
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_quad_scan_iterator.h
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_rational_camera_utils.cxx
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_rational_camera_utils.h
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_raytrace_operations.cxx
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_raytrace_operations.h
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_test_util.cxx
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_test_util.h
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_triangle_interpolation_iterator.h
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_triangle_interpolation_iterator.hxx
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_triangle_scan_iterator.cxx
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_triangle_scan_iterator.h
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_utils.cxx
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_utils.h
delete mode 100644 contrib/brl/bseg/boxm/util/boxm_vrml_util.h
delete mode 100644 contrib/brl/bseg/boxm/util/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm/util/tests/camera0.txt
delete mode 100644 contrib/brl/bseg/boxm/util/tests/frame_00000.txt
delete mode 100644 contrib/brl/bseg/boxm/util/tests/test_boxm_plane_ransac.cxx
delete mode 100644 contrib/brl/bseg/boxm/util/tests/test_boxm_rational_camera_utils.cxx
delete mode 100644 contrib/brl/bseg/boxm/util/tests/test_driver.cxx
delete mode 100644 contrib/brl/bseg/boxm/util/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/boxm/util/tests/test_quad_interpolate.cxx
delete mode 100644 contrib/brl/bseg/boxm/util/tests/test_template_include.cxx
delete mode 100644 contrib/brl/bseg/boxm_batch/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm_batch/reg_boxm.cxx
delete mode 100644 contrib/brl/bseg/boxm_batch/reg_boxm.h
delete mode 100644 contrib/brl/bseg/boxm_batch/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm_batch/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/boxm_bridge/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm_bridge/boxm2_normails_to_boxm.cxx
delete mode 100644 contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.cxx
delete mode 100644 contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.h
delete mode 100644 contrib/brl/bseg/boxm_bridge/boxm_normals_to_boxm2.cxx
delete mode 100644 contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.cxx
delete mode 100644 contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.h
delete mode 100644 contrib/brl/bseg/boxm_bridge/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/boxm_bridge/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1---.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_octree_sample+float--.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_pca_basis_sample+10--.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_taylor_basis2_sample-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1----.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_octree_sample+float---.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_pca_basis_sample+10---.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_taylor_basis2_sample--.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_pca+125-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_taylor+double.10-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_taylor+float.3-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_discover_pca_kernels-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_corners-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_pca+125--.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_taylor+double.10--.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_pca_error_scenes-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_taylor_scenes_map-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/Templates/vnl_matrix_fixed+double.125.125-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_block_kernel_operator.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_block_vector_operator.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_cell_data_traits.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_corner_detector.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_corner_functors.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.hxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.hxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_kernel_operator.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_neighbors.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vector_operator.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vector_operator_impl.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vrml_util.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_pca_error_scenes.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_pca_error_scenes.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_kernel_operator.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_vector_operator.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_scenes_map.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_scenes_map.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_discover_pca_kernels-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_corners-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_pca+125--.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_taylor+double.10--.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_pca_error_scenes-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_taylor_scenes_map-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_taylor.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/io/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_discover_pca_kernels_sptr-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_global_corners_sptr-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_global_pca_125_sptr-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_pca_error_scenes_sptr-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_taylor_scenes_map_sptr-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+vbl_smart_ptr+bvpl_global_taylor+double.10---.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_processes.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_register.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_register.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_block_avg_value_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_block_kernel_operator_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_compute_gauss_gradients.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_create_scene_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_grad_scene_to_bin_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_nonmax_supp_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_plane_propagate_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_save_vrml_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_histogram_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_kernel_operator_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_vector_operator_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_compute_beaudet_measure_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_compute_harris_measure_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_corner_statistics_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_load_global_corners_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_threshold_corners_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_add_pca_errors_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_combine_pairwise_statistics_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_error_block_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_error_scene_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_test_error_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_discover_pca_features_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_global_pca_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_init_global_pca_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_global_pca_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_pca_error_scenes_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_pca_info_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_normalize_pca_training_error_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_add_error_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_proj_error_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_statistics_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_project_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/steerable_filters/bvpl_compute_sf_raw_response_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/steerable_filters/bvpl_init_sf_response_scene_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_add_taylor_errors_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_compute_taylor_coefficients_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_compute_taylor_error_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_explore_coefficient_scene_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_init_global_taylor_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_load_global_taylor_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_load_taylor_scenes_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_taylor_global_add_error_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_taylor_global_proj_error_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_bvpl_plane_propagation_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_driver.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/readme.txt
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/add_pca_error.py
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/compute_pca_error_scene.py
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/extract_pca_kernels.py
delete mode 100755 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/pca.sh
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/save_pca_raw.py
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/extract_pca_kernels.py
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/normalized_training_error.py
delete mode 100755 contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/pca.sh
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/readme.txt
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/add_taylor_error.py
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/compute_taylor_error_scene.py
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/explore_histogram.py
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/run_taylor_kernels.py
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/save_taylor_raw.py
delete mode 100755 contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/taylor.sh
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/taylor_kernel_threads.py
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bsta_gaussian_sphere+float.1-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1--.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_octree_sample+float-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_pca_basis_sample+10-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.hxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.hxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.h
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/test_template_include.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_driver.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_gauss3D_steerable_filters.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_octree_kernel_operator.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_octree_neighbors.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_pca_kernels.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_taylor_basis.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_template_include.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_utils.cxx
delete mode 100644 contrib/brl/bseg/bvpl/bvpl_octree/tests/test_utils.h
delete mode 100644 contrib/brl/bseg/bvpl/kernels/pro/Templates/brdb_value_t+bvpl_taylor_scenes_map_sptr-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/kernels/pro/Templates/vbl_io_smart_ptr+bvpl_taylor_scenes_map-.cxx
delete mode 100644 contrib/brl/bseg/bvpl/kernels/pro/processes/bvpl_load_taylor_responses_process.cxx
delete mode 100644 contrib/brl/bseg/bvpl_octree_batch/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/bvpl_octree_batch/reg_bvpl_octree.cxx
delete mode 100644 contrib/brl/bseg/bvpl_octree_batch/reg_bvpl_octree.h
delete mode 100644 contrib/brl/bseg/bvpl_octree_batch/tests/CMakeLists.txt
delete mode 100644 contrib/brl/bseg/bvpl_octree_batch/tests/test_include.cxx
delete mode 100644 contrib/brl/bseg/bvxm/algo/bvxm_boxm_convert.h
delete mode 100644 contrib/brl/bseg/bvxm/algo/pro/processes/boxm_scene_to_bvxm_grid_process.cxx
delete mode 100644 contrib/brl/bseg/bvxm/algo/tests/test_boxm_scene_to_bvxm_grid.cxx
diff --git a/contrib/brl/bseg/CMakeLists.txt b/contrib/brl/bseg/CMakeLists.txt
index f2b53d63ae..0d20b12438 100644
--- a/contrib/brl/bseg/CMakeLists.txt
+++ b/contrib/brl/bseg/CMakeLists.txt
@@ -41,18 +41,12 @@ add_subdirectory(brec_batch)
# octree
add_subdirectory(boct)
-# octree based modeling
-add_subdirectory(boxm)
-
# updated, gpu compatible octree based modeling
add_subdirectory(boxm2)
# updated, gpu compatible octree based modeling
add_subdirectory(boxm2_batch)
-# octree based modeling python interface
-add_subdirectory(boxm_batch)
-
# semi-global matching
add_subdirectory(bsgm)
@@ -62,15 +56,9 @@ add_subdirectory(bvpl)
# voxel processing library python interface
add_subdirectory(bvpl_batch)
-# voxel processing library python interface for octrees
-add_subdirectory(bvpl_octree_batch)
-
# Brown affine patch library, SIFT keypoint & descriptor
add_subdirectory(bapl)
-#the bridge lib to convert between boxm and boxm2 scenes
-add_subdirectory(boxm_bridge)
-
#multi gpu library
add_subdirectory(boxm2_multi)
diff --git a/contrib/brl/bseg/boxm/CMakeLists.txt b/contrib/brl/bseg/boxm/CMakeLists.txt
deleted file mode 100644
index 6a0e5159f4..0000000000
--- a/contrib/brl/bseg/boxm/CMakeLists.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-# contrib/brl/bseg/boxm/CMakeLists.txt
-FIND_PACKAGE(EXPAT REQUIRED)
-FIND_PACKAGE(EXPATPP REQUIRED)
-if(EXPAT_FOUND)
-
-include_directories( ${EXPAT_INCLUDE_DIR} )
-include_directories( ${GEL_INCLUDE_DIR} )
-include_directories( ${GEL_INCLUDE_DIR}/mrc )
-include_directories( ${BRL_INCLUDE_DIR}/b3p/expatpp )
-
-set(boxm_sources
- boxm_export.h
- boxm_block.hxx boxm_block.h
- boxm_scene_base.cxx boxm_scene_base.h
- boxm_scene.hxx boxm_scene.h
- boxm_aux_scene.hxx boxm_aux_scene.h
- boxm_scene_parser.cxx boxm_scene_parser.h
- boxm_apm_traits.cxx boxm_apm_traits.h
- boxm_aux_traits.h
- boxm_io_scene_base.h boxm_io_scene_base.cxx
-)
-
-aux_source_directory(Templates boxm_sources)
-
-vxl_add_library(LIBRARY_NAME boxm LIBRARY_SOURCES ${boxm_sources})
-
-target_link_libraries(boxm boct bsta brdb ${VXL_LIB_PREFIX}vgl_io ${VXL_LIB_PREFIX}vgl_xio ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vpgl_xio ${VXL_LIB_PREFIX}vpgl_algo vsol expatpp ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vnl_algo ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vbl_io ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vsl ${VXL_LIB_PREFIX}vpl ${VXL_LIB_PREFIX}vcl)
-
-#processes
-add_subdirectory(pro)
-
-#util
-add_subdirectory(util)
-
-#samples
-add_subdirectory(sample)
-
-#basic algorithms involving scenes
-add_subdirectory(algo)
-
-#basic structures
-add_subdirectory(basic)
-
-
-#tests
-if( BUILD_TESTING )
- add_subdirectory(tests)
-endif()
-
-endif()
-
-#install the .h .hxx and libs
diff --git a/contrib/brl/bseg/boxm/Templates/boct_tree+short.bsta_num_obs+bsta_gauss_sf1--.cxx b/contrib/brl/bseg/boxm/Templates/boct_tree+short.bsta_num_obs+bsta_gauss_sf1--.cxx
deleted file mode 100644
index 3c4f37b302..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boct_tree+short.bsta_num_obs+bsta_gauss_sf1--.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_gauss_sf1.h>
-#include <bsta/io/bsta_io_attributes.h>
-#include <bsta/io/bsta_io_gaussian_sphere.h>
-#include <boct/boct_tree.hxx>
-
-typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
-
-BOCT_TREE_INSTANTIATE(short, gauss_type);
diff --git a/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+double.10--.cxx b/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+double.10--.cxx
deleted file mode 100644
index 7612eb4071..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+double.10--.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <boct/boct_tree.hxx>
-#include <boct/boct_tree_cell.hxx>
-#include <vnl/vnl_vector_fixed.h>
-#include <vnl/io/vnl_io_vector_fixed.h>
-
-typedef vnl_vector_fixed<double,10> vector;
-
-BOCT_TREE_INSTANTIATE(short, vector );
-BOCT_TREE_CELL_INSTANTIATE(short, vector);
diff --git a/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+float.10--.cxx b/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+float.10--.cxx
deleted file mode 100644
index 63921f9183..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+float.10--.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <boct/boct_tree.hxx>
-#include <boct/boct_tree_cell.hxx>
-#include <vnl/vnl_vector_fixed.h>
-#include <vnl/io/vnl_io_vector_fixed.h>
-
-typedef vnl_vector_fixed<float,10> vector;
-
-BOCT_TREE_INSTANTIATE(short, vector );
-BOCT_TREE_CELL_INSTANTIATE(short, vector);
diff --git a/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+float.3--.cxx b/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+float.3--.cxx
deleted file mode 100644
index fb055c2df5..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boct_tree+short.vnl_vector_fixed+float.3--.cxx
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <boct/boct_tree.hxx>
-#include <boct/boct_tree_cell.hxx>
-#include <vnl/vnl_vector_fixed.h>
-#include <vnl/io/vnl_io_vector_fixed.h>
-
-typedef vnl_vector_fixed<float,3> vector;
-
-
-BOCT_TREE_INSTANTIATE(short, vector );
-BOCT_TREE_CELL_INSTANTIATE(short, vector);
diff --git a/contrib/brl/bseg/boxm/Templates/boct_tree_cell+short.bsta_num_obs+bsta_gauss_sf1--.cxx b/contrib/brl/bseg/boxm/Templates/boct_tree_cell+short.bsta_num_obs+bsta_gauss_sf1--.cxx
deleted file mode 100644
index 1a7c7d6247..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boct_tree_cell+short.bsta_num_obs+bsta_gauss_sf1--.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_gauss_sf1.h>
-#include <boct/boct_tree_cell.hxx>
-#include <bsta/io/bsta_io_attributes.h>
-#include <bsta/io/bsta_io_gaussian_sphere.h>
-
-typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
-
-BOCT_TREE_CELL_INSTANTIATE(short, gauss_type);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.bool--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.bool--.cxx
deleted file mode 100644
index c104d2eed5..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.bool--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,bool> tree_type;
-BOXM_BLOCK_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx
deleted file mode 100644
index e629c522cb..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_gauss_sf1.h>
-#include <boct/boct_tree.h>
-#include <boxm/boxm_block.hxx>
-
-typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
-typedef boct_tree<short,gauss_type> tree_type;
-
-BOXM_BLOCK_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.char--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.char--.cxx
deleted file mode 100644
index 562247092f..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.char--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,char> tree_type;
-BOXM_BLOCK_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.float--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.float--.cxx
deleted file mode 100644
index 3c0bdbf155..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.float--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,float> tree_type;
-BOXM_BLOCK_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.int--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.int--.cxx
deleted file mode 100644
index 247d59847c..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.int--.cxx
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,int> tree_type;
-BOXM_BLOCK_INSTANTIATE(tree_type);
-
-typedef boct_tree<short,short int> short_tree_type;
-BOXM_BLOCK_INSTANTIATE(short_tree_type);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vgl_point_3d+double---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vgl_point_3d+double---.cxx
deleted file mode 100644
index 5bee916221..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vgl_point_3d+double---.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-
-typedef boct_tree<short, vgl_point_3d<double> > tree_type;
-BOXM_BLOCK_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+double.10---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+double.10---.cxx
deleted file mode 100644
index 177fcfeeee..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+double.10---.cxx
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <iostream>
-#include <string>
-#include <boct/boct_tree.h>
-#include <boxm/boxm_block.hxx>
-#include <boxm/boxm_scene.hxx>
-#include <vnl/vnl_vector_fixed.h>
-#include <vbl/vbl_array_3d.hxx>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-typedef boct_tree<short, vnl_vector_fixed<double,10> > tree_type;
-
-BOXM_BLOCK_INSTANTIATE(tree_type);
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
-BOXM_SCENE_INSTANTIATE(tree_type);
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type> *);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.10---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.10---.cxx
deleted file mode 100644
index 5f31529e08..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.10---.cxx
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <iostream>
-#include <string>
-#include <boct/boct_tree.h>
-#include <boxm/boxm_block.hxx>
-#include <boxm/boxm_scene.hxx>
-#include <vnl/vnl_vector_fixed.h>
-#include <vbl/vbl_array_3d.hxx>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-typedef boct_tree<short, vnl_vector_fixed<float,10> > tree_type;
-
-BOXM_BLOCK_INSTANTIATE(tree_type);
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
-BOXM_SCENE_INSTANTIATE(tree_type);
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type> *);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.3---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.3---.cxx
deleted file mode 100644
index ac40b5ec2d..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.3---.cxx
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <iostream>
-#include <string>
-#include <boct/boct_tree.h>
-#include <boxm/boxm_block.hxx>
-#include <boxm/boxm_scene.hxx>
-#include <vnl/vnl_vector_fixed.h>
-#include <vbl/vbl_array_3d.hxx>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-typedef boct_tree<short, vnl_vector_fixed<float,3> > tree_type;
-
-BOXM_BLOCK_INSTANTIATE(tree_type);
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
-BOXM_SCENE_INSTANTIATE(tree_type);
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type> *);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.bool--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.bool--.cxx
deleted file mode 100644
index 5834cafab6..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.bool--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,bool > tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx
deleted file mode 100644
index b4bce045ed..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_gauss_sf1.h>
-#include <boxm/boxm_scene.hxx>
-
-typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
-typedef boct_tree<short,gauss_type> tree_type;
-
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.char--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.char--.cxx
deleted file mode 100644
index 09f831722a..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.char--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,char > tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.float--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.float--.cxx
deleted file mode 100644
index 4129f1a830..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.float--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,float > tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.int--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.int--.cxx
deleted file mode 100644
index 50ef71285a..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.int--.cxx
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,int > tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
-
-typedef boct_tree<short,short int > short_tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(short_tree_type);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.vgl_point_3d+double---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.vgl_point_3d+double---.cxx
deleted file mode 100644
index 2cd39a3534..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_block_iterator+boct_tree+short.vgl_point_3d+double---.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-#include <vgl/vgl_point_3d.h>
-
-typedef boct_tree<short,vgl_point_3d<double> > tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.bool--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.bool--.cxx
deleted file mode 100644
index 02bbdc01a7..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.bool--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.hxx>
-
-typedef boct_tree<short,bool > tree;
-BOXM_SCENE_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx
deleted file mode 100644
index 88886e65c2..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_gauss_sf1.h>
-#include <boxm/boxm_scene.hxx>
-
-typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
-typedef boct_tree<short,gauss_type> tree_type;
-
-BOXM_SCENE_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.char--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.char--.cxx
deleted file mode 100644
index 273a95c2a6..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.char--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.hxx>
-
-typedef boct_tree<short,char > tree;
-BOXM_SCENE_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.float--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.float--.cxx
deleted file mode 100644
index cf8ef6a19e..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.float--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.hxx>
-
-typedef boct_tree<short,float > tree;
-BOXM_SCENE_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.int--.cxx b/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.int--.cxx
deleted file mode 100644
index 234256af7c..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.int--.cxx
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.hxx>
-
-typedef boct_tree<short,int > tree;
-BOXM_SCENE_INSTANTIATE(tree);
-
-typedef boct_tree<short, short int > short_tree;
-BOXM_SCENE_INSTANTIATE(short_tree);
diff --git a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.vgl_point_3d+double---.cxx b/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.vgl_point_3d+double---.cxx
deleted file mode 100644
index 4f9dff9071..0000000000
--- a/contrib/brl/bseg/boxm/Templates/boxm_scene+boct_tree+short.vgl_point_3d+double---.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-
-typedef boct_tree<short,vgl_point_3d<double> > tree;
-BOXM_SCENE_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx b/contrib/brl/bseg/boxm/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx
deleted file mode 100644
index 5de38b0662..0000000000
--- a/contrib/brl/bseg/boxm/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <brdb/brdb_value.hxx>
-#include <boxm/boxm_scene_base.h>
-#include <vbl/io/vbl_io_smart_ptr.h>
-BRDB_VALUE_INSTANTIATE(boxm_scene_base_sptr, "boxm_scene_base_sptr");
diff --git a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.bool--~-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.bool--~-.cxx
deleted file mode 100644
index 08145d2ca1..0000000000
--- a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.bool--~-.cxx
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.hxx>
-
-typedef boct_tree<short, bool > tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type>*);
diff --git a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---~-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---~-.cxx
deleted file mode 100644
index a84c7ef3e4..0000000000
--- a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---~-.cxx
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_gauss_sf1.h>
-#include <boxm/boxm_block.hxx>
-#include <vbl/vbl_array_3d.hxx>
-#include <boct/boct_tree.hxx>
-
-typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
-typedef boct_tree<short,gauss_type> tree_type;
-
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type> *);
diff --git a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.char--~-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.char--~-.cxx
deleted file mode 100644
index 0464e1208e..0000000000
--- a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.char--~-.cxx
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.hxx>
-
-typedef boct_tree<short, char > tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type>*);
diff --git a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.float--~-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.float--~-.cxx
deleted file mode 100644
index f3ea04b9df..0000000000
--- a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.float--~-.cxx
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.hxx>
-
-typedef boct_tree<short,float> tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type>*);
diff --git a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.int--~-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.int--~-.cxx
deleted file mode 100644
index 01b86c0776..0000000000
--- a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.int--~-.cxx
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.hxx>
-
-typedef boct_tree<short, int > tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type>*);
-
-typedef boct_tree<short, short > short_tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<short_tree_type>*);
diff --git a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.vgl_point_3d+double---~-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.vgl_point_3d+double---~-.cxx
deleted file mode 100644
index ff3080df2c..0000000000
--- a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+boxm_block+boct_tree+short.vgl_point_3d+double---~-.cxx
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.hxx>
-
-typedef boct_tree<short, vgl_point_3d<double> > tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type>*);
diff --git a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+vsl_b_ifstream~-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_array_3d+vsl_b_ifstream~-.cxx
deleted file mode 100644
index 912522b858..0000000000
--- a/contrib/brl/bseg/boxm/Templates/vbl_array_3d+vsl_b_ifstream~-.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <vsl/vsl_binary_io.h>
-
-VBL_ARRAY_3D_INSTANTIATE(vsl_b_ifstream*);
diff --git a/contrib/brl/bseg/boxm/Templates/vbl_io_smart_ptr+boxm_scene_base-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_io_smart_ptr+boxm_scene_base-.cxx
deleted file mode 100644
index 7158d38f30..0000000000
--- a/contrib/brl/bseg/boxm/Templates/vbl_io_smart_ptr+boxm_scene_base-.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_io_scene_base.h>
-#include <vbl/io/vbl_io_smart_ptr.hxx>
-
-VBL_IO_SMART_PTR_INSTANTIATE(boxm_scene_base);
diff --git a/contrib/brl/bseg/boxm/Templates/vbl_smart_ptr+boxm_scene_base-.cxx b/contrib/brl/bseg/boxm/Templates/vbl_smart_ptr+boxm_scene_base-.cxx
deleted file mode 100644
index f9544ebe70..0000000000
--- a/contrib/brl/bseg/boxm/Templates/vbl_smart_ptr+boxm_scene_base-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/boxm_scene_base.h>
-#include <vbl/vbl_smart_ptr.hxx>
-
-VBL_SMART_PTR_INSTANTIATE(boxm_scene_base);
diff --git a/contrib/brl/bseg/boxm/algo/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/CMakeLists.txt
deleted file mode 100644
index 16694fbbc4..0000000000
--- a/contrib/brl/bseg/boxm/algo/CMakeLists.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-# brl/bseg/boxm/algo/CMakeLists.txt
-FIND_PACKAGE(RPLY REQUIRED)
-include_directories( ${MUL_INCLUDE_DIR} )
-include_directories( ${RPLY_INCLUDE_DIR} )
-set(boxm_algo_sources
- boxm_compute_scene_statistics.h
- boxm_crop_scene.h
- boxm_fill_in_mesh.h
- boxm_fill_internal_cells.h
- boxm_init_scene.h
- boxm_refine.h
- boxm_save_block_raw.h
- boxm_save_scene_raw.h
- boxm_save_scene_raw_general.h
- boxm_upload_mesh.h
- boxm_merge_mog.h boxm_merge_mog.cxx
- boxm_split_sample.h
- boxm_compute_scene_difference.h
- boxm_linear_operations.h
- boxm_scene_levels_utils.h
- )
-
-vxl_add_library(LIBRARY_NAME boxm_algo LIBRARY_SOURCES ${boxm_algo_sources})
-
-if( BUILD_TESTING )
- add_subdirectory(tests)
-endif()
-
-target_link_libraries(boxm_algo boxm boxm_util boxm_sample boxm_sample_algo boxm_basic bsta imesh ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vcl)
-
-#raytracing algorithms
-add_subdirectory(rt)
-
-#splatting algorithms
-add_subdirectory(sp)
-
-#processes
-add_subdirectory(pro)
diff --git a/contrib/brl/bseg/boxm/algo/boxm_compute_scene_difference.h b/contrib/brl/bseg/boxm/algo/boxm_compute_scene_difference.h
deleted file mode 100644
index 5043e4a2a3..0000000000
--- a/contrib/brl/bseg/boxm/algo/boxm_compute_scene_difference.h
+++ /dev/null
@@ -1,98 +0,0 @@
-#ifndef boxm_compute_scene_difference_h_
-#define boxm_compute_scene_difference_h_
-//:
-// \file
-#include <iostream>
-#include <boct/boct_tree.h>
-#include <boct/boct_tree_cell.h>
-#include <boxm/boxm_block.h>
-#include <boxm/boxm_scene.h>
-#include <imesh/imesh_mesh.h>
-#include <imesh/imesh_operations.h>
-#include <vgl/vgl_point_3d.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-
-void boxm_compute_block_difference(boxm_block<boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > > * block1,
- boxm_block<boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > > * block2,
- boxm_block<boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > > * blockout,
- float threshold)
-{
- typedef boxm_sample<BOXM_APM_MOG_GREY> data_type;
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- typedef boct_tree_cell<short, boxm_sample<BOXM_APM_MOG_GREY> > cell_type;
-
- tree_type* tree1 = block1->get_tree();
- tree_type* tree2 = block2->get_tree();
- tree_type* treeout = blockout->get_tree();
-
- std::vector<cell_type*> leaves=tree1->leaf_cells();
- std::vector<cell_type*> leavesout=treeout->leaf_cells();
-
- for (unsigned i=0;i<leaves.size();i++)
- {
- cell_type *cell1=leaves[i];
- cell_type *cellout=leavesout[i];
- vgl_point_3d<double> p=cell1->local_bounding_box(tree1->root_level()).centroid();
- cell_type *cell2=tree2->locate_point(p);
- if (cell2)
- {
- data_type data1=cell1->data();
- double len1=tree1->cell_bounding_box(cell1).width();
-
- data_type data2=cell2->data();
- double len2=tree2->cell_bounding_box(cell2).width();
-
- data_type dataout=cellout->data();
-
- double p1=1-std::exp(-data1.alpha*len1);
- double p2=1-std::exp(-data2.alpha*len2);
-
- double p=p1+p2-2*p1*p2;
-
- double alphaout=-std::log(1-p)/len1;
- if (p<threshold)
- alphaout=0.0;
- dataout.alpha=(float)alphaout;
- if (p1>p2)
- dataout.appearance_=data1.appearance_;
- else
- dataout.appearance_=data2.appearance_;
-
- cellout->set_data(dataout);
- }
- }
-}
-
-
-void boxm_compute_scene_difference(boxm_scene<boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > >&scene1,
- boxm_scene<boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > >&scene2,
- boxm_scene<boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > >&sceneout,
- float threshold)
-{
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> >tree_type;
- boxm_block_iterator<tree_type> iter1(&scene1);
- boxm_block_iterator<tree_type> iter2(&scene2);
-
- // scene out is cloned as scene1.
- scene1.clone_blocks(sceneout);
- boxm_block_iterator<tree_type> iterout(&sceneout);
-
- for (; !iter1.end(); iter1++,iter2++,iterout++) {
- std::cout<<'.';
- scene1.load_block(iter1.index());
- scene2.load_block(iter2.index());
- sceneout.load_block(iterout.index());
-
- //boxm_block<tree_type>* block1 = *iter1;
- //boxm_block<tree_type>* block2 = *iter2;
- //boxm_block<tree_type>* blockout = *iterout;
-
- boxm_compute_block_difference((*iter1),(*iter2),(*iterout), threshold);
- sceneout.write_active_block();
- }
-}
-
-#endif // boxm_compute_scene_difference_h_
diff --git a/contrib/brl/bseg/boxm/algo/boxm_compute_scene_statistics.h b/contrib/brl/bseg/boxm/algo/boxm_compute_scene_statistics.h
deleted file mode 100644
index c697a4e6b4..0000000000
--- a/contrib/brl/bseg/boxm/algo/boxm_compute_scene_statistics.h
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifndef boxm_compute_scene_statistics_h
-#define boxm_compute_scene_statistics_h
-//:
-// \file
-#include <iostream>
-#include <boxm/boxm_scene.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <bsta/bsta_histogram.h>
-
-//: Compute histogram of a simple-type scenes. e.g. T_data = float, double
-template <class T_loc, class T_data>
-bool boxm_compute_scene_statistics(boxm_scene<boct_tree<T_loc, T_data > >* scene, bsta_histogram<float>& response_hist )//, bsta_histogram<float>& level_hist, unsigned& n_leaves)
-{
- std::cout << " Using compute_scene_statistics\n";
-
- typedef boct_tree<T_loc, T_data> tree_type;
-
- //(1) Traverse the leaves of the scene
- boxm_cell_iterator<tree_type > iterator = scene->cell_iterator(&boxm_scene<tree_type>::load_block, true);
-
- iterator.begin();
- float cell_count = 0;
- float max = (float)(*iterator)->data();
- float min = max;
- float this_val = max;
- while (!iterator.end()) {
- cell_count++;
- this_val = (float)(*iterator)->data();
- if ( this_val > max) max = this_val;
- if ( this_val < min) min = this_val;
- ++iterator;
- }
-
- unsigned int nbins = (unsigned int)std::abs(max-min);// std::floor(std::sqrt(cell_count));
- response_hist = bsta_histogram<float>(min, max, nbins);
- scene->unload_active_blocks();
- iterator.begin();
- while (!iterator.end()) {
- response_hist.upcount((float)(*iterator)->data(), 1.0f);
- ++iterator;
- }
-
- scene->unload_active_blocks();
-
- return true;
-}
-
-//: Compute histogram for appearance model scene - where alpha, omega etc are relevant
-template <class T_loc, class T_data>
-bool compute_scene_statistics(boxm_scene<boct_tree<T_loc, T_data > >& scene, bsta_histogram<float>& omega_hist, bsta_histogram<float>& sigma_hist, bsta_histogram<float>& level_hist, unsigned& n_leaves)
-{
- typedef boct_tree<T_loc, T_data> tree_type;
- typedef boct_tree_cell<T_loc,T_data> cell_type;
-
- omega_hist = bsta_histogram<float>(0.0f, 1.0f, 20);
- sigma_hist = bsta_histogram<float>(0.0f, 1.0f, 20);
- level_hist = bsta_histogram<float>(0.0f, 10.0f, 10);
- boxm_block_iterator<tree_type> bit = scene.iterator();
- for (;!bit.end(); ++bit)
- {
- vgl_point_3d<int> block_index = bit.index();
- scene.load_block(block_index);
- boxm_block<tree_type> * block = scene.get_active_block();
- tree_type* tree=block->get_tree();
- if (!tree) return false;
- int n_levels = tree->number_levels();
- int fin_level = tree->finest_level();
- for (int level = n_levels-1; level>=fin_level; --level)
- {
- std::vector<cell_type *> cells_at_level =
- tree->leaf_cells_at_level(static_cast<unsigned>(level));
- level_hist.upcount(static_cast<float>(level),
- static_cast<float>(cells_at_level.size()));
- }
- std::vector<cell_type *> leaves = tree->leaf_cells();
- n_leaves = leaves.size();
- for (typename std::vector<cell_type *>::iterator cit = leaves.begin(); cit != leaves.end(); ++cit)
- {
- T_data data = (*cit)->data();
- vgl_box_3d<double> bb = tree->cell_bounding_box(*cit);
- double dx = bb.width(), dy = bb.height(), dz = bb.depth();
- double diag = std::sqrt(dx*dx + dy*dy + dz*dz);
- double alpha = data.alpha;
- double omega = 1.0 - std::exp(-alpha*diag);
- omega_hist.upcount(static_cast<float>(omega), 1.0f);
-
- if (scene.appearence_model() == BOXM_APM_SIMPLE_GREY)
- {
- float sigma = data.appearance_.sigma();
- sigma_hist.upcount(sigma, 1.0f);
- }
- }
- }
- return true;
-}
-
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/boxm_crop_scene.h b/contrib/brl/bseg/boxm/algo/boxm_crop_scene.h
deleted file mode 100644
index 63aa888efa..0000000000
--- a/contrib/brl/bseg/boxm/algo/boxm_crop_scene.h
+++ /dev/null
@@ -1,95 +0,0 @@
-// This is brl/bseg/boxm/algo/boxm_crop_scene.h
-#ifndef boxm_crop_scene_h
-#define boxm_crop_scene_h
-
-//:
-// \file
-// \brief Template functions to create a new scene that is a cropped portion of another
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date January 11, 2010
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <vgl/vgl_box_3d.h>
-#include <boxm/boxm_scene.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-
-template <class T_data>
-boxm_scene<boct_tree<short, T_data> > * boxm_crop_scene(boxm_scene<boct_tree<short,T_data> > *scene_in,vgl_box_3d<double> bbox)
-{
- //only one-block scenes are supported for now
- if (!(scene_in->world_dim().x() == 1 && scene_in->world_dim().y()==1 && scene_in->world_dim().z()==1))
- {
- std::cerr << "In bvxm_crop_scene -- Input scene has more than one block, which is not supported\n";
- return nullptr;
- }
-
- //get the tree inside the block and locate region
- boxm_block_iterator<boct_tree<short, T_data> > iter_in = scene_in->iterator();
- iter_in.begin();
-
- //there is no need to increase iterator, since there should only be one block in the scene
- scene_in->load_block(iter_in.index());
- boct_tree<short, T_data> *tree_in= (*iter_in)->get_tree();
-
- boct_tree_cell<short,T_data>* root = tree_in->locate_region_global(bbox, true);
-
- //most parameters of the output scene are the same as those of the input scene,
- //except the ROI which is determined by the root node
- double cell_length = 1.0/(double)(1<<(tree_in->root_level() - root->level()));
- double cell_origin_x = (double)(root->get_code().x_loc_)/(double)(1<<(tree_in->root_level()));
- double cell_origin_y = (double)(root->get_code().y_loc_)/(double)(1<<(tree_in->root_level()));
- double cell_origin_z = (double)(root->get_code().z_loc_)/(double)(1<<(tree_in->root_level()));
-
- vgl_box_3d<double> global_bbox = tree_in->bounding_box();
-
- vgl_point_3d<double> origin(cell_origin_x, cell_origin_y, cell_origin_z);
-
- vgl_point_3d<double> min_point((global_bbox.min_x() + global_bbox.width()*origin.x()),
- (global_bbox.min_y() + global_bbox.height()*origin.y()),
- (global_bbox.min_z() + global_bbox.depth()*origin.z()));
-
- vgl_vector_3d<double> block_dim(cell_length*global_bbox.width(),
- cell_length*global_bbox.height(),
- cell_length*global_bbox.depth());
-
- boxm_scene<boct_tree<short, T_data> > *scene_out =
- new boxm_scene<boct_tree<short, T_data> >(scene_in->lvcs(),min_point,block_dim,scene_in->world_dim(), scene_in->save_internal_nodes());
-
- scene_out->set_paths(scene_in->path(), "cropped");
- scene_out->set_appearance_model(scene_in->appearence_model());
- scene_out->clean_scene();
- boxm_block_iterator<boct_tree<short, T_data> > iter_out = scene_out->iterator();
- iter_out.begin();
- scene_out->load_block(iter_out.index());
-
-
- //Region of interest in [0,1)x[0,1)x[0,1) coordinates
- vgl_point_3d<double> norm_bbox_min((bbox.min_x()-global_bbox.min_x())/global_bbox.width(),
- (bbox.min_y()-global_bbox.min_y())/global_bbox.height(),
- (bbox.min_z()-global_bbox.min_z())/global_bbox.depth());
- vgl_point_3d<double> norm_bbox_max((bbox.max_x()-global_bbox.min_x())/global_bbox.width(),
- (bbox.max_y()-global_bbox.min_y())/global_bbox.height(),
- (bbox.max_z()-global_bbox.min_z())/global_bbox.depth());
-
-
- //output tree
- boct_tree<short, T_data > *tree_out = tree_in->clone_and_intersect(root, tree_in->root_level(), vgl_box_3d<double>(norm_bbox_min,norm_bbox_max));
-
- //write the output tree
- (*iter_out)->init_tree(tree_out);
- scene_out->write_active_block();
- scene_out->write_scene("/cropped_scene.xml");
-
- return scene_out;
-}
-
-
-#endif // boxm_crop_scene_h
diff --git a/contrib/brl/bseg/boxm/algo/boxm_fill_in_mesh.h b/contrib/brl/bseg/boxm/algo/boxm_fill_in_mesh.h
deleted file mode 100644
index f41af5bca8..0000000000
--- a/contrib/brl/bseg/boxm/algo/boxm_fill_in_mesh.h
+++ /dev/null
@@ -1,316 +0,0 @@
-#ifndef boxm_fill_in_mesh_h_
-#define boxm_fill_in_mesh_h_
-//:
-// \file
-#include <iostream>
-#include <boct/boct_tree.h>
-#include <boct/boct_tree_cell.h>
-#include <boxm/boxm_block.h>
-#include <boxm/boxm_scene.h>
-#include <imesh/imesh_mesh.h>
-#include <imesh/imesh_operations.h>
-#include <vpgl/vpgl_lvcs.h>
-#include <vgl/vgl_box_3d.h>
-#include <vgl/vgl_intersection.h>
-#include <vgl/algo/vgl_intersection.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-bool is_mesh_in_block(imesh_mesh & mesh, vgl_box_3d<double> block_bbox,vpgl_lvcs& lvcs, bool use_lvcs)
-{
- imesh_face_array_base& fs = mesh.faces();
- std::list<vgl_point_3d<double> > v_list;
- vgl_box_3d<double> bb_global;
-
- for (unsigned i=0; i < fs.size(); ++i)
- {
- imesh_vertex_array<3>& vertices = mesh.vertices<3>();
- for (unsigned j=0; j<fs.num_verts(i); ++j) {
- unsigned int v_id = fs(i,j);
- vgl_point_3d<double> v;
- if (use_lvcs) {
- double lx, ly, lz;
- lvcs.global_to_local(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2),
- vpgl_lvcs::wgs84,lx,ly,lz);
- v=vgl_point_3d<double>(lx,ly,lz);
- }
- else
- v=vgl_point_3d<double>(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2));
- bb_global.add(v);
- v_list.push_back(v);
- }
- }
-
- vgl_box_3d<double> inters = vgl_intersection(block_bbox,bb_global);
- if (inters.is_empty())
- return false;
-
- return true;
-}
-
-template <class T_loc, class T_data>
-bool are_meshes_in_block(std::vector<imesh_mesh> meshes, vgl_box_3d<double> block_bbox,vpgl_lvcs& lvcs, bool use_lvcs)
-{
- bool flag=false;
- for (auto & meshe : meshes)
- {
- meshe.compute_face_normals(true);
- imesh_face_array_base& fs = meshe.faces();
- std::list<vgl_point_3d<double> > v_list;
- vgl_box_3d<double> bb_global;
-
- for (unsigned i=0; i < fs.size(); ++i)
- {
- imesh_vertex_array<3>& vertices = meshe.vertices<3>();
- for (unsigned j=0; j<fs.num_verts(i); ++j) {
- unsigned int v_id = fs(i,j);
- vgl_point_3d<double> v;
- if (use_lvcs) {
- double lx, ly, lz;
- lvcs.global_to_local(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2),
- vpgl_lvcs::wgs84,lx,ly,lz);
- v=vgl_point_3d<double>(lx,ly,lz);
- }
- else
- v=vgl_point_3d<double>(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2));
- bb_global.add(v);
- v_list.push_back(v);
- }
- }
-
- vgl_box_3d<double> inters = vgl_intersection(block_bbox,bb_global);
- if (!inters.is_empty())
- flag=true;
- }
- return flag;
-}
-
-template <class T_loc, class T_data>
-void boxm_fill_in_mesh_into_block(boxm_block<boct_tree<T_loc, T_data> > *block,
- std::vector<imesh_mesh> meshes, vpgl_lvcs& lvcs, bool use_lvcs, T_data val)
-{
- typedef boct_tree<T_loc, T_data> tree_type;
- tree_type* tree = block->get_tree();
- vgl_box_3d<double> block_bb = block->bounding_box();
- for (auto & meshe : meshes)
- {
- imesh_face_array_base& fs = meshe.faces();
- std::list<vgl_point_3d<double> > v_list;
- vgl_box_3d<double> bb_scale, bb_global;
- for (unsigned i=0; i < fs.size(); ++i)
- {
- imesh_vertex_array<3>& vertices = meshe.vertices<3>();
- for (unsigned j=0; j<fs.num_verts(i); ++j) {
- unsigned int v_id = fs(i,j);
- vgl_point_3d<double> v;
- if (use_lvcs) {
- double lx, ly, lz;
- lvcs.global_to_local(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2),
- vpgl_lvcs::wgs84,lx,ly,lz);
- v=vgl_point_3d<double>(lx,ly,lz);
- }
- else
- v=vgl_point_3d<double>(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2));
- bb_global.add(v);
- vgl_vector_3d<double> diff = v-block_bb.min_point(); // get the value according to the block origin
- v.set(diff.x(), diff.y(), diff.z());
- // the local coordinates inside the box region
- v_list.push_back(v);
- //convert the values into [0,1] range
- v.set(diff.x()/block_bb.width(),diff.y()/ block_bb.height(),diff.z()/ block_bb.depth());
- bb_scale.add(v);
- }
- }
- // check if polygon's bounding box intersects with the block
- vgl_box_3d<double> inters = vgl_intersection(vgl_box_3d<double>(0,0,0,1,1,1), bb_scale);
- if (inters.is_empty())
- continue;
-
- // locate the polygon bounding box in tree
- boct_tree_cell<T_loc,T_data>* region=tree->locate_region(inters);
- if (region) {
- // test all the children for intersection
- std::vector<boct_tree_cell<T_loc,T_data>*> children;
- if (!region->is_leaf())
- region->leaf_children(children);
- else // insert the node itself, if no children
- children.push_back(region);
- for (unsigned i=0; i<children.size(); i++) {
- boct_tree_cell<T_loc,T_data>* cell=children[i];
- vgl_box_3d<double> cell_bb=tree->cell_bounding_box_local(cell);
- if (contains_point(meshe,cell_bb.centroid())) {
- cell->set_data(val);
- }
- }
- }
- }
-}
-
-//: this is to copy mesh into existing tree and replacing the appearance model of the existing tree.
-template <>
-void boxm_fill_in_mesh_into_block(boxm_block<boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > > *block,
- std::vector<imesh_mesh> meshes, vpgl_lvcs& lvcs,
- bool use_lvcs, boxm_sample<BOXM_APM_MOG_GREY> val)
-{
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- tree_type* tree = block->get_tree();
- vgl_box_3d<double> block_bb = block->bounding_box();
- for (auto & meshe : meshes)
- {
- if (is_mesh_in_block(meshe, block_bb,lvcs, use_lvcs))
- {
- imesh_face_array_base& fs = meshe.faces();
- std::list<vgl_point_3d<double> > v_list;
- vgl_box_3d<double> bb_scale, bb_global;
-
- for (unsigned i=0; i < fs.size(); ++i)
- {
- imesh_vertex_array<3>& vertices = meshe.vertices<3>();
- for (unsigned j=0; j<fs.num_verts(i); ++j) {
- unsigned int v_id = fs(i,j);
- vgl_point_3d<double> v;
- if (use_lvcs) {
- double lx, ly, lz;
- lvcs.global_to_local(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2),
- vpgl_lvcs::wgs84,lx,ly,lz);
- v=vgl_point_3d<double>(lx,ly,lz);
- }
- else
- v=vgl_point_3d<double>(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2));
- bb_global.add(v);
- vgl_vector_3d<double> diff = v-block_bb.min_point(); // get the value according to the block origin
- v.set(diff.x(), diff.y(), diff.z());
- // the local coordinates inside the box region
- v_list.push_back(v);
- //convert the values into [0,1] range
- v.set(diff.x()/block_bb.width(),diff.y()/ block_bb.height(),diff.z()/ block_bb.depth());
- bb_scale.add(v);
- }
- }
-
- // check if polygon's bounding box intersects with the block
- vgl_box_3d<double> inters = vgl_intersection(vgl_box_3d<double>(0,0,0,1,1,1), bb_scale);
- if (inters.is_empty())
- continue;
-
- meshe.compute_face_normals();
-
- // locate the polygon bounding box in tree
- boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >* region=tree->locate_region(inters);
- if (region)
- {
- // test all the children for intersection
- std::vector<boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >*> children;
- if (!region->is_leaf())
- region->leaf_children(children);
- else // insert the node itself, if no children
- children.push_back(region);
- for (auto cell : children) {
- vgl_box_3d<double> cell_bb=tree->cell_bounding_box(cell);
-
- if (contains_point(meshe,cell_bb.centroid())) {
- boxm_sample<BOXM_APM_MOG_GREY> tempdata=cell->data();
- tempdata.set_appearance(val.appearance());
- tempdata.alpha*=val.alpha;
- cell->set_data(tempdata);
- }
- }
- }
- }
- }
-}
-
-template <>
-void boxm_fill_in_mesh_into_block(boxm_block<boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > > *block,
- std::vector<imesh_mesh> meshes, vpgl_lvcs& lvcs,
- bool use_lvcs, boxm_sample<BOXM_APM_SIMPLE_GREY> val)
-{
- typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
- tree_type* tree = block->get_tree();
- vgl_box_3d<double> block_bb = block->bounding_box();
- for (auto & meshe : meshes)
- {
- if (is_mesh_in_block(meshe, block_bb,lvcs, use_lvcs))
- {
- imesh_face_array_base& fs = meshe.faces();
- std::list<vgl_point_3d<double> > v_list;
- vgl_box_3d<double> bb_scale, bb_global;
-
- for (unsigned i=0; i < fs.size(); ++i)
- {
- imesh_vertex_array<3>& vertices = meshe.vertices<3>();
- for (unsigned j=0; j<fs.num_verts(i); ++j) {
- unsigned int v_id = fs(i,j);
- vgl_point_3d<double> v;
- if (use_lvcs) {
- double lx, ly, lz;
- lvcs.global_to_local(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2),
- vpgl_lvcs::wgs84,lx,ly,lz);
- v=vgl_point_3d<double>(lx,ly,lz);
- }
- else
- v=vgl_point_3d<double>(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2));
- bb_global.add(v);
- vgl_vector_3d<double> diff = v-block_bb.min_point(); // get the value according to the block origin
- v.set(diff.x(), diff.y(), diff.z());
- // the local coordinates inside the box region
- v_list.push_back(v);
- //convert the values into [0,1] range
- v.set(diff.x()/block_bb.width(),diff.y()/ block_bb.height(),diff.z()/ block_bb.depth());
- bb_scale.add(v);
- }
- }
-
- // check if polygon's bounding box intersects with the block
- vgl_box_3d<double> inters = vgl_intersection(vgl_box_3d<double>(0,0,0,1,1,1), bb_scale);
- if (inters.is_empty())
- continue;
-
- meshe.compute_face_normals();
-
- // locate the polygon bounding box in tree
- boct_tree_cell<short,boxm_sample<BOXM_APM_SIMPLE_GREY> >* region=tree->locate_region(inters);
- if (region)
- {
- // test all the children for intersection
- std::vector<boct_tree_cell<short,boxm_sample<BOXM_APM_SIMPLE_GREY> >*> children;
- if (!region->is_leaf())
- region->leaf_children(children);
- else // insert the node itself, if no children
- children.push_back(region);
- for (auto cell : children) {
- vgl_box_3d<double> cell_bb=tree->cell_bounding_box(cell);
-
- if (contains_point(meshe,cell_bb.centroid())) {
- boxm_sample<BOXM_APM_SIMPLE_GREY> tempdata=cell->data();
- tempdata.set_appearance(val.appearance());
- tempdata.alpha*=val.alpha;
- cell->set_data(tempdata);
- }
- }
- }
- }
- }
-}
-
-template <class T_loc, class T_data>
-void boxm_fill_in_mesh_into_scene(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- std::vector<imesh_mesh> meshes, bool use_lvcs, T_data val)
-{
- typedef boct_tree<T_loc, T_data > tree_type;
- vpgl_lvcs lvcs=scene.lvcs();
- boxm_block_iterator<tree_type> iter(&scene);
- for (; !iter.end(); iter++) {
- vgl_box_3d<double> block_bb=scene.get_block_bbox(iter.index().x(),iter.index().y(),iter.index().z());
- if (are_meshes_in_block<T_loc, T_data >(meshes,block_bb,lvcs,use_lvcs))
- {
- scene.load_block(iter.index());
- boxm_block<tree_type>* block = *iter;
- boxm_fill_in_mesh_into_block(block, meshes, lvcs, use_lvcs, val);
- scene.write_active_block();
- }
- }
-}
-
-#endif // boxm_fill_in_mesh_h_
diff --git a/contrib/brl/bseg/boxm/algo/boxm_fill_internal_cells.h b/contrib/brl/bseg/boxm/algo/boxm_fill_internal_cells.h
deleted file mode 100644
index 6d81beef0f..0000000000
--- a/contrib/brl/bseg/boxm/algo/boxm_fill_internal_cells.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// This is brl/bseg/boxm/algo/boxm_fill_internal_cells.h
-#ifndef boxm_fill_internal_cells_h
-#define boxm_fill_internal_cells_h
-//:
-// \file
-// \brief Class in charged of filling the intermediate nodes of a tree.
-// \author Maria Isabel Restrepo mir@lems.brown.edu
-// \date Feb 3, 2010
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <boxm/boxm_scene.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-//: A class to combine children cells and fill intermediate nodes
-template <class T_data>
-class boxm_fill_internal_cells
-{
- public:
- typedef boct_tree<short,T_data> tree_type;
-
- boxm_scene<boct_tree<short,T_data> > * traverse_and_fill(boxm_scene<boct_tree<short,T_data> > *scene_in)
- {
- // Most parameters of the output scene are the same as those of the input scene
- // but we need to change the mode of the scene to be saving internal nodes
- bool save_internal_nodes = true;
- boxm_scene<tree_type> *scene_out = new boxm_scene<tree_type>(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(),
- scene_in->world_dim(), scene_in->max_level(), scene_in->init_level(),
- false, save_internal_nodes);
- std::string block_pref = scene_in->block_prefix() + "_all_nodes";
- scene_out->set_paths(scene_in->path(), block_pref);
- scene_out->set_appearance_model(scene_in->appearence_model());
-
- scene_out->write_scene(block_pref + ".xml");
-
- //Iterate through the blocks
- boxm_block_iterator<tree_type> iter_in = scene_in->iterator();
- boxm_block_iterator<tree_type> iter_out = scene_out->iterator();
-
- iter_in.begin();
- iter_out.begin();
-
- while (!iter_in.end() && !iter_out.end())
- {
- scene_in->load_block(iter_in.index());
- scene_out->load_block(iter_out.index());
-
- tree_type *tree_in= (*iter_in)->get_tree();
- // Copy input tree into output tree and fill
- tree_type *tree_out = tree_in->clone();
- this->traverse_and_fill(tree_out);
- (*iter_out)->init_tree(tree_out);
- std::cout << "writing block: " << iter_out.index() <<std::endl;
- scene_out->write_active_block();
-
- iter_in++; iter_out++;
- }
-
- return scene_out;
- }
-
- protected:
-
- //: Traverses a tree and fills intermediate cells with the average of the 8 children.
- // If there is need to fill cells with something different to the average, this function can be made abstract and
- // write specializations. As in the template method design pattern
- void traverse_and_fill(tree_type *tree_to_fill)
- {
- tree_to_fill->fill_with_average();
- }
-};
-
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/boxm_init_scene.h b/contrib/brl/bseg/boxm/algo/boxm_init_scene.h
deleted file mode 100644
index 9325f47c46..0000000000
--- a/contrib/brl/bseg/boxm/algo/boxm_init_scene.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef boxm_init_scene_h_
-#define boxm_init_scene_h_
-//:
-// \file
-#include <iostream>
-#include <boct/boct_tree.h>
-#include <boct/boct_tree_cell.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_scene.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-
-//: This method inits the blocks (octrees) of the scene of type boxm_sample
-template <boxm_apm_type APM_TYPE>
-void boxm_init_scene(boxm_scene<boct_tree<short, boxm_sample<APM_TYPE> > > &scene)
-{
- typedef boct_tree<short, boxm_sample<APM_TYPE> > tree_type;
- boxm_block_iterator<tree_type> iter(&scene);
- float pinit=scene.pinit();
- float dimx=(float)scene.block_dim().x();
- float numbercells=(float)(1<<(scene.init_level()-1));
-
- float alpha_init=-std::log(1-pinit)*numbercells/dimx;
- for (; !iter.end(); iter++) {
- vgl_point_3d<int> index=iter.index();
- if (!scene.discover_block(index.x(),index.y(),index.z()))
- {
- boxm_sample<APM_TYPE> initsample(alpha_init);
- tree_type* tree= new tree_type(initsample,scene.max_level(),scene.init_level());
- boxm_block<tree_type> * block=new boxm_block<tree_type>(scene.get_block_bbox(index.x(),index.y(),index.z()),tree);
- scene.set_block(index,block);
- scene.write_active_block();
- }
- }
-}
-
-//: Initializes a general scene
-template <class T_data>
-void boxm_init_scene(boxm_scene<boct_tree<short, T_data> > &scene)
-{
- typedef boct_tree<short, T_data> tree_type;
- boxm_block_iterator<tree_type> iter(&scene);
- float dimx=(float)scene.block_dim().x();
-
- for (; !iter.end(); iter++) {
- vgl_point_3d<int> index=iter.index();
- if (!scene.discover_block(index.x(),index.y(),index.z()))
- {
- T_data initdata;
- tree_type* tree= new tree_type(initdata,scene.max_level(),scene.init_level());
- boxm_block<tree_type> * block=new boxm_block<tree_type>(scene.get_block_bbox(index.x(),index.y(),index.z()),tree);
- scene.set_block(index,block);
- scene.write_active_block();
- }
- }
-}
-
-#endif // boxm_init_scene_h_
diff --git a/contrib/brl/bseg/boxm/algo/boxm_linear_operations.h b/contrib/brl/bseg/boxm/algo/boxm_linear_operations.h
deleted file mode 100644
index 01726ab977..0000000000
--- a/contrib/brl/bseg/boxm/algo/boxm_linear_operations.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// This is brl/bseg/boxm/algo/boxm_linear_operations.h
-#ifndef boxm_linear_operations_h
-#define boxm_linear_operations_h
-//:
-// \file
-// \brief Functions to perfoms linear operations on boxm scenes and/or blocks
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 2-Feb-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <boxm/boxm_block.h>
-#include <boct/boct_tree.h>
-#include <cassert>
-#ifdef DEBUG
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#endif
-
-//: Computes the linear combination of two blocks in place. i.e block1 = s1*block1 + s2*block2
-template<class T_data>
-bool boxm_linear_combination(boxm_block<boct_tree<short, T_data> > *block1, boxm_block<boct_tree<short, T_data> > *block2, float s1, float s2)
-{
- boct_tree<short, T_data> *tree1 = block1->get_tree();
- boct_tree<short, T_data> *tree2 = block2->get_tree();
-
- std::vector<boct_tree_cell<short, T_data>* > cells1 = tree1->leaf_cells();
- std::vector<boct_tree_cell<short, T_data>* > cells2 = tree2->leaf_cells();
-
- //iterators
- typename std::vector<boct_tree_cell<short, T_data>* >::iterator it1 = cells1.begin();
- typename std::vector<boct_tree_cell<short, T_data>* >::iterator it2 = cells2.begin();
-
- for (; (it1!=cells1.end())&&(it2!= cells2.end()); it1++, it2++)
- {
- boct_tree_cell<short,T_data> *cell1 = *it1;
- boct_tree_cell<short,T_data> *cell2 = *it2;
-
-#ifdef DEBUG
- //if level and location code of cells isn't the same quit
- boct_loc_code<short> code1 = cell1->get_code();
- boct_loc_code<short> code2 = cell2->get_code();
- if (!(code1.isequal(code2)))
- {
- std::cerr << "In boxm_linear_combination: Blocks must have the same structure\n";
- return false;
- }
-#endif
-
- cell1->set_data(s1*cell1->data() + s2*cell2->data());
- }
- return true;
-}
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/boxm_merge_mog.cxx b/contrib/brl/bseg/boxm/algo/boxm_merge_mog.cxx
deleted file mode 100644
index e7e2f6585c..0000000000
--- a/contrib/brl/bseg/boxm/algo/boxm_merge_mog.cxx
+++ /dev/null
@@ -1,239 +0,0 @@
-#include <vector>
-#include <iostream>
-#include <limits>
-#include "boxm_merge_mog.h"
-//:
-// \file
-
-#include <boxm/boxm_scene.h>
-#include <cassert>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vnl/vnl_math.h> // for vnl_math::sqr()
-
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-
-void boxm_merge_mog::kl_merge(mix_gauss_type const& mixture,bsta_gauss_sf1 &gaussian)
-{
- //When merging components of gaussian mixtures, we need to perform the following calculations
- //1. find the normalizing weight of the new component.
- // In this case this value is 1 because we are merging all the components
- //2. find the mean
- //3. find the variance
-
- float mean = 0.0f;
- float var = 0.0f;
-
- //CAUTION: only mixtures of 3 modes are supported for now.
- assert(mixture.num_components() == 3);
- unsigned num_components = mixture.num_components();
-
- for (unsigned i = 0; i<num_components; ++i)
- {
- // note: these equations omit the weight of the final distribution
- // only because in this case it is 1
- mean += mixture.weight(i) * mixture.distribution(i).mean();
- var += mixture.weight(i) *(mixture.distribution(i).var() +
- vnl_math::sqr(mixture.distribution(i).mean()));
- }
- if (var < vnl_math::sqr(mean))
- std::cout<< "This should not happen: " << mixture << std::endl;
- var -= vnl_math::sqr(mean);
- assert(var >= 0);
-
- gaussian.set_mean(mean);
- gaussian.set_var(var);
- return;
-}
-
-//: Merges the components of the gaussian mixtures at each voxel into a single gaussian
-// Thus the resulting grid contains unimodal gaussians
-bool boxm_merge_mog::kl_merge_scene(boxm_scene<boct_tree<short, mix_gauss_type> > &mog_scene,
- boxm_scene<boct_tree<short, gauss_type> > &gauss_scene)
-{
- // iterate through the scene
- boxm_block_iterator<mog_tree_type > mog_iter = mog_scene.iterator();
- boxm_block_iterator<gauss_tree_type > gauss_iter = gauss_scene.iterator();
-
- for (mog_iter.begin(), gauss_iter.begin(); !mog_iter.end(); ++mog_iter, ++gauss_iter) {
- mog_scene.load_block(mog_iter.index());
- gauss_scene.load_block(gauss_iter.index());
- mog_tree_type *mog_tree = (*mog_iter)->get_tree();
- gauss_tree_type *gauss_tree = mog_tree->clone_to_type<gauss_type>();
-#if 0
- gauss_tree->init_cells(func_max.min_response());
-#endif
- this->kl_merge_octree(mog_tree,gauss_tree);
- (*gauss_iter)->init_tree(gauss_tree);
- gauss_scene.write_active_block();
- }
-
- return true;
-}
-
-//: Merges the components of the gaussian mixtures at each voxel into a single gaussian
-// Thus the resulting grid contains unimodal gaussians
-bool boxm_merge_mog::kl_merge_octree(boct_tree<short, mix_gauss_type> *mog_tree,
- boct_tree<short, gauss_type> *gauss_tree)
-{
- // iterate through the trees
- std::vector<mog_cell_type*> mog_cells = mog_tree->all_cells();
- std::vector<gauss_cell_type*> gauss_cells = gauss_tree->all_cells();
-
- if (mog_cells.size()!=gauss_cells.size() ) {
- std::cerr << "Different size vectors in boxm_merge_mog::kl_merge_octree\n";
- return false;
- }
-
-
- for (unsigned i = 0; i < mog_cells.size(); ++i)
- {
- gauss_type result_gauss;
- this->kl_merge(mog_cells[i]->data(), result_gauss);
- gauss_cells[i]->set_data(result_gauss);
- }
- return true;
-}
-
-/********************** Non-class functions************************************/
-
-//: Computes the differential entropy of a gaussian scene- only for leave cells
-bool compute_differential_entropy(boxm_scene<boct_tree<short, bsta_num_obs<bsta_gauss_sf1> > >& scene_in,boxm_scene<boct_tree<short, float> >& scene_out)
-{
- typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
-
- scene_in.clone_blocks_to_type<boct_tree<short, float > >(scene_out, std::numeric_limits<float>::min());
-
- //iterate through the leaf cells computing entropy
- boxm_cell_iterator<boct_tree<short, gauss_type > > it_in =
- scene_in.cell_iterator(&boxm_scene<boct_tree<short, gauss_type> >::load_block);
-
- boxm_cell_iterator<boct_tree<short, float > > it_out =
- scene_out.cell_iterator(&boxm_scene<boct_tree<short, float> >::load_block);
-
- it_in.begin();
- it_out.begin();
-
- while ( !(it_in.end() || it_out.end()) ) {
- boct_tree_cell<short,gauss_type> *cell_in = *it_in;
- boct_tree_cell<short,float> *cell_out = *it_out;
-
- boct_loc_code<short> out_code = cell_in->get_code();
- boct_loc_code<short> in_code = cell_out->get_code();
-
- //if level and location code of cells isn't the same then continue
- if ((cell_in->level() != cell_out->level()) || !(in_code.isequal(&out_code))) {
- std::cerr << " Input and output cells don't have the same structure\n";
- ++it_in;
- ++it_out;
- continue;
- }
-
- double h = 0.5*std::log(vnl_math::pi*vnl_math::e*2*cell_in->data().var());
- cell_out->set_data(float(h));
- ++it_in;
- ++it_out;
- }
-
- return true;
-}
-
-
-//: Compute expectation given that the voxel is occupied
-bool compute_expected_color(boxm_scene<boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > >& scene_in, boxm_scene<boct_tree<short, float > >& scene_out, float grey_offset)
-{
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > scene_tree_type;
- scene_in.clone_blocks_to_type<boct_tree<short, float > >(scene_out, std::numeric_limits<float>::min());
-
- //iterate through the leaf cells computing mean appearance
- boxm_cell_iterator<scene_tree_type > it_in =
- scene_in.cell_iterator(&boxm_scene<scene_tree_type >::load_block, true);
-
- boxm_cell_iterator<boct_tree<short, float > > it_out =
- scene_out.cell_iterator(&boxm_scene<boct_tree<short, float> >::load_block);
-
- it_in.begin();
- it_out.begin();
-
- while ( !(it_in.end() || it_out.end()) ) {
- boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> > *cell_in = *it_in;
- boct_tree_cell<short,float> *cell_out = *it_out;
-
- boct_loc_code<short> out_code = cell_in->get_code();
- boct_loc_code<short> in_code = cell_out->get_code();
-
- //if level and location code of cells isn't the same then continue
- if ((cell_in->level() != cell_out->level()) || !(in_code.isequal(&out_code))) {
- std::cerr << " Input and output cells don't have the same structure\n";
- ++it_in;
- ++it_out;
- continue;
- }
-
- float mean_color = boxm_mog_grey_processor::expected_color(cell_in->data().appearance());
- // update alpha integral
- float vis_color = float(1.0 - std::exp(- cell_in->data().alpha * it_in.length()))*(mean_color+grey_offset);
- cell_out->set_data(vis_color);
- ++it_in;
- ++it_out;
- }
-
- scene_in.unload_active_blocks();
- scene_out.unload_active_blocks();
-
- return true;
-}
-
-
-#if 0
-//: Compute total expectation E(I) = E(I| X \in S) P(X \in S) + E(I| X !\in S) P(X !\in S)
-// Expected appearance of a non surface voxel is not defined. Every intensity is equally likely therefore E(I| X !\in S) = 127.5 for I in [0,255]
-bool compute_expected_color(boxm_scene<boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > >& scene_in, boxm_scene<boct_tree<short, float > >& scene_out)
-{
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > scene_tree_type;
- scene_in.clone_blocks_to_type<boct_tree<short, float > >(scene_out, std::numeric_limits<float>::min());
-
- //iterate through the leaf cells computing mean appearance
- boxm_cell_iterator<scene_tree_type > it_in =
- scene_in.cell_iterator(&boxm_scene<scene_tree_type >::load_block, true);
-
- boxm_cell_iterator<boct_tree<short, float > > it_out =
- scene_out.cell_iterator(&boxm_scene<boct_tree<short, float> >::load_block);
-
- it_in.begin();
- it_out.begin();
-
- while ( !(it_in.end() || it_out.end()) )
- {
- boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> > *cell_in = *it_in;
- boct_tree_cell<short,float> *cell_out = *it_out;
-
- boct_loc_code<short> out_code = cell_in->get_code();
- boct_loc_code<short> in_code = cell_out->get_code();
-
- //if level and location code of cells isn't the same then continue
- if ((cell_in->level() != cell_out->level()) || !(in_code.isequal(&out_code))) {
- std::cerr << " Input and output cells don't have the same structure\n";
- ++it_in;
- ++it_out;
- continue;
- }
-
- float mean_color = boxm_mog_grey_processor::expected_color(cell_in->data().appearance());
- //alpha integral
- float vis = std::exp(- cell_in->data().alpha * it_in.length());
- float vis_color = (1.0f - vis) *mean_color;
- float invis_color = vis * 0.5f; // E(I| X !\in S) = 127.5/255
- cell_out->set_data(vis_color + invis_color);
- ++it_in;
- ++it_out;
- }
-
- scene_in.unload_active_blocks();
- scene_out.unload_active_blocks();
-
- return true;
-}
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/boxm_merge_mog.h b/contrib/brl/bseg/boxm/algo/boxm_merge_mog.h
deleted file mode 100644
index 1c39b9e84c..0000000000
--- a/contrib/brl/bseg/boxm/algo/boxm_merge_mog.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// This is brl/bseg/boxm/algo/boxm_merge_mog.h
-#ifndef boxm_merge_mog_h_
-#define boxm_merge_mog_h_
-//:
-// \file
-// \brief class with methods to merge gaussian mixtures.
-// \author Isabel Restrepo
-// \date April 20, 2009
-//
-// \verbatim
-// Modifications
-// Nov 7 2009 - Isabel Restrepo: Copied from bvxm
-// \endverbatim
-
-#include <bsta/bsta_distribution.h>
-#include <bsta/bsta_gauss_sf1.h>
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_mixture_fixed.h>
-#include <bsta/bsta_gaussian_indep.h>
-#include <boxm/sample/algo/boxm_mob_grey_processor.h>
-
-#include <boxm/boxm_scene.h>
-
-//:
-// Only floating point are supported for now and mixtures with 3 components.
-// This class can be further templated if necessary
-class boxm_merge_mog
-{
- private:
- typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
- typedef bsta_mixture_fixed<gauss_type, 3> mix_gauss;
- typedef bsta_num_obs<mix_gauss> mix_gauss_type;
- typedef boct_tree<short, mix_gauss_type> mog_tree_type;
- typedef boct_tree<short, gauss_type> gauss_tree_type;
- typedef boct_tree_cell<short, mix_gauss_type> mog_cell_type;
- typedef boct_tree_cell<short, gauss_type> gauss_cell_type;
-
- public:
-
- // === Scene operations ===
-
- //: Merges the components of the gaussian mixtures at each voxel into a single gaussian, that minimizes KL divergence.
- // The resulting scene contains unimodal Gaussians.
- bool kl_merge_scene(boxm_scene<boct_tree<short, mix_gauss_type> > &app_scene, boxm_scene<boct_tree<short, gauss_type> > &gauss_app);
-
- bool kl_merge_octree(boct_tree<short, mix_gauss_type> *mog_tree, boct_tree<short, gauss_type> *gauss_tree);
-
-#if 0
- //: Converts a mixture of gaussians grid into an unimodal gaussian grid corresponding to the most probable mode
- static bool mpm_merge_scene(boxm_scene<boct_tree<short, mix_gauss_type> app_scene, boxm_scene<boct_tree<short, gauss_type> gauss_app);
-#endif
-
- // === Distribution operations ===
-
- //: Merges all the components in the mixture into one component that minimizes the KL divergence between the two distributions
- static void kl_merge(mix_gauss_type const& mixture,bsta_gauss_sf1 &gaussian);
-};
-
-
-//: Computes the differential entropy of a gaussian scene- only for leave cells
-bool compute_differential_entropy(boxm_scene<boct_tree<short, bsta_num_obs<bsta_gauss_sf1> > >& scene,boxm_scene<boct_tree<short, float > >& scene_out);
-
-//: Computes expected color of a voxel as mean/occupancy
-bool compute_expected_color(boxm_scene<boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > >& scene, boxm_scene<boct_tree<short, float > >& scene_out, float grey_offset);
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/boxm_refine.h b/contrib/brl/bseg/boxm/algo/boxm_refine.h
deleted file mode 100644
index c3f464f906..0000000000
--- a/contrib/brl/bseg/boxm/algo/boxm_refine.h
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifndef boxm_refine_h_
-#define boxm_refine_h_
-//:
-// \file
-#include <iostream>
-#include <boct/boct_tree.h>
-#include <boct/boct_tree_cell.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_scene.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <class T_loc, class T_data>
-void boxm_refine_block(boxm_block<boct_tree<T_loc, T_data> > *block,
- float occlusion_prob_thresh, unsigned & num_split, bool reset_appearance = true)
-{
- typedef boct_tree<T_loc, T_data> tree_type;
- tree_type* tree = block->get_tree();
- float max_alpha_int = (float)-std::log(1.0 - occlusion_prob_thresh);
- // get the leaf nodes of the block
- std::vector<boct_tree_cell<T_loc, T_data>*> leaf_nodes = tree->leaf_cells();
-#ifdef DEBUG
- std::cout << " NUMBER OF LEAF NODES=" << leaf_nodes.size();
-#endif
- std::vector<boct_tree_cell<T_loc, T_data >*> split_list;
- for (unsigned i=0; i<leaf_nodes.size(); i++) {
- boct_tree_cell<T_loc, T_data>* cell = leaf_nodes[i];
- T_data data = cell->data();
-
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(cell);
- float side_len = (float) (cell_bb.max_z() - cell_bb.min_z());
- float alpha_int = data.alpha * side_len;
-
- if ((alpha_int > max_alpha_int) && (cell->level() > 0)) {
- split_list.push_back(cell);
- // make sure neighbor cells are not already coarser than this cell
- // get all the faces;
-#if 0
- boct_face_idx faces = ALL;
- std::vector<boct_tree_cell<T_loc, T_data >*> neighbors;
- cell->find_neighbors(faces, neighbors, cell->level()+1);
- split_list.insert(split_list.end(), neighbors.begin(), neighbors.end());
-#endif
- }
- }
- num_split+=(int)split_list.size();
-#ifdef DEBUG
- std::cout<<" Splitting "<<split_list.size()<<" cells" << std::endl;
-#endif
- // splitting
- for (unsigned i=0; i<split_list.size(); i++) {
- boct_tree_cell<T_loc, T_data>* cell = split_list[i];
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(cell);
- float side_len = (float) (cell_bb.max_z() - cell_bb.min_z());
- float new_alpha = max_alpha_int / side_len;
-
- T_data old_sample = cell->data();
- typename T_data::apm_datatype app;
- if (!reset_appearance) {
- // if it is not set, transfer the old appearance to the new sample
- T_data new_sample = old_sample;
- new_sample.alpha=new_alpha;
- cell->split(new_sample);
- }
- else {
- T_data new_sample = T_data();
- new_sample.alpha = new_alpha;
- cell->split(new_sample);
- }
- }
-}
-
-//: This method refines the blocks (octrees) of the scene
-// If there are some cells with big values they are spitted into new child cells;
-// the data of the cell is copied to the children's data. The purpose of this
-// method is to elaborate the octree at the areas where more details exist.
-// returns the number of leaf nodes in the refined octree
-template <class T_loc, class T_data>
-unsigned int boxm_refine_scene(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- float occlusion_prob_thresh,
- bool reset_appearance = true)
-{
- typedef boct_tree<T_loc, T_data > tree_type;
-
- unsigned int nleaves = 0;
- boxm_block_iterator<tree_type> iter(&scene);
- //float max_alpha_int = (float)-std::log(1.0 - occlusion_prob_thresh);
- for (; !iter.end(); iter++) {
- scene.load_block(iter.index());
- boxm_block<tree_type>* block = *iter;
- boxm_refine_block(block, occlusion_prob_thresh,nleaves, reset_appearance);
- //nleaves += block->size();
- scene.write_active_block();
- }
- std::cout<<"Total No of leaves split "<<nleaves<<std::endl;
- return nleaves;
-}
-
-#endif // boxm_refine_h_
diff --git a/contrib/brl/bseg/boxm/algo/boxm_save_block_raw.h b/contrib/brl/bseg/boxm/algo/boxm_save_block_raw.h
deleted file mode 100644
index 65c03397ce..0000000000
--- a/contrib/brl/bseg/boxm/algo/boxm_save_block_raw.h
+++ /dev/null
@@ -1,155 +0,0 @@
-#ifndef boxm_save_block_raw_h_
-#define boxm_save_block_raw_h_
-
-#include <vector>
-#include <new>
-#include <iostream>
-
-#include <boct/boct_tree.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/basic/boxm_block_vis_graph_iterator.h>
-#include <boxm/basic/boxm_cell_vis_graph_iterator.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/util/boxm_cell_data_traits.h>
-
-#include <bsta/bsta_attributes.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <class T_loc, class T_data>
-void boxm_save_block_raw(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vgl_point_3d<int> block_idx,
- std::string filename,
- unsigned int resolution_level)
-{
- typedef boct_tree<T_loc, T_data > tree_type;
-
- scene.load_block(block_idx);
- boxm_block<tree_type>* block = scene.get_block(block_idx);
- vgl_box_3d<double> block_bb = block->bounding_box();
- tree_type* tree = block->get_tree();
-
- // query the finest level of the tree and do not make the resolution smaller than that
- if (tree->finest_level() > (int)resolution_level)
- resolution_level = tree->finest_level();
-
- // get origin of block
- vgl_point_3d<double> min = block_bb.min_point();
-
- const unsigned int ncells = 1 << (tree->root_level() - (int)resolution_level);
-
- // assume that bounding box is a cube
- const double step_len = ((block_bb.max_x() - block_bb.min_x())/double(ncells));
-
- // origin should specify center of first cell
- vgl_point_3d<double> data_og(min.x() + (step_len/2.0), min.y() + (step_len/2.0), min.z() + (step_len/2.0));
-
- int data_size = ncells*ncells*ncells;
- int y_size = ncells*ncells;
- float *data = nullptr;
- data = new (std::nothrow)float[data_size];
-
- if (data == nullptr) {
- std::cout << "boxm_save_block_raw: Could not allocate data!" << std::endl;
- return;
- }
- // init to zero
- for (float* dp = data; dp < data + ncells*ncells*ncells; ++dp) {
- *dp = 0.0f;
- }
-
- double out_cell_norm_volume = (tree->number_levels() - (int)resolution_level + 1);
- out_cell_norm_volume = out_cell_norm_volume*out_cell_norm_volume*out_cell_norm_volume;
-
- std::vector<boct_tree_cell<T_loc, T_data > *> cells = tree->leaf_cells();
- for (unsigned i=0; i<cells.size(); i++)
- {
- vgl_point_3d<double> node = tree->cell_bounding_box_local(cells[i]).min_point();
-
- float cell_val = boxm_cell_to_float(cells[i], step_len);
-
- unsigned int level = cells[i]->get_code().level;
-
- if (level == resolution_level) {
- // just copy value to output array
- int out_index = static_cast<int>((node.x()/step_len)*ncells*ncells + (node.y()/step_len)*ncells + (node.z()/step_len));
- if (out_index >= data_size)
- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl;
- else
- data[out_index] = cell_val;
- }
- else if (level > resolution_level) {
- // cell is bigger than output cells. copy value to all contained output cells.
- const unsigned int us_factor = 1 << (level - resolution_level);
- const unsigned int node_x_start = static_cast<unsigned int>(node.x()/step_len);
- const unsigned int node_y_start = static_cast<unsigned int>(node.y()/step_len);
- const unsigned int node_z_start = static_cast<unsigned int>(node.z()/step_len);
- for (unsigned int z=node_z_start; z<node_z_start+us_factor; ++z) {
- for (unsigned int y=node_y_start; y<node_y_start+us_factor; ++y) {
- for (unsigned int x=node_x_start; x<node_x_start+us_factor; ++x) {
- int out_index = z*y_size + y*ncells + x;
- //std::cout << level << " " << out_index << std::endl;
- if (out_index >= data_size)
- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl;
- else
- data[out_index] = cell_val;
- }
- }
- }
- }
- else {
- // cell is smaller than output cells. increment output cell value
- unsigned int ds_factor = 1 << (resolution_level - level);
- double update_weight = 1.0 / double(ds_factor*ds_factor*ds_factor);
- const unsigned int node_x = static_cast<unsigned int>(node.x()/step_len);
- const unsigned int node_y = static_cast<unsigned int>(node.y()/step_len);
- const unsigned int node_z = static_cast<unsigned int>(node.z()/step_len);
- unsigned int out_index = static_cast<unsigned int>((node_z)*y_size + (node_y)*ncells + (node_x));
- data[out_index] += float(cell_val*update_weight);
- }
- }
- // convert float values to char
-
- unsigned char *byte_data = nullptr;
- byte_data = new (std::nothrow) unsigned char[data_size];
- if (byte_data == nullptr) {
- std::cout << "boxm_save_block_raw: Could not allocate byte data!" << std::endl;
- return;
- }
-
- float* dp = data;
- for (unsigned char* bdp = byte_data; dp < data + data_size; ++dp, ++bdp) {
- //double P = 1.0 - std::exp(-*dp*step_len);
- *bdp = (unsigned char)(std::floor((255.0 * (*dp)) + 0.5)); // always positive so this is an ok way to round
- }
- delete[] data;
-
- // write header
- unsigned char data_type = 0; // 0 means unsigned byte
-
- vxl_uint_32 nx = ncells;
- vxl_uint_32 ny = ncells;
- vxl_uint_32 nz = ncells;
-
- std::ofstream os(filename.c_str(),std::ios::binary);
- if (!os.good()) {
- std::cerr << "error opening " << filename << " for write!\n";
- return;
- }
-
- os.write(reinterpret_cast<char*>(&data_type),sizeof(data_type));
- os.write(reinterpret_cast<char*>(&nx),sizeof(nx));
- os.write(reinterpret_cast<char*>(&ny),sizeof(ny));
- os.write(reinterpret_cast<char*>(&nz),sizeof(nz));
-
- os.write((char*)byte_data,data_size);
- delete[] byte_data;
-
- return;
-}
-
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/boxm_save_scene_raw.h b/contrib/brl/bseg/boxm/algo/boxm_save_scene_raw.h
deleted file mode 100644
index f3051e8f6e..0000000000
--- a/contrib/brl/bseg/boxm/algo/boxm_save_scene_raw.h
+++ /dev/null
@@ -1,277 +0,0 @@
-#ifndef boxm_save_scene_raw_h_
-#define boxm_save_scene_raw_h_
-//:
-// \file
-// \brief Writes the 3D scene into a raw file by combining all the spatial data in a set of octrees.
-// The octree data mapped to a 3D regular grid and kept in binary files temporarily.
-// And then these sets of data combined and saved in a raw file.
-//
-// \author Gamze Tunali
-// \date September 9, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <vector>
-#include <new>
-#include <iostream>
-#include <sstream>
-#include <boct/boct_tree.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/util/boxm_cell_data_traits.h>
-#include <boxm/basic/boxm_block_vis_graph_iterator.h>
-#include <boxm/basic/boxm_cell_vis_graph_iterator.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-
-#include <bsta/bsta_histogram.h>
-#include <vbl/vbl_array_3d.hxx>
-#include <vsl/vsl_binary_io.h>
-#include <vpl/vpl.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <cassert>
-
-template <class T_loc, class T_data>
-void boxm_save_scene_raw(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- std::string filename,
- unsigned int resolution_level)
-{
- float minv = 1.0e10, maxv = 0.0;
- bsta_histogram<float> h(0.0f, 1.0f, 20);
- typedef boct_tree<T_loc, T_data > tree_type;
-
- // create an array for each block, and save in a binary file
-
- // number of cells for each block should be the same, because they have the
- // same tree max_level definitions
- unsigned int ncells = 0;
- boxm_block_iterator<tree_type> iter(&scene);
-
- unsigned int finest_level=scene.finest_level();
-
- // query the finest level of the tree and do not make the resolution
- // smaller than that
- if (resolution_level < finest_level)
- resolution_level=finest_level;
-
- iter.begin();
- while (!iter.end()) {
- vgl_point_3d<int> idx = iter.index();
- scene.load_block(idx);
- boxm_block<tree_type>* block = scene.get_block(idx);
- vgl_box_3d<double> block_bb = block->bounding_box();
- tree_type* tree = block->get_tree();
-
- // get origin of block
- vgl_point_3d<double> min = block_bb.min_point();
-
- ncells = 1 << (tree->root_level() - (int)resolution_level);
-
- // assume that bounding box is a cube
- const double step_len = ((block_bb.max_x() - block_bb.min_x())/double(ncells));
-
- // origin should specify center of first cell
- vgl_point_3d<double> data_og(min.x() + (step_len/2.0), min.y() + (step_len/2.0), min.z() + (step_len/2.0));
-
- int data_size = ncells*ncells*ncells;
- float *data = nullptr;
- std::cout << "Data Size=" << data_size << std::endl;
- data = new (std::nothrow)float[data_size];
-
- if (data == nullptr) {
- std::cout << "boxm_save_block_raw: Could not allocate data!" << std::endl;
- return;
- }
- // init to zero
- for (float* dp = data; dp < data + ncells*ncells*ncells; ++dp) {
- *dp = 0.0f;
- }
-
- double out_cell_norm_volume = (tree->number_levels() - (int)resolution_level + 1);
- out_cell_norm_volume = out_cell_norm_volume*out_cell_norm_volume*out_cell_norm_volume;
-
- std::vector<boct_tree_cell<T_loc, T_data > *> cells = tree->leaf_cells();
- for (unsigned i=0; i<cells.size(); i++)
- {
- vgl_point_3d<double> node = tree->cell_bounding_box_local(cells[i]).min_point();
-
- float cell_val = boxm_cell_to_float(cells[i], step_len);
-
- unsigned int level = cells[i]->get_code().level;
- if (level == resolution_level) {
- // just copy value to output array
- //int out_index = static_cast<int>((node.x()/step_len)*ncells*ncells + (node.y()/step_len)*ncells + (node.z()/step_len));
- int out_index=static_cast<int>(ncells-1-(node.z()/step_len) + (node.y()/step_len)*ncells + (node.x()/step_len)*ncells*ncells);
- //////int out_index=static_cast<int>((node.z()/step_len) + (node.y()/step_len)*ncells + (node.x()/step_len)*ncells*ncells);
- //////int out_index=static_cast<int>(ncells-(node.z()/step_len)-1 + (node.x()/step_len)*ncells + (node.y()/step_len)*ncells*ncells);
-
- if (out_index >= data_size)
- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl;
- else
- data[out_index] = cell_val;
- }
- else if (level > resolution_level) {
- // cell is bigger than output cells. copy value to all contained output cells.
- const unsigned int us_factor = 1 << (level - resolution_level);
- const unsigned int node_x_start = static_cast<unsigned int>(node.x()/step_len);
- const unsigned int node_y_start = static_cast<unsigned int>(node.y()/step_len);
- const unsigned int node_z_start = static_cast<unsigned int>(node.z()/step_len);
- for (unsigned int z=node_z_start; z<node_z_start+us_factor; ++z) {
- for (unsigned int y=node_y_start; y<node_y_start+us_factor; ++y) {
- for (unsigned int x=node_x_start; x<node_x_start+us_factor; ++x) {
- //int out_index=x*y_size + y*ncells + z;
- int out_index=ncells-1-z + y*ncells + x*ncells*ncells;
- //////int out_index=z + y*ncells + x*ncells*ncells;
- //////int out_index=ncells-1-z + x*ncells + y*ncells*ncells;
-
- if (out_index >= data_size)
- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl;
- else
- data[out_index] = cell_val;
- }
- }
- }
- }
- else {
- // cell is smaller than output cells. increment output cell value
- unsigned int ds_factor = 1 << (resolution_level - level);
- double update_weight = 1.0 / double(ds_factor*ds_factor*ds_factor);
- const unsigned int node_x = static_cast<unsigned int>(node.x()/step_len);
- const unsigned int node_y = static_cast<unsigned int>(node.y()/step_len);
- const unsigned int node_z = static_cast<unsigned int>(node.z()/step_len);
- //unsigned int out_index=node_x*y_size + node_y*ncells + node_z;
- int out_index=ncells-1-node_z + node_y*ncells + node_x*ncells*ncells;
- //////int out_index=node_z + node_y*ncells + node_x*ncells*ncells;
- //////int out_index=ncells-1-node_z + node_x*ncells + node_y*ncells*ncells;
-
- data[out_index] += float(cell_val*update_weight);
- }
- }
-
- // write the data into a bin file, generate a file name
- std::stringstream strm;
- strm << filename<< idx.x() << '_' << idx.y() << '_' << idx.z() << ".bin";
- std::string fn(strm.str());
- vsl_b_ofstream os(fn.c_str(),std::ios::binary);
- if (!os.os().good()) {
- std::cerr << "error opening " << fn << " for write!\n";
- return;
- }
-
- vsl_b_write(os, (unsigned int) ncells); // x dimension
- vsl_b_write(os, (unsigned int) ncells); // y dimension
- vsl_b_write(os, (unsigned int) ncells); // z dimension
-
- float* dp = data;
- for (; dp < data + data_size; ++dp) {
- //double P = 1.0 - std::exp(-*dp*step_len);
- // always positive so this is an ok way to round
- float fv = *dp;
- h.upcount(fv, 1.0f);
- if (fv<minv) minv = fv;
- if (fv>maxv) maxv = fv;
- unsigned char c = (unsigned char)(std::floor((255.0 * (*dp)) + 0.5));
- vsl_b_write(os, (char) c);
- }
- delete[] data;
- os.close();
- iter++;
- }
- scene.unload_active_blocks();
-
- assert(ncells > 0);
-
- // combine the blocks
- vgl_vector_3d<unsigned> dim = scene.world_dim();
- unsigned dimx = dim.x()*ncells;
- unsigned dimy = dim.y()*ncells;
- unsigned dimz = dim.z()*ncells;
- // we will read the data a column at a time and this is enough
- int row_data_size = ncells;
- char* byte_data = new (std::nothrow) char[row_data_size];
- if (byte_data == nullptr) {
- std::cout << "boxm_save_block_raw: Could not allocate byte data!" << std::endl;
- return;
- }
-
- // open the binary files streams, saved earlier
- unsigned int nx,ny,nz;
- vbl_array_3d<vsl_b_ifstream*> streams(dim.x(), dim.y(), dim.z());
- for (unsigned z=0; z<dim.z(); z++) {
- for (unsigned y=0; y<dim.y(); y++) {
- for (unsigned x=0; x<dim.x(); x++) {
- vsl_b_ifstream*& s = streams(x,y,z);
- std::stringstream strm;
- strm << filename << x << '_' << y << '_' << z << ".bin";
- std::string fn(strm.str());
- s = new vsl_b_ifstream(fn.c_str(),std::ios::binary);
- vsl_b_read(*s, nx);
- vsl_b_read(*s, ny);
- vsl_b_read(*s, nz);
- }
- }
- }
-
- // start writing the raw header
- unsigned char data_type = 0; // 0 means unsigned byte
- vxl_uint_32 nx_uint = dimx;
- vxl_uint_32 ny_uint = dimy;
- vxl_uint_32 nz_uint = dimz;
- std::ofstream os(filename.c_str(),std::ios::binary);
- if (!os.good()) {
- std::cerr << "error opening " << filename << " for write!\n";
- return;
- }
-
- os.write(reinterpret_cast<char*>(&data_type),sizeof(data_type));
- os.write(reinterpret_cast<char*>(&nx_uint),sizeof(nx_uint));
- os.write(reinterpret_cast<char*>(&ny_uint),sizeof(ny_uint));
- os.write(reinterpret_cast<char*>(&nz_uint),sizeof(nz_uint));
-
- // combine the column from streams to generate one raw file
- for (unsigned x=0; x<dim.x(); x++) {
- unsigned k=0;
- while (k<dim.y()*dim.z()*ncells*ncells*ncells) {
- for (unsigned y=0; y<dim.y(); y++) {
- unsigned j=0;
- while (j < ncells*ncells*dim.z()) {
- for (unsigned z=dim.z();z>0; z--) {
- vsl_b_ifstream* s=streams(x,y,z-1);
- s->is().read(byte_data, ncells);
- os.write((char*)byte_data,ncells);
- j+=ncells;
- k+=ncells;
- }
- }
- }
- }
- }
-
- os.close();
- delete[] byte_data;
-
- // remove the intermediate bin files
- for (unsigned z=0; z<dim.z(); z++) {
- for (unsigned y=0; y<dim.y(); y++) {
- for (unsigned x=0; x<dim.x(); x++) {
- vsl_b_ifstream*& s = streams(x,y,z);
- s->close();
- std::stringstream strm;
- strm << filename << x << '_' << y << '_' << z << ".bin";
- std::string fn(strm.str());
- std::cout << "Deleting " << fn << std::endl;
- vpl_unlink(fn.data());
- delete s;
- }
- }
- }
- std::cout << "Volume Histogram(" << minv << ' ' << maxv << "):[0->1]20bins\n";
- h.print();
- return;
-}
-
-#endif // boxm_save_scene_raw_h_
diff --git a/contrib/brl/bseg/boxm/algo/boxm_save_scene_raw_general.h b/contrib/brl/bseg/boxm/algo/boxm_save_scene_raw_general.h
deleted file mode 100644
index 28753c4595..0000000000
--- a/contrib/brl/bseg/boxm/algo/boxm_save_scene_raw_general.h
+++ /dev/null
@@ -1,824 +0,0 @@
-// This is brl/bseg/boxm/algo/boxm_save_scene_raw_general.h
-#ifndef boxm_save_scene_raw_general_h
-#define boxm_save_scene_raw_general_h
-
-//:
-// \file
-// \brief Writes the 3D scene into a raw file by combining all the spatial data in a set of octrees.
-// The octree data mapped to a 3D regular grid and kept in binary files temporarily.
-// And then these sets of data combined and saved in a raw file.
-//
-// \author Gamze Tunali
-// \date September 9, 2009
-// \verbatim
-// Modifications
-// February 17, 2011 Isabel Restrepo: Modified functions to use with more general scenes.
-// Double, float values are not converted to byte, nor assumptions are made. Values are saves as they are
-// \endverbatim
-
-#include <vector>
-#include <new>
-#include <iostream>
-#include <sstream>
-#include <boct/boct_tree.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/util/boxm_cell_data_traits.h>
-#include <boxm/basic/boxm_block_vis_graph_iterator.h>
-#include <boxm/basic/boxm_cell_vis_graph_iterator.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/algo/boxm_compute_scene_statistics.h>
-#include <bsta/bsta_histogram.h>
-#include <vbl/vbl_array_3d.hxx>
-#include <vsl/vsl_binary_io.h>
-#include <vpl/vpl.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <cassert>
-
-#include <vul/vul_file.h>
-
-
-//: Traits for saving grids of different datatypes to Drishti .raw file
-template <class T>
-class boxm_dristhi_traits;
-
-//: Drishti datatypes for header:
-// * 0 : unsigned byte - 1 byte per voxel
-// * 1 : signed byte - 1 byte per voxel
-// * 2 : unsigned short - 2 bytes per voxel
-// * 3 : signed short - 2 bytes per voxel
-// * 4 : integer - 4 bytes per voxel
-// * 8 : float - 4 bytes per voxel
-
-//: Drishti traits specializations. Please extent as needed
-
-template <>
-class boxm_dristhi_traits<float>
-{
- public:
- static unsigned char dristhi_header() {return 8;}
-};
-
-
-template <>
-class boxm_dristhi_traits<unsigned char>
-{
- public:
- static unsigned char dristhi_header() {return 0;}
-};
-
-template <>
-class boxm_dristhi_traits<char>
-{
- public:
- static unsigned char dristhi_header() {return 1;}
-};
-
-template <>
-class boxm_dristhi_traits<short>
-{
- public:
- static unsigned char dristhi_header() {return 3;}
-};
-
-template <>
-class boxm_dristhi_traits<unsigned int>
-{
- public:
- static unsigned char dristhi_header() {return 4;}
-};
-
-template <>
-class boxm_dristhi_traits<bsta_num_obs<bsta_gauss_sf1> >
-{
- public:
- static unsigned char dristhi_header() {return 8;}
-};
-
-
-template <class T_loc>
-void boxm_save_scene_raw_general(boxm_scene<boct_tree<T_loc, bool > > &scene,
- std::string filename,
- unsigned int resolution_level)
-{
- unsigned long n_zeros = 0;
- unsigned long n_ones = 0;
- unsigned long n_zeros_level0 = 0;
- unsigned long n_ones_level0 = 0;
-
- typedef boct_tree<T_loc, bool > tree_type;
-
- // create an array for each block, and save in a binary file
-
- // number of cells for each block should be the same, because they have the
- // same tree max_level definitions
- unsigned int ncells = 0;
- boxm_block_iterator<tree_type> iter(&scene);
-
- // query the finest level of the tree and do not make the resolution
- // smaller than that
- unsigned int finest_level=scene.finest_level();
-
- if (resolution_level < finest_level)
- resolution_level=finest_level;
-
- iter.begin();
- while (!iter.end())
- {
- vgl_point_3d<int> idx = iter.index();
- scene.load_block(idx);
- boxm_block<tree_type>* block = scene.get_block(idx);
- vgl_box_3d<double> block_bb = block->bounding_box();
- tree_type* tree = block->get_tree();
-
- // get origin of block
- vgl_point_3d<double> min = block_bb.min_point();
-
- ncells = 1 << (tree->root_level() - (int)resolution_level);
-
- // assume that bounding box is a cube
- const double step_len = ((block_bb.max_x() - block_bb.min_x())/double(ncells));
-
- // origin should specify center of first cell
- vgl_point_3d<double> data_og(min.x() + (step_len/2.0), min.y() + (step_len/2.0), min.z() + (step_len/2.0));
-
- int data_size = ncells*ncells*ncells;
- unsigned char *data = nullptr;
- std::cout << "Data Size=" << data_size << std::endl;
- data = new (std::nothrow)unsigned char[data_size];
-
- if (data == nullptr) {
- std::cout << "boxm_save_block_raw: Could not allocate data!" << std::endl;
- return;
- }
-
- // init to zero
- for (unsigned char* dp = data; dp < data + ncells*ncells*ncells; ++dp) {
- *dp = (unsigned char)0.0;
- }
-
- double out_cell_norm_volume = (tree->number_levels() - (int)resolution_level + 1);
- out_cell_norm_volume = out_cell_norm_volume*out_cell_norm_volume*out_cell_norm_volume;
-
- std::vector<boct_tree_cell<T_loc, bool > *> cells = tree->leaf_cells();
- for (unsigned i=0; i<cells.size(); i++)
- {
- vgl_point_3d<double> node = tree->cell_bounding_box_local(cells[i]).min_point();
-
- unsigned char cell_val = (unsigned char)cells[i]->data()*255;
- if (cells[i]->data()) {
- n_ones++;
- if (cells[i]->get_code().level ==0)
- n_ones_level0++;
- }
- else {
- n_zeros++;
- if (cells[i]->get_code().level ==0)
- n_zeros_level0++;
- }
-
- unsigned int level = cells[i]->get_code().level;
- if (level == resolution_level) {
- // just copy value to output array
- int out_index=static_cast<int>(ncells-1-(node.z()/step_len) + (node.y()/step_len)*ncells + (node.x()/step_len)*ncells*ncells);
-
- if (out_index >= data_size)
- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl;
- else
- data[out_index] = cell_val;
- }
- else if (level > resolution_level) {
- // cell is bigger than output cells. copy value to all contained output cells.
- const unsigned int us_factor = 1 << (level - resolution_level);
- const unsigned int node_x_start = static_cast<unsigned int>(node.x()/step_len);
- const unsigned int node_y_start = static_cast<unsigned int>(node.y()/step_len);
- const unsigned int node_z_start = static_cast<unsigned int>(node.z()/step_len);
- for (unsigned int z=node_z_start; z<node_z_start+us_factor; ++z) {
- for (unsigned int y=node_y_start; y<node_y_start+us_factor; ++y) {
- for (unsigned int x=node_x_start; x<node_x_start+us_factor; ++x) {
- int out_index=ncells-1-z + y*ncells + x*ncells*ncells;
-
- if (out_index >= data_size)
- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl;
- else
- data[out_index] = cell_val;
- }
- }
- }
- }
- else {
- // cell is smaller than output cells. increment output cell value
- unsigned int ds_factor = 1 << (resolution_level - level);
- double update_weight = 1.0 / double(ds_factor*ds_factor*ds_factor);
- const unsigned int node_x = static_cast<unsigned int>(node.x()/step_len);
- const unsigned int node_y = static_cast<unsigned int>(node.y()/step_len);
- const unsigned int node_z = static_cast<unsigned int>(node.z()/step_len);
- int out_index=ncells-1-node_z + node_y*ncells + node_x*ncells*ncells;
-
- data[out_index] += (unsigned char)(cell_val*update_weight);
- }
- }
-
- // write the data into a bin file, generate a file name
- std::stringstream strm;
- strm << filename<< idx.x() << '_' << idx.y() << '_' << idx.z() << ".bin";
- std::string fn(strm.str());
- vsl_b_ofstream os(fn.c_str(),std::ios::binary);
- if (!os.os().good()) {
- std::cerr << "error opening " << filename << " for write!\n";
- return;
- }
-
- vsl_b_write(os, (unsigned int) ncells); // x dimension
- vsl_b_write(os, (unsigned int) ncells); // y dimension
- vsl_b_write(os, (unsigned int) ncells); // z dimension
-
- unsigned char* dp = data;
- for (; dp < data + data_size; ++dp) {
- unsigned char v = *dp;
- vsl_b_write(os, (unsigned char)v);
- }
- delete[] data;
- os.close();
- iter++;
- }
-
- scene.unload_active_blocks();
-
- assert(ncells > 0);
-
- // combine the blocks
- vgl_vector_3d<unsigned> dim = scene.world_dim();
- unsigned dimx = dim.x()*ncells;
- unsigned dimy = dim.y()*ncells;
- unsigned dimz = dim.z()*ncells;
- // we will read the data a column at a time and this is enough
- int row_data_size = ncells;
- unsigned char* read_data = new (std::nothrow) unsigned char[row_data_size];
- if (read_data == nullptr) {
- std::cout << "boxm_save_block_raw: Could not allocate read data!" << std::endl;
- return;
- }
-
- // open the binary files streams, saved earlier
- unsigned int nx,ny,nz;
- vbl_array_3d<vsl_b_ifstream*> streams(dim.x(), dim.y(), dim.z());
- for (unsigned z=0; z<dim.z(); z++) {
- for (unsigned y=0; y<dim.y(); y++) {
- for (unsigned x=0; x<dim.x(); x++) {
- vsl_b_ifstream*& s = streams(x,y,z);
- std::stringstream strm;
- strm << filename << x << '_' << y << '_' << z << ".bin";
- std::string fn(strm.str());
- s = new vsl_b_ifstream(fn.c_str(),std::ios::binary);
- vsl_b_read(*s, nx);
- vsl_b_read(*s, ny);
- vsl_b_read(*s, nz);
- }
- }
- }
-
- // start writing the raw header
- unsigned char data_type= 0;
- vxl_uint_32 nx_uint = dimx;
- vxl_uint_32 ny_uint = dimy;
- vxl_uint_32 nz_uint = dimz;
- std::ofstream os(filename.c_str(),std::ios::binary);
- if (!os.good()) {
- std::cerr << "error opening " << filename << " for write!\n";
- return;
- }
-
- os.write(reinterpret_cast<char*>(&data_type),sizeof(data_type));
- os.write(reinterpret_cast<char*>(&nx_uint),sizeof(nx_uint));
- os.write(reinterpret_cast<char*>(&ny_uint),sizeof(ny_uint));
- os.write(reinterpret_cast<char*>(&nz_uint),sizeof(nz_uint));
-
- // combine the column from streams to generate one raw file
- for (unsigned x=0; x<dim.x(); x++) {
- unsigned k=0;
- while (k<dim.y()*dim.z()*ncells*ncells*ncells) {
- for (unsigned y=0; y<dim.y(); y++) {
- unsigned j=0;
- while (j < ncells*ncells*dim.z()) {
- for (unsigned z=dim.z();z>0; z--) {
- vsl_b_ifstream* s=streams(x,y,z-1);
- s->is().read(reinterpret_cast<char*>(read_data), ncells*sizeof(unsigned char));
- os.write(reinterpret_cast<char*>(read_data),ncells*sizeof(unsigned char));
- j+=ncells;
- k+=ncells;
- }
- }
- }
- }
- }
-
- os.close();
- delete[] read_data;
-
- // remove the intermediate bin files
- for (unsigned z=0; z<dim.z(); z++) {
- for (unsigned y=0; y<dim.y(); y++) {
- for (unsigned x=0; x<dim.x(); x++) {
- vsl_b_ifstream*& s = streams(x,y,z);
- s->close();
- std::stringstream strm;
- strm << filename << x << '_' << y << '_' << z << ".bin";
- std::string fn(strm.str());
- std::cout << "Deleting " << fn << std::endl;
- vpl_unlink(fn.data());
- delete s;
- }
- }
- }
-
- std::cout << "Number of true cells : " << n_ones << "\n Number of false cells: " << n_zeros << std::endl;
- std::cout << "Number of true cells at level 0 : " << n_ones_level0 << "\n Number of false cells at level 0: " << n_zeros_level0 << std::endl;
-
- return;
-}
-
-
-template <class T_loc, class T_data>
-void boxm_save_scene_raw_general(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- std::string filename,
- unsigned int resolution_level)
-{
- std::cout << " Using boxm_save_scene_raw_general\n";
- bsta_histogram<float> hist;
- boxm_compute_scene_statistics(&scene, hist);
- hist.pretty_print();
-
- std::stringstream ss;
- ss << vul_file::strip_extension(filename) << "_hist_plot.txt" ;
- std::ofstream hist_arrays_ofs((ss.str()).c_str());
- hist.print_to_arrays(hist_arrays_ofs);
- hist_arrays_ofs.close();
-
- typedef boct_tree<T_loc, T_data > tree_type;
-
- // create an array for each block, and save in a binary file
-
- // number of cells for each block should be the same, because they have the
- // same tree max_level definitions
- unsigned int ncells = 0;
- boxm_block_iterator<tree_type> iter(&scene);
-
- // query the finest level of the tree and do not make the resolution
- // smaller than that
- unsigned int finest_level=scene.finest_level();
-
- if (resolution_level < finest_level)
- resolution_level=finest_level;
-
- iter.begin();
- while (!iter.end())
- {
- vgl_point_3d<int> idx = iter.index();
- scene.load_block(idx);
- boxm_block<tree_type>* block = scene.get_block(idx);
- vgl_box_3d<double> block_bb = block->bounding_box();
- tree_type* tree = block->get_tree();
-
- // get origin of block
- vgl_point_3d<double> min = block_bb.min_point();
-
- ncells = 1 << (tree->root_level() - (int)resolution_level);
-
- // assume that bounding box is a cube
- const double step_len = ((block_bb.max_x() - block_bb.min_x())/double(ncells));
-
- // origin should specify center of first cell
- vgl_point_3d<double> data_og(min.x() + (step_len/2.0), min.y() + (step_len/2.0), min.z() + (step_len/2.0));
-
- int data_size = ncells*ncells*ncells;
- T_data *data = nullptr;
- std::cout << "Data Size=" << data_size << std::endl;
- data = new (std::nothrow)T_data[data_size];
-
- if (data == nullptr) {
- std::cout << "boxm_save_block_raw: Could not allocate data!" << std::endl;
- return;
- }
-
- // init to zero
- for (T_data* dp = data; dp < data + ncells*ncells*ncells; ++dp) {
- *dp = (T_data)0.0;
- }
-
- double out_cell_norm_volume = (tree->number_levels() - (int)resolution_level + 1);
- out_cell_norm_volume = out_cell_norm_volume*out_cell_norm_volume*out_cell_norm_volume;
-
- std::vector<boct_tree_cell<T_loc, T_data > *> cells = tree->leaf_cells();
- for (unsigned i=0; i<cells.size(); i++)
- {
- vgl_point_3d<double> node = tree->cell_bounding_box_local(cells[i]).min_point();
-
- T_data cell_val = cells[i]->data();
-
- unsigned int level = cells[i]->get_code().level;
- if (level == resolution_level) {
- // just copy value to output array
- int out_index=static_cast<int>(ncells-1-(node.z()/step_len) + (node.y()/step_len)*ncells + (node.x()/step_len)*ncells*ncells);
-
- if (out_index >= data_size)
- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl;
- else
- data[out_index] = cell_val;
- }
- else if (level > resolution_level) {
- // cell is bigger than output cells. copy value to all contained output cells.
- const unsigned int us_factor = 1 << (level - resolution_level);
- const unsigned int node_x_start = static_cast<unsigned int>(node.x()/step_len);
- const unsigned int node_y_start = static_cast<unsigned int>(node.y()/step_len);
- const unsigned int node_z_start = static_cast<unsigned int>(node.z()/step_len);
- for (unsigned int z=node_z_start; z<node_z_start+us_factor; ++z) {
- for (unsigned int y=node_y_start; y<node_y_start+us_factor; ++y) {
- for (unsigned int x=node_x_start; x<node_x_start+us_factor; ++x) {
- int out_index=ncells-1-z + y*ncells + x*ncells*ncells;
-
- if (out_index >= data_size)
- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl;
- else
- data[out_index] = cell_val;
- }
- }
- }
- }
- else {
- // cell is smaller than output cells. increment output cell value
- unsigned int ds_factor = 1 << (resolution_level - level);
- double update_weight = 1.0 / double(ds_factor*ds_factor*ds_factor);
- const unsigned int node_x = static_cast<unsigned int>(node.x()/step_len);
- const unsigned int node_y = static_cast<unsigned int>(node.y()/step_len);
- const unsigned int node_z = static_cast<unsigned int>(node.z()/step_len);
- int out_index=ncells-1-node_z + node_y*ncells + node_x*ncells*ncells;
-
- data[out_index] += (T_data)(cell_val*update_weight);
- }
- }
-
- // write the data into a bin file, generate a file name
- std::stringstream strm;
- strm << filename<< idx.x() << '_' << idx.y() << '_' << idx.z() << ".bin";
- std::string fn(strm.str());
- vsl_b_ofstream os(fn.c_str(),std::ios::binary);
- if (!os.os().good()) {
- std::cerr << "error opening " << filename << " for write!\n";
- return;
- }
-
- vsl_b_write(os, (unsigned int) ncells); // x dimension
- vsl_b_write(os, (unsigned int) ncells); // y dimension
- vsl_b_write(os, (unsigned int) ncells); // z dimension
-
- T_data* dp = data;
- for (; dp < data + data_size; ++dp) {
- T_data v = *dp;
- if (v > 19 || v < -1)
- std::cerr << "Error, v: " << v << '\n';
- vsl_b_write(os, (T_data)v);
- }
- std::cerr << " Data Correct ? " << '\n';
-
- delete[] data;
- os.close();
- iter++;
- }
-
- scene.unload_active_blocks();
-
- assert(ncells > 0);
-
- // combine the blocks
- vgl_vector_3d<unsigned> dim = scene.world_dim();
- unsigned dimx = dim.x()*ncells;
- unsigned dimy = dim.y()*ncells;
- unsigned dimz = dim.z()*ncells;
- // we will read the data a column at a time and this is enough
- int row_data_size = ncells;
- T_data* read_data = new (std::nothrow) T_data[row_data_size];
- if (read_data == nullptr) {
- std::cout << "boxm_save_block_raw: Could not allocate read data!" << std::endl;
- return;
- }
-
- // open the binary files streams, saved earlier
- unsigned int nx,ny,nz;
- vbl_array_3d<vsl_b_ifstream*> streams(dim.x(), dim.y(), dim.z());
- for (unsigned z=0; z<dim.z(); z++) {
- for (unsigned y=0; y<dim.y(); y++) {
- for (unsigned x=0; x<dim.x(); x++) {
- vsl_b_ifstream*& s = streams(x,y,z);
- std::stringstream strm;
- strm << filename << x << '_' << y << '_' << z << ".bin";
- std::string fn(strm.str());
- s = new vsl_b_ifstream(fn.c_str(),std::ios::binary);
- vsl_b_read(*s, nx);
- vsl_b_read(*s, ny);
- vsl_b_read(*s, nz);
- }
- }
- }
-
- // start writing the raw header
- unsigned char data_type = boxm_dristhi_traits<T_data>::dristhi_header();
- vxl_uint_32 nx_uint = dimx;
- vxl_uint_32 ny_uint = dimy;
- vxl_uint_32 nz_uint = dimz;
- std::ofstream os(filename.c_str(),std::ios::binary);
- if (!os.good()) {
- std::cerr << "error opening " << filename << " for write!\n";
- return;
- }
-
- os.write(reinterpret_cast<char*>(&data_type),sizeof(data_type));
- os.write(reinterpret_cast<char*>(&nx_uint),sizeof(nx_uint));
- os.write(reinterpret_cast<char*>(&ny_uint),sizeof(ny_uint));
- os.write(reinterpret_cast<char*>(&nz_uint),sizeof(nz_uint));
-
- // combine the column from streams to generate one raw file
- for (unsigned x=0; x<dim.x(); x++) {
- unsigned k=0;
- while (k<dim.y()*dim.z()*ncells*ncells*ncells) {
- for (unsigned y=0; y<dim.y(); y++) {
- unsigned j=0;
- while (j < ncells*ncells*dim.z()) {
- for (unsigned z=dim.z();z>0; z--) {
- vsl_b_ifstream* s=streams(x,y,z-1);
- s->is().read((char*)read_data, ncells*sizeof(T_data));
- os.write((char*)read_data,ncells*sizeof(T_data));
- j+=ncells;
- k+=ncells;
- }
- }
- }
- }
- }
-
- os.close();
- delete[] read_data;
-
- // remove the intermediate bin files
- for (unsigned z=0; z<dim.z(); z++) {
- for (unsigned y=0; y<dim.y(); y++) {
- for (unsigned x=0; x<dim.x(); x++) {
- vsl_b_ifstream*& s = streams(x,y,z);
- s->close();
- std::stringstream strm;
- strm << filename << x << '_' << y << '_' << z << ".bin";
- std::string fn(strm.str());
- std::cout << "Deleting " << fn << std::endl;
- vpl_unlink(fn.data());
- delete s;
- }
- }
- }
- return;
-}
-
-
-template <class T_loc, class T_data>
-void boxm_save_scene_raw_general_to_byte(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- std::string filename,
- unsigned int resolution_level)
-{
- typedef boct_tree<T_loc, T_data > tree_type;
-
- std::cout << " Using boxm_save_scene_raw_general_to_byte\n";
-
- bsta_histogram<float> hist;
- boxm_compute_scene_statistics(&scene, hist);
-
- // create an array for each block, and save in a binary file
-
- // number of cells for each block should be the same, because they have the
- // same tree max_level definitions
- unsigned int ncells = 0;
- boxm_block_iterator<tree_type> iter(&scene);
-
- unsigned int finest_level=scene.finest_level();
-
- // query the finest level of the tree and do not make the resolution
- // smaller than that
- if (resolution_level < finest_level)
- resolution_level=finest_level;
-
- iter.begin();
- while (!iter.end())
- {
- vgl_point_3d<int> idx = iter.index();
- scene.load_block(idx);
- boxm_block<tree_type>* block = scene.get_block(idx);
- vgl_box_3d<double> block_bb = block->bounding_box();
- tree_type* tree = block->get_tree();
-
- // get origin of block
- vgl_point_3d<double> min = block_bb.min_point();
-
- ncells = 1 << (tree->root_level() - (int)resolution_level);
-
- // assume that bounding box is a cube
- const double step_len = ((block_bb.max_x() - block_bb.min_x())/double(ncells));
-
- // origin should specify center of first cell
- vgl_point_3d<double> data_og(min.x() + (step_len/2.0), min.y() + (step_len/2.0), min.z() + (step_len/2.0));
-
- int data_size = ncells*ncells*ncells;
- float *data = nullptr;
- std::cout << "Data Size=" << data_size << std::endl;
- data = new (std::nothrow)float[data_size];
-
- if (data == nullptr) {
- std::cout << "boxm_save_block_raw: Could not allocate data!" << std::endl;
- return;
- }
- // init to zero
- for (float* dp = data; dp < data + ncells*ncells*ncells; ++dp) {
- *dp = 0.0f;
- }
-
- double out_cell_norm_volume = (tree->number_levels() - (int)resolution_level + 1);
- out_cell_norm_volume = out_cell_norm_volume*out_cell_norm_volume*out_cell_norm_volume;
-
- std::vector<boct_tree_cell<T_loc, T_data > *> cells = tree->leaf_cells();
- for (unsigned i=0; i<cells.size(); i++)
- {
- vgl_point_3d<double> node = tree->cell_bounding_box_local(cells[i]).min_point();
-
- float cell_val = boxm_cell_to_float(cells[i], step_len);
-
- unsigned int level = cells[i]->get_code().level;
- if (level == resolution_level) {
- // just copy value to output array
- //int out_index = static_cast<int>((node.x()/step_len)*ncells*ncells + (node.y()/step_len)*ncells + (node.z()/step_len));
- int out_index=static_cast<int>(ncells-1-(node.z()/step_len) + (node.y()/step_len)*ncells + (node.x()/step_len)*ncells*ncells);
- //////int out_index=static_cast<int>((node.z()/step_len) + (node.y()/step_len)*ncells + (node.x()/step_len)*ncells*ncells);
- //////int out_index=static_cast<int>(ncells-(node.z()/step_len)-1 + (node.x()/step_len)*ncells + (node.y()/step_len)*ncells*ncells);
-
- if (out_index >= data_size)
- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl;
- else
- data[out_index] = cell_val;
- }
- else if (level > resolution_level) {
- // cell is bigger than output cells. copy value to all contained output cells.
- const unsigned int us_factor = 1 << (level - resolution_level);
- const unsigned int node_x_start = static_cast<unsigned int>(node.x()/step_len);
- const unsigned int node_y_start = static_cast<unsigned int>(node.y()/step_len);
- const unsigned int node_z_start = static_cast<unsigned int>(node.z()/step_len);
- for (unsigned int z=node_z_start; z<node_z_start+us_factor; ++z) {
- for (unsigned int y=node_y_start; y<node_y_start+us_factor; ++y) {
- for (unsigned int x=node_x_start; x<node_x_start+us_factor; ++x) {
- //int out_index=x*y_size + y*ncells + z;
- int out_index=ncells-1-z + y*ncells + x*ncells*ncells;
- //////int out_index=z + y*ncells + x*ncells*ncells;
- //////int out_index=ncells-1-z + x*ncells + y*ncells*ncells;
-
- if (out_index >= data_size)
- std::cout << "boxm_save_block_raw, array out of index! " << out_index << " -- " << data_size << std::endl;
- else
- data[out_index] = cell_val;
- }
- }
- }
- }
- else {
- // cell is smaller than output cells. increment output cell value
- unsigned int ds_factor = 1 << (resolution_level - level);
- double update_weight = 1.0 / double(ds_factor*ds_factor*ds_factor);
- const unsigned int node_x = static_cast<unsigned int>(node.x()/step_len);
- const unsigned int node_y = static_cast<unsigned int>(node.y()/step_len);
- const unsigned int node_z = static_cast<unsigned int>(node.z()/step_len);
- //unsigned int out_index=node_x*y_size + node_y*ncells + node_z;
- int out_index=ncells-1-node_z + node_y*ncells + node_x*ncells*ncells;
- //////int out_index=node_z + node_y*ncells + node_x*ncells*ncells;
- //////int out_index=ncells-1-node_z + node_x*ncells + node_y*ncells*ncells;
-
- data[out_index] += float(cell_val*update_weight);
- }
- }
-
- // write the data into a bin file, generate a file name
- std::stringstream strm;
- strm << filename<< idx.x() << '_' << idx.y() << '_' << idx.z() << ".bin";
- std::string fn(strm.str());
- vsl_b_ofstream os(fn.c_str(),std::ios::binary);
- if (!os.os().good()) {
- std::cerr << "error opening " << filename << " for write!\n";
- return;
- }
-
- vsl_b_write(os, (unsigned int) ncells); // x dimension
- vsl_b_write(os, (unsigned int) ncells); // y dimension
- vsl_b_write(os, (unsigned int) ncells); // z dimension
-
- T_data minv = hist.min();
- T_data maxv = hist.max();
- T_data rangev = maxv-minv;
-
- float* dp = data;
- for (; dp < data + data_size; ++dp) {
- unsigned char c = (unsigned char)(std::floor((255.0f * float((*dp)-minv)/float(rangev)) + 0.5f));
- vsl_b_write(os, (char) c);
- }
- delete[] data;
- os.close();
- iter++;
- }
- assert(ncells > 0);
-
- scene.unload_active_blocks();
-
- // combine the blocks
- vgl_vector_3d<unsigned> dim = scene.world_dim();
- unsigned dimx = dim.x()*ncells;
- unsigned dimy = dim.y()*ncells;
- unsigned dimz = dim.z()*ncells;
- // we will read the data a column at a time and this is enough
- int row_data_size = ncells;
- char* byte_data = new (std::nothrow) char[row_data_size];
- if (byte_data == nullptr) {
- std::cout << "boxm_save_block_raw: Could not allocate byte data!" << std::endl;
- return;
- }
-
- // open the binary files streams, saved earlier
- unsigned int nx,ny,nz;
- vbl_array_3d<vsl_b_ifstream*> streams(dim.x(), dim.y(), dim.z());
- for (unsigned z=0; z<dim.z(); z++) {
- for (unsigned y=0; y<dim.y(); y++) {
- for (unsigned x=0; x<dim.x(); x++) {
- vsl_b_ifstream*& s = streams(x,y,z);
- std::stringstream strm;
- strm << filename << x << '_' << y << '_' << z << ".bin";
- std::string fn(strm.str());
- s = new vsl_b_ifstream(fn.c_str(),std::ios::binary);
- vsl_b_read(*s, nx);
- vsl_b_read(*s, ny);
- vsl_b_read(*s, nz);
- }
- }
- }
-
- // start writing the raw header
- unsigned char data_type = 0; // 0 means unsigned byte
- vxl_uint_32 nx_uint = dimx;
- vxl_uint_32 ny_uint = dimy;
- vxl_uint_32 nz_uint = dimz;
- std::ofstream os(filename.c_str(),std::ios::binary);
- if (!os.good()) {
- std::cerr << "error opening " << filename << " for write!\n";
- return;
- }
-
- os.write(reinterpret_cast<char*>(&data_type),sizeof(data_type));
- os.write(reinterpret_cast<char*>(&nx_uint),sizeof(nx_uint));
- os.write(reinterpret_cast<char*>(&ny_uint),sizeof(ny_uint));
- os.write(reinterpret_cast<char*>(&nz_uint),sizeof(nz_uint));
-
- // combine the column from streams to generate one raw file
- for (unsigned x=0; x<dim.x(); x++) {
- unsigned k=0;
- while (k<dim.y()*dim.z()*ncells*ncells*ncells) {
- for (unsigned y=0; y<dim.y(); y++) {
- unsigned j=0;
- while (j < ncells*ncells*dim.z()) {
- for (unsigned z=dim.z();z>0; z--) {
- vsl_b_ifstream* s=streams(x,y,z-1);
- s->is().read(byte_data, ncells);
- os.write((char*)byte_data,ncells);
- j+=ncells;
- k+=ncells;
- }
- }
- }
- }
- }
-
- os.close();
- delete[] byte_data;
-
- // remove the intermediate bin files
- for (unsigned z=0; z<dim.z(); z++) {
- for (unsigned y=0; y<dim.y(); y++) {
- for (unsigned x=0; x<dim.x(); x++) {
- vsl_b_ifstream*& s = streams(x,y,z);
- s->close();
- std::stringstream strm;
- strm << filename << x << '_' << y << '_' << z << ".bin";
- std::string fn(strm.str());
- std::cout << "Deleting " << fn << std::endl;
- vpl_unlink(fn.data());
- delete s;
- }
- }
- }
- std::cout << "Volume Histogram\n";
- hist.pretty_print();
- return;
-}
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/boxm_scene_levels_utils.h b/contrib/brl/bseg/boxm/algo/boxm_scene_levels_utils.h
deleted file mode 100644
index bdfb1db979..0000000000
--- a/contrib/brl/bseg/boxm/algo/boxm_scene_levels_utils.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// This is brl/bseg/boxm/algo/boxm_scene_levels_utils.h
-#ifndef boxm_scene_levels_utils_h
-#define boxm_scene_levels_utils_h
-//:
-// \file
-// \brief Functions to explore the levels of an octre
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 15-Sep-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <boxm/boxm_scene.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <class T_data>
-boxm_scene<boct_tree<short, bool> >* boxm_explore_cells_at_level(boxm_scene<boct_tree<short, T_data> > *scene_in, short level)
-{
- //parameters and structure of the output scene are the same as those of the input scene
- boxm_scene<boct_tree<short, bool> > *scene_out = new boxm_scene<boct_tree<short, bool> >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level());
- scene_out->set_paths(scene_in->path(), "level");
- scene_out->set_appearance_model(BOXM_BOOL);
- scene_out->write_scene("level.xml");
-
- scene_in->template clone_blocks_to_type<boct_tree<short, bool> >(*scene_out, false);
-
- //iterate through the leaf cells
- boxm_cell_iterator<boct_tree<short, T_data> > it_in =
- scene_in->cell_iterator(&boxm_scene<boct_tree<short, T_data> >::load_block, true);
- boxm_cell_iterator<boct_tree<short, bool> > it_out =
- scene_out->cell_iterator(&boxm_scene<boct_tree<short, bool> >::load_block);
-
- for (it_in.begin(), it_out.begin(); !it_in.end() && !it_out.end(); ++it_in, ++it_out)
- {
- boct_tree_cell<short,T_data > *cell_in = *it_in;
- boct_tree_cell<short,bool > *cell_out = *it_out;
-
- //check for level
- if ((cell_in->level() == level)) {
- cell_out->set_data(true);
- }
- }
-
- scene_in->unload_active_blocks();
- scene_out->unload_active_blocks();
-
- return scene_out;
-}
-
-
-template <class T_data>
-void boxm_remove_level_0_leaves(boxm_scene<boct_tree<short, T_data> > *scene_in)
-{
- typedef boct_tree<short,T_data> tree_type;
-
- //Iterate through the blocks
- boxm_block_iterator<tree_type> it_in = scene_in->iterator();
- for (it_in.begin(); !it_in.end(); ++it_in)
- {
- scene_in->load_block(it_in.index());
- tree_type *tree_in= (*it_in)->get_tree();
-
- std::vector<boct_tree_cell<short, T_data> * > all_cells = tree_in->all_cells();
- typename std::vector<boct_tree_cell<short, T_data> * >::iterator cells_it = all_cells.begin();
-
- for (; cells_it!=all_cells.end(); cells_it++) {
- boct_tree_cell<short, T_data> * cell_in = *cells_it;
- //check for level
- short level = cell_in->level();
- if (level == 0) {
- cell_in = nullptr;
- }
- else {
- if (level == 1)
- cell_in->set_children_null();
- //shift loccode one space to the rigth
- boct_loc_code<short> shift_code;
- shift_code.set_code(cell_in->get_code().x_loc_ >> 1, cell_in->get_code().y_loc_ >> 1, cell_in->get_code().z_loc_ >> 1);
- shift_code.set_level(level - 1);
- cell_in->set_code(shift_code);
- }
- }
-
- tree_in->reset_num_levels(tree_in->number_levels() - 1);
- scene_in->write_active_block();
- std::cout << '.';
- }
- std::cout << "\nCleaning\n";
- scene_in->unload_active_blocks();
-}
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/boxm_split_sample.h b/contrib/brl/bseg/boxm/algo/boxm_split_sample.h
deleted file mode 100644
index eb982606db..0000000000
--- a/contrib/brl/bseg/boxm/algo/boxm_split_sample.h
+++ /dev/null
@@ -1,105 +0,0 @@
-// This is brl/bseg/boxm/algo/boxm_split_sample.h
-#ifndef boxm_split_sample_h
-#define boxm_split_sample_h
-//:
-// \file
-// \brief A class enclosing set of functions to split a boxm_sample scenes/trees into appearance and occupancy scenes/trees
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date December 3, 2009
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <boxm/boxm_scene.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_apm_traits.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template<boxm_apm_type APM_MODEL>
-class boxm_split_sample
-{
- public:
- typedef boct_tree<short, boxm_sample<APM_MODEL> > sample_tree_type;
- typedef boct_tree_cell<short, boxm_sample<APM_MODEL> > sample_cell_type;
-
- typedef typename boxm_apm_traits<APM_MODEL>::apm_datatype apm_datatype;
- typedef boct_tree<short, apm_datatype> apm_tree_type;
- typedef boct_tree_cell<short, apm_datatype> apm_cell_type;
-
- typedef typename boxm_apm_traits<APM_MODEL>::obs_mathtype alpha_datatype;
- typedef boct_tree<short, alpha_datatype> alpha_tree_type;
- typedef boct_tree_cell<short, alpha_datatype> alpha_cell_type;
-
- //: A function to split an boxm_sample scene, into an appearance and an occupancy scene
- void split_scene(boxm_scene<sample_tree_type> &scene_in, boxm_scene<apm_tree_type> &apm_scene, boxm_scene<alpha_tree_type > &alpha_scene);
-
- //: A function to split an boxm_sample tree, into an appearance and an occupancy tree
- void split_tree(sample_tree_type *tree_in, apm_tree_type *apm_tree, alpha_tree_type *alpha_tree);
-};
-
-
-//: A function to split an boxm_sample scene, into an appearance and an occupancy scene
-template<boxm_apm_type APM_MODEL>
-void boxm_split_sample<APM_MODEL>::split_scene(boxm_scene<sample_tree_type> &scene_in,
- boxm_scene<apm_tree_type> &apm_scene,
- boxm_scene<alpha_tree_type > &alpha_scene)
-{
- //missing:check that dimensions of all scenes agree
-
- //iterate through blocks in the scenes
- boxm_block_iterator<sample_tree_type> iter_in = scene_in.iterator();
- boxm_block_iterator<apm_tree_type> apm_iter = apm_scene.iterator();
- boxm_block_iterator<alpha_tree_type> alpha_iter = alpha_scene.iterator();
-
- iter_in.begin();
- apm_iter.begin();
- alpha_iter.begin();
- while (!iter_in.end() || !apm_iter.end() ||!alpha_iter.end())
- {
- scene_in.load_block(iter_in.index());
- apm_scene.load_block(apm_iter.index());
- alpha_scene.load_block(alpha_iter.index());
-
- sample_tree_type *tree_in= (*iter_in)->get_tree();
- apm_tree_type *apm_tree = tree_in->template clone_to_type<apm_datatype>();
- alpha_tree_type *alpha_tree = tree_in->template clone_to_type<alpha_datatype>();
- this->split_tree(tree_in, apm_tree,alpha_tree);
- (*apm_iter)->init_tree(apm_tree);
- (*alpha_iter)->init_tree(alpha_tree);
- apm_scene.write_active_block();
- alpha_scene.write_active_block();
-
- iter_in++; apm_iter++; alpha_iter++;
- }
-}
-
-
-//: A function to split an boxm_sample tree, into an appearance and an occupancy tree
-template<boxm_apm_type APM_MODEL>
-void boxm_split_sample<APM_MODEL>::split_tree(sample_tree_type *tree_in, apm_tree_type *apm_tree, alpha_tree_type *alpha_tree)
-{
- //iterate through the trees
- std::vector<sample_cell_type*> sample_cells = tree_in->all_cells();
- std::vector<apm_cell_type*> apm_cells = apm_tree->all_cells();
- std::vector<alpha_cell_type*> alpha_cells = alpha_tree->all_cells();
-
- if (sample_cells.size()!=apm_cells.size() || apm_cells.size()!=alpha_cells.size()){
- std::cerr << "Different size vectors in split_sample_scene::split_tree\n";
- return;
- }
-
- for (unsigned i = 0; i < sample_cells.size(); i++)
- {
- boxm_sample<APM_MODEL> sample = sample_cells[i]->data();
- apm_cells[i]->set_data(sample.appearance_);
- alpha_cells[i]->set_data(sample.alpha);
- }
-}
-
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/boxm_upload_mesh.h b/contrib/brl/bseg/boxm/algo/boxm_upload_mesh.h
deleted file mode 100644
index 63fe2ff02b..0000000000
--- a/contrib/brl/bseg/boxm/algo/boxm_upload_mesh.h
+++ /dev/null
@@ -1,156 +0,0 @@
-#ifndef boxm_render_mesh_h_
-#define boxm_render_mesh_h_
-//:
-// \file
-#include <iostream>
-#include <boct/boct_tree.h>
-#include <boct/boct_tree_cell.h>
-#include <boxm/boxm_block.h>
-#include <boxm/boxm_scene.h>
-#include <imesh/imesh_mesh.h>
-#include <vpgl/vpgl_lvcs.h>
-#include <vgl/vgl_box_3d.h>
-#include <vgl/vgl_intersection.h>
-#include <vgl/algo/vgl_intersection.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <class T_loc, class T_data>
-void boxm_upload_mesh_into_block(boxm_block<boct_tree<T_loc, T_data> > *block,
- imesh_mesh& mesh, vpgl_lvcs& lvcs, bool use_lvcs, T_data val)
-{
- typedef boct_tree<T_loc, T_data> tree_type;
- tree_type* tree = block->get_tree();
- vgl_box_3d<double> block_bb = block->bounding_box();
- imesh_face_array_base& fs = mesh.faces();
- for (unsigned i=0; i < fs.size(); ++i)
- {
- std::list<vgl_point_3d<double> > v_list;
- imesh_vertex_array<3>& vertices = mesh.vertices<3>();
- vgl_box_3d<double> bb_scale, bb_global;
- for (unsigned j=0; j<fs.num_verts(i); ++j) {
- unsigned int v_id = fs(i,j);
- vgl_point_3d<double> v;
- if (use_lvcs) {
- double lx, ly, lz;
- lvcs.global_to_local(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2),
- vpgl_lvcs::wgs84,lx,ly,lz);
- v=vgl_point_3d<double>(lx,ly,lz);
- }
- else
- v=vgl_point_3d<double>(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2));
- bb_global.add(v);
- vgl_vector_3d<double> diff = v-block_bb.min_point(); // get the value according to the block origin
- v.set(diff.x(), diff.y(), diff.z());
- // the local coordinates inside the box region
- v_list.push_back(v);
- //convert the values into [0,1] range
- v.set(diff.x()/block_bb.width(),diff.y()/ block_bb.height(),diff.z()/ block_bb.depth());
- bb_scale.add(v);
- }
- // check if polygon's bounding box intersects with the block
- vgl_box_3d<double> inters = vgl_intersection(vgl_box_3d<double>(0,0,0,1,1,1), bb_scale);
- if (inters.is_empty())
- return;
-
- // locate the polygon bounding box in tree
- boct_tree_cell<T_loc,T_data>* region=tree->locate_region(inters);
- if (region) {
- // test all the children for intersection
- std::vector<boct_tree_cell<T_loc,T_data>*> children;
- if (!region->is_leaf())
- region->leaf_children(children);
- else // insert the node itself, if no children
- children.push_back(region);
- for (unsigned i=0; i<children.size(); i++) {
- boct_tree_cell<T_loc,T_data>* cell=children[i];
- vgl_box_3d<double> cell_bb=tree->cell_bounding_box_local(cell);
- if (vgl_intersection<double>(cell_bb, v_list)) {
- cell->set_data(val);
- }
- }
- }
- }
-}
-
-//: this is to copy mesh into existing tree and replacing the appearance model of the existing tree.
-template <>
-void boxm_upload_mesh_into_block(boxm_block<boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > > *block,
- imesh_mesh& mesh, vpgl_lvcs& lvcs,
- bool use_lvcs, boxm_sample<BOXM_APM_MOG_GREY> val)
-{
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- tree_type* tree = block->get_tree();
- vgl_box_3d<double> block_bb = block->bounding_box();
- imesh_face_array_base& fs = mesh.faces();
- for (unsigned i=0; i < fs.size(); ++i)
- {
- std::list<vgl_point_3d<double> > v_list;
- imesh_vertex_array<3>& vertices = mesh.vertices<3>();
- vgl_box_3d<double> bb_scale, bb_global;
- for (unsigned j=0; j<fs.num_verts(i); ++j) {
- unsigned int v_id = fs(i,j);
- vgl_point_3d<double> v;
- if (use_lvcs) {
- double lx, ly, lz;
- lvcs.global_to_local(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2),
- vpgl_lvcs::wgs84,lx,ly,lz);
- v=vgl_point_3d<double>(lx,ly,lz);
- }
- else
- v=vgl_point_3d<double>(vertices(v_id,0), vertices(v_id,1), vertices(v_id,2));
- bb_global.add(v);
- vgl_vector_3d<double> diff = v-block_bb.min_point(); // get the value according to the block origin
- v.set(diff.x(), diff.y(), diff.z());
- // the local coordinates inside the box region
- v_list.push_back(v);
- //convert the values into [0,1] range
- v.set(diff.x()/block_bb.width(),diff.y()/ block_bb.height(),diff.z()/ block_bb.depth());
- bb_scale.add(v);
- }
- // check if polygon's bounding box intersects with the block
- vgl_box_3d<double> inters = vgl_intersection(vgl_box_3d<double>(0,0,0,0.999,0.999,0.999), bb_scale);
- if (inters.is_empty())
- return;
-
- // locate the polygon bounding box in tree
- boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >* region=tree->locate_region(inters);
- if (region) {
- // test all the children for intersection
- std::vector<boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >*> children;
- if (!region->is_leaf())
- region->leaf_children(children);
- else // insert the node itself, if no children
- children.push_back(region);
- for (auto cell : children) {
- vgl_box_3d<double> cell_bb=tree->cell_bounding_box(cell);
- if (vgl_intersection<double>(cell_bb, v_list)) {
- boxm_sample<BOXM_APM_MOG_GREY> tempdata=cell->data();
- tempdata.set_appearance(val.appearance());
- tempdata.alpha*=val.alpha;
- cell->set_data(tempdata);
- }
- }
- }
- }
-}
-
-//: calls all the blocks for drawing meshes
-template <class T_loc, class T_data>
-void boxm_upload_mesh_into_scene(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- imesh_mesh& mesh, bool use_lvcs, T_data val)
-{
- typedef boct_tree<T_loc, T_data > tree_type;
- vpgl_lvcs lvcs=scene.lvcs();
- boxm_block_iterator<tree_type> iter(&scene);
- mesh.compute_face_normals(true);
- for (; !iter.end(); iter++) {
- scene.load_block(iter.index());
- boxm_block<tree_type>* block = *iter;
- boxm_upload_mesh_into_block(block, mesh, lvcs, use_lvcs, val);
- scene.write_active_block();
- }
-}
-
-#endif // boxm_render_mesh_h_
diff --git a/contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt
deleted file mode 100644
index 2a41c2db1a..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/CMakeLists.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-# boxm's Process Library
-
-# bprb depends on expat and bvxm_pro depends on bprb primarily
-FIND_PACKAGE(EXPAT REQUIRED)
-FIND_PACKAGE(EXPATPP REQUIRED)
-
-if(EXPAT_FOUND)
- include_directories( ${BRL_INCLUDE_DIR}/bpro )
- include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb )
- include_directories( ${BRL_INCLUDE_DIR}/bseg )
- include_directories( ${GEL_INCLUDE_DIR}/mrc/vpgl )
- include_directories( ${GEL_INCLUDE_DIR}/mrc )
-
-FIND_PACKAGE(RPLY REQUIRED)
-if(RPLY_FOUND)
- include_directories( ${RPLY_INCLUDE_DIR} )
-else()
- include_directories( ${VTHREEP_INCLUDE_DIR}/rply )
-endif()
-
- set(boxm_algo_pro_sources
- boxm_algo_processes.h
- boxm_algo_register.h boxm_algo_register.cxx
- )
-
- #aux_source_directory(Templates boxm_algo_pro_sources)
- aux_source_directory(processes boxm_algo_pro_sources)
-
- vxl_add_library(LIBRARY_NAME boxm_algo_pro LIBRARY_SOURCES ${boxm_algo_pro_sources} )
-
- target_link_libraries(boxm_algo_pro boxm_algo boxm boxm_sample boxm_util boct bprb brdb bsta_pro vil_pro bsta vpgl_pro ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vpgl_algo ${VXL_LIB_PREFIX}vil vsol ${VXL_LIB_PREFIX}vgl brip ${VXL_LIB_PREFIX}vcl rply)
- # Need bsta_pro only for the instantiation of brdb_value_t<vbl_smart_ptr<bsta_histogram_base> >
- # Need vpgl_pro only for the instantiation of brdb_value_t<vbl_smart_ptr<vpgl_camera<double> > >
- # Need vil_pro only for the instantiation of brdb_value_t<vil_smart_ptr<vil_image_view_base> >
-
- if( BUILD_TESTING )
- add_subdirectory(tests)
- endif()
-
-endif()
diff --git a/contrib/brl/bseg/boxm/algo/pro/boxm_algo_processes.h b/contrib/brl/bseg/boxm/algo/pro/boxm_algo_processes.h
deleted file mode 100644
index f22427eeed..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/boxm_algo_processes.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef boxm_algo_processes_h_
-#define boxm_algo_processes_h_
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_macros.h>
-
-//the init functions
-DECLARE_FUNC_CONS(boxm_describe_scene_process);
-DECLARE_FUNC_CONS(boxm_init_scene_process);
-DECLARE_FUNC_CONS(boxm_line_backproject_process);
-DECLARE_FUNC_CONS(boxm_refine_scene_process);
-DECLARE_FUNC_CONS(boxm_replace_const_app_process);
-DECLARE_FUNC_CONS(boxm_roi_init_process);
-DECLARE_FUNC_CONS(boxm_roi_init_rational_camera_process);
-DECLARE_FUNC_CONS(boxm_save_occupancy_raw_process);
-DECLARE_FUNC_CONS(boxm_save_scene_raw_process);
-DECLARE_FUNC_CONS(boxm_render_expected_edge_vrml_process);
-DECLARE_FUNC_CONS(boxm_merge_mixtures_process);
-DECLARE_FUNC_CONS(boxm_split_scene_process);
-DECLARE_FUNC_CONS(boxm_compute_scene_difference_process);
-DECLARE_FUNC_CONS(boxm_compute_entropy_process);
-DECLARE_FUNC_CONS(boxm_compute_expected_color_scene_process);
-DECLARE_FUNC_CONS(boxm_linear_combination_process);
-DECLARE_FUNC_CONS(boxm_explore_cells_at_level_process);
-DECLARE_FUNC_CONS(boxm_fill_internal_cells_process);
-DECLARE_FUNC_CONS(boxm_remove_level0_process);
-DECLARE_FUNC_CONS(boxm_create_scene_from_ply_process);
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/pro/boxm_algo_register.cxx b/contrib/brl/bseg/boxm/algo/pro/boxm_algo_register.cxx
deleted file mode 100644
index b883c164fa..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/boxm_algo_register.cxx
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "boxm_algo_register.h"
-
-#include <bprb/bprb_macros.h>
-#include <bprb/bprb_batch_process_manager.h>
-#include <bprb/bprb_func_process.h>
-
-#include "boxm_algo_processes.h"
-
-void boxm_algo_register::register_datatype()
-{
-}
-
-void boxm_algo_register::register_process()
-{
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_describe_scene_process,"boxmDescribeSceneProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_init_scene_process,"boxmInitSceneProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_line_backproject_process,"boxmLineBackprojectProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_refine_scene_process, "boxmRefineSceneProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_replace_const_app_process,"boxmReplaceConstAppProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_roi_init_process, "boxmROIInitProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_roi_init_rational_camera_process, "boxmROIInitRationalCameraProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_save_occupancy_raw_process, "boxmSaveOccupancyRawProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_save_scene_raw_process, "boxmSaveSceneRawProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_render_expected_edge_vrml_process, "boxmRenderExpectedEdgeVRMLProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_merge_mixtures_process, "boxmMergeMixturesProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_split_scene_process ,"boxmSplitSceneProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_compute_scene_difference_process, "boxmComputeSceneDifferenceProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_compute_entropy_process, "boxmComputeEntropyProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_compute_expected_color_scene_process, "boxmComputeExpectedColorSceneProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_linear_combination_process, "boxmLinearCombinationProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_explore_cells_at_level_process, "boxmExploreCellsAtLevelProcess");
- REG_PROCESS_FUNC_CONS2(boxm_fill_internal_cells_process);
- REG_PROCESS_FUNC_CONS2(boxm_remove_level0_process);
- REG_PROCESS_FUNC_CONS2(boxm_create_scene_from_ply_process);
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/boxm_algo_register.h b/contrib/brl/bseg/boxm/algo/pro/boxm_algo_register.h
deleted file mode 100644
index 3c21937894..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/boxm_algo_register.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef boxm_algo_register_h_
-#define boxm_algo_register_h_
-
-class boxm_algo_register
-{
- public:
- static void register_datatype();
- static void register_process();
-};
-
-#endif // boxm_algo_register_h_
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_entropy_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_entropy_process.cxx
deleted file mode 100644
index 1b8cf32459..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_entropy_process.cxx
+++ /dev/null
@@ -1,83 +0,0 @@
-//:
-// \file
-// \brief A process that outputs the differential entropy of the gaussian stored at every leave cell
-// \author Isabel Restrepo
-// \date 15-Nov-2010
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <boxm/algo/boxm_merge_mog.h>
-
-
-//:global variables
-namespace boxm_compute_entropy_process_globals
-{
- constexpr unsigned n_inputs_ = 1;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//:sets input and output types
-bool boxm_compute_entropy_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_compute_entropy_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool boxm_compute_entropy_process(bprb_func_process& pro)
-{
- using namespace boxm_compute_entropy_process_globals;
-
- if (pro.n_inputs() != n_inputs_)
- {
- std::cout << pro.name() << ": the input number should be " << n_inputs_
- << " but instead it is " << pro.n_inputs() << std::endl;
- return false;
- }
-
- //get inputs:
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(0);
-
- //check input's validity
- if (!scene_base.ptr()) {
- std::cout << " :-- Scene is not valid!\n";
- return false;
- }
-
- //:Note initial implementation is for fixed types, but this can be changed if more cases are needed
-
- typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
- typedef boct_tree<short, gauss_type> gauss_tree_type;
-
- auto *gauss_scene = dynamic_cast<boxm_scene<gauss_tree_type>* > (scene_base.as_pointer());
-
- //check input's validity
- if (!gauss_scene) {
- std::cout << " :-- Scene is not of valid type!\n";
- return false;
- }
-
- //parameters and structure of the output scene are the same as those of the input scene
- boxm_scene<boct_tree<short, float> > *entropy_scene = new boxm_scene<boct_tree<short, float> >(gauss_scene->lvcs(), gauss_scene->origin(), gauss_scene->block_dim(), gauss_scene->world_dim(), gauss_scene->max_level(), gauss_scene->init_level());
- entropy_scene->set_paths(gauss_scene->path(), "entropy");
- entropy_scene->set_appearance_model(BOXM_FLOAT);
-
- compute_differential_entropy(*gauss_scene, *entropy_scene);
- gauss_scene->write_scene("entropy_scene.xml");
- pro.set_output_val<boxm_scene_base_sptr>(0, entropy_scene);
- std::cout<<"Exiting" << std::endl;
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_expected_color_scene_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_expected_color_scene_process.cxx
deleted file mode 100644
index e99f978d28..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_expected_color_scene_process.cxx
+++ /dev/null
@@ -1,83 +0,0 @@
-//:
-// \file
-// \brief A process that computes the "expected visible color" at each voxel
-// \author Isabel Restrepo
-// \date 17-Nov-2010
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <boxm/algo/boxm_merge_mog.h>
-
-
-//:global variables
-namespace boxm_compute_expected_color_scene_process_globals
-{
- constexpr unsigned n_inputs_ = 2;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//:sets input and output types
-bool boxm_compute_expected_color_scene_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_compute_expected_color_scene_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "float"; //offset for appearance values
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool boxm_compute_expected_color_scene_process(bprb_func_process& pro)
-{
- using namespace boxm_compute_expected_color_scene_process_globals;
-
- if (pro.n_inputs() != n_inputs_)
- {
- std::cout << pro.name() << ": the input number should be " << n_inputs_
- << " but instead it is " << pro.n_inputs() << std::endl;
- return false;
- }
-
- //get inputs:
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(0);
- auto grey_offset = pro.get_input<float>(1);
-
- //check input's validity
- if (!scene_base.ptr()) {
- std::cout << " :-- Scene is not valid!\n";
- return false;
- }
-
- //:Note initial implementation is for fixed types, but this can be changed if more cases are needed
-
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > scene_tree_type;
-
- auto *scene = dynamic_cast<boxm_scene<scene_tree_type>* > (scene_base.as_pointer());
-
- //check input's validity
- if (!scene) {
- std::cout << " :-- Scene is not of valid type!\n";
- return false;
- }
-
- //parameters and structure of the output scene are the same as those of the input scene
- boxm_scene<boct_tree<short, float> > *mean_color_scene = new boxm_scene<boct_tree<short, float> >(scene->lvcs(), scene->origin(), scene->block_dim(), scene->world_dim(), scene->max_level(), scene->init_level());
- mean_color_scene->set_paths(scene->path(), "mean_color");
- mean_color_scene->set_appearance_model(BOXM_FLOAT);
-
- compute_expected_color(*scene, *mean_color_scene, grey_offset);
- mean_color_scene->write_scene("mean_color_scene.xml");
- pro.set_output_val<boxm_scene_base_sptr>(0, mean_color_scene);
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_scene_difference_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_scene_difference_process.cxx
deleted file mode 100644
index f7efed8c52..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_compute_scene_difference_process.cxx
+++ /dev/null
@@ -1,91 +0,0 @@
-// This is brl/bseg/boxm/algo/pro/processes/boxm_compute_scene_difference_process.cxx
-
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-//:
-// \file
-// \brief A process for computing the difference between two scenes.
-//
-// \author Vishal Jain
-// \date Sept 8, 2010
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_scene_parser.h>
-#include <boxm/algo/boxm_compute_scene_difference.h>
-
-//: global variables
-namespace boxm_compute_scene_difference_process_globals
-{
- //this process takes no outputs
- constexpr unsigned n_inputs_ = 4;
- constexpr unsigned n_outputs_ = 0;
-}
-
-//: sets input and output types
-bool boxm_compute_scene_difference_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_compute_scene_difference_process_globals;
-
- // process takes 1 input and no outputs
- //input[0]: The scene
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "boxm_scene_base_sptr";
- input_types_[2] = "boxm_scene_base_sptr";
- input_types_[3] = "float";
-
- std::vector<std::string> output_types_(n_outputs_);
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-//: creates a scene from parameters
-bool boxm_compute_scene_difference_process(bprb_func_process& pro)
-{
- using namespace boxm_compute_scene_difference_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << "boxm_compute_scene_difference_process: The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get inputs:
- unsigned i = 0;
- boxm_scene_base_sptr scene1_ptr = pro.get_input<boxm_scene_base_sptr>(i++);
- boxm_scene_base_sptr scene2_ptr = pro.get_input<boxm_scene_base_sptr>(i++);
- boxm_scene_base_sptr sceneout_ptr = pro.get_input<boxm_scene_base_sptr>(i++);
- auto t = pro.get_input<float>(i++);
-
- if (scene1_ptr->appearence_model() == BOXM_APM_MOG_GREY &&
- scene2_ptr->appearence_model() == BOXM_APM_MOG_GREY &&
- sceneout_ptr->appearence_model() == BOXM_APM_MOG_GREY )
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto *scene1 = static_cast<boxm_scene<tree_type>*> (scene1_ptr.as_pointer());
- auto *scene2 = static_cast<boxm_scene<tree_type>*> (scene2_ptr.as_pointer());
- auto *sceneout = static_cast<boxm_scene<tree_type>*> (sceneout_ptr.as_pointer());
-
- boxm_compute_scene_difference(*scene1,*scene2,*sceneout,t);
- }
- else {
- std::cout << "boxm_compute_scene_difference_process: undefined APM type" << std::endl;
- return false;
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_create_scene_from_ply_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_create_scene_from_ply_process.cxx
deleted file mode 100644
index fdf40edf0e..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_create_scene_from_ply_process.cxx
+++ /dev/null
@@ -1,257 +0,0 @@
-//:
-// \file
-// \brief A process that creates a boxm scene from a .ply file
-// \author Isabel Restrepo
-// \date 2-Jan-2012
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <boxm/boxm_scene.h>
-#include <rply.h> //.ply parser
-#include <cassert>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boct/util/boct_construct_tree.h>
-#define DEBUG_PLY
-
-class boxm_vgl_point_3d_coord_compare
-{
- public:
- boxm_vgl_point_3d_coord_compare() = default;
- ~boxm_vgl_point_3d_coord_compare() = default;
-
- bool operator() ( vgl_point_3d<int> const& pa, vgl_point_3d<int> pb ) const
- {
- if ( pa.x() != pb.x() ) return pa.x() < pb.x();
- else if ( pa.y() != pb.y() ) return pa.y() < pb.y();
- else return pa.z() < pb.z();
- }
-};
-
-
-class boxm_apperace_fileio_parsed_ply_
-{
- public:
- double p[3]; //holds location
- unsigned char color; //holds color
- double grey_offset; //offset the floating point (0,1) color value
- //accumulated data in the shape of leaf cells
- std::map<vgl_point_3d<int>, std::vector<boct_tree_cell<short, float> >, boxm_vgl_point_3d_coord_compare > data;
- boxm_scene<boct_tree<short, float> > *scene;
-};
-
-bool boxm_load_color_ply(const std::string &ply_file, boxm_scene<boct_tree<short, float> > *scene,
- std::map<vgl_point_3d<int>,
- std::vector<boct_tree_cell<short, float> >,boxm_vgl_point_3d_coord_compare > &data,
- const float &grey_offset);
-
-//: Call-back function for a "vertex" element
-int boxm_plyio_vertex_cb_(p_ply_argument argument);
-
-//: global variables
-namespace boxm_create_scene_from_ply_process_globals
-{
- constexpr unsigned n_inputs_ = 3;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//: sets input and output types
-bool boxm_create_scene_from_ply_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_create_scene_from_ply_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vcl_string"; //path to .ply file
- input_types_[1] = "boxm_scene_base_sptr"; //the scene to fill up
- input_types_[2] = "float"; //offset for appearance values
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//: the process
-bool boxm_create_scene_from_ply_process(bprb_func_process& pro)
-{
- using namespace boxm_create_scene_from_ply_process_globals;
-
- if (pro.n_inputs() != n_inputs_)
- {
- std::cout << pro.name() << ": the input number should be " << n_inputs_
- << " but instead it is " << pro.n_inputs() << std::endl;
- return false;
- }
-
- //get inputs:
- std::string ply_file = pro.get_input<std::string>(0);
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(1);
- auto grey_offset = pro.get_input<float>(2);
-
- // Note initial implementation is for fixed types, but this can be changed if more cases are needed
- // cast input scene
- auto *scene = dynamic_cast<boxm_scene<boct_tree<short, float> >* > (scene_base.as_pointer());
-
- //check input's validity
- if (!scene_base.ptr()) {
- std::cout << " :-- Scene is not valid!\n";
- return false;
- }
-
- // Map to hold the index of block and the cell containing appearance (0,1)
- std::map<vgl_point_3d<int>, std::vector<boct_tree_cell<short, float> >, boxm_vgl_point_3d_coord_compare > data;
-
- boxm_block_iterator<boct_tree<short, float> > block_iter = scene->iterator();
-
- for (block_iter.begin(); !block_iter.end(); ++block_iter)
- {
- data[block_iter.index()]= std::vector<boct_tree_cell<short, float> >();
- }
-
- if (!boxm_load_color_ply(ply_file, scene, data, grey_offset)){
- pro.set_output_val<boxm_scene_base_sptr>(0, nullptr);
- return false;
- }
-
-
- //construct trees
- for (block_iter.begin(); !block_iter.end(); ++block_iter)
- {
- std::cout << "In block: " << block_iter.index() << "Number of leaves: " <<data[block_iter.index()].size() << std::endl;
- boct_tree_cell<short, float>* root = boct_construct_tree(data[block_iter.index()], scene->max_level(), 0.0f );
- auto* tree = new boct_tree<short,float>(root, scene->max_level());
- vgl_box_3d<double> tree_bbox= scene->get_block_bbox(block_iter.index());
- tree->set_bbox(tree_bbox);
-
- scene->load_block(block_iter.index());
- (*block_iter)->init_tree(tree);
- scene->write_active_block();
- data[block_iter.index()].clear();
- }
-
- pro.set_output_val<boxm_scene_base_sptr>(0, scene);
-
- return true;
-}
-
-
-// ============================== PLY ==============================
-
-
-bool boxm_load_color_ply(const std::string &ply_file, boxm_scene<boct_tree<short, float> > *scene,
- std::map<vgl_point_3d<int>,
- std::vector<boct_tree_cell<short, float> >,boxm_vgl_point_3d_coord_compare > &data,
- const float &grey_offset)
-{
- long nvertices;
-
- boxm_apperace_fileio_parsed_ply_ parsed_ply;
- parsed_ply.grey_offset = grey_offset;
- parsed_ply.data = data;
- parsed_ply.scene = scene;
-
-
- // OPEN file
-#ifdef DEBUG_PLY
- std::cerr << " loading " << ply_file << " :\n";
- std::cerr << " gray_offset " << parsed_ply.grey_offset << grey_offset << " :\n";
-
-#endif
-
- p_ply ply = ply_open(ply_file.c_str(), nullptr, 0, nullptr);
- if (!ply){
- std::cerr << "Couldn't open ply file: " << ply_file << '\n';
- return false;
- }
-
- // Read HEADER
- if (!ply_read_header(ply)) return false;
-
- // vertex
- nvertices =
- ply_set_read_cb(ply, "vertex", "x",
- boxm_plyio_vertex_cb_, (void*) (&parsed_ply), 0);
- ply_set_read_cb(ply, "vertex", "y",
- boxm_plyio_vertex_cb_, (void*) (&parsed_ply), 1);
- ply_set_read_cb(ply, "vertex", "z",
- boxm_plyio_vertex_cb_, (void*) (&parsed_ply), 2);
- ply_set_read_cb(ply, "vertex", "diffuse_red",
- boxm_plyio_vertex_cb_, (void*) (&parsed_ply), 3);
-
-#ifdef DEBUG_PLY
- std::cerr << nvertices << " points\n";
-#endif
-
- // Read DATA
- if (!ply_read(ply)) return false;
-
- // CLOSE file
- ply_close(ply);
-
- data=parsed_ply.data;
-
-#ifdef DEBUG_PLY
- std::cerr << " done.\n";
-#endif
-
- return true;
-}
-
-
-//: Call-back function for a "vertex" element
-int boxm_plyio_vertex_cb_(p_ply_argument argument)
-{
- long index;
- void* temp;
- ply_get_argument_user_data(argument, &temp, &index);
-
- auto* parsed_ply = (boxm_apperace_fileio_parsed_ply_*) temp;
- //std::cout << "color: " << parsed_ply->grey_offset << std::endl;
-
- switch (index)
- {
- case 0: // "x" coordinate
- parsed_ply->p[0] = ply_get_argument_value(argument);
- break;
- case 1: // "y" coordinate
- parsed_ply->p[1] = ply_get_argument_value(argument);
- break;
- case 2: // "z" coordinate
- parsed_ply->p[2] = ply_get_argument_value(argument);
- break;
- case 3:
- {
- parsed_ply->color = (unsigned char)ply_get_argument_value(argument);
- //insert data
- vgl_point_3d<int> block_index(-1,-1,-1);
- if (parsed_ply->scene->get_block_index(vgl_point_3d<double>(parsed_ply->p), block_index))
- {
- //convert point into local(tree coordinates)
- vgl_box_3d<double> global_bbox= parsed_ply->scene->get_block_bbox(block_index);
- vgl_point_3d<double> norm_p((parsed_ply->p[0]-global_bbox.min_x())/global_bbox.width(),
- (parsed_ply->p[1]-global_bbox.min_y())/global_bbox.height(),
- (parsed_ply->p[2]-global_bbox.min_z())/global_bbox.depth());
- // convert point to location code.
- boct_loc_code<short> loc_code(norm_p, parsed_ply->scene->max_level()-1);
- boct_tree_cell<short, float> leaf_cell(loc_code);
- float expected_color = float(parsed_ply->color)/255.0f + float(parsed_ply->grey_offset);
- if (expected_color > 2.0f || expected_color < 0.0f)
- std::cout << "color: " << parsed_ply->grey_offset << std::endl;
- leaf_cell.set_data(expected_color);
- parsed_ply->data[block_index].push_back(leaf_cell);
- }
- break;
- }
- default:
- assert(!"This should not happen: index out of range");
- break;
- }
- return 1;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_describe_scene_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_describe_scene_process.cxx
deleted file mode 100644
index 2fb47d460f..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_describe_scene_process.cxx
+++ /dev/null
@@ -1,106 +0,0 @@
-// This is brl/bseg/boxm/algo/pro/processes/boxm_describe_scene_process.cxx
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A process for describing the attributes of a scene
-//
-// \author J.L. Mundy
-// \date January 24, 2010
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/boxm_compute_scene_statistics.h>
-#include <boxm/boxm_apm_traits.h>
-#include <bsta/bsta_histogram_sptr.h>
-
-namespace boxm_describe_scene_process_globals
-{
- constexpr unsigned n_inputs_ = 1;
- constexpr unsigned n_outputs_ = 4;
-}
-
-bool boxm_describe_scene_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_describe_scene_process_globals;
-
- //process takes 1 input
- //input[0]: scene binary file
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
-
- // process has 4 outputs:
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "bsta_histogram_sptr"; // Omega Histogram
- output_types_[1] = "bsta_histogram_sptr"; // Sigma Histogram
- output_types_[2] = "bsta_histogram_sptr"; // Level Histogram
- output_types_[3] = "unsigned"; // Number of leaves
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-// This process produces four outputs
-// 1) The distribution of "Omega" values where Omega = 1-e^( alpha x length )
-// 2) The distribution of "Sigma" values where Sigma is the std_dev of
-// the appearance model. (currently implemented only for simple grey)
-// 3) The histogram of levels for leaves in the octree
-// 4) The number of leaves in the tree
-//
-bool boxm_describe_scene_process(bprb_func_process& pro)
-{
- using namespace boxm_describe_scene_process_globals;
-
- if ( !pro.verify_inputs() ) {
- std::cerr << pro.name() << ": invalid inputs\n";
- return false;
- }
- unsigned n_leaves = 0;
- //assign tree type
- boxm_scene_base_sptr scene_ptr = pro.get_input<boxm_scene_base_sptr>(0);
- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) {
- if (!scene_ptr->multi_bin())
- {
- std::cerr<<"boxm_describe_scene_process not yet implemented for Gaussian mixture\n";
- return false;//not implemented
- }
- else
- {
- std::cerr<<"boxm_describe_scene_process not yet implemented for multi-bin/Gaussian mixture\n";
- return false;
- }
- }
- else if (scene_ptr->appearence_model() == BOXM_APM_SIMPLE_GREY)
- {
- if (!scene_ptr->multi_bin()) {
- typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
- auto* scene = dynamic_cast<boxm_scene<tree_type> *> (scene_ptr.as_pointer());
-
- bsta_histogram<float> omega_hist, sigma_hist, level_hist;
- if (!compute_scene_statistics(*scene, omega_hist, sigma_hist,
- level_hist, n_leaves))
- return false;
- std::cout << "Omega Hist\n";
- omega_hist.print_vals_prob();
- std::cout << "Sigma Hist\n";
- sigma_hist.print_vals_prob();
- std::cout << "Level Hist\n";
- level_hist.print_vals_prob();
- std::cout << "Number of Leaves " << n_leaves << '\n';
- pro.set_output_val<bsta_histogram_sptr>(0, new bsta_histogram<float>(omega_hist));
- pro.set_output_val<bsta_histogram_sptr>(1, new bsta_histogram<float>(sigma_hist));
- pro.set_output_val<bsta_histogram_sptr>(2, new bsta_histogram<float>(level_hist));
- pro.set_output_val<unsigned>(3, n_leaves);
- }
- else {
- std::cerr<<"boxm_describe_scene_process not yet implemented for multi-bin/simple_grey\n";
- return false;
- }
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_explore_cells_at_level_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_explore_cells_at_level_process.cxx
deleted file mode 100644
index 1dfc74a8ee..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_explore_cells_at_level_process.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-//:
-// \file
-// \brief A process to label cells at a given leve
-// \author Isabel Restrepo
-// \date 15-Sep-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-#include <brdb/brdb_value.h>
-
-#include <boxm/algo/boxm_scene_levels_utils.h>
-
-
-//:global variables
-namespace boxm_explore_cells_at_level_process_globals
-{
- constexpr unsigned n_inputs_ = 2;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//:sets input and output types
-bool boxm_explore_cells_at_level_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_explore_cells_at_level_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr"; //scene in
- input_types_[1] = "unsigned"; //octree level
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr"; //label scene
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool boxm_explore_cells_at_level_process(bprb_func_process& pro)
-{
- using namespace boxm_explore_cells_at_level_process_globals;
-
- //get inputs
- boxm_scene_base_sptr scene_in_base = pro.get_input<boxm_scene_base_sptr>(0);
- auto level = pro.get_input<unsigned>(1);
-
- if (scene_in_base->appearence_model() == BOXM_FLOAT)
- {
- typedef boct_tree<short, float > type;
-
- auto* scene = dynamic_cast<boxm_scene<type>*>(scene_in_base.as_pointer());
-
- if (!scene)
- return false;
-
- //store output
- pro.set_output_val<boxm_scene_base_sptr>(0, boxm_explore_cells_at_level(scene,level));
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_fill_internal_cells_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_fill_internal_cells_process.cxx
deleted file mode 100644
index c222d74cd7..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_fill_internal_cells_process.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-// This is brl/bseg/boxm/algo/pro/processes/boxm_fill_internal_cells_process.cxx
-//:
-// \file
-// \brief process fills the internal cells of the octrees in the scene
-//
-// \author Isabel Restrepo
-// \date December 3, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bprb/bprb_func_process.h>
-#include <boxm/algo/boxm_fill_internal_cells.h>
-
-#include <bprb/bprb_parameters.h>
-#include <brdb/brdb_value.h>
-
-
-namespace boxm_fill_internal_cells_process_globals
-{
- constexpr unsigned n_inputs_ = 1;
- constexpr unsigned n_outputs_ = 1;
-}
-
-//: process takes 1 input and 1 output.
-// input[0]: The input scene
-// output[0]: The output scene
-
-bool boxm_fill_internal_cells_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_fill_internal_cells_process_globals;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_fill_internal_cells_process(bprb_func_process& pro)
-{
- using namespace boxm_fill_internal_cells_process_globals;
-
- if (pro.n_inputs() != n_inputs_)
- {
- std::cout << pro.name() << ": the number of inputs should be " << n_inputs_
- << " but instead it is " << pro.n_inputs() << std::endl;
- return false;
- }
-
- //get inputs:
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(0);
-
- //check input's validity
- if (!scene_base.ptr()) {
- std::cout << " :-- Grid is not valid!\n";
- return false;
- }
-
- if (auto *scene_in = dynamic_cast<boxm_scene<boct_tree<short, float> >* > (scene_base.as_pointer()))
- {
- boxm_fill_internal_cells<float> filler;
- pro.set_output_val<boxm_scene_base_sptr>(0, filler.traverse_and_fill(scene_in));
- return true;
- }
-
- std::cerr << "In boxm_fill_internal_cells_process: Unsupportted scene type\n";
- return false;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_init_scene_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_init_scene_process.cxx
deleted file mode 100644
index e023ca2500..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_init_scene_process.cxx
+++ /dev/null
@@ -1,111 +0,0 @@
-// This is brl/bseg/boxm/algo/pro/processes/boxm_init_scene_process.cxx
-
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-//:
-// \file
-// \brief A process for initializing a new boxm_scene when there is not a saved one.
-// It receives the parameters from a parameter file in XML
-//
-// \author Vishal Jain
-// \date Feb 8, 2010
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <boxm/boxm_scene_parser.h>
-#include <boxm/algo/boxm_init_scene.h>
-
-//: global variables
-namespace boxm_init_scene_process_globals
-{
- //this process takes no outputs
- constexpr unsigned n_inputs_ = 1;
- constexpr unsigned n_outputs_ = 0;
-}
-
-//: sets input and output types
-bool boxm_init_scene_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_init_scene_process_globals;
-
- // process takes 1 input and no outputs
- //input[0]: The scene
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
-
- std::vector<std::string> output_types_(n_outputs_);
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-//: creates a scene from parameters
-bool boxm_init_scene_process(bprb_func_process& pro)
-{
- using namespace boxm_init_scene_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << "boxm_init_scene_process: The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get inputs:
- unsigned i = 0;
- boxm_scene_base_sptr scene = pro.get_input<boxm_scene_base_sptr>(i++);
-
- // check the input validity
- if (scene == nullptr) {
- std::cout << "boxm_init_scene_process: scene is null, cannot run" << std::endl;
- return false;
- }
-
- if (scene->appearence_model() == BOXM_APM_MOG_GREY) {
- if (!scene->multi_bin()) {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- boxm_init_scene<BOXM_APM_MOG_GREY>(*s);
- }
- }
- else if (scene->appearence_model() == BOXM_APM_SIMPLE_GREY) {
- if (scene->multi_bin()) {
- std::cout << "boxm_init_scene_process: multibin case is not implemented for BOXM_APM_SIMPLE_GREY yet" << std::endl;
- return false;
- }
- else {
- typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- boxm_init_scene<BOXM_APM_SIMPLE_GREY>(*s);
- }
- }
- else if (scene->appearence_model() == BOXM_APM_MOB_GREY) {
- if (scene->multi_bin()) {
- std::cout << "boxm_init_scene_process: multibin case is not implemented for BOXM_APM_SIMPLE_GREY yet" << std::endl;
- return false;
- }
- else {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOB_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- boxm_init_scene<BOXM_APM_MOB_GREY >(*s);
- }
- }
- else {
- std::cout << "boxm_init_scene_process: undefined APM type" << std::endl;
- return false;
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_line_backproject_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_line_backproject_process.cxx
deleted file mode 100644
index b8767b24bc..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_line_backproject_process.cxx
+++ /dev/null
@@ -1,259 +0,0 @@
-// This is brl/bseg/boxm/algo/pro/processes/boxm_line_backproject_process.cxx
-#include <iostream>
-#include <cstdio>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A process for computing the backprojection of lines.
-// Lines are represented as an image with 3 plane images (plane 0=a, plane1=b,
-// plane2=c, line is defined as ax+by=c). The backprojection, which is a plane
-// is stored as an other image with 4 planes (ax+by+cz=d) as the output.
-//
-// \author Gamze Tunali
-// \date Feb 4, 2010
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bprb/bprb_parameters.h>
-#include <brdb/brdb_value.h>
-
-#include <vpgl/vpgl_proj_camera.h>
-#include <vpgl/vpgl_perspective_camera.h>
-#include <vpgl/vpgl_local_rational_camera.h>
-#include <vpgl/algo/vpgl_ray.h>
-
-#include <vgl/vgl_plane_3d.h>
-
-#include <vil/vil_image_view_base.h>
-#include <vil/vil_image_view.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-//: globals
-namespace boxm_line_backproject_process_globals
-{
- constexpr unsigned n_inputs_ = 2;
- constexpr unsigned n_outputs_ = 1;
-}
-
-//: set input and output types
-// process takes 2 inputs and has 1 output:
-// input[0]: The edge image (vil_image_view<float> with three planes for (a,b,c))
-// input[1]: camera
-// output[0]: The plane image
-bool boxm_line_backproject_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_line_backproject_process_globals;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "vil_image_view_base_sptr";
- input_types_[i++] = "vpgl_camera_double_sptr";
-
- std::vector<std::string> output_types_(n_outputs_);
- unsigned j = 0;
- output_types_[j++] = "vil_image_view_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-vpgl_rational_camera<double>
-perspective_to_rational(vpgl_perspective_camera<double>&cam_pers)
-{
- vnl_matrix_fixed<double,3,4> cam_pers_matrix = cam_pers.get_matrix();
- std::vector<double> neu_u,den_u,neu_v,den_v;
- double x_scale = 1.0, x_off = 0.0, y_scale = 1.0, y_off = 0.0, z_scale = 1.0, z_off = 0.0, u_scale = 1.0, u_off = 0.0, v_scale = 1.0, v_off = 0.0;
-
- for (int i=0; i<20; i++) {
- neu_u.push_back(0.0);
- neu_v.push_back(0.0);
- den_u.push_back(0.0);
- den_v.push_back(0.0);
- }
-
- int vector_map[] = {9,15,18,19};
-
- for (int i=0; i<4; i++) {
- neu_u[vector_map[i]] = cam_pers_matrix(0,i);
- neu_v[vector_map[i]] = cam_pers_matrix(1,i);
- den_u[vector_map[i]] = cam_pers_matrix(2,i);
- den_v[vector_map[i]] = cam_pers_matrix(2,i);
- }
-
- vpgl_rational_camera<double> cam_rat(neu_u,den_u,neu_v,den_v,
- x_scale,x_off,y_scale,y_off,z_scale,z_off,
- u_scale,u_off,v_scale,v_off);
- return cam_rat;
-}
-
-//: optimizes rpc camera parameters based on edges
-bool boxm_line_backproject_process(bprb_func_process& pro)
-{
- using namespace boxm_line_backproject_process_globals;
-
- // check number of inputs
- if ( pro.n_inputs() < n_inputs_ ) {
- std::cout << pro.name() << " The number of inputs should be " << n_inputs_<< std::endl;
- return false;
- }
-
- // get the inputs
- unsigned i = 0;
-
- // image
- vil_image_view_base_sptr edge_image_sptr = pro.get_input<vil_image_view_base_sptr>(i++);
-
- // camera
- vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(i++);
-
- // make sure that image has 3 planes
- if (edge_image_sptr->nplanes() != 3) {
- std::cerr << "boxm_line_backproject_process: The edge image is expected to have 3 planes!\n";
- return false;
- }
-
- vil_image_view<float> *plane_image;
- if (edge_image_sptr->pixel_format() == VIL_PIXEL_FORMAT_FLOAT) {
- vil_image_view<float> edge_image(edge_image_sptr);
- unsigned ni=edge_image.ni();
- unsigned nj=edge_image.nj();
-
- // the output image
- plane_image = new vil_image_view<float>(ni,nj,4);
- float col, row, theta;
-
- if (camera->type_name() == "vpgl_proj_camera") {
- auto* cam = dynamic_cast<vpgl_proj_camera<double>*>(camera.ptr());
-
- for (unsigned i=0; i<ni; i++) {
- for (unsigned j=0; j<nj; j++) {
- col =edge_image(i,j,0); // sub-pixel column
- row =edge_image(i,j,1); // sub_pixel row
- theta=edge_image(i,j,2); // orientation in radians
-
- if (col<0 || row<0) // no edge is present, check sdet_pro/sdet_detect_edge_tangent_process.h
- (*plane_image)(i,j) = 0.0f;
- else {
- // get two points on the line
- vgl_point_2d<double> p1(col,row);
-
- float x = col + 0.5f*std::cos(theta);
- float y = row + 0.5f*std::sin(theta);
- vgl_point_2d<double> p2(x,y);
-
- vgl_line_2d<double> line(p1,p2);
-
- //create a line and backproject it
- vgl_homg_line_2d<double> image_line(line);
- vgl_homg_plane_3d<double> plane = cam->backproject(image_line);
- if (plane.a()==0 && plane.b()==0 && plane.c()==0 && plane.d()==0)
- std::cout << "ZERO a,b,c,d" << std::endl;
- (*plane_image)(i,j,0)=float(plane.a());
- (*plane_image)(i,j,1)=float(plane.b());
- (*plane_image)(i,j,2)=float(plane.c());
- (*plane_image)(i,j,3)=float(plane.d());
- }
- }
- }
- }
- else if (camera->type_name() == "vpgl_local_rational_camera") {
- auto* cam = dynamic_cast<vpgl_local_rational_camera<double>*>(camera.ptr());
- for (unsigned i=0; i<ni; i++) {
- for (unsigned j=0; j<nj; j++) {
- col =edge_image(i,j,0); // sub-pixel column
- row =edge_image(i,j,1); // sub_pixel row
- theta=edge_image(i,j,2); // orientation in radians
-
- if (col<0 || row<0) { // no edge is present, check sdet_pro/sdet_detect_edge_tangent_process.h
- (*plane_image)(i,j,0) = 0.0f;
- (*plane_image)(i,j,1) = 0.0f;
- (*plane_image)(i,j,2) = 0.0f;
- (*plane_image)(i,j,3) = 0.0f;
- }
- else {
- // get two point on the line
- vgl_point_2d<double> p1(col, row);
-
- float x = col + 0.5f*std::cos(theta);
- float y = row + 0.5f*std::sin(theta);
- vgl_point_2d<double> p2(x,y);
-
- //backproject it
- vgl_plane_3d<double> plane;
- if (vpgl_ray::plane_ray(*cam, p1, p2, plane)) {
- (*plane_image)(i,j,0)=float(plane.a());
- (*plane_image)(i,j,1)=float(plane.b());
- (*plane_image)(i,j,2)=float(plane.c());
- (*plane_image)(i,j,3)=float(plane.d());
- }
- else { // the backprojection was unsuccessful
- std::cout << i << ',' << j << "NO PLANE!!!!!" << std::endl;
- (*plane_image)(i,j,0) = 0.0f;
- (*plane_image)(i,j,1) = 0.0f;
- (*plane_image)(i,j,2) = 0.0f;
- (*plane_image)(i,j,3) = 0.0f;
- }
- }
- }
- }
- }
- else if (camera->type_name() == "vpgl_perspective_camera") {
- auto* cam = dynamic_cast<vpgl_perspective_camera<double>*>(camera.ptr());
- auto* proj_cam = static_cast<vpgl_proj_camera<double>*>(cam);
- for (unsigned i=0; i<ni; i++) {
- for (unsigned j=0; j<nj; j++) {
- col =edge_image(i,j,0); // sub-pixel column
- row =edge_image(i,j,1); // sub_pixel row
- theta=edge_image(i,j,2); // orientation in radians
-
- if (col<0 || row<0) { // no edge is present, check sdet_pro/sdet_detect_edge_tangent_process.h
- (*plane_image)(i,j,0) = 0.0f;
- (*plane_image)(i,j,1) = 0.0f;
- (*plane_image)(i,j,2) = 0.0f;
- (*plane_image)(i,j,3) = 0.0f;
- }
- else {
- // get two point on the line
- vgl_point_2d<double> p1(col, row);
-
- float x = col + 0.5f*std::cos(theta);
- float y = row + 0.5f*std::sin(theta);
- vgl_point_2d<double> p2(x,y);
-
- vgl_line_2d<double> line(p1,p2);
-
- //create a line and backproject it
- vgl_homg_line_2d<double> image_line(line);
-
- vgl_homg_plane_3d<double> plane = proj_cam->backproject(image_line);
- if (plane.a()==0 && plane.b()==0 && plane.c()==0 && plane.d()==0)
- std::cout << "ZERO a,b,c,d" << std::endl;
- (*plane_image)(i,j,0)=float(plane.a());
- (*plane_image)(i,j,1)=float(plane.b());
- (*plane_image)(i,j,2)=float(plane.c());
- (*plane_image)(i,j,3)=float(plane.d());
- }
- }
- }
- }
- else {
- std::cerr << "boxm_line_backproject_process: The camera type [" << camera->type_name() << "]is not defined yet!\n";
- return false;
- }
- }
- else {
- std::cerr << "boxm_line_backproject_process: This pixel format is not supported yet!\n";
- return false;
- }
- // output
- unsigned j = 0;
- // update the camera and store
- pro.set_output_val<vil_image_view_base_sptr>(j++, plane_image);
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_linear_combination_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_linear_combination_process.cxx
deleted file mode 100644
index 3cdbcbe8e4..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_linear_combination_process.cxx
+++ /dev/null
@@ -1,102 +0,0 @@
-//:
-// \file
-// \brief A process to perform linear combination of blocks in situ i.e block1 = s1*block1+ s2*block2
-// \author Isabel Restrepo
-// \date 2-Feb-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/boxm_linear_operations.h>
-
-//:global variables
-namespace boxm_linear_combination_process_globals
-{
- constexpr unsigned n_inputs_ = 7;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool boxm_linear_combination_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_linear_combination_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "boxm_scene_base_sptr" ; //scene1
- input_types_[i++] = "boxm_scene_base_sptr" ; //scene2
- input_types_[i++] = "float" ; //s1
- input_types_[i++] = "float" ; //s2
- input_types_[i++] = "int" ; //block index in x-dimension
- input_types_[i++] = "int" ; //block index in y-dimension
- input_types_[i++] = "int" ; //block index in z-dimension
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool boxm_linear_combination_process(bprb_func_process& pro)
-{
- using namespace boxm_linear_combination_process_globals;
-
- //get inputs
- unsigned i = 0;
- boxm_scene_base_sptr scene_base1 = pro.get_input<boxm_scene_base_sptr>(i++);
- boxm_scene_base_sptr scene_base2 = pro.get_input<boxm_scene_base_sptr>(i++);
- auto s1 = pro.get_input<float>(i++);
- auto s2 = pro.get_input<float>(i++);
- int block_i = pro.get_input<int>(i++);
- int block_j = pro.get_input<int>(i++);
- int block_k = pro.get_input<int>(i++);
-
- if (!(scene_base1 && scene_base2))
- {
- std::cerr << "In boxm_linear_combination_process: Null input scene\n";
- return false;
- }
-
- switch (scene_base1->appearence_model())
- {
- case BOXM_FLOAT:
- {
- if (scene_base2->appearence_model()!= BOXM_FLOAT)
- {
- std::cerr << "In boxm_linear_combination_process, datatype not supported\n";
- return false;
- }
- auto *scene1 = static_cast<boxm_scene<boct_tree<short, float> >*> (scene_base1.as_pointer());
- auto *scene2 = static_cast<boxm_scene<boct_tree<short, float> >*> (scene_base2.as_pointer());
-
- scene1->load_block(block_i,block_j,block_k);
- scene2->load_block(block_i,block_j,block_k);
-
- boxm_block<boct_tree<short, float> > *block1 = scene1->get_block(block_i,block_j,block_k);
- boxm_block<boct_tree<short, float> > *block2 = scene2->get_block(block_i,block_j,block_k);
-
- //The result is block1 = s1*block1+ s2*block2
- boxm_linear_combination(block1, block2, s1, s2);
-
- //make sure to write the block back to disk
- scene1->write_active_block();
-
- //clean memory
- scene1->unload_active_blocks();
- scene2->unload_active_blocks();
-
- break;
- }
- default:
- std::cerr << "In boxm_linear_combination_process: Invalid datatype\n";
- return false;
- break;
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_merge_mixtures_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_merge_mixtures_process.cxx
deleted file mode 100644
index 700f8bba5c..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_merge_mixtures_process.cxx
+++ /dev/null
@@ -1,90 +0,0 @@
-// This is brl/bseg/boxm/algo/pro/processes/boxm_merge_mixtures_process.cxx
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief process that merges all gaussian mixtures in a boxm_scene into unimodal gaussians
-//
-// \author Isabel Restrepo
-// \date December 8, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <boxm/algo/boxm_merge_mog.h>
-
-#include <bprb/bprb_parameters.h>
-#include <brdb/brdb_value.h>
-
-
-namespace boxm_merge_mixtures_process_globals
-{
- constexpr unsigned n_inputs_ = 1;
- constexpr unsigned n_outputs_ = 1;
-}
-
-//: process takes 1 input and 1 output.
-// input[0]: The sample scene
-// output[0]: The appearance scene
-
-bool boxm_merge_mixtures_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_merge_mixtures_process_globals;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_merge_mixtures_process(bprb_func_process& pro)
-{
- using namespace boxm_merge_mixtures_process_globals;
-
- if (pro.n_inputs() != n_inputs_)
- {
- std::cout << pro.name() << ": the input number should be " << n_inputs_
- << " but instead it is " << pro.n_inputs() << std::endl;
- return false;
- }
-
- //get inputs:
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(0);
-
- //check input's validity
- if (!scene_base.ptr()) {
- std::cout << " :-- Grid is not valid!\n";
- return false;
- }
-
- //:Note initial implementation is for fixed types, but this can be changed if more cases are needed
- typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype apm_datatype;
- typedef boct_tree<short, apm_datatype> mog_tree_type;
-
- typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
- typedef boct_tree<short, gauss_type> gauss_tree_type;
-
- auto *mog_scene = dynamic_cast<boxm_scene<mog_tree_type>* > (scene_base.as_pointer());
-
- //check input's validity
- if (!mog_scene) {
- std::cout << " :-- Grid is not of valid type!\n";
- return false;
- }
-
- //parameters of the output scene are the same as those of the input scene
- boxm_scene<gauss_tree_type> *gauss_scene = new boxm_scene<gauss_tree_type>(mog_scene->lvcs(), mog_scene->origin(), mog_scene->block_dim(), mog_scene->world_dim());
- gauss_scene->set_paths(mog_scene->path(), "bsta_gauss_sf1");
- gauss_scene->set_appearance_model(BSTA_GAUSS_F1);
-
- boxm_merge_mog merger;
- merger.kl_merge_scene( *mog_scene, *gauss_scene);
- gauss_scene->write_scene("gaussf1_scene.xml");
- pro.set_output_val<boxm_scene_base_sptr>(0, gauss_scene);
- std::cout<<"Exiting" << std::endl;
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_refine_scene_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_refine_scene_process.cxx
deleted file mode 100644
index 6b3f53a79c..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_refine_scene_process.cxx
+++ /dev/null
@@ -1,119 +0,0 @@
-// This is brl/bseg/boxm/algo/pro/processes/boxm_refine_scene_process.cxx
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief Process to refine the block (octrees) of the scene
-// If there are some cells with big values they are spit into
-// new child cells; the data of the cell is copied to the
-// children's data. The purpose of this process is to elaborate
-// the octree at the areas where more details exist.
-//
-// \author Gamze Tunali
-// \date April 24, 2009
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/boxm_refine.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-
-namespace boxm_refine_scene_process_globals
-{
- constexpr unsigned n_inputs_ = 3;
- constexpr unsigned n_outputs_ = 1;
-}
-
-bool boxm_refine_scene_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_refine_scene_process_globals;
-
- //process takes 3 inputs
- //input[0]: The scene
- //input[1]: The threshold for splitting
- //input[2]: bool for resetting the appearence model
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "float";
- input_types_[2] = "bool";
-
- //process has 1 output
- //output[0]: The number of leaf cells in the refined scene
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "int";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_refine_scene_process(bprb_func_process& pro)
-{
- using namespace boxm_refine_scene_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << "boxm_refine_scene_process: The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get inputs:
- unsigned i = 0;
- boxm_scene_base_sptr scene = pro.get_input<boxm_scene_base_sptr>(i++);
- auto thresh = pro.get_input<float>(i++);
- bool reset = pro.get_input<bool>(i++);
-
- // check the input validity
- if (scene == nullptr) {
- std::cout << "boxm_refine_scene_process: scene is null, cannot run" << std::endl;
- return false;
- }
-
- unsigned int ncells = 0;
-
- if (scene->appearence_model() == BOXM_APM_MOG_GREY) {
- if (scene->multi_bin()) {
- typedef boct_tree<short, boxm_sample_multi_bin<BOXM_APM_MOG_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- ncells = boxm_refine_scene<short, boxm_sample_multi_bin<BOXM_APM_MOG_GREY> >(*s, thresh, reset);
- }
- else {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- ncells = boxm_refine_scene<short, boxm_sample<BOXM_APM_MOG_GREY> >(*s, thresh, reset);
- }
- }
- else if (scene->appearence_model() == BOXM_APM_SIMPLE_GREY) {
- if (scene->multi_bin()) {
- std::cout << "boxm_refine_scene_process: multibin case is not implemented for BOXM_APM_SIMPLE_GREY yet" << std::endl;
- return false;
- }
- else {
- typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- ncells = boxm_refine_scene<short, boxm_sample<BOXM_APM_SIMPLE_GREY> >(*s, thresh, reset);
- }
- }
- else if (scene->appearence_model() == BOXM_APM_MOB_GREY) {
- if (scene->multi_bin()) {
- std::cout << "boxm_refine_scene_process: multibin case is not implemented for BOXM_APM_SIMPLE_GREY yet" << std::endl;
- return false;
- }
- else {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOB_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- ncells = boxm_refine_scene<short, boxm_sample<BOXM_APM_MOB_GREY> >(*s, thresh, reset);
- }
- }
- else {
- std::cout << "boxm_refine_scene_process: undefined APM type" << std::endl;
- return false;
- }
-
- // set output
- pro.set_output_val<int>(0,ncells);
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_remove_level0_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_remove_level0_process.cxx
deleted file mode 100644
index 67086ac142..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_remove_level0_process.cxx
+++ /dev/null
@@ -1,87 +0,0 @@
-//:
-// \file
-// \brief A process to remove level 0 of the octrees
-// \author Isabel Restrepo
-// \date Nov 23 2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/boxm_scene_levels_utils.h>
-
-//:global variables
-namespace boxm_remove_level0_process_globals
-{
- constexpr unsigned n_inputs_ = 2;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//:sets input and output types
-bool boxm_remove_level0_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_remove_level0_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr"; //scene_in
- input_types_[1] = "vcl_string"; //block_prefix for scene out
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr"; //scene_out
-
- return pro.set_input_types(input_types_)
- && pro.set_output_types(output_types_);
-}
-
-
-//: the process
-bool boxm_remove_level0_process(bprb_func_process& pro)
-{
- using namespace boxm_remove_level0_process_globals;
-
- if (pro.n_inputs() != n_inputs_)
- {
- std::cout << pro.name() << ": the number of inputs should be " << n_inputs_
- << " but instead it is " << pro.n_inputs() << std::endl;
- return false;
- }
-
- //get inputs:
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(0);
- std::string block_pref = pro.get_input<std::string>(1);
-
- //check input's validity
- if (!scene_base.ptr()) {
- std::cout << " :-- Grid is not valid!\n";
- return false;
- }
-
- if (auto *scene_in = dynamic_cast<boxm_scene<boct_tree<short, float> >* > (scene_base.as_pointer()))
- {
- //clone the input scene
- boxm_scene<boct_tree<short, float> > *scene_out = new boxm_scene<boct_tree<short, float> >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(),
- scene_in->world_dim(), scene_in->max_level(), scene_in->init_level(),
- scene_in->load_all_blocks(), scene_in->save_internal_nodes());
-
- scene_out->set_paths(scene_in->path(), block_pref);
- scene_out->set_appearance_model(scene_in->appearence_model());
- std::cout << "Cloning\n";
- scene_in->clone_blocks(*scene_out);
-
- std::cout << "Restructuring\n";
- boxm_remove_level_0_leaves(scene_out);
- std::cout << "Done\n";
-
- //write the scene after the number of levels has been adjusted
- scene_out->set_octree_levels(scene_in->max_level() - 1, scene_in->init_level());
- scene_out->write_scene(block_pref + ".xml");
-
- pro.set_output_val<boxm_scene_base_sptr>(0, scene_out);
- return true;
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_render_expected_edge_vrml_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_render_expected_edge_vrml_process.cxx
deleted file mode 100644
index c14dfbda09..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_render_expected_edge_vrml_process.cxx
+++ /dev/null
@@ -1,149 +0,0 @@
-// This is brl/bseg/boxm/algo/pro/processes/boxm_render_expected_edge_vrml_process.cxx
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A class for obtaining roc curve from change detection results.
-//
-// \author Gamze Tunali
-// \date Apr 14, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-#include <bvrml/bvrml_write.h>
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_intersection.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-namespace boxm_render_expected_edge_vrml_process_globals
-{
- constexpr unsigned n_inputs_ = 4;
- constexpr unsigned n_outputs_ = 0;
-}
-
-bool boxm_render_expected_edge_vrml_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_render_expected_edge_vrml_process_globals;
-
- // process takes 4 inputs and no output
- //input[0]: scene binary file
- //input[1]: the path for vrml file
- //input[2]: threshold
- //input[3]: s (to write every s cell)
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vcl_string";
- input_types_[2] = "float";
- input_types_[3] = "int";
-
- std::vector<std::string> output_types_(n_outputs_);
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_render_expected_edge_vrml_process(bprb_func_process& pro)
-{
- using namespace boxm_render_expected_edge_vrml_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ) {
- std::cerr << pro.name() << ": The input number should be " << n_inputs_<< '\n';
- return false;
- }
-
- //get the inputs
- unsigned i = 0;
- boxm_scene_base_sptr scene_ptr = pro.get_input<boxm_scene_base_sptr>(i++);
- //vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(i++);
- std::string path = pro.get_input<std::string>(i++);
- auto threshold = pro.get_input<float>(i++);
- int s = pro.get_input<int>(i++); // FIXME - unused!
-
- std::ofstream stream(path.c_str());
-
- if (scene_ptr->appearence_model() == BOXM_EDGE_LINE)
- {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short, boxm_inf_line_sample<float> > type;
- auto* scene = dynamic_cast<boxm_scene<type>*> (scene_ptr.as_pointer());
- if (!scene) {
- std::cout << "boxm_render_expected_edge_process: the scene is not of expected type" << std::endl;
- return false;
- }
- bvrml_write::write_vrml_header(stream);
-#if 0
- vgl_point_3d<double> origin(0.0,0.0,0.0);
- vgl_vector_3d<double> dirx(1,0,0);
- vgl_vector_3d<double> diry(0,1,0);
- vgl_vector_3d<double> dirz(0,0,1);
- bvrml_write::write_vrml_line(stream,origin,dirx,3,1,0,0);
- bvrml_write::write_vrml_line(stream,origin,diry,3,0,1,0);
- bvrml_write::write_vrml_line(stream,origin,dirz,3,0,0,1);
-#endif
- // for each block
- boxm_block_iterator<type> iter(scene);
- iter.begin();
- while (!iter.end())
- {
- scene->load_block(iter.index());
- boxm_block<type>* block = *iter;
- type* tree = block->get_tree();
- std::vector<boct_tree_cell<short,boxm_inf_line_sample<float> >*> cells = tree->leaf_cells();
-
- // iterate over cells
- for (auto cell : cells)
- {
- boxm_inf_line_sample<float> data = cell->data();
- vgl_infinite_line_3d<float> line = data.line_;
- vgl_vector_2d<double> x0(line.x0().x(), line.x0().y());
- // TODO: revise with segment length
- if (!(line.x0().x()==0 && line.x0().y()==0)) {
- //if (data.num_obs_ > threshold)
- {
- vgl_point_3d<double> p0,p1;
- vgl_box_3d<double> bb = tree->cell_bounding_box(cell);
- // convert to line type (from float to double)
- vgl_vector_3d<double> dir(line.direction().x(), line.direction().y(), line.direction().z());
-
- vgl_infinite_line_3d<double> dline(x0,dir);
- if (vgl_intersection<double>(bb, dline, p0, p1)) {
- vgl_vector_3d<double> dir(p1-p0);
- double length=dir.length();
- dir/=length;
- std::cout<<data.residual_<<' ';
- if (data.residual_<threshold)
- {
- bvrml_write::write_vrml_line(stream, p0,dir,float(length),1.f,0.f,0.f);
- //bvrml_write::write_vrml_disk(stream,p0,dir,data.residual_,0.f,1.0f,0.f);
- }
- }
- }
- }
- }
- iter++;
- }
- }
- else
- {
- std::cerr << "Ray tracing version not yet implemented\n";
- return false;
- }
- }
- else {
- std::cerr << "boxm_render_expected_edge_vrml_process: undefined APM type\n";
- return false;
- }
-
- // no output
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_replace_const_app_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_replace_const_app_process.cxx
deleted file mode 100644
index 1ca0a383ac..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_replace_const_app_process.cxx
+++ /dev/null
@@ -1,95 +0,0 @@
-// This is brl/bseg/boxm/algo/pro/processes/boxm_replace_const_app_process.cxx
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief Process to replace the appearance model for the whole scene by a constant appearance model
-// \author Vishal Jain
-// \date July 28, 2009
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/boxm_refine.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <boxm/util/boxm_utils.h>
-
-void boxm_replace_constant_app(boxm_scene<boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > > &scene, float mean);
-
-namespace boxm_replace_const_app_process_globals
-{
- constexpr unsigned n_inputs_ = 2;
- constexpr unsigned n_outputs_ = 0;
-}
-
-bool boxm_replace_const_app_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_replace_const_app_process_globals;
-
- //process takes 2 inputs and no output
- //input[0]: The scene
- //input[1]: mean value for appearance
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "float";
-
- std::vector<std::string> output_types_(n_outputs_);
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_replace_const_app_process(bprb_func_process& pro)
-{
- using namespace boxm_replace_const_app_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << "boxm_replace_const_app_process: The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get inputs:
- unsigned i = 0;
- boxm_scene_base_sptr scene = pro.get_input<boxm_scene_base_sptr>(i++);
- auto meanval = pro.get_input<float>(i++);
-
- // check the input validity
- if (scene == nullptr) {
- std::cout << "boxm_replace_const_app_process: scene is null, cannot run" << std::endl;
- return false;
- }
-
- if (scene->appearence_model() == BOXM_APM_MOG_GREY) {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- boxm_replace_constant_app(*s,meanval );
- }
- else {
- std::cout << "boxm_replace_const_app_process: undefined APM type" << std::endl;
- return false;
- }
-
- return true;
-}
-
-void boxm_replace_constant_app(boxm_scene<boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > > &scene, float mean)
-{
- boxm_block_iterator<boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > > iter(&scene);
- boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype app=boxm_utils::obtain_mog_grey_single_mode(mean);
- for (; !iter.end(); iter++) {
- scene.load_block(iter.index());
- boxm_block<boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > >* block = *iter;
- boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> >* tree = block->get_tree();
-
- std::vector<boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >*> leaf_cells=tree->leaf_cells();
- for (auto & leaf_cell : leaf_cells)
- {
- boxm_sample<BOXM_APM_MOG_GREY> new_data(leaf_cell->data().alpha,app);
- leaf_cell->set_data(new_data);
- }
- scene.write_active_block();
- }
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_roi_init_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_roi_init_process.cxx
deleted file mode 100644
index ce50f795ba..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_roi_init_process.cxx
+++ /dev/null
@@ -1,195 +0,0 @@
-// This is brl/bseg/boxm/algo/pro/processes/boxm_roi_init_process.cxx
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A class for clipping and image based on a 3D bounding box.
-// - Input:
-// - Image path (string)
-// - boxm_voxel_world_sptr
-//
-// - Output:
-// - modified rational camera "vpgl_camera_double_sptr"
-// - clipped image area (NITF) "vil_image_view_base_sptr"
-//
-// - Params:
-// -geographic uncertainty (error) in meters
-//
-// \author Copied from boxm/pro
-// \date May 5, 2008
-// \verbatim
-// \endverbatim
-
-#include <boxm/boxm_scene.h>
-#include <boxm/util/boxm_utils.h>
-
-#include <vgl/vgl_point_2d.h>
-#include <vgl/vgl_box_2d.h>
-#include <vgl/vgl_box_3d.h>
-
-#include <vsol/vsol_box_2d_sptr.h>
-#include <vsol/vsol_box_2d.h>
-
-#include <brip/brip_roi.h>
-
-#include <vil/vil_load.h>
-#include <vil/vil_crop.h>
-#include <vil/file_formats/vil_nitf2_image.h>
-#include <vil/vil_image_view_base.h>
-#include <vpgl/vpgl_camera.h>
-
-#include <bprb/bprb_parameters.h>
-
-//: globals variables and functions
-namespace boxm_roi_init_process_globals
-{
- constexpr unsigned n_inputs_ = 3;
- constexpr unsigned n_outputs_ = 3;
-
- //functions
- bool roi_init(const std::string& img_path,
- const vpgl_camera_double_sptr& camera,
- vgl_box_3d<double> box,
- vil_image_view<unsigned char> & roi_img);
-
- //: projects the box on the image by taking the union of all the projected corners
- vgl_box_2d<double>* project_box(const vpgl_camera_double_sptr& cam,
- vgl_box_3d<double> box);
-}
-
-//: set input and output types
-bool boxm_roi_init_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_roi_init_process_globals;
-
- //this process takes 3 input:
- //the filename of the image, the camera and the voxel world
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i=0;
- input_types_[i++] = "vcl_string"; // image path
- input_types_[i++] = "vpgl_camera_double_sptr"; // camera
- input_types_[i++] = "boxm_scene_base_sptr"; // voxel world spec
-
- //output
- unsigned j = 0;
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[j++] = "vpgl_camera_double_sptr"; // unadjusted local rational camera
- output_types_[j++] = "vil_image_view_base_sptr"; // image ROI
- output_types_[j++] = "float"; // uncertainty
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-bool boxm_roi_init_process(bprb_func_process& pro)
-{
- using namespace boxm_roi_init_process_globals;
- //static const parameters
- static const std::string error = "error";
-
- if ( pro.n_inputs() < n_inputs_ ) {
- std::cout << pro.name() << " The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- // get the inputs:
- unsigned i = 0;
- // image
- std::string image_path = pro.get_input<std::string>(i++);
- // camera
- vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(i++);
- //voxel_world
- boxm_scene_base_sptr scene = pro.get_input<boxm_scene_base_sptr>(i++);
-
- vil_image_view_base_sptr img_ptr=vil_load(image_path.c_str());
- auto *temp=new vil_image_view<unsigned char>();
- if (img_ptr->pixel_format()==VIL_PIXEL_FORMAT_BYTE)
- {
- if (auto *img=dynamic_cast<vil_image_view<unsigned char> * > (img_ptr.ptr()))
- {
- vgl_box_2d<double>* roi_box = project_box(camera, scene->get_world_bbox());
- brip_roi broi(img->ni(), img->nj());
- vsol_box_2d_sptr bb = new vsol_box_2d();
- bb->add_point(roi_box->min_x(), roi_box->min_y());
- bb->add_point(roi_box->max_x(), roi_box->max_y());
- bb = broi.clip_to_image_bounds(bb);
- if (bb->width() <= 0 || bb->height() <= 0) {
- std::cerr << "boxm_roi_init_process::roi_init()-- clipping box is out of image boundaries\n";
- return false;
- }
- temp->set_size(int(bb->width()),int(bb->height()));
- temp->deep_copy(vil_crop(*img,(unsigned int)bb->get_min_x(),
- (unsigned int)bb->width(),
- (unsigned int)bb->get_min_y(),
- (unsigned int)bb->height()));
- }
- }
- if (temp->ni() == 0 || temp->nj() == 0)
- return false;
-
- //Store outputs
- unsigned j = 0;
- // update the camera and store
- pro.set_output_val<vpgl_camera_double_sptr >(j++, camera);
- // store image output
- pro.set_output_val<vil_image_view_base_sptr>(j++, temp);
- // store uncertainty
- pro.set_output_val<float>(j++, 0);
-
- return true;
-}
-
-//: roi_init function
-bool boxm_roi_init_process_globals::roi_init(const std::string& img_path,
- const vpgl_camera_double_sptr& camera,
- vgl_box_3d<double> box,
- vil_image_view<unsigned char> & roi_img)
-{
- vil_image_view_base_sptr img_ptr=vil_load(img_path.c_str());
- if (img_ptr->pixel_format()==VIL_PIXEL_FORMAT_BYTE)
- {
- if (auto *img=dynamic_cast<vil_image_view<unsigned char> * > (img_ptr.ptr()))
- {
- vgl_box_2d<double>* roi_box = project_box(camera, box);
- brip_roi broi(img->ni(), img->nj());
- vsol_box_2d_sptr bb = new vsol_box_2d();
- bb->add_point(roi_box->min_x(), roi_box->min_y());
- bb->add_point(roi_box->max_x(), roi_box->max_y());
- bb = broi.clip_to_image_bounds(bb);
- if (bb->width() <= 0 || bb->height() <= 0) {
- std::cerr << "boxm_roi_init_process::roi_init()-- clipping box is out of image boundaries\n";
- return false;
- }
-
- vil_image_view<unsigned char> temp=vil_crop(*img,
- (unsigned int)bb->get_min_x(),
- (unsigned int)bb->width(),
- (unsigned int)bb->get_min_y(),
- (unsigned int)bb->height());
- roi_img=temp;
- return true;
- }
- else
- return false;
- }
- else // non-supported pixel format
- return false;
-}
-
-//: project_box function
-vgl_box_2d<double>* boxm_roi_init_process_globals::project_box( const vpgl_camera_double_sptr& cam,
- vgl_box_3d<double> box)
-{
- // create a box with uncertainty
- std::vector<vgl_point_3d<double> > box_corners = boxm_utils::corners_of_box_3d(box);
-
- auto* roi = new vgl_box_2d<double>();
-
- for (auto & box_corner : box_corners) {
- double u,v;
- cam->project(box_corner.x(),box_corner.y(),box_corner.z(),u,v);
- vgl_point_2d<double> p2d(u,v);
- std::cout<<u<<' '<<v<<'\n';
- roi->add(p2d);
- }
- return roi;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_roi_init_rational_camera_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_roi_init_rational_camera_process.cxx
deleted file mode 100644
index fbfe3b9704..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_roi_init_rational_camera_process.cxx
+++ /dev/null
@@ -1,310 +0,0 @@
-// This is brl/bseg/boxm/algo/pro/processes/boxm_roi_init_rational_camera_process.cxx
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A class for clipping and image based on a 3D bounding box.
-// * Input:
-// - Image path (string)
-// - boxm_voxel_world_sptr
-//
-// * Output:
-// - modified rational camera "vpgl_camera_double_sptr"
-// - clipped image area (NITF) "vil_image_view_base_sptr"
-//
-// * Params:
-// - geographic uncertainty (error) in meters
-//
-// \author Copied from boxm/pro
-// \date May 5, 2008
-
-#include <boxm/boxm_scene.h>
-#include <boxm/util/boxm_utils.h>
-
-#include <vgl/vgl_point_2d.h>
-#include <vgl/vgl_box_2d.h>
-#include <vgl/vgl_box_3d.h>
-
-#include <vsol/vsol_box_2d_sptr.h>
-#include <vsol/vsol_box_2d.h>
-
-#include <brip/brip_roi.h>
-
-#include <vil/vil_load.h>
-#include <vil/file_formats/vil_nitf2_image.h>
-#include <vil/vil_image_view_base.h>
-#include <vpgl/vpgl_local_rational_camera.h>
-#include <vpgl/vpgl_lvcs.h>
-
-#include <bprb/bprb_parameters.h>
-
-//: globals variables and functions
-namespace boxm_roi_init_rational_camera_process_globals
-{
- constexpr unsigned n_inputs_ = 3;
- constexpr unsigned n_outputs_ = 3;
-
- // functions
- bool roi_init(std::string const& image_path,
- vpgl_rational_camera<double>* camera,
- vgl_box_3d<double> box,
- const vpgl_lvcs& lvcs,
- float uncertainty,
- vil_image_view<unsigned char>* nitf_image_unsigned_char,
- vpgl_local_rational_camera<double>& local_camera);
-
- //: projects the box on the image by taking the union of all the projected corners
- vgl_box_2d<double>* project_box(vpgl_rational_camera<double>* cam,
- vpgl_lvcs lvcs,
- vgl_box_3d<double> box,
- float r);
-}
-
-//:set input and output types
-bool boxm_roi_init_rational_camera_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_roi_init_rational_camera_process_globals;
-
- //this process takes 3 input:
- //the filename of the image, the camera and the voxel world
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i=0;
- input_types_[i++] = "vcl_string"; // NITF image path
- input_types_[i++] = "vpgl_camera_double_sptr"; // rational camera
- input_types_[i++] = "boxm_scene_base_sptr"; // voxel world spec
-
- //output
- unsigned j = 0;
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[j++] = "vpgl_camera_double_sptr"; // unadjusted local rational camera
- output_types_[j++] = "vil_image_view_base_sptr"; // image ROI
- output_types_[j++] = "float"; // uncertainty
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-bool boxm_roi_init_rational_camera_process(bprb_func_process& pro)
-{
- using namespace boxm_roi_init_rational_camera_process_globals;
- //static const parameters
- static const std::string error = "error";
-
- if ( pro.n_inputs() < n_inputs_ ) {
- std::cout << pro.name() << " The input number should be " << n_inputs_<< std::endl;
- return false;
- }
- // uncertainty (meters) -- SHOULD BE A PARAM
- float uncertainty=10.0;
- if ( !pro.parameters()->get_value(error, uncertainty) ) {
- std::cout << pro.name() << ": error in retrieving parameters\n";
- return false;
- }
-
- // get the inputs:
- unsigned i = 0;
- // image
- std::string image_path = pro.get_input<std::string>(i++);
- // camera
- vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(i++);
- //voxel_world
- boxm_scene_base_sptr scene = pro.get_input<boxm_scene_base_sptr>(i++);
-
- auto* img_ptr = new vil_image_view<unsigned char>();
- auto* rat_camera =
- dynamic_cast<vpgl_rational_camera<double>*> (camera.as_pointer());
-
- if (!rat_camera) {
- std::cerr << "The camera input is not a rational camera\n";
- return false;
- }
-
- vpgl_local_rational_camera<double> local_camera;
- if (scene->appearence_model() == BOXM_APM_MOG_GREY ||
- scene->appearence_model() == BOXM_EDGE_FLOAT ||
- scene->appearence_model() == BOXM_EDGE_LINE) {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
-
- if (!roi_init(image_path, rat_camera, s->get_world_bbox(),(s->lvcs()), uncertainty, img_ptr, local_camera)) {
- std::cerr << "The process has failed!\n";
- return false;
- }
-
- if (img_ptr->ni() == 0 || img_ptr->nj() == 0)
- return false;
-
- //Store outputs
- unsigned j = 0;
- // update the camera and store
- pro.set_output_val<vpgl_camera_double_sptr >(j++, new vpgl_local_rational_camera<double> (local_camera));
- // store image output
- pro.set_output_val<vil_image_view_base_sptr>(j++, img_ptr);
- // store uncertainty
- pro.set_output_val<float>(j++, uncertainty);
- }
- else {
- std::cout << "boxm_refine_scene_process: undefined APM type" << std::endl;
- return false;
- }
- return true;
-}
-
-//: roi_init function
-bool boxm_roi_init_rational_camera_process_globals::roi_init(std::string const& image_path,
- vpgl_rational_camera<double>* camera,
- vgl_box_3d<double> box,
- const vpgl_lvcs& lvcs,
- float uncertainty,
- vil_image_view<unsigned char>* nitf_image_unsigned_char,
- vpgl_local_rational_camera<double>& local_camera)
-{
- // read the image and extract the camera
- vil_image_resource_sptr img = vil_load_image_resource(image_path.c_str());
- std::string format = img->file_format();
- std::string prefix = format.substr(0,4);
- if (prefix.compare("nitf") != 0) {
- std::cerr << "boxm_roi_init_rational_camera_process::execute - The image should be an NITF\n";
- return false;
- }
-
- auto* nitf = static_cast<vil_nitf2_image*> (img.ptr());
-
- vgl_box_2d<double>* roi_box = project_box(camera, lvcs, box, uncertainty);
-
- brip_roi broi(nitf->ni(), nitf->nj());
- vsol_box_2d_sptr bb = new vsol_box_2d();
- bb->add_point(roi_box->min_x(), roi_box->min_y());
- bb->add_point(roi_box->max_x(), roi_box->max_y());
- bb = broi.clip_to_image_bounds(bb);
-
- if (bb->width() <= 0 || bb->height() <= 0) {
- std::cerr << "boxm_roi_init_rational_camera_process::roi_init()-- clipping box is out of image boundaries\n";
- return false;
- }
-
- vil_image_view_base_sptr roi = nitf->get_copy_view((unsigned int)bb->get_min_x(),
- (unsigned int)bb->width(),
- (unsigned int)bb->get_min_y(),
- (unsigned int)bb->height());
- if (!roi) {
- std::cerr << "boxm_roi_init_rational_camera_process::roi_init()-- clipping box is out of image boundaries\n";
- return false;
- }
-
- if (!roi.as_pointer())
- return false;
-
- if (roi->pixel_format() == VIL_PIXEL_FORMAT_UINT_16)
- {
- vil_image_view<vxl_uint_16> nitf_image_vxl_uint_16(roi);
-
- *nitf_image_unsigned_char = vil_image_view<unsigned char> (roi->ni(),roi->nj(),roi->nplanes());
-
- int bigendian = 0;
- { union { unsigned int i; char c[4]; } u; u.i = 1; bigendian = u.c[0] == 0; }
- for (unsigned m=0; m<nitf_image_unsigned_char->ni(); ++m)
- {
- for (unsigned n=0; n<nitf_image_unsigned_char->nj(); ++n)
- {
- for (unsigned p=0; p<nitf_image_unsigned_char->nplanes(); ++p)
- {
- // we will ignore the most significant 5 bits and less significant 3 bits
- vxl_uint_16 curr_pixel_val = nitf_image_vxl_uint_16(m,n,p);
-
- if (bigendian) {
- auto* arr = (unsigned char*) &curr_pixel_val;
- // [defgh3][5abc]
- // --> [abcdefgh]
- unsigned char big = *arr;
- unsigned char small = *(++arr);
- big >>= 3;
- small <<= 5;
- curr_pixel_val = big || small;
- }
- else { // little endian
- // [5abc][defgh3]
- // --> [abcdefgh]
- curr_pixel_val <<= 5;
- // [defgh3][5abc]
- // --> [abcdefgh]
- curr_pixel_val >>= 8;
- }
-
- auto pixel_val = static_cast<unsigned char> (curr_pixel_val);
-
-#if 0
- //This is how Thom uses to get the region
- int temp_pix_val = int(int(curr_pixel_val)*255.0/1500.0);
- if (temp_pix_val > 255)
- temp_pix_val =255;
- unsigned char pixel_val = static_cast<unsigned char>(temp_pix_val);
- //end hack
-#endif
-
- (*nitf_image_unsigned_char)(m,n,p) = pixel_val;
- }
- }
- }
- }
- else if (roi->pixel_format() == VIL_PIXEL_FORMAT_BYTE) {
- *nitf_image_unsigned_char = vil_image_view<unsigned char>(roi);
- }
- else
- std::cout << "boxm_roi_init_rational_camera_process - Unsupported Pixel Format = " << roi->pixel_format() << std::endl;
-
- double u, v;
- camera->image_offset(u, v);
- double tu = u - roi_box->min_x();
- double tv = v - roi_box->min_y();
- camera->set_image_offset(tu, tv);
- local_camera = vpgl_local_rational_camera<double> (lvcs, *camera);
- delete roi_box;
-
- return true;
-}
-
-//:project_box function
-vgl_box_2d<double>*boxm_roi_init_rational_camera_process_globals::project_box( vpgl_rational_camera<double>* cam,
- vpgl_lvcs lvcs,
- vgl_box_3d<double> box,
- float r)
-{
- double xoff, yoff, zoff;
- xoff = cam->offset(vpgl_rational_camera<double>::X_INDX);
- yoff = cam->offset(vpgl_rational_camera<double>::Y_INDX);
- zoff = cam->offset(vpgl_rational_camera<double>::Z_INDX);
-
- // global to local
- double lx, ly, lz;
- lvcs.global_to_local(xoff, yoff, zoff, vpgl_lvcs::wgs84, lx, ly, lz, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- double center[3];
- center[0] = lx;
- center[1] = ly;
- center[2] = lz;
-
- // create a box with uncertainty
- vgl_box_3d<double> cam_box(center, 2*r, 2*r, 2*r, vgl_box_3d<double>::centre);
- std::vector<vgl_point_3d<double> > cam_corners = boxm_utils::corners_of_box_3d(cam_box);
- std::vector<vgl_point_3d<double> > box_corners = boxm_utils::corners_of_box_3d(box);
- auto* roi = new vgl_box_2d<double>();
-
- double lon, lat, gz;
- for (auto cam_corner : cam_corners) {
- lvcs.local_to_global(cam_corner.x(), cam_corner.y(), cam_corner.z(),
- vpgl_lvcs::wgs84, lon, lat, gz, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vpgl_rational_camera<double>* new_cam = cam->clone();
- new_cam->set_offset(vpgl_rational_camera<double>::X_INDX, lon);
- new_cam->set_offset(vpgl_rational_camera<double>::Y_INDX, lat);
- new_cam->set_offset(vpgl_rational_camera<double>::Z_INDX, gz);
-
- // project the box
- for (auto & box_corner : box_corners) {
- // convert the box corners to world coordinates
- lvcs.local_to_global(box_corner.x(), box_corner.y(), box_corner.z(),
- vpgl_lvcs::wgs84, lon, lat, gz, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_2d<double> p2d = new_cam->project(vgl_point_3d<double>(lon, lat, gz));
- roi->add(p2d);
- }
- }
- return roi;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_save_occupancy_raw_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_save_occupancy_raw_process.cxx
deleted file mode 100644
index 8c8b260f04..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_save_occupancy_raw_process.cxx
+++ /dev/null
@@ -1,229 +0,0 @@
-// This is brl/bseg/boxm/algo/pro/processes/boxm_save_occupancy_raw_process.cxx
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A class for writing the occupancy probability of scenes to drishti raw files
-//
-// \author Gamze Tunali
-// \date Apr 14, 2009
-// \verbatim
-// Modifications
-// Sep 11, 2009 Gamze Tunali
-// Added scene writing option, input number is increased to 4 and if 4th
-// input is 0, blocks saved as raw files separately, if 1, then blocks
-// combined to generate 1 raw file for the whole scene
-// \endverbatim
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/boxm_save_block_raw.h>
-#include <boxm/algo/boxm_save_scene_raw.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <boxm/sample/boxm_scalar_sample.h>
-
-namespace boxm_save_occupancy_raw_process_globals
-{
- constexpr unsigned n_inputs_ = 4;
- constexpr unsigned n_outputs_ = 0;
-}
-
-bool boxm_save_occupancy_raw_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_save_occupancy_raw_process_globals;
-
- // process takes 4 inputs but has no outputs
- //input[0]: scene binary file
- //input[1]: output file (raw) path
- //input[2]: the resolution level wanted.. 0 is the most detailed (lowest possible level)
- //input[3]: 0 for writing blocks individually, 1 for writing the scene into one file
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vcl_string";
- input_types_[2] = "unsigned";
- input_types_[3] = "unsigned";
-
- std::vector<std::string> output_types_(n_outputs_);
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_save_occupancy_raw_process(bprb_func_process& pro)
-{
- using namespace boxm_save_occupancy_raw_process_globals;
-
- if ( pro.n_inputs() < n_inputs_) {
- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get the inputs
- unsigned i = 0;
- boxm_scene_base_sptr scene_ptr = pro.get_input<boxm_scene_base_sptr>(i++);
- std::string filepath = pro.get_input<std::string>(i++);
- auto resolution = pro.get_input<unsigned>(i++);
- auto whole = pro.get_input<unsigned>(i++);
-
- // check the scene's app model
- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY)
- {
- if (scene_ptr->multi_bin())
- {
- typedef boct_tree<short, boxm_sample_multi_bin<BOXM_APM_MOG_GREY> > type;
- auto* scene = static_cast<boxm_scene<type>*>(scene_ptr.as_pointer());
- if (!whole) {
- boxm_block_iterator<type> it(scene);
- it.begin();
- while (!it.end()) {
- std::stringstream strm;
- vgl_point_3d<int> index = it.index();
- strm << index.x() << '_' << index.y() << '_' << index.z();
- std::string str(strm.str());
- std::string s = filepath + str + ".raw";
- boxm_save_block_raw<short, boxm_sample_multi_bin<BOXM_APM_MOG_GREY> >(*scene, it.index(), s, resolution);
- it++;
- }
- }
- else { // write the whole scene
- boxm_save_scene_raw<short, boxm_sample_multi_bin<BOXM_APM_MOG_GREY> >(*scene, filepath + ".raw", resolution);
- }
- }
- else
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > type;
- auto* scene = static_cast<boxm_scene<type>*>(scene_ptr.as_pointer());
- if (!whole) {
- boxm_block_iterator<type> it(scene);
- it.begin();
- while (!it.end()) {
- std::stringstream strm;
- vgl_point_3d<int> index = it.index();
- strm << index.x() << '_' << index.y() << '_' << index.z();
- std::string str(strm.str());
- std::string s = filepath + str + ".raw";
- boxm_save_block_raw<short,boxm_sample<BOXM_APM_MOG_GREY> >(*scene, it.index(), s, resolution);
- it++;
- }
- }
- else { // write the whole scene
- boxm_save_scene_raw<short,boxm_sample<BOXM_APM_MOG_GREY> >(*scene, filepath + ".raw", resolution);
- }
- }
- }
- else if (scene_ptr->appearence_model() == BOXM_APM_SIMPLE_GREY) {
- typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > type;
- auto* scene = static_cast<boxm_scene<type>*>(scene_ptr.as_pointer());
- if (!whole) {
- boxm_block_iterator<type> it(scene);
- it.begin();
- while (!it.end()) {
- std::stringstream strm;
- vgl_point_3d<int> index = it.index();
- strm << index.x() << '_' << index.y() << '_' << index.z();
- std::string str(strm.str());
- std::string s = filepath + str + ".raw";
- boxm_save_block_raw<short,boxm_sample<BOXM_APM_SIMPLE_GREY> >(*scene, it.index(), s, resolution);
- it++;
- }
- }
- else { // write the whole scene
- boxm_save_scene_raw<short,boxm_sample<BOXM_APM_SIMPLE_GREY> >(*scene, filepath + ".raw", resolution);
- }
- }
- else if ( auto *scene= dynamic_cast<boxm_scene< boct_tree<short, float > > * >(scene_ptr.as_pointer())) {
- if (!whole) {
- boxm_block_iterator<boct_tree<short, float> > it(scene);
- it.begin();
- while (!it.end()) {
- std::stringstream strm;
- vgl_point_3d<int> index = it.index();
- strm << index.x() << '_' << index.y() << '_' << index.z();
- std::string str(strm.str());
- std::string s = filepath + str + ".raw";
- boxm_save_block_raw<short,float >(*scene, it.index(), s, resolution);
- it++;
- }
- }
- else { // write the whole scene
- boxm_save_scene_raw<short,float >(*scene, filepath + ".raw", resolution);
- }
- }
- else if (scene_ptr->appearence_model() == BSTA_MOG_F1){
- if (!whole) {
- typedef boct_tree<short,boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype > tree_type;
- auto *scene = dynamic_cast<boxm_scene<tree_type>* > (scene_ptr.as_pointer());
- boxm_block_iterator<tree_type> it(scene);
- it.begin();
- while (!it.end()) {
- std::stringstream strm;
- vgl_point_3d<int> index = it.index();
- strm << index.x() << '_' << index.y() << '_' << index.z();
- std::string str(strm.str());
- std::string s = filepath + str + ".raw";
- boxm_save_block_raw<short,boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype >(*scene, it.index(), s, resolution);
- it++;
- }
- }
- else { // write the whole scene
- //boxm_save_scene_raw<short,boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype >(*scene, filepath + ".raw", resolution);
- }
- }
- else if ( auto *scene= dynamic_cast<boxm_scene< boct_tree<short, bsta_num_obs<bsta_gauss_sf1> > > * >(scene_ptr.as_pointer())) {
- if (!whole) {
- boxm_block_iterator<boct_tree<short, bsta_num_obs<bsta_gauss_sf1> > > it(scene);
- it.begin();
- while (!it.end()) {
- std::stringstream strm;
- vgl_point_3d<int> index = it.index();
- strm << index.x() << '_' << index.y() << '_' << index.z();
- std::string str(strm.str());
- std::string s = filepath + str + ".raw";
- boxm_save_block_raw<short,bsta_num_obs<bsta_gauss_sf1> >(*scene, it.index(), s, resolution);
- it++;
- }
- }
- else { // write the whole scene
- boxm_save_scene_raw<short,bsta_num_obs<bsta_gauss_sf1> >(*scene, filepath + ".raw", resolution);
- }
- }
- else if (scene_ptr->appearence_model() == BOXM_APM_MOB_GREY) {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOB_GREY> > type;
- auto* scene = static_cast<boxm_scene<type>*>(scene_ptr.as_pointer());
- if (!whole) {
- boxm_block_iterator<type> it(scene);
- it.begin();
- while (!it.end()) {
- std::stringstream strm;
- vgl_point_3d<int> index = it.index();
- strm << index.x() << '_' << index.y() << '_' << index.z();
- std::string str(strm.str());
- std::string s = filepath + str + ".raw";
- boxm_save_block_raw<short,boxm_sample<BOXM_APM_MOB_GREY> >(*scene, it.index(), s, resolution);
- it++;
- }
- }
- else { // write the whole scene
- boxm_save_scene_raw<short,boxm_sample<BOXM_APM_MOB_GREY> >(*scene, filepath + ".raw", resolution);
- }
- }
- else if (scene_ptr->appearence_model() == BOXM_EDGE_FLOAT) {
- typedef boct_tree<short, boxm_edge_sample<float> > type;
- auto* scene = static_cast<boxm_scene<type>*>(scene_ptr.as_pointer());
- boxm_save_scene_raw<short,boxm_edge_sample<float> >(*scene, filepath + ".raw", resolution);
- }
- else if (scene_ptr->appearence_model() == BOXM_SCALAR_FLOAT) {
- typedef boct_tree<short, boxm_scalar_sample<float> > type;
- auto* scene = static_cast<boxm_scene<type>*>(scene_ptr.as_pointer());
- boxm_save_scene_raw<short,boxm_scalar_sample<float> >(*scene, filepath + ".raw", resolution);
- }
- else {
- std::cout << "boxm_save_occupancy_raw_process: undefined APM type" << std::endl;
- return false;
- }
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_save_scene_raw_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_save_scene_raw_process.cxx
deleted file mode 100644
index 5f4d68c008..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_save_scene_raw_process.cxx
+++ /dev/null
@@ -1,140 +0,0 @@
-// This is brl/bseg/boxm/algo/pro/processes/boxm_save_scene_raw_process.cxx
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A class for writing general scenes to drishti raw files. Values in voxels are saved as they are
-//
-// \author Isabel Restrepo
-// \date Feb 17, 2011
-// \verbatim
-// Modifications
-// <None>
-// \endverbatim
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/boxm_save_scene_raw_general.h>
-#include <boxm/boxm_apm_traits.h>
-
-namespace boxm_save_scene_raw_process_globals
-{
- constexpr unsigned n_inputs_ = 4;
- constexpr unsigned n_outputs_ = 0;
-}
-
-bool boxm_save_scene_raw_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_save_scene_raw_process_globals;
-
- // process takes 4 inputs but has no outputs
- //input[0]: scene binary file
- //input[1]: output file (raw) path
- //input[2]: the resolution level wanted.. 0 is the most detailed (lowest possible level)
- //input[3]: 0 for writing blocks individually, 1 for writing the scene into one file
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vcl_string";
- input_types_[2] = "unsigned";
- input_types_[3] = "unsigned";
-
- std::vector<std::string> output_types_(n_outputs_);
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_save_scene_raw_process(bprb_func_process& pro)
-{
- using namespace boxm_save_scene_raw_process_globals;
-
- if ( pro.n_inputs() < n_inputs_) {
- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get the inputs
- unsigned i = 0;
- boxm_scene_base_sptr scene_ptr = pro.get_input<boxm_scene_base_sptr>(i++);
- std::string filepath = pro.get_input<std::string>(i++);
- auto resolution = pro.get_input<unsigned>(i++);
- auto whole = pro.get_input<unsigned>(i++);
-
- // check the scene's app model
- if (scene_ptr->appearence_model() == BOXM_FLOAT)
- {
- if (scene_ptr->multi_bin())
- {
- std::cout << "boxm_save_scene_raw_process: Multibin scenes not implemented" << std::endl;
- return false;
- }
- else
- {
- typedef boct_tree<short, float > type;
- auto* scene = dynamic_cast<boxm_scene<type>*>(scene_ptr.as_pointer());
- if(!scene)
- return false;
- if (!whole) {
- std::cout << "boxm_save_scene_raw_process: Save by block not implemented" << std::endl;
- return false;
- }
- else { // write the whole scene
- boxm_save_scene_raw_general_to_byte<short,float>(*scene, filepath + ".raw", resolution);
- }
- }
- }
- // check the scene's app model
- else if (scene_ptr->appearence_model() == BOXM_CHAR)
- {
- if (scene_ptr->multi_bin())
- {
- std::cout << "boxm_save_scene_raw_process: Multibin scenes not implemented" << std::endl;
- return false;
- }
- else
- {
- typedef boct_tree<short, char > type;
- auto* scene = dynamic_cast<boxm_scene<type>*>(scene_ptr.as_pointer());
- if(!scene)
- return false;
- if (!whole) {
- std::cout << "boxm_save_scene_raw_process: Save by block not implemented" << std::endl;
- return false;
- }
- else { // write the whole scene
- boxm_save_scene_raw_general<short,char>(*scene, filepath + ".raw", resolution);
- }
- }
- }
- // check the scene's app model
- else if (scene_ptr->appearence_model() == BOXM_BOOL)
- {
- if (scene_ptr->multi_bin())
- {
- std::cout << "boxm_save_scene_raw_process: Multibin scenes not implemented" << std::endl;
- return false;
- }
- else
- {
- typedef boct_tree<short, bool > type;
- auto* scene = dynamic_cast<boxm_scene<type>*>(scene_ptr.as_pointer());
- if(!scene)
- return false;
- if (!whole) {
- std::cout << "boxm_save_scene_raw_process: Save by block not implemented" << std::endl;
- return false;
- }
- else { // write the whole scene
- boxm_save_scene_raw_general<short>(*scene, filepath + ".raw", resolution);
- }
- }
- }
- else {
- std::cout << "boxm_save_scene_raw_process: undefined APM type" << std::endl;
- return false;
- }
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_split_scene_process.cxx b/contrib/brl/bseg/boxm/algo/pro/processes/boxm_split_scene_process.cxx
deleted file mode 100644
index d5b044d0db..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/processes/boxm_split_scene_process.cxx
+++ /dev/null
@@ -1,97 +0,0 @@
-// This is brl/bseg/boxm/algo/pro/processes/boxm_split_scene_process.cxx
-//:
-// \file
-// \brief process that splits a boxm_scene of boxm samples into an appearance and occupancy scene
-//
-// \author Isabel Restrepo
-// \date December 3, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bprb/bprb_func_process.h>
-#include <boxm/algo/boxm_split_sample.h>
-
-#include <bprb/bprb_parameters.h>
-#include <brdb/brdb_value.h>
-
-
-namespace boxm_split_scene_process_globals
-{
- constexpr unsigned n_inputs_ = 1;
- constexpr unsigned n_outputs_ = 2;
-}
-
-//: process takes 1 input and two outputs.
-// input[0]: The sample scene
-// output[0]: The appearance scene
-// output[1]: The alpha scene
-
-bool boxm_split_scene_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_split_scene_process_globals;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr";
- output_types_[1] = "boxm_scene_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_split_scene_process(bprb_func_process& pro)
-{
- using namespace boxm_split_scene_process_globals;
-
- if (pro.n_inputs() != n_inputs_)
- {
- std::cout << pro.name() << ": the input number should be " << n_inputs_
- << " but instead it is " << pro.n_inputs() << std::endl;
- return false;
- }
-
- //get inputs:
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(0);
-
- //check input's validity
- if (!scene_base.ptr()) {
- std::cout << " :-- Grid is not valid!\n";
- return false;
- }
-
- //: Note initial implementation is for fixed types, but this can be changed if more cases are needed
-
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > sample_tree_type;
-
- typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype apm_datatype;
- typedef boct_tree<short, apm_datatype> apm_tree_type;
-
- typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_mathtype alpha_type;
- typedef boct_tree<short, alpha_type> alpha_tree_type;
-
- auto *scene_in = static_cast<boxm_scene<sample_tree_type>* > (scene_base.as_pointer());
-
- // parameters of the output scene are the same as those of the input scene
- boxm_scene<apm_tree_type> *apm_scene = new boxm_scene<apm_tree_type>(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(),
- scene_in->max_level(), scene_in->init_level());
- apm_scene->set_paths(scene_in->path(), "apm_mog_grey");
- apm_scene->set_appearance_model(BSTA_MOG_F1);
- boxm_scene<alpha_tree_type > *alpha_scene = new boxm_scene<alpha_tree_type >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(),
- scene_in->max_level(), scene_in->init_level());
- alpha_scene->set_paths(scene_in->path(), "alpha");
- alpha_scene->set_appearance_model(BOXM_FLOAT);
- boxm_split_sample<BOXM_APM_MOG_GREY> splitter;
-
- splitter.split_scene( *scene_in, *apm_scene, *alpha_scene);
-
- apm_scene->write_scene("apm_scene.xml");
- alpha_scene->write_scene("/alpha_scene.xml");
-
- pro.set_output_val<boxm_scene_base_sptr>(0, apm_scene);
- pro.set_output_val<boxm_scene_base_sptr>(1, alpha_scene);
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/pro/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/pro/tests/CMakeLists.txt
deleted file mode 100644
index 2c499a1c2f..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/tests/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-add_executable( boxm_algo_pro_test_include test_include.cxx )
-target_link_libraries( boxm_algo_pro_test_include boxm_algo_pro)
diff --git a/contrib/brl/bseg/boxm/algo/pro/tests/test_include.cxx b/contrib/brl/bseg/boxm/algo/pro/tests/test_include.cxx
deleted file mode 100644
index 8ee327ed5f..0000000000
--- a/contrib/brl/bseg/boxm/algo/pro/tests/test_include.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/algo/pro/boxm_algo_processes.h>
-#include <boxm/algo/pro/boxm_algo_register.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm/algo/rt/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/rt/CMakeLists.txt
deleted file mode 100644
index 6140bcbb4a..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# brl/bseg/boxm/algo/CMakeLists.txt
-include_directories( ${MUL_INCLUDE_DIR} )
-set(boxm_algo_rt_sources
- boxm_change_probability_functor.h
- boxm_edge_tangent_updater.h boxm_edge_tangent_updater.hxx
- boxm_edge_updater.h boxm_edge_updater.hxx
- boxm_generate_edge_sample_functor.h
- boxm_generate_edge_tangent_sample_functor.h
- boxm_generate_opt2_sample_functor.h
- boxm_generate_opt3_sample_functor.h
- boxm_generate_opt_sample_functor.h
- boxm_opt2_optimizer.h boxm_opt2_optimizer.hxx
- boxm_opt3_optimizer.h boxm_opt3_optimizer.hxx
- boxm_opt_appearance_estimator.h
- boxm_opt_rt_bayesian_optimizer.h boxm_opt_rt_bayesian_optimizer.hxx
- boxm_pre_infinity_functor.h
- boxm_render_expected_depth_functor.h
- boxm_render_expected_edge_image_functor.h
- boxm_render_expected_edge_tangent_image_functor.h
- boxm_render_expected_image_functor.h
- boxm_render_expected_shadow_image_functor.h
- boxm_rpc_registration.h
- boxm_sun_vis_prob_functor.h
- boxm_update_image_functor.h
- boxm_compute_num_rays_statistics.h
- boxm_expected_edge_functor.h
- boxm_shadow_appearance_estimator.h
- boxm_generate_shadow_sample_functor.h
- boxm_shadow_app_initializer.h boxm_shadow_app_initializer.hxx
- boxm_shadow_bayes_optimizer.h boxm_shadow_bayes_optimizer.hxx
- dummy.cxx
- )
-
-aux_source_directory(Templates boxm_algo_rt_sources)
-
-vxl_add_library(LIBRARY_NAME boxm_algo_rt LIBRARY_SOURCES ${boxm_algo_rt_sources})
-
-#processes
-add_subdirectory(pro)
-
-if( BUILD_TESTING )
- add_subdirectory(tests)
-endif()
-
-target_link_libraries(boxm_algo_rt boxm boxm_sample boxm_sample_algo boxm_basic boxm_util ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vcl ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vgl_algo bsta ${VXL_LIB_PREFIX}vnl sdet brip ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vpgl_algo )
-
diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_edge_tangent_updater+short.float.float-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_edge_tangent_updater+short.float.float-.cxx
deleted file mode 100644
index ef11ac6b96..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_edge_tangent_updater+short.float.float-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/algo/rt/boxm_edge_tangent_updater.hxx>
-
-BOXM_EDGE_TANGENT_UPDATER_INSTANTIATE(short,float,float);
-BOXM_EDGE_TANGENT_REFINE_UPDATES_INSTANTIATE(short,float,float);
diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_edge_updater+short.float.float-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_edge_updater+short.float.float-.cxx
deleted file mode 100644
index 8d4e1a9f37..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_edge_updater+short.float.float-.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <boxm/algo/rt/boxm_edge_updater.hxx>
-
-BOXM_EDGE_UPDATER_INSTANTIATE(short,float,float);
diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt2_optimizer+short.BOXM_APM_MOG_GREY.BOXM_AUX_OPT2_GREY-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt2_optimizer+short.BOXM_APM_MOG_GREY.BOXM_AUX_OPT2_GREY-.cxx
deleted file mode 100644
index ca43ee5ebf..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt2_optimizer+short.BOXM_APM_MOG_GREY.BOXM_AUX_OPT2_GREY-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/algo/rt/boxm_opt2_optimizer.hxx>
-#include <boxm/boxm_apm_traits.h>
-
-BOXM_OPT2_OPTIMIZER_INSTANTIATE(short,BOXM_APM_MOG_GREY,BOXM_AUX_OPT2_GREY);
diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt2_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT2_GREY-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt2_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT2_GREY-.cxx
deleted file mode 100644
index fc93c9b10a..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt2_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT2_GREY-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/algo/rt/boxm_opt2_optimizer.hxx>
-#include <boxm/boxm_apm_traits.h>
-
-BOXM_OPT2_OPTIMIZER_INSTANTIATE(short,BOXM_APM_SIMPLE_GREY,BOXM_AUX_OPT2_GREY);
diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt3_optimizer+short.BOXM_APM_MOG_GREY.BOXM_APM_MOG_GREY-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt3_optimizer+short.BOXM_APM_MOG_GREY.BOXM_APM_MOG_GREY-.cxx
deleted file mode 100644
index a9b24b175b..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt3_optimizer+short.BOXM_APM_MOG_GREY.BOXM_APM_MOG_GREY-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/algo/rt/boxm_opt3_optimizer.hxx>
-#include <boxm/boxm_apm_traits.h>
-
-BOXM_OPT3_OPTIMIZER_INSTANTIATE(short,BOXM_APM_MOG_GREY,BOXM_APM_MOG_GREY);
diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt3_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_APM_MOG_GREY-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt3_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_APM_MOG_GREY-.cxx
deleted file mode 100644
index 318336e55b..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt3_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_APM_MOG_GREY-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/algo/rt/boxm_opt3_optimizer.hxx>
-#include <boxm/boxm_apm_traits.h>
-
-BOXM_OPT3_OPTIMIZER_INSTANTIATE(short,BOXM_APM_SIMPLE_GREY, BOXM_APM_MOG_GREY);
diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt_rt_bayesian_optimizer+short.BOXM_APM_MOG_GREY.BOXM_AUX_OPT_RT_GREY-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt_rt_bayesian_optimizer+short.BOXM_APM_MOG_GREY.BOXM_AUX_OPT_RT_GREY-.cxx
deleted file mode 100644
index 89f46b6393..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt_rt_bayesian_optimizer+short.BOXM_APM_MOG_GREY.BOXM_AUX_OPT_RT_GREY-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/algo/rt/boxm_opt_rt_bayesian_optimizer.hxx>
-#include <boxm/boxm_apm_traits.h>
-
-BOXM_OPT_RT_BAYESIAN_OPTIMIZER_INSTANTIATE(short,BOXM_APM_MOG_GREY,BOXM_AUX_OPT_RT_GREY);
diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt_rt_bayesian_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt_rt_bayesian_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx
deleted file mode 100644
index 0c8a2da7d1..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_opt_rt_bayesian_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/algo/rt/boxm_opt_rt_bayesian_optimizer.hxx>
-#include <boxm/boxm_apm_traits.h>
-
-BOXM_OPT_RT_BAYESIAN_OPTIMIZER_INSTANTIATE(short,BOXM_APM_SIMPLE_GREY,BOXM_AUX_OPT_RT_GREY);
diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_shadow_app_initializer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_shadow_app_initializer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx
deleted file mode 100644
index 1cc6084872..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_shadow_app_initializer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <boxm/algo/rt/boxm_shadow_app_initializer.hxx>
-#include <boxm/boxm_apm_traits.h>
-BOXM_SHADOW_APP_INITIALIZER_INSTANTIATE(short,BOXM_APM_SIMPLE_GREY,BOXM_AUX_OPT_RT_GREY);
diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_shadow_bayes_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_shadow_bayes_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx
deleted file mode 100644
index 8a9638f4b1..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/Templates/boxm_shadow_bayes_optimizer+short.BOXM_APM_SIMPLE_GREY.BOXM_AUX_OPT_RT_GREY-.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <boxm/algo/rt/boxm_shadow_bayes_optimizer.hxx>
-#include <boxm/boxm_apm_traits.h>
-BOXM_SHADOW_BAYES_OPTIMIZER_INSTANTIATE(short,BOXM_APM_SIMPLE_GREY,BOXM_AUX_OPT_RT_GREY);
diff --git a/contrib/brl/bseg/boxm/algo/rt/Templates/bpgl_camera_estimator+boxm_expected_edge_functor+short.boxm_inf_line_sample+float---.cxx b/contrib/brl/bseg/boxm/algo/rt/Templates/bpgl_camera_estimator+boxm_expected_edge_functor+short.boxm_inf_line_sample+float---.cxx
deleted file mode 100644
index 71036d42a6..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/Templates/bpgl_camera_estimator+boxm_expected_edge_functor+short.boxm_inf_line_sample+float---.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <bpgl/bpgl_camera_estimator.hxx>
-#include <boxm/algo/rt/boxm_expected_edge_functor.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-
-typedef boxm_inf_line_sample<float> sample;
-typedef boxm_expected_edge_functor<short,sample > functor;
-BPGL_CAMERA_ESTIMATOR_INSTANTIATE(functor);
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_change_3d_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_change_3d_functor.h
deleted file mode 100644
index 5700690341..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_change_3d_functor.h
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifndef boxm_change_3d_functor_h
-#define boxm_change_3d_functor_h
-//:
-// \file
-#include <iostream>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/sample/boxm_scalar_sample.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-
-template <boxm_apm_type APM>
-class boxm_change_3d_functor
-{
- public:
- //: "default" constructor
- boxm_change_3d_functor(vil_image_view<float> const& change_image, float prob_ratio)
- : change_image_(change_image),
- vis_img_(change_image.ni(),change_image.nj(), 1),
- alpha_integral_(change_image.ni(),change_image.nj(), 1),
- prob_ratio_(prob_ratio)
- {
- vis_img_.fill(1.0f);
- alpha_integral_.fill(0.0f);
-
- //only reads info from the scene
- scene_read_only_=true;
- //needs to write aux
- is_aux_=true;
- }
-
- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d<double> s0, vgl_point_3d<double> s1, boxm_sample<APM>& cell_value, boxm_scalar_sample<float>& scalar)
- {
- // compute segment length
- const float seg_len = (float)(s1 - s0).length();
-
- // update segment length sum
- scalar.seg_len_ += seg_len;
-
- // update alpha integral
- alpha_integral_(i,j) += cell_value.alpha * seg_len;
-
- // compute new visibility probability with updated alpha_integral
- const float vis_prob_end = std::exp(-alpha_integral_(i,j));
-
- // compute weight for this cell
- const float Omega = vis_img_(i,j) - vis_prob_end;
-
- float back_prob = change_image_(i,j);
- float fore_prob = 1.0f/(1.0f + prob_ratio_*back_prob);
-
- // set change prob in auxiliary voxel
- scalar.scalar_sum_ += Omega * fore_prob * seg_len;
-
- // update visibility probability
- vis_img_(i,j) = vis_prob_end;
-
- return true;
- }
-
- public:
- bool scene_read_only_;
- bool is_aux_;
-
- private:
- vil_image_view<float> change_image_;
- vil_image_view<float> alpha_integral_;
- vil_image_view<float> vis_img_;
- float prob_ratio_;
-};
-
-template <class T_loc, class T_data>
-void boxm_change_3d(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<float> &change_image,
- std::string chng_name,
- float prob_ratio)
-{
- typedef boxm_scalar_sample<float> sample_datatype;
- boxm_aux_scene<T_loc, T_data, sample_datatype> aux_scene(&scene,chng_name, boxm_aux_scene<T_loc, T_data, sample_datatype>::CLONE);
-
- std::cout<<"Chng visibility"<<std::endl;
- // functor to compute 3-d change prob
- typedef boxm_change_3d_functor<T_data::apm_type> change_functor;
-
- // set up the raytrace function
- boxm_raytrace_function<change_functor,T_loc, T_data, sample_datatype> raytracer_chng(scene,aux_scene,cam.ptr(),change_image.ni(),change_image.nj());
-
- // construct the change probability functor
- change_functor chng_func(change_image, prob_ratio);
-
- // run the functor over the octree
- raytracer_chng.run(chng_func);
-
- std::cout<<"Change 3-d Done."<<std::endl;
-}
-
-#endif // boxm_change_3d_functor_h
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_change_probability_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_change_probability_functor.h
deleted file mode 100644
index a5d584f2c0..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_change_probability_functor.h
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef boxm_change_probability_functor_h
-#define boxm_change_probability_functor_h
-//:
-// \file
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <boxm/sample/algo/boxm_mob_grey_processor.h>
-#include <vil/vil_image_view.h>
-
-template <boxm_apm_type APM, class T_aux>
-class boxm_change_probability_functor
-{
- public:
- //: "default" constructor
- boxm_change_probability_functor(vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> const & image, vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> &change_prob,
- vil_image_view<float> &mask_vis,
- unsigned int ni,unsigned nj,
- bool scene_read_only=false,bool is_aux=true)
- : image_(image), change_prob_(change_prob), vis_img_(mask_vis), alpha_integral_(ni,nj, 1)
- {
- alpha_integral_.fill(0.0f);
- typename boxm_apm_traits<APM>::obs_datatype nil(0);
- change_prob_.fill(nil);
- vis_img_.fill(1.0f);
- scene_read_only_=scene_read_only;
- is_aux_=is_aux;
- }
-
- inline bool step_cell(unsigned int i, unsigned int j,
- vgl_point_3d<double> s0, vgl_point_3d<double> s1,
- boxm_sample<APM> &cell_value,
- T_aux /*aux_val*/)
- {
- // compute segment length
- const float seg_len = (float)(s1 - s0).length();
- // compute appearance probability of observation
- const float prob_den = boxm_apm_traits<APM>::apm_processor::prob_density(cell_value.appearance(), image_(i,j));
- // update alpha integral
- alpha_integral_(i,j) += cell_value.alpha * seg_len;
-
- // compute new visibility probability with updated alpha_integral
- const float vis_prob_end = std::exp(-alpha_integral_(i,j));
- // compute weight for this cell
- const float Omega = vis_img_(i,j) - vis_prob_end;
- // and update expected image
- change_prob_(i,j) += prob_den* Omega;
- // update visibility probability
- vis_img_(i,j) = vis_prob_end;
-
- return true;
- }
-
- bool scene_read_only_;
- bool is_aux_;
-
- private:
- vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> const& image_;
- vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> &change_prob_;
- vil_image_view<float> &vis_img_;
- vil_image_view<float> alpha_integral_;
-};
-
-
-template <class T_loc, class T_data>
-void boxm_change_prob_rt(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vil_image_view<typename T_data::obs_datatype> const& image,
- vpgl_camera_double_sptr cam,
- vil_image_view<typename T_data::obs_datatype> &change_prob,
- vil_image_view<float> & mask,
- int /*bin*/ = -1,
- bool /*use_black_background*/ = false)
-{
- typedef boxm_aux_traits<BOXM_AUX_NULL>::sample_datatype sample_datatype;
- boxm_aux_scene<T_loc, T_data,boxm_rt_sample<sample_datatype> > aux_scene(&scene,boxm_aux_traits<BOXM_AUX_NULL>::storage_subdir(), boxm_aux_scene<T_loc, T_data,boxm_rt_sample<sample_datatype> >::LOAD);
- typedef boxm_change_probability_functor<T_data::apm_type,boxm_rt_sample<sample_datatype> > chng_functor;
- boxm_raytrace_function<chng_functor,T_loc, T_data,boxm_rt_sample<sample_datatype> > raytracer(scene,aux_scene,cam.ptr(),change_prob.ni(),change_prob.nj());
- chng_functor functor(image, change_prob,mask,change_prob.ni(),change_prob.nj(),true,false);
- raytracer.run(functor);
-}
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_compute_num_rays_statistics.h b/contrib/brl/bseg/boxm/algo/rt/boxm_compute_num_rays_statistics.h
deleted file mode 100644
index 144d5bd7bf..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_compute_num_rays_statistics.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef boxm_compute_num_rays_statistics_h
-#define boxm_compute_num_rays_statistics_h
-
-#include <iostream>
-#include <boxm/boxm_scene.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <bsta/bsta_histogram.h>
-#include <boxm/basic/boxm_num_rays_functor.h>
-#include <boxm/sample/boxm_scalar_sample.h>
-
-template <class T_loc, class T_data>
-bool compute_ray_statistics(boxm_scene<boct_tree<T_loc, T_data > >& scene,
- vpgl_camera_double_sptr cam,
- bsta_histogram<float>& num_rays_hist,
- unsigned ni, unsigned nj)
-{
- typedef boxm_aux_traits<BOXM_AUX_SCALAR_SAMPLE>::sample_datatype sample_datatype;
- boxm_aux_scene<T_loc, T_data,boxm_scalar_sample<sample_datatype> > aux_scene(&scene,boxm_aux_traits<BOXM_AUX_SCALAR_SAMPLE>::storage_subdir(), boxm_aux_scene<T_loc, T_data,boxm_scalar_sample<sample_datatype> >::CLONE);
-
- typedef boxm_num_rays_functor<T_data::apm_type,boxm_scalar_sample<sample_datatype> > functor_type;
- boxm_raytrace_function<functor_type,T_loc, T_data,boxm_scalar_sample<sample_datatype> > raytracer(scene,aux_scene,cam.ptr(),ni,nj);
- functor_type num_rays_functor;
- raytracer.run(num_rays_functor);
-
- typedef boct_tree<T_loc, T_data > tree_type;
-
- typedef boct_tree<T_loc, boxm_scalar_sample<sample_datatype> > aux_tree_type;
- typedef boct_tree_cell<T_loc,boxm_scalar_sample<sample_datatype> > aux_cell_type;
-
- num_rays_hist = bsta_histogram<float>(0.0f, 80.0f, 40);
- boxm_block_iterator<tree_type> bit = scene.iterator();
- float avg_rays=0;
- float num_cells=0;
- for (; !bit.end(); ++bit)
- {
- vgl_point_3d<int> block_index = bit.index();
- //aux_scene.load_block(block_index);
- boxm_block<aux_tree_type> * block = aux_scene.get_block(block_index);
- aux_tree_type* tree=block->get_tree();
- if (!tree) return false;
- std::vector<aux_cell_type *> leaves = tree->leaf_cells();
- for (typename std::vector<aux_cell_type *>::iterator cit = leaves.begin(); cit != leaves.end(); ++cit)
- {
- boxm_scalar_sample<sample_datatype> data = (*cit)->data();
- num_rays_hist.upcount(static_cast<float>(data.scalar_sum_), 1.0f);
- avg_rays+=data.scalar_sum_;
- num_cells++;
- }
- }
-
- //aux_scene.clean_scene();
- std::cout<<"Avg num of rays per cell "<<avg_rays/num_cells<<std::endl
- << "[#rays]=Frequency" << '\n';
-
- for (unsigned int i=0; i<num_rays_hist.nbins(); i++)
- {
- std::cout<< '[' << num_rays_hist.avg_bin_value(i) << "]=" << num_rays_hist.counts(i) << '\n';
- }
-
- return true;
-}
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_edge_tangent_updater.h b/contrib/brl/bseg/boxm/algo/rt/boxm_edge_tangent_updater.h
deleted file mode 100644
index 510fb1158d..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_edge_tangent_updater.h
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifndef boxm_edge_tangent_updater_h_
-#define boxm_edge_tangent_updater_h_
-//:
-// \file
-// \brief class to find the optimal intersecting 3D lines for each voxel in the scene
-//
-// \author G. Tunali
-//
-// \verbatim
-// Modifications
-// Ozge C. Ozcanli July 7, 2010 : made some internal hard-coded defaults into parameters
-// \endverbatim
-
-#include <vector>
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-
-#include <vpgl/vpgl_camera_double_sptr.h>
-#include <vil/vil_image_view.h>
-
-template<class T_loc, class APM, class AUX>
-class boxm_edge_tangent_updater
-{
- public:
-
- boxm_edge_tangent_updater(boxm_scene<boct_tree<T_loc, boxm_inf_line_sample<APM> > > &scene,
- std::vector<std::string> image_ids, bool use_ransac=true, float ransac_ortho_thres = 0.01f, float ransac_volume_ratio = 128.0f, int ransac_consensus_cnt = 3);
-
- ~boxm_edge_tangent_updater()= default;
-
- bool add_cells();
-
- protected:
- std::vector<std::string> image_ids_;
- bool use_ransac_;
-
- float ransac_ortho_thres_;
- float ransac_volume_ratio_;
- int ransac_consensus_cnt_; // number of images that need to contribute planes to a hypothesis for a cell to be assigned a 3D edge
- // there should be at least ransac_consensus_cnt_+1 training images for some consensus to be met at any voxel, otherwise edge world will be empty
-
- boxm_scene<boct_tree<T_loc, boxm_inf_line_sample<APM> > > &scene_;
-};
-
-template<class T_loc, class APM, class AUX>
-class boxm_edge_tangent_refine_updates
-{
- public:
-
- boxm_edge_tangent_refine_updates(boxm_scene<boct_tree<T_loc, boxm_inf_line_sample<APM> > > &scene, int consensus_cnt,
- std::vector<vil_image_view<float> > edge_images,
- std::vector<vpgl_camera_double_sptr> cameras);
-
- ~boxm_edge_tangent_refine_updates() = default;
-
- bool refine_cells();
-
- protected:
- std::vector<vil_image_view<float> > edge_images_; // edge_img(ix, iy, 0) = static_cast<float>(x); subpixel location of edge
- // edge_img(ix, iy, 1) = static_cast<float>(y);
- // edge_img(ix, iy, 2) = static_cast<float>(dir); tangent direction of the edgel
- std::vector<vpgl_camera_double_sptr> cameras_;
-
- int consensus_cnt_; // how many images need to be in agreement for an edgel to survive
- boxm_scene<boct_tree<T_loc, boxm_inf_line_sample<APM> > > &scene_;
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_edge_tangent_updater.hxx b/contrib/brl/bseg/boxm/algo/rt/boxm_edge_tangent_updater.hxx
deleted file mode 100644
index 5c3d68f321..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_edge_tangent_updater.hxx
+++ /dev/null
@@ -1,291 +0,0 @@
-#ifndef boxm_edge_tangent_updater_hxx_
-#define boxm_edge_tangent_updater_hxx_
-
-#include <utility>
-#include <vector>
-#include <iostream>
-#include <string>
-#include "boxm_edge_tangent_updater.h"
-
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_aux_scene.h>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-#include <boxm/sample/boxm_plane_obs.h>
-#include <boxm/util/boxm_plane_ransac.h>
-#include <vpgl/vpgl_camera.h>
-
-#include <vgl/vgl_infinite_line_3d.h>
-#include <vgl/vgl_plane_3d.h>
-#include <vgl/vgl_intersection.h>
-#include <vgl/algo/vgl_intersection.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <bsta/bsta_histogram.h>
-
-template <class T_loc, class APM, class AUX>
-boxm_edge_tangent_updater<T_loc,APM,AUX>::boxm_edge_tangent_updater(boxm_scene<boct_tree<T_loc,
- boxm_inf_line_sample<APM> > > &scene,
- std::vector<std::string> image_ids,
- bool use_ransac,
- float ransac_ortho_thres,
- float ransac_volume_ratio,
- int ransac_concensus_cnt)
-: image_ids_(std::move(image_ids)), use_ransac_(use_ransac), ransac_ortho_thres_(ransac_ortho_thres), ransac_volume_ratio_(ransac_volume_ratio), ransac_consensus_cnt_(ransac_concensus_cnt), scene_(scene)
-{}
-
-
-template <class T_loc, class APM, class AUX>
-bool boxm_edge_tangent_updater<T_loc,APM,AUX>::add_cells()
-{
- // get auxiliary scenes associated with each input image
-
- typedef boct_tree<T_loc, boxm_inf_line_sample<APM> > tree_type;
-
- std::vector<boxm_aux_scene<T_loc, boxm_inf_line_sample<APM>, boxm_edge_tangent_sample<AUX> > > aux_scenes;
- for (unsigned int i=0; i<image_ids_.size(); ++i) {
- boxm_aux_scene<T_loc, boxm_inf_line_sample<APM>, boxm_edge_tangent_sample<AUX> >
- aux_scene(&scene_,image_ids_[i],boxm_aux_scene<T_loc, boxm_inf_line_sample<APM>,
- boxm_edge_tangent_sample<AUX> >::LOAD, BOXM_EDGE_TANGENT_LINE);
- aux_scenes.push_back(aux_scene);
- }
-
- std::vector<boxm_edge_tangent_sample<APM> > aux_samples;
-
- // for each block
- boxm_block_iterator<tree_type> iter(&scene_);
- iter.begin();
- while (!iter.end())
- {
- scene_.load_block(iter.index());
- boxm_block<tree_type>* block = *iter;
- boct_tree<T_loc, boxm_inf_line_sample<APM> >* tree = block->get_tree();
- std::vector<boct_tree_cell<T_loc,boxm_inf_line_sample<APM> >*> cells = tree->leaf_cells();
- int nums=0;
- // get a vector of incremental readers for each aux scene.
- std::vector<boct_tree_cell_reader<T_loc, boxm_edge_tangent_sample<AUX> > *> aux_readers(aux_scenes.size());
- std::vector<unsigned> aux_samples_num(aux_scenes.size());
- for (unsigned int i=0; i<aux_scenes.size(); ++i) {
- aux_readers[i] = aux_scenes[i].get_block_incremental(iter.index());
- aux_samples_num[i] = 0;
- }
- //int a;
- //std::cin>>a;
- // iterate over cells
- for (unsigned i=0; i<cells.size(); ++i)
- {
- aux_samples.clear();
- boct_tree_cell<T_loc,boxm_inf_line_sample<APM> >* cell = cells[i];
- // initialize the cell
- boxm_inf_line_sample<AUX> data(vgl_infinite_line_3d<AUX>(vgl_vector_2d<AUX>(0,0),vgl_vector_3d<AUX>(1,1,1)));
- cell->set_data(data);
-
- for (unsigned j=0; j<aux_readers.size(); j++) {
- boct_tree_cell<T_loc, boxm_edge_tangent_sample<AUX> > temp_cell;
-
- if (!aux_readers[j]->next(temp_cell)) {
- std::cerr << "error: incremental reader returned false.\n";
- return false;
- }
-
- if (!temp_cell.code_.isequal(&(cell->code_))) {
- std::cerr << "error: temp_cell idx does not match cell idx.\n";
- return false;
- }
- if (temp_cell.data().num_obs()>0)
- {
- aux_samples.push_back(temp_cell.data());
- //aux_samples_num[j]++;
- }
- }
-
- if (aux_samples.size() > 1)
- {
- std::vector<vgl_plane_3d<AUX> > planes;
- std::vector<AUX> weights;
-
- for (unsigned int k=0;k<aux_samples.size(); ++k) {
- boxm_edge_tangent_sample<APM> s = aux_samples[k];
- for (unsigned int j=0; j<s.num_obs(); j++) {
- boxm_plane_obs<AUX> obs = s.obs(j);
- weights.push_back(obs.seg_len_);
- vgl_plane_3d<AUX> plane(obs.plane_);
- planes.push_back(plane);
- }
- }
- nums+=planes.size();
- if (planes.size() > 1) {
- if (use_ransac_) {
- vgl_infinite_line_3d<AUX> line;
- float residual=1e5;
- vgl_box_3d<double> bb = tree->cell_bounding_box(cell);
-
- // ransac_consensus_cnt_ used to be hard-coded here to 5; made it into a parameter with a default value of 3
- if (boxm_plane_ransac<AUX>(aux_samples, weights, line, residual,bb, ransac_consensus_cnt_, ransac_ortho_thres_, ransac_volume_ratio_)) {
- boxm_inf_line_sample<AUX> data(line,aux_samples.size());
- data.residual_=residual;
-
- // now set the clipped line
- // convert to type double
- vgl_vector_2d<double> x0(line.x0().x(), line.x0().y());
- vgl_point_3d<double> p0,p1;
- vgl_vector_3d<double> dir(line.direction().x(), line.direction().y(), line.direction().z());
- vgl_infinite_line_3d<double> dline(x0,dir);
- if (!vgl_intersection<double>(bb, dline, p0, p1))
- data.residual_=0;
- else {
- // convert back to type AUX
- vgl_point_3d<AUX> p0_t(AUX(p0.x()), AUX(p0.y()), AUX(p0.z()));
- vgl_point_3d<AUX> p1_t(AUX(p1.x()), AUX(p1.y()), AUX(p1.z()));
- vgl_line_3d_2_points<AUX> line_clipped(p0_t,p1_t);
- data.line_clipped_ = line_clipped;
- }
-
- cell->set_data(data);
- }
- else
- {
- boxm_inf_line_sample<AUX> sample(vgl_infinite_line_3d<AUX>(vgl_vector_2d<AUX>(-10000,-10000),vgl_vector_3d<AUX>(0,0,1)));
- cell->set_data(sample);
- }
- }
- else
- {
- boxm_inf_line_sample<AUX> sample(vgl_infinite_line_3d<AUX>(vgl_vector_2d<AUX>(-10000,-10000),vgl_vector_3d<AUX>(0,0,1)));
- cell->set_data(sample);
- }
- }
- else
- {
- boxm_inf_line_sample<AUX> sample(vgl_infinite_line_3d<AUX>(vgl_vector_2d<AUX>(-10000,-10000),vgl_vector_3d<AUX>(0,0,1)));
- cell->set_data(sample);
- }
- }
- else
- {
- boxm_inf_line_sample<AUX> sample(vgl_infinite_line_3d<AUX>(vgl_vector_2d<AUX>(-10000,-10000),vgl_vector_3d<AUX>(0,0,1)));
- cell->set_data(sample);
- }
- }
- nums/=cells.size();
-
- scene_.write_active_block();
- for (unsigned int i=0; i<aux_readers.size(); ++i) {
- aux_readers[i]->close();
- }
- iter++;
- }
-#ifdef DEBUG
- std::cout << "done with all cells" << std::endl;
-#endif
-#if 0
- // clear the aux scenes so that its starts with the refined scene next time
- for (unsigned i=0; i<aux_scenes.size(); i++) {
- aux_scenes[i].clean_scene();
- }
-#endif
- return true;
-}
-
-template <class T_loc, class APM, class AUX>
-boxm_edge_tangent_refine_updates<T_loc,APM,AUX>::boxm_edge_tangent_refine_updates(boxm_scene<boct_tree<T_loc, boxm_inf_line_sample<APM> > > &scene,
- int consensus_cnt,
- std::vector<vil_image_view<float> > edge_images,
- std::vector<vpgl_camera_double_sptr> cameras)
-: edge_images_(std::move(edge_images)), cameras_(std::move(cameras)), consensus_cnt_(consensus_cnt), scene_(scene)
-{}
-
-template <class T_loc, class APM, class AUX>
-bool boxm_edge_tangent_refine_updates<T_loc,APM,AUX>::refine_cells()
-{
- std::cout << "using " << edge_images_.size() << " images to refine edge world!" << std::endl;
-
- typedef boct_tree<T_loc, boxm_inf_line_sample<APM> > tree_type;
-
- // for each block
- boxm_block_iterator<tree_type> iter(&scene_);
- iter.begin();
- while (!iter.end())
- {
- scene_.load_block(iter.index());
- boxm_block<tree_type>* block = *iter;
- boct_tree<T_loc, boxm_inf_line_sample<APM> >* tree = block->get_tree();
- std::vector<boct_tree_cell<T_loc,boxm_inf_line_sample<APM> >*> cells = tree->leaf_cells();
-
- // iterate over cells
- for (unsigned i=0; i<cells.size(); ++i)
- {
- boct_tree_cell<T_loc,boxm_inf_line_sample<APM> >* cell = cells[i];
- boxm_inf_line_sample<AUX> cell_value = cell->data();
-
- // update residual of cell_value based on the visibility and support of this 3D line in all the images
- if (cell_value.residual_<1.0)
- {
- // go through each image
- int cnt = 0;
- for (unsigned k = 0; k < edge_images_.size(); k++) {
- int ni = edge_images_[k].ni();
- int nj = edge_images_[k].nj();
- // project this 3D line to the image
- double u1,v1,u2,v2;
- vgl_point_3d<float> p1=cell_value.line_clipped_.point1();
- vgl_point_3d<float> p2=cell_value.line_clipped_.point2();
- cameras_[k]->project(p1.x(),p1.y(),p1.z(),u1,v1);
- cameras_[k]->project(p2.x(),p2.y(),p2.z(),u2,v2);
-
- double line_angle = vnl_math::angle_0_to_2pi(std::atan2(v2-v1, -(u2-u1)));
- double line_angle2 = vnl_math::angle_0_to_2pi(line_angle + vnl_math::pi); // line segment is symmetric
-
- // find mid point of line seg
- int cent_i = int(u1+(u2-u1)/2.0);
- int cent_j = int(v1+(v2-v1)/2.0);
-
- // check a neighborhood of 10x10 in the image to find the edgel that is nearest to this line segment
- double angle_of_min = 0.0;
- double dist = 10.0;
- for (int ii = cent_i - 10; ii < cent_i + 10; ii++) {
- if (ii < 0 || ii >= ni) continue;
- for (int jj = cent_j - 10; jj < cent_j + 10; jj++) {
- if (jj < 0 || jj >= nj) continue;
- double ex = edge_images_[k](ii,jj,0);
- double ey = edge_images_[k](ii,jj,1);
- double dir = edge_images_[k](ii,jj,2);
- double dist_to_seg = vgl_distance_to_linesegment<double>(u1, v1, u2, v2, ex, ey);
- if (dist_to_seg < dist) {
- dist = dist_to_seg;
- angle_of_min = dir;
- }
- }
- }
- if (dist < 10.0)
- if (std::abs(angle_of_min - line_angle) < vnl_math::pi/16.0 || std::abs(angle_of_min - line_angle2) < vnl_math::pi/16.0)
- cnt++;
- }
-
- if (cnt >= consensus_cnt_)
- cell_value.residual_ = AUX(1.0)-AUX(cnt)/AUX(edge_images_.size());
- else
- cell_value.residual_ = AUX(1.0);
- cell->set_data(cell_value);
- }
- }
- scene_.write_active_block();
- iter++;
- }
-
- return true;
-}
-
-
-#define BOXM_EDGE_TANGENT_UPDATER_INSTANTIATE(T1,T2,T3) \
-template class boxm_edge_tangent_updater<T1,T2,T3 >
-
-#define BOXM_EDGE_TANGENT_REFINE_UPDATES_INSTANTIATE(T1,T2,T3) \
-template class boxm_edge_tangent_refine_updates<T1,T2,T3 >
-
-#endif // boxm_edge_tangent_updater_hxx_
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_edge_updater.h b/contrib/brl/bseg/boxm/algo/rt/boxm_edge_updater.h
deleted file mode 100644
index 646f92a418..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_edge_updater.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef boxm_edge_updater_h_
-#define boxm_edge_updater_h_
-
-#include <vector>
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_scene.h>
-
-#include <boxm/sample/boxm_edge_sample.h>
-
-template<class T_loc, class APM, class AUX>
-class boxm_edge_updater
-{
- public:
- boxm_edge_updater(boxm_scene<boct_tree<T_loc, boxm_edge_sample<APM> > > &scene,
- std::vector<std::string> image_ids);
-
- ~boxm_edge_updater()= default;
-
- bool add_cells();
-
- protected:
- std::vector<std::string> image_ids_;
-
- boxm_scene<boct_tree<T_loc, boxm_edge_sample<APM> > > &scene_;
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_edge_updater.hxx b/contrib/brl/bseg/boxm/algo/rt/boxm_edge_updater.hxx
deleted file mode 100644
index 029f503587..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_edge_updater.hxx
+++ /dev/null
@@ -1,110 +0,0 @@
-#ifndef boxm_edge_updater_hxx_
-#define boxm_edge_updater_hxx_
-
-#include <utility>
-#include <vector>
-#include <iostream>
-#include <string>
-#include "boxm_edge_updater.h"
-
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_aux_scene.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <class T_loc, class APM, class AUX>
-boxm_edge_updater<T_loc,APM,AUX>::boxm_edge_updater(boxm_scene<boct_tree<T_loc,
- boxm_edge_sample<APM> > > &scene,
- std::vector<std::string> image_ids)
-: image_ids_(std::move(image_ids)), scene_(scene)
-{}
-
-
-template <class T_loc, class APM, class AUX>
-bool boxm_edge_updater<T_loc,APM,AUX>::add_cells()
-{
- // get auxiliary scenes associated with each input image
- //typedef typename boxm_aux_traits<AUX>::sample_datatype AUX;
-
- typedef boct_tree<T_loc, boxm_edge_sample<APM> > tree_type;
-
- std::vector<boxm_aux_scene<T_loc, boxm_edge_sample<APM>, boxm_aux_edge_sample<AUX> > > aux_scenes;
- for (unsigned int i=0; i<image_ids_.size(); ++i) {
- boxm_aux_scene<T_loc, boxm_edge_sample<APM>, boxm_aux_edge_sample<AUX> > aux_scene(&scene_,image_ids_[i],boxm_aux_scene<T_loc, boxm_edge_sample<APM>, boxm_aux_edge_sample<AUX> >::LOAD);
- aux_scenes.push_back(aux_scene);
- }
-
- std::vector<boxm_aux_edge_sample<APM> > aux_samples;
-
- // for each block
- boxm_block_iterator<tree_type> iter(&scene_);
- iter.begin();
- while (!iter.end())
- {
- scene_.load_block(iter.index());
- boxm_block<tree_type>* block = *iter;
- boct_tree<T_loc, boxm_edge_sample<APM> >* tree = block->get_tree();
- std::vector<boct_tree_cell<T_loc,boxm_edge_sample<APM> >*> cells = tree->leaf_cells();
-
- // get a vector of incremental readers for each aux scene.
- std::vector<boct_tree_cell_reader<T_loc, boxm_aux_edge_sample<AUX> > *> aux_readers(aux_scenes.size());
- for (unsigned int i=0; i<aux_scenes.size(); ++i) {
- aux_readers[i] = aux_scenes[i].get_block_incremental(iter.index());
- }
- // iterate over cells
- for (unsigned i=0; i<cells.size(); ++i)
- {
- aux_samples.clear();
- boct_tree_cell<T_loc,boxm_edge_sample<APM> >* cell = cells[i];
- boxm_edge_sample<APM> data = cell->data();
- //std::cout << "cell IN " << data.alpha << data.appearence_<< std::endl;
- for (unsigned j=0; j<aux_readers.size(); j++) {
- boct_tree_cell<T_loc, boxm_aux_edge_sample<AUX> > temp_cell;
-
- if (!aux_readers[j]->next(temp_cell)) {
- std::cerr << "error: incremental reader returned false.\n";
- return false;
- }
-
- if (!temp_cell.code_.isequal(&(cell->code_))) {
- std::cerr << "error: temp_cell idx does not match cell idx.\n";
- return false;
- }
- if (temp_cell.data().seg_len_ > 0.0f) {
- aux_samples.push_back(temp_cell.data());
- }
- }
-
- //std::vector<typename boxm_edge_sample<APM> > obs_vector(aux_samples.size());
- for (unsigned int s=0; s<aux_samples.size(); ++s) {
- data.edge_prob_ += aux_samples[s].obs_/aux_samples[s].seg_len_;
- }
- data.num_obs_ += 1;
- cell->set_data(data);
- }
- scene_.write_active_block();
- for (unsigned int i=0; i<aux_readers.size(); ++i) {
- aux_readers[i]->close();
- }
- iter++;
- }
-#ifdef DEBUG
- std::cout << "done with all cells" << std::endl;
-#endif
- // clear the aux scenes so that its starts with the refined scene next time
- for (unsigned i=0; i<aux_scenes.size(); i++) {
- aux_scenes[i].clean_scene();
- }
-
- return true;
-}
-
-
-#define BOXM_EDGE_UPDATER_INSTANTIATE(T1,T2,T3) \
-template class boxm_edge_updater<T1,T2,T3 >
-
-#endif // boxm_edge_updater_hxx_
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_expected_edge_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_expected_edge_functor.h
deleted file mode 100644
index b0d443ca27..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_expected_edge_functor.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef boxm_expected_edge_functor_h_
-#define boxm_expected_edge_functor_h_
-//:
-// \file
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/rt/boxm_render_expected_edge_tangent_image_functor.h>
-
-#include <vpgl/vpgl_camera_double_sptr.h>
-#include <vil/vil_image_view.h>
-#include <vil/vil_transform.h>
-
-#include <brip/brip_vil_float_ops.h>
-
-//: Functor class to compute (1-x)
-// assumes that max range value is "1"
-// only sensible for real types
-class boxm_exp_edge_vil_not_functor
-{
- public:
- float operator()(float x) const { return x<1.0f?(1.0f-x):0.0f; }
- double operator()(double x) const { return x<1.0?1.0-x:0.0; }
-};
-
-template <class T_loc, class T_data>
-class boxm_expected_edge_functor
-{
- public:
- boxm_expected_edge_functor(boxm_scene<boct_tree<T_loc, T_data > > &scene)
- : scene_(scene) {}
- ~boxm_expected_edge_functor() = default;
-
- bool apply(const vpgl_camera_double_sptr& cam, vil_image_view<float> *img_eei)
- {
- boxm_render_edge_tangent_image_rt(scene_,cam,*img_eei);
- // now take the inverse of this image, pixels which contain edges will have values closer to 1 and others will be zero
- boxm_exp_edge_vil_not_functor nt;
- vil_transform(*img_eei, nt);
-
- // now blur this image
- *img_eei = brip_vil_float_ops::gaussian(*img_eei, 1.0f);
-
- return true;
- }
-
- private:
- boxm_scene<boct_tree<T_loc, T_data > > scene_;
-};
-
-#undef BOXM_EXPECTED_EDGE_INSTANTIATE
-#define BOXM_EXPECTED_EDGE_INSTANTIATE(T1,T2) \
-template class boxm_expected_edge_functor<T1, T2 >
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_edge_sample_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_generate_edge_sample_functor.h
deleted file mode 100644
index 756c0ca4a6..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_edge_sample_functor.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef boxm_generate_edge_sample_functor_h
-#define boxm_generate_edge_sample_functor_h
-//:
-// \file
-#include <iostream>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/sample/boxm_edge_sample.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <vil/vil_image_view.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <class T, class T_aux>
-class boxm_generate_edge_sample_functor
-{
- public:
- boxm_generate_edge_sample_functor(vil_image_view<float> &observation,
- unsigned int /*ni*/=0,unsigned /*nj*/=0)
- : obs_(observation)
- {
- scene_read_only_=true;
- is_aux_=true;
- }
-
- inline bool step_cell(unsigned int i, unsigned int j,
- vgl_point_3d<double> s0, vgl_point_3d<double> s1,
- T &cell_value, // FIXME: unused...
- T_aux &aux_val)
- {
- const float seg_len = (float)(s1 - s0).length();
- aux_val.obs_ += obs_(i,j) * seg_len;
- aux_val.seg_len_ += seg_len;
- return true;
- }
-
- public:
- bool scene_read_only_;
- bool is_aux_;
-
- private:
- vil_image_view<float> &obs_;
-};
-
-template <class T_loc, class T_data>
-void boxm_generate_edge_sample_rt(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<float> &obs,
- std::string iname)
-{
- typedef boxm_aux_edge_sample<float> aux_datatype;
- boxm_aux_scene<T_loc, T_data, aux_datatype> aux_scene(&scene,iname, boxm_aux_scene<T_loc,T_data,aux_datatype>::CLONE);
- typedef boxm_generate_edge_sample_functor<boxm_edge_sample<float>,aux_datatype> func;
- boxm_raytrace_function<func,T_loc, T_data, aux_datatype> raytracer(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
- std::cerr << "PROCESSING EDGE IMAGE\n";
- func functor(obs,obs.ni(),obs.nj());
- raytracer.run(functor);
-
- //aux_scene.clean_scene();
- std::cerr << "DONE.\n";
-}
-
-#endif // boxm_generate_edge_sample_functor_h
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_edge_tangent_sample_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_generate_edge_tangent_sample_functor.h
deleted file mode 100644
index 009e75228c..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_edge_tangent_sample_functor.h
+++ /dev/null
@@ -1,78 +0,0 @@
-#ifndef boxm_generate_edge_tangent_sample_functor_h
-#define boxm_generate_edge_tangent_sample_functor_h
-//:
-// \file
-#include <iostream>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-#include <boxm/sample/boxm_plane_obs.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <vgl/vgl_homg_plane_3d.h>
-#include <vil/vil_image_view.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <class T, class T_aux>
-class boxm_generate_edge_tangent_sample_functor
-{
- public:
- boxm_generate_edge_tangent_sample_functor(vil_image_view<float> &observation,
- unsigned int /*ni*/=0, unsigned /*nj*/=0)
- : obs_(observation)
- {
- scene_read_only_=true;
- is_aux_=true;
- // make sure that the image has 4 planes ((a,b,c,d) params of a plane ax+by+cz=d )
- if (observation.nplanes() != 4)
- std::cerr << "boxm_generate_edge_tangent_sample_functor: the image does not have 4 planes\n";
- }
-
- inline bool step_cell(unsigned int i, unsigned int j,
- vgl_point_3d<double> s0, vgl_point_3d<double> s1,
- T &cell_value, // FIXME - unused
- T_aux &aux_val)
- {
- const float seg_len = (float)(s1 - s0).length();
- float a = obs_(i,j,0);
- float b = obs_(i,j,1);
- float c = obs_(i,j,2);
- float d = obs_(i,j,3);
-
- if (a||b||c||d) {
- vgl_homg_plane_3d<float> p(a,b,c,d);
- boxm_plane_obs<float> observation(p,seg_len);
- aux_val.insert(observation);
- }
- return true;
- }
-
- public:
- bool scene_read_only_;
- bool is_aux_;
-
- private:
- vil_image_view<float> &obs_;
-};
-
-template <class T_loc, class T_data>
-void boxm_generate_edge_tangent_sample_rt(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<float> &obs,
- std::string iname)
-{
- typedef boxm_edge_tangent_sample<float> aux_datatype;
- boxm_aux_scene<T_loc, T_data, aux_datatype> aux_scene(&scene,iname, boxm_aux_scene<T_loc,T_data,aux_datatype>::CLONE, BOXM_EDGE_TANGENT_LINE);
- typedef boxm_generate_edge_tangent_sample_functor<boxm_inf_line_sample<float>,aux_datatype> func;
- boxm_raytrace_function<func,T_loc, T_data, aux_datatype> raytracer(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
- std::cerr << "PROCESSING EDGE IMAGE\n";
- func functor(obs,obs.ni(),obs.nj());
- raytracer.run(functor);
- //aux_scene.clean_scene();
- std::cerr << "DONE.\n";
-}
-
-#endif // boxm_generate_edge_tangent_sample_functor_h
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt2_sample_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt2_sample_functor.h
deleted file mode 100644
index 5cbaef86fc..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt2_sample_functor.h
+++ /dev/null
@@ -1,197 +0,0 @@
-#ifndef boxm_generate_opt2_sample_functor_h
-#define boxm_generate_opt2_sample_functor_h
-//:
-// \file
-#include <iostream>
-#include "boxm_pre_infinity_functor.h"
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/sample/boxm_opt2_sample.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/basic/boxm_seg_length_functor.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <vil/vil_image_view.h>
-#include <vil/vil_math.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-
-template <boxm_apm_type APM, class T_aux>
-class boxm_generate_opt2_sample_functor_pass_2
-{
- public:
- //: "default" constructor
- boxm_generate_opt2_sample_functor_pass_2(vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> const& image,
- vil_image_view<float> const& beta_denom,
- float model_prior,
- vil_image_view<float> const& alt_prob_img)
- : scene_read_only_(true) /*only reads info from the scene*/, is_aux_(true) /*needs to write aux*/,
- model_prior_(model_prior), alt_prob_img_(alt_prob_img), obs_(image), beta_denom_(beta_denom),
- vis_img_(image.ni(),image.nj(),1), pre_img_(image.ni(),image.nj(),1), alpha_integral_(image.ni(),image.nj(),1)
- {
- vis_img_.fill(1.0f);
- pre_img_.fill(0.0f);
- alpha_integral_.fill(0.0f);
- }
-
- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d<double> s0, vgl_point_3d<double> s1, boxm_sample<APM> &cell_value, T_aux & aux_val)
- {
- // compute segment length
- const float seg_len = (float)(s1 - s0).length();
- // compute appearance probability of observation
- float mean_obs = aux_val.obs_/aux_val.seg_len_;
- const float PI = boxm_apm_traits<APM>::apm_processor::prob_density(cell_value.appearance(), mean_obs);
- // update alpha integral
- alpha_integral_(i,j) += cell_value.alpha * seg_len;
-
- // compute new visibility probability with updated alpha_integral
- const float vis_prob_end = std::exp(-alpha_integral_(i,j));
- // grab this cell's pre and vis value
- const float pre = pre_img_(i,j);
- const float vis = vis_img_(i,j);
- // compute weight for this cell
- const float Omega = vis - vis_prob_end;
-
- // update vis and pre
- pre_img_(i,j) += PI * Omega;
- vis_img_(i,j) = vis_prob_end;
- // accumulate aux sample values
- aux_val.pre_ += (pre * model_prior_ + alt_prob_img_(i,j)) * seg_len;
- aux_val.vis_ += vis * model_prior_ * seg_len;
-
- const float beta_num = pre + vis*PI;
- const float beta_num_expanded = (beta_num * model_prior_) + alt_prob_img_(i,j);
- const float beta_denom = beta_denom_(i,j);
- const float beta_denom_expanded = (beta_denom * model_prior_) + alt_prob_img_(i,j);
-
- float beta = 1.0f;
- if (beta_denom_expanded > 1e-5f) {
- beta = beta_num_expanded / beta_denom_expanded;
- }
- const float old_PQ = (float)(1.0 - std::exp(-cell_value.alpha*seg_len));
- const float new_PQ = old_PQ * beta;
- const float pass_prob_old = 1.0f - old_PQ;
- float pass_prob = 1.0f - new_PQ;
-
- // compute expected information gained from update
- const float weight = new_PQ * std::log(new_PQ / old_PQ) + pass_prob * std::log(pass_prob / pass_prob_old);
- // ensure log doesn't go to infinity
- if (pass_prob < 1e-5f) {
- pass_prob = 1e-5f;
- }
- aux_val.log_pass_prob_sum_ += std::log(pass_prob) * weight/seg_len;
- aux_val.weighted_seg_len_sum_ += weight; // += seg_len * weight/seg_len;
-
- return true;
- }
-
- public:
- bool scene_read_only_;
- bool is_aux_;
-
- private:
- float model_prior_;
- vil_image_view<float> const& alt_prob_img_;
- vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> const& obs_;
- vil_image_view<float> const& beta_denom_;
-
- //vil_image_view<float> const& pre_inf_;
- vil_image_view<float> vis_img_;
- vil_image_view<float> pre_img_;
- vil_image_view<float> alpha_integral_;
-};
-
-template <class T_loc, class T_data, boxm_aux_type AUX_T>
-void boxm_generate_opt2_samples(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<typename T_data::obs_datatype> &obs,
- std::string iname,
- std::vector<float> const& alt_appearance_priors,
- std::vector<typename T_data::apm_datatype> const& alt_appearance_models,
- bool black_background = false)
-{
- typedef typename boxm_aux_traits<AUX_T>::sample_datatype sample_datatype;
- //std::cout << "scene.save_platform_independent() = " << scene.save_platform_independent() << std::endl;
- boxm_aux_scene<T_loc, T_data, sample_datatype> aux_scene(&scene,iname, boxm_aux_scene<T_loc, T_data, sample_datatype>::CLONE);
- typedef boxm_seg_length_functor<T_data::apm_type,sample_datatype> pass_0;
- boxm_raytrace_function<pass_0,T_loc, T_data, sample_datatype> raytracer_0(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
- std::cout<<"PASS 0"<<std::endl;
- pass_0 pass_0_functor(obs,obs.ni(),obs.nj());
- raytracer_0.run(pass_0_functor);
-
- vil_image_view<float> pre_inf(obs.ni(),obs.nj(),1);
- vil_image_view<float> vis_inf(obs.ni(),obs.nj(),1);
- vil_image_view<float> inf_term(obs.ni(), obs.nj());
-
- typedef boxm_pre_infinity_functor<T_data::apm_type,sample_datatype> pass_1;
- boxm_raytrace_function<pass_1,T_loc, T_data, sample_datatype> raytracer_1(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
- std::cout<<"PASS 1"<<std::endl;
- pass_1 pass_1_functor(obs,pre_inf,vis_inf);
- raytracer_1.run(pass_1_functor);
-
- // compute observation probability for "infinity" appearance model
- if (black_background) {
- std::cout << "using black background model" << std::endl;
- // use single-mode gaussian centered at 0
- typedef bsta_gaussian_sphere<typename T_data::obs_mathtype, T_data::obs_dim> gauss_type;
- typename T_data::obs_mathtype black(0);
- const float black_std_dev = 8.0f/255;
- const gauss_type appearance_dist(black, black_std_dev*black_std_dev);
-
- //float peak=T_data::apm_processor::expected_color(background_apm);
- //std::cout<<"Peak: "<<peak<<std::endl;
- vil_image_view<float> PI_inf(obs.ni(), obs.nj(),1);
- typename vil_image_view<typename T_data::obs_datatype>::const_iterator img_it = obs.begin();
- typename vil_image_view<float>::iterator PI_it = PI_inf.begin();
- for (; img_it != obs.end(); ++img_it, ++PI_it) {
- *PI_it = appearance_dist.prob_density(*img_it);
- }
- vil_math_image_product<float,float,float>(vis_inf,PI_inf,inf_term);
- }
- else {
- // assume uniform prob. density on interval [0, 1]
- //PI_inf.fill(1.0f);
- // don't actually have to compute anything since multiplying by 1
- inf_term = vis_inf;
- }
- vil_image_view<float> beta_denom_img(obs.ni(), obs.nj());
- vil_math_image_sum<float,float,float>(pre_inf,inf_term,beta_denom_img);
-
- // compute model prior
- float model_prior = 1.0f;
- for (float alt_appearance_prior : alt_appearance_priors) {
- model_prior -= alt_appearance_prior;
- }
- // sanity check
- if (model_prior <= 0.0f) {
- std::cerr << "error: boxm_generate_opt2_samples : alt_appearance_priors sum to " << 1.0f - model_prior << " >= 1.0!\n";
- }
-
- // compute alternate appearance probability for each pixel in the image
- vil_image_view<float> alt_prob_img(obs.ni(), obs.nj());
- alt_prob_img.fill(0.0f);
- const unsigned int n_alt = alt_appearance_priors.size();
- if (n_alt > 0) {
- typename vil_image_view<typename T_data::obs_datatype>::const_iterator img_it = obs.begin();
- typename vil_image_view<float>::iterator alt_prob_it = alt_prob_img.begin();
- for (; img_it != obs.end(); ++img_it, ++alt_prob_it) {
- for (unsigned int a=0; a< n_alt; ++a) {
- const float alt_prob_density = boxm_apm_traits<T_data::apm_type>::apm_processor::prob_density(alt_appearance_models[a],*img_it);
- *alt_prob_it += alt_prob_density * alt_appearance_priors[a];
- }
- }
- }
-
- // run the raytrace function
- std::cout<<"PASS 2"<<std::endl;
- typedef boxm_generate_opt2_sample_functor_pass_2<T_data::apm_type, sample_datatype> pass_2;
- boxm_raytrace_function<pass_2,T_loc, T_data, sample_datatype> raytracer_2(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
- pass_2 pass_2_functor(obs,beta_denom_img, model_prior, alt_prob_img);
- raytracer_2.run(pass_2_functor);
-
- //aux_scene.clean_scene();
- std::cout<<"DONE."<<std::endl;
-}
-
-#endif // boxm_generate_opt2_sample_functor_h
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt3_sample_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt3_sample_functor.h
deleted file mode 100644
index 2447f5f483..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt3_sample_functor.h
+++ /dev/null
@@ -1,219 +0,0 @@
-#ifndef boxm_generate_opt3_sample_functor_h
-#define boxm_generate_opt3_sample_functor_h
-//:
-// \file
-#include <iostream>
-#include "boxm_pre_infinity_functor.h"
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/basic/boxm_seg_length_functor.h>
-#include <boxm/sample/boxm_opt3_sample.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <vil/vil_math.h>
-#include <vil/vil_save.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-
-template <boxm_apm_type APM>
-class pre_inf_functor
-{
- typedef typename boxm_aux_traits<BOXM_AUX_NULL>::sample_datatype aux_null_t;
- public:
- //: "default" constructor
- pre_inf_functor(vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> const& image,
- vil_image_view<float> &pre_inf, vil_image_view<float> &vis_inf)
- : alpha_integral_(image.ni(),image.nj(),1), obs_(image), vis_img_(vis_inf), pre_img_(pre_inf)
- {
- alpha_integral_.fill(0.0f);
- pre_img_.fill(0.0f);
- vis_img_.fill(1.0f);
- //only reads info from the scene
- scene_read_only_=true;
- //no need to write aux
- is_aux_=false;
- }
-
- inline bool step_cell(unsigned int i, unsigned int j,
- vgl_point_3d<double> s0, vgl_point_3d<double> s1,
- boxm_sample<APM> &cell_value, aux_null_t & /*aux_val*/)
- {
- // compute segment length
- const float seg_len = (float)(s1 - s0).length();
- // compute appearance probability of observation
- const float PI = boxm_apm_traits<APM>::apm_processor::prob_density(cell_value.appearance(),obs_(i,j)); // aux_val.PI_;
- // update alpha integral
- alpha_integral_(i,j) += cell_value.alpha * seg_len;
- // compute new visibility probability with updated alpha_integral
- const float vis_prob_end = std::exp(-alpha_integral_(i,j));
- // compute weight for this cell
- const float Omega = vis_img_(i,j) - vis_prob_end;
- // and update pre
- pre_img_(i,j) += PI * Omega;
- // update visibility probability
- vis_img_(i,j) = vis_prob_end;
- return true;
- }
-
- public:
- bool scene_read_only_;
- bool is_aux_;
- vil_image_view<float> alpha_integral_;
- private:
- vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> const& obs_;
- vil_image_view<float> &vis_img_;
- vil_image_view<float> &pre_img_;
-};
-
-
-template <boxm_apm_type APM, class T_aux>
-class boxm_generate_opt3_sample_functor
-{
- public:
- //: "default" constructor
- boxm_generate_opt3_sample_functor(vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> const& image,
- vil_image_view<float> const& beta_denom)
- : obs_(image), beta_denom_(beta_denom), vis_img_(image.ni(),image.nj(),1), pre_img_(image.ni(),image.nj(),1), alpha_integral_(image.ni(),image.nj(),1)
- {
- alpha_integral_.fill(0.0f);
- pre_img_.fill(0.0f);
- vis_img_.fill(1.0f);
- //only reads info from the scene
- scene_read_only_=true;
- //needs to write aux
- is_aux_=true;
- }
-
- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d<double> s0, vgl_point_3d<double> s1, boxm_sample<APM> &cell_value, T_aux &aux_val)
- {
- // compute segment length
- const float seg_len = (float)(s1 - s0).length();
- // compute appearance probability of observation
- const float PI = boxm_apm_traits<APM>::apm_processor::prob_density(cell_value.appearance(), obs_(i,j));
- // update alpha integral
- alpha_integral_(i,j) += cell_value.alpha * seg_len;
- // compute new visibility probability with updated alpha_integral
- const float vis_prob_end = (float)std::exp(-alpha_integral_(i,j));
- // grab this cell's pre and vis value
- const float pre = pre_img_(i,j);
- const float vis = vis_img_(i,j);
- // compute weight for this cell
- const float Omega = vis - vis_prob_end;
-
- // update vis and pre
- pre_img_(i,j) += PI * Omega;
- vis_img_(i,j) = vis_prob_end;
-
- // update observation distribution
- aux_val.update_obs_dist(obs_(i,j),vis);
- aux_val.weighted_vis_sum_ += vis*seg_len;
-
- const float old_PQ = 1.0f - (float)std::exp(-cell_value.alpha * seg_len);
- float new_PQ = old_PQ;
- const float beta_denom_val = beta_denom_(i,j);
- const double epsilon = 1e-6;
- if (beta_denom_val > epsilon) {
- const float beta = (pre + vis*PI) / beta_denom_val;
- new_PQ = old_PQ * beta;
- }
- double pass_prob = 1.0 - new_PQ;
- if (pass_prob < epsilon) {
- pass_prob = epsilon;
- }
- aux_val.log_pass_prob_sum_ += (float)std::log(pass_prob);
- aux_val.seg_len_sum_ += seg_len;
-
- return true;
- }
-
- public:
- bool scene_read_only_;
- bool is_aux_;
-
- private:
- vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> const& obs_;
- vil_image_view<float> const& beta_denom_;
-
- vil_image_view<float> vis_img_;
- vil_image_view<float> pre_img_;
- vil_image_view<float> alpha_integral_;
-};
-
-template <class T_loc, class T_data, boxm_aux_type AUX_T>
-void boxm_generate_opt3_sample(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<typename T_data::obs_datatype> &obs,
- std::string image_id,
- bool black_background = false)
-{
- typedef boxm_opt3_sample<boxm_aux_traits<AUX_T>::APM_TYPE> aux_sample_datatype;
- boxm_aux_scene<T_loc, T_data, aux_sample_datatype> aux_scene(&scene, image_id, boxm_aux_scene<T_loc, T_data, aux_sample_datatype>::CLONE);
-#if 0
- typedef boxm_seg_length_functor<T_data::apm_type,sample_datatype> pass_0;
- boxm_raytrace_function<pass_0,T_loc, T_data, sample_datatype> raytracer_0(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
- std::cout<<"PASS 0"<<std::endl;
- pass_0 pass_0_functor(obs,obs.ni(),obs.nj());
- raytracer_0.run(pass_0_functor);
-#endif
- vil_image_view<float> pre_inf(obs.ni(),obs.nj(),1);
- vil_image_view<float> vis_inf(obs.ni(),obs.nj(),1);
-
- typedef pre_inf_functor<T_data::apm_type> pre_inf_functor_t;
- boxm_raytrace_function<pre_inf_functor_t, T_loc, T_data> raytracer_1(scene,cam.ptr(),obs.ni(),obs.nj());
- std::cout<<"PASS 1"<<std::endl;
- pre_inf_functor_t pass_1_functor(obs,pre_inf,vis_inf);
- raytracer_1.run(pass_1_functor);
-
- vil_image_view<float> inf_term(obs.ni(), obs.nj());
- vil_image_view<float> beta_denom_img(obs.ni(), obs.nj());
-
- // compute observation probability for "infinity" appearance model
- vil_image_view<float> PI_inf(obs.ni(), obs.nj(),1);
- if (black_background) {
- std::cout << "using black background model" << std::endl;
- // use single-mode gaussian centered at 0
- typedef bsta_gaussian_sphere<typename T_data::obs_mathtype, T_data::obs_dim> gauss_type;
- typename T_data::obs_mathtype black(0);
- const float black_std_dev = 8.0f/255;
- const gauss_type appearance_dist(black, black_std_dev);
-#if 0
- float peak=T_data::apm_processor::expected_color(background_apm);
- std::cout<<"Peak: "<<peak<<std::endl;
-#endif
- typename vil_image_view<typename T_data::obs_datatype>::const_iterator img_it = obs.begin();
- typename vil_image_view<float>::iterator PI_it = PI_inf.begin();
- for (; img_it != obs.end(); ++img_it, ++PI_it) {
- *PI_it = appearance_dist.prob_density(*img_it);
- }
- vil_math_image_product<float,float,float>(vis_inf,PI_inf,inf_term);
- }
- else {
- // assume uniform prob. density on interval [0, 1]
- //PI_inf.fill(1.0f);
- // don't actually have to compute anything since multiplying by 1
- inf_term = vis_inf;
- }
- vil_math_image_sum<float,float,float>(pre_inf,inf_term,beta_denom_img);
-
-#ifdef DEBUG
- vil_save(vis_inf, "E:/tests/capitol/vis_inf.tiff");
- vil_save(pre_inf, "E:/tests/capitol/pre_inf.tiff");
- vil_save(beta_denom_img, "E:/tests/capitol/beta_denom_img.tiff");
- vil_save(pass_1_functor.alpha_integral_, "E:/tests/capitol/alpha_integr.tiff");
-#endif
-
- std::cout<<"PASS 2"<<std::endl;
- typedef boxm_generate_opt3_sample_functor<T_data::apm_type, aux_sample_datatype> pass_2_functor_t;
- boxm_raytrace_function<pass_2_functor_t, T_loc, T_data, aux_sample_datatype> raytracer_2(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
- pass_2_functor_t pass_2_functor(obs, beta_denom_img);
- raytracer_2.run(pass_2_functor);
-#if 0
- aux_scene.clean_scene();
-#endif
- std::cout<<"DONE."<<std::endl;
-}
-
-#endif // boxm_generate_opt3_sample_functor_h
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt_sample_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt_sample_functor.h
deleted file mode 100644
index c23998293f..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_opt_sample_functor.h
+++ /dev/null
@@ -1,164 +0,0 @@
-#ifndef boxm_generate_opt_sample_functor_h
-#define boxm_generate_opt_sample_functor_h
-//:
-// \file
-#include <iostream>
-#include "boxm_pre_infinity_functor.h"
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/basic/boxm_seg_length_functor.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <vil/vil_math.h>
-#include <vil/vil_save.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-
-template <boxm_apm_type APM, class T_aux>
-class boxm_generate_opt_sample_functor_pass_2
-{
- public:
- //: "default" constructor
- boxm_generate_opt_sample_functor_pass_2(vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> const& image,
- vil_image_view<float> const& Beta_denom)
- : obs_(image), Beta_denom_(Beta_denom), vis_img_(image.ni(),image.nj(),1), pre_img_(image.ni(),image.nj(),1), alpha_integral_(image.ni(),image.nj(),1)
- {
- alpha_integral_.fill(0.0f);
- pre_img_.fill(0.0f);
- vis_img_.fill(1.0f);
- //only reads info from the scene
- scene_read_only_=true;
- //needs to write aux
- is_aux_=true;
- }
-
- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d<double> s0, vgl_point_3d<double> s1, boxm_sample<APM> &cell_value, T_aux & aux_val)
- {
- // compute segment length
- const float seg_len = (float)(s1 - s0).length();
- // compute appearance probability of observation
- float mean_obs= aux_val.obs_/aux_val.seg_len_;
- const float PI = boxm_apm_traits<APM>::apm_processor::prob_density(cell_value.appearance(), mean_obs);
- // update alpha integral
- alpha_integral_(i,j) += cell_value.alpha * seg_len;
-
- // compute new visibility probability with updated alpha_integral
- const float vis_prob_end = std::exp(-alpha_integral_(i,j));
- // grab this cell's pre and vis value
- const float pre = pre_img_(i,j);
- const float vis = vis_img_(i,j);
- // compute weight for this cell
- const float Omega = vis - vis_prob_end;
-
- // update vis and pre
- pre_img_(i,j) += PI * Omega;
- vis_img_(i,j) = vis_prob_end;
- // accumulate aux sample values
- aux_val.pre_ += pre * seg_len;
- aux_val.vis_ += vis * seg_len;
-
- const float Beta_num = pre + vis*PI;
- float Beta = 1.0f;
- if (Beta_denom_(i,j) < 1e-6) {
- if (Beta_num > 1e-5) {
- Beta = 10.0f;
- }
- }
- else {
- Beta = Beta_num / Beta_denom_(i,j);
- }
- if (Beta < 0) {
- if (Beta < -1e-5) {
- std::cerr << " error: beta = " << Beta << " setting to 0. " << '\n';
- }
- Beta = 0;
- }
- aux_val.Beta_ += Beta * seg_len;
- //aux_val.seg_len_ += seg_len;
- return true;
- }
-
- public:
- bool scene_read_only_;
- bool is_aux_;
-
- private:
- vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> const& obs_;
- vil_image_view<float> const& Beta_denom_;
-
- vil_image_view<float> vis_img_;
- vil_image_view<float> pre_img_;
- vil_image_view<float> alpha_integral_;
-};
-
-template <class T_loc, class T_data>
-void boxm_generate_opt_sample_rt(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<typename T_data::obs_datatype> &obs,
- std::string iname,
- bool black_background = false)
-{
- typedef boxm_aux_traits<BOXM_AUX_OPT_RT_GREY>::sample_datatype sample_datatype;
- boxm_aux_scene<T_loc, T_data, sample_datatype> aux_scene(&scene,iname, boxm_aux_scene<T_loc, T_data, sample_datatype>::CLONE);
- typedef boxm_seg_length_functor<T_data::apm_type,sample_datatype> pass_0;
- boxm_raytrace_function<pass_0,T_loc, T_data, sample_datatype> raytracer_0(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
- std::cout<<"PASS 0"<<std::endl;
- pass_0 pass_0_functor(obs,obs.ni(),obs.nj());
- raytracer_0.run(pass_0_functor);
-
- vil_image_view<float> pre_inf(obs.ni(),obs.nj(),1);
- vil_image_view<float> vis_inf(obs.ni(),obs.nj(),1);
-
- typedef boxm_pre_infinity_functor<T_data::apm_type,sample_datatype> pass_1;
- boxm_raytrace_function<pass_1,T_loc, T_data, sample_datatype> raytracer_1(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
- std::cout<<"PASS 1"<<std::endl;
- pass_1 pass_1_functor(obs,pre_inf,vis_inf);
- raytracer_1.run(pass_1_functor);
-
- vil_image_view<float> PI_inf(obs.ni(), obs.nj(),1);
-
-
- if (black_background) {
- std::cout << "using black background model" << std::endl;
- typename T_data::obs_datatype black(0.0f);
- float background_std_dev = 8.0f/255; // ???????????? 4/255 Vishal's
- typename T_data::apm_datatype background_apm(black, background_std_dev*background_std_dev,1.0f);
-
- float peak=T_data::apm_processor::expected_color(background_apm);
- std::cout<<"Peak: "<<peak<<std::endl;
- typename vil_image_view<typename T_data::obs_datatype>::const_iterator img_it = obs.begin();
- typename vil_image_view<float>::iterator PI_it = PI_inf.begin();
- for (; img_it != obs.end(); ++img_it, ++PI_it) {
- *PI_it = T_data::apm_processor::prob_density(background_apm,*img_it);
- }
- }
- else {
- PI_inf.fill(1.0f);
- }
-
- vil_image_view<float> inf_term(obs.ni(), obs.nj());
- vil_math_image_product<float,float,float>(vis_inf,PI_inf,inf_term);
- vil_image_view<float> Beta_denom_img(obs.ni(), obs.nj());
- vil_math_image_sum<float,float,float>(pre_inf,inf_term,Beta_denom_img);
-#ifdef DEBUG
- vil_save(vis_inf, "E:/tests/capitol/vis_inf.tiff");
- vil_save(pre_inf, "E:/tests/capitol/pre_inf.tiff");
- vil_save(Beta_denom_img, "E:/tests/capitol/Beta_denom_img.tiff");
- vil_save(pass_1_functor.alpha_integral_, "E:/tests/capitol/alpha_integr.tiff");
-#endif
- std::cout<<"PASS 2"<<std::endl;
- typedef boxm_generate_opt_sample_functor_pass_2<T_data::apm_type, sample_datatype> pass_2;
- boxm_raytrace_function<pass_2,T_loc, T_data, sample_datatype> raytracer_2(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
- pass_2 pass_2_functor(obs,Beta_denom_img);
- raytracer_2.run(pass_2_functor);
-
-#if 0
- aux_scene.clean_scene();
-#endif
- std::cout<<"DONE."<<std::endl;
-}
-
-#endif // boxm_generate_opt_sample_functor_h
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_shadow_sample_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_generate_shadow_sample_functor.h
deleted file mode 100644
index 551c049134..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_generate_shadow_sample_functor.h
+++ /dev/null
@@ -1,212 +0,0 @@
-#ifndef boxm_generate_shadow_sample_functor_h
-#define boxm_generate_shadow_sample_functor_h
-//:
-// \file
-#include <iostream>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/basic/boxm_seg_length_functor.h>
-#include <boxm/algo/rt/boxm_pre_infinity_functor.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <vil/vil_math.h>
-#include <vil/vil_save.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <boxm_apm_type APM, class T_aux>
-class boxm_generate_shadow_sample_functor_pass_2
-{
- public:
- //: "default" constructor
- boxm_generate_shadow_sample_functor_pass_2(vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> const& image,
- vil_image_view<float> const& Beta_denom, float shadow_prior, vil_image_view<float> const& shadow_density)
- : obs_(image), Beta_denom_(Beta_denom), vis_img_(image.ni(),image.nj(),1), pre_img_(image.ni(),image.nj(),1), alpha_integral_(image.ni(),image.nj(),1), shadow_prior_(shadow_prior), shadow_density_(shadow_density)
- {
- alpha_integral_.fill(0.0f);
- pre_img_.fill(0.0f);
- vis_img_.fill(1.0f);
- //only reads info from the scene
- scene_read_only_=true;
- //needs to write aux
- is_aux_=true;
- }
-
- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d<double> s0, vgl_point_3d<double> s1, boxm_sample<APM> &cell_value, T_aux & aux_val)
- {
- // compute segment length
- const float seg_len = (float)(s1 - s0).length();
- // compute appearance probability of observation
- float mean_obs= aux_val.obs_/aux_val.seg_len_;
- const float PI = boxm_apm_traits<APM>::apm_processor::prob_density(cell_value.appearance(), mean_obs);
- // update alpha integral
- float alpha_l = cell_value.alpha * seg_len; //change
- alpha_integral_(i,j) += alpha_l;
-
- // compute new visibility probability with updated alpha_integral
- const float vis_prob_end = std::exp(-alpha_integral_(i,j));
- // grab this cell's pre and vis value
- const float pre = pre_img_(i,j);
- const float vis = vis_img_(i,j);
- // compute weight for this cell
- const float Omega = vis - vis_prob_end;
-
- // update vis and pre
- pre_img_(i,j) += PI * Omega;
- vis_img_(i,j) = vis_prob_end;
- // accumulate aux sample values
- aux_val.pre_ += pre * seg_len;
- aux_val.vis_ += vis * seg_len; //<<changed Feb 05, 2010
- float Beta_num = pre + vis*PI;
- Beta_num *=(1.0f - shadow_prior_);
- Beta_num += shadow_density_(i,j);
- float Beta = 1.0f;
- if (Beta_denom_(i,j) < 1e-6) {
- if (Beta_num > 1e-5) {
- Beta = 10.0f;
- }
- }
- else {
- Beta = Beta_num / Beta_denom_(i,j);
- }
- if (Beta < 0) {
- if (Beta < -1e-5) {
- std::cerr << " error: beta = " << Beta << " setting to 0.\n";
- }
- Beta = 0;
- }
-#if 0
- if (mean_obs == 0.0f){
- std::cout << PI << ' ' << shadow_density_(i,j) << ' '
- << pre << ' ' << vis << ' ' << Beta_denom_(i,j)
- << ' ' << Beta << '\n';
- }
-#endif
- aux_val.Beta_ += Beta * seg_len;
- //New discrete probability computations
- float PQ_prior = 1.0f - std::exp(-alpha_l);
- float PQ_post = Beta*PQ_prior;
- if (PQ_post>=0.999f) PQ_post = 0.999f;
- // v------note minus sign
- float lg = -std::log(1.0f-PQ_post);
- aux_val.log_sum_ += lg;
- //End of new discrete probability calculations
- return true;
- }
-
- public:
- bool scene_read_only_;
- bool is_aux_;
- float shadow_prior_;
- private:
- vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> const& obs_;
- vil_image_view<float> const& Beta_denom_;
-
- //vil_image_view<float> const& pre_inf_;
- vil_image_view<float> vis_img_;
- vil_image_view<float> pre_img_;
- vil_image_view<float> alpha_integral_;
- vil_image_view<float> shadow_density_;
-};
-
-template <class T_loc, class T_data>
-void boxm_initial_shadow_sampler_rt(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<typename T_data::obs_datatype> &obs,
- std::string iname)
-{
- typedef boxm_aux_traits<BOXM_AUX_OPT_RT_GREY>::sample_datatype sample_datatype;
- boxm_aux_scene<T_loc, T_data, sample_datatype> aux_scene(&scene,iname, boxm_aux_scene<T_loc, T_data, sample_datatype>::CLONE);
- typedef boxm_seg_length_functor<T_data::apm_type,sample_datatype> pass_0;
- boxm_raytrace_function<pass_0,T_loc, T_data, sample_datatype> raytracer_0(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
- std::cout<<"Collect Observations"<<std::endl;
- pass_0 pass_0_functor(obs,obs.ni(),obs.nj());
- raytracer_0.run(pass_0_functor);
- std::cout<<"Samples collected\n"<<std::endl;
-}
-
-template <class T_loc, class T_data>
-void boxm_generate_shadow_sample_rt(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<typename T_data::obs_datatype> &obs,
- std::string iname,
- float shadow_prior,
- float shadow_mean,
- float shadow_sigma,
- bool black_background = false)
-{
- typedef boxm_aux_traits<BOXM_AUX_OPT_RT_GREY>::sample_datatype sample_datatype;
- boxm_aux_scene<T_loc, T_data, sample_datatype> aux_scene(&scene,iname, boxm_aux_scene<T_loc, T_data, sample_datatype>::CLONE);
- typedef boxm_seg_length_functor<T_data::apm_type,sample_datatype> pass_0;
- boxm_raytrace_function<pass_0,T_loc, T_data, sample_datatype> raytracer_0(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
- std::cout<<"PASS 0"<<std::endl;
- pass_0 pass_0_functor(obs,obs.ni(),obs.nj());
- raytracer_0.run(pass_0_functor);
-
- vil_image_view<float> pre_inf(obs.ni(),obs.nj(),1);
- vil_image_view<float> vis_inf(obs.ni(),obs.nj(),1);
-
- typedef boxm_pre_infinity_functor<T_data::apm_type,sample_datatype> pass_1;
- boxm_raytrace_function<pass_1,T_loc, T_data, sample_datatype> raytracer_1(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
- std::cout<<"PASS 1"<<std::endl;
- pass_1 pass_1_functor(obs,pre_inf,vis_inf);
- raytracer_1.run(pass_1_functor);
-
- vil_image_view<float> PI_inf(obs.ni(), obs.nj(),1);
-
-
- if (black_background) {
- std::cout << "using black background model" << std::endl;
- typename T_data::obs_datatype black(0.0f);
- float background_std_dev = 8.0f/255;//???????????? 4/255 Vishal's
- typename T_data::apm_datatype background_apm(black, background_std_dev,1.0f);
-
- float peak=T_data::apm_processor::expected_color(background_apm);
- std::cout<<"Peak: "<<peak<<std::endl;
- typename vil_image_view<typename T_data::obs_datatype>::const_iterator img_it = obs.begin();
- typename vil_image_view<float>::iterator PI_it = PI_inf.begin();
- for (; img_it != obs.end(); ++img_it, ++PI_it) {
- *PI_it = T_data::apm_processor::prob_density(background_apm,*img_it);
- }
- }
- else {
- PI_inf.fill(1.0f);
- }
-
- vil_image_view<float> inf_term(obs.ni(), obs.nj());
- vil_math_image_product<float,float,float>(vis_inf,PI_inf,inf_term);
- vil_image_view<float> Beta_denom_img(obs.ni(), obs.nj());
- vil_math_image_sum<float,float,float>(pre_inf,inf_term,Beta_denom_img);
-
- boxm_simple_grey shadow_dist(shadow_mean, shadow_sigma);
- vil_image_view<float> shadow_density(obs.ni(), obs.nj());
- for (unsigned j=0; j<obs.nj(); ++j)
- for (unsigned i=0; i<obs.ni(); ++i)
- {
- float sh_density =
- boxm_simple_grey_processor::prob_density(shadow_dist, obs(i,j));
- sh_density *=2.0f;//if Gaussian centered at 0
- shadow_density(i,j) = sh_density*shadow_prior;
- Beta_denom_img(i,j) *= (1.0f-shadow_prior);
- Beta_denom_img(i,j) += shadow_density(i,j);
- }
-
-#if 0
- vil_save(vis_inf, "E:/ShadowSite/vis_inf.tiff");
- vil_save(pre_inf, "E:/ShadowSite/pre_inf.tiff");
- vil_save(Beta_denom_img, "E:/ShadowSite/Beta_denom_img.tiff");
- vil_save(pass_1_functor.alpha_integral_, "E:/tests/capitol/alpha_integr.tiff");
-#endif
- std::cout<<"PASS 2"<<std::endl;
- typedef boxm_generate_shadow_sample_functor_pass_2<T_data::apm_type, sample_datatype> pass_2;
- boxm_raytrace_function<pass_2,T_loc, T_data, sample_datatype> raytracer_2(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
- pass_2 pass_2_functor(obs,Beta_denom_img, shadow_prior, shadow_density);
- raytracer_2.run(pass_2_functor);
-
- //aux_scene.clean_scene();
- std::cout<<"DONE."<<std::endl;
-}
-
-#endif // boxm_generate_shadow_sample_functor_h
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_opt2_optimizer.h b/contrib/brl/bseg/boxm/algo/rt/boxm_opt2_optimizer.h
deleted file mode 100644
index 0b7a1f34f7..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_opt2_optimizer.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef boxm_opt2_bayesian_optimizer_h_
-#define boxm_opt2_bayesian_optimizer_h_
-
-#include <vector>
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_scene.h>
-
-#include <boxm/sample/boxm_opt2_sample.h>
-
-template<class T_loc, boxm_apm_type APM, boxm_aux_type AUX>
-class boxm_opt2_optimizer
-{
- public:
- boxm_opt2_optimizer(boxm_scene<boct_tree<T_loc, boxm_sample<APM> > > &scene,
- std::vector<std::string> image_ids);
-
- ~boxm_opt2_optimizer()= default;
-
- bool update();
-
- protected:
- std::vector<std::string> image_ids_;
-
- boxm_scene<boct_tree<T_loc, boxm_sample<APM> > > &scene_;
-
- const float max_cell_P_;
- const float min_cell_P_;
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_opt2_optimizer.hxx b/contrib/brl/bseg/boxm/algo/rt/boxm_opt2_optimizer.hxx
deleted file mode 100644
index ae00724692..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_opt2_optimizer.hxx
+++ /dev/null
@@ -1,152 +0,0 @@
-#ifndef boxm_opt2_optimizer_hxx_
-#define boxm_opt2_optimizer_hxx_
-
-#include <utility>
-#include <vector>
-#include <iostream>
-#include <string>
-#include "boxm_opt2_optimizer.h"
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_aux_scene.h>
-#include <boxm/boxm_apm_traits.h>
-
-template <class T_loc, boxm_apm_type APM, boxm_aux_type AUX>
-boxm_opt2_optimizer<T_loc,APM,AUX>::boxm_opt2_optimizer(boxm_scene<boct_tree<T_loc, boxm_sample<APM> > > &scene,
- std::vector<std::string> image_ids)
- : image_ids_(std::move(image_ids)), scene_(scene), max_cell_P_(0.995f), min_cell_P_(0.0001f)
-{}
-
-
-template <class T_loc, boxm_apm_type APM, boxm_aux_type AUX>
-bool boxm_opt2_optimizer<T_loc,APM,AUX>::update()
-{
- // get auxiliary scenes associated with each input image
- typedef typename boxm_aux_traits<AUX>::sample_datatype aux_type;
-
- typedef boct_tree<T_loc, boxm_sample<APM> > tree_type;
-
- std::vector<boxm_aux_scene<T_loc, boxm_sample<APM>, aux_type> > aux_scenes;
- for (unsigned int i=0; i<image_ids_.size(); ++i) {
- boxm_aux_scene<T_loc, boxm_sample<APM>, aux_type> aux_scene(&scene_,image_ids_[i],boxm_aux_scene<T_loc, boxm_sample<APM>, aux_type>::LOAD, APM);
- aux_scenes.push_back(aux_scene);
- }
-
- std::vector<boxm_opt2_sample<typename boxm_apm_traits<APM>::obs_datatype> > aux_samples;
-
- // for each block
- boxm_block_iterator<tree_type> iter(&scene_);
- iter.begin();
- while (!iter.end())
- {
- scene_.load_block(iter.index());
- boxm_block<tree_type>* block = *iter;
- boct_tree<T_loc, boxm_sample<APM> >* tree = block->get_tree();
- std::vector<boct_tree_cell<T_loc,boxm_sample<APM> >*> cells = tree->leaf_cells();
-
- // get a vector of incremental readers for each aux scene.
- std::vector<boct_tree_cell_reader<T_loc, aux_type>* > aux_readers(aux_scenes.size());
- for (unsigned int i=0; i<aux_scenes.size(); ++i) {
- aux_readers[i] = aux_scenes[i].get_block_incremental(iter.index());
- }
- // iterate over cells
- for (unsigned i=0; i<cells.size(); ++i)
- {
- aux_samples.clear();
- boct_tree_cell<T_loc,boxm_sample<APM> >* cell = cells[i];
- boxm_sample<APM> data = cell->data();
- //std::cout << "cell IN " << data.alpha << data.appearence_<< std::endl;
- for (unsigned j=0; j<aux_readers.size(); j++) {
- boct_tree_cell<T_loc, aux_type> temp_cell;
-
- if (!aux_readers[j]->next(temp_cell)) {
- std::cerr << "error: incremental reader returned false.\n";
- return false;
- }
- //boxm_opt_sample<typename boxm_apm_traits<APM>::obs_datatype> aux_cell = temp_cell.data();
- if (!temp_cell.code_.isequal(&(cell->code_))) {
- std::cerr << "error: temp_cell idx does not match cell idx.\n";
- return false;
- }
- if (temp_cell.data().seg_len_ > 0.0f) {
- aux_samples.push_back(temp_cell.data());
- }
- }
- std::vector<float> pre_vector;
- std::vector<float> vis_vector;
- std::vector<typename boxm_apm_traits<APM>::obs_datatype> obs_vector;
-
- // UPDATE METHOD #1 : "OR" of occlusion probabilities
- double log_pass_prob_sum = 0.0;
- double weighted_seg_len_sum = 0.0;
- for (unsigned int s=0; s<aux_samples.size(); ++s) {
- const float obs_seg_len = aux_samples[s].seg_len_;
- const float obs_weighted_seg_len = aux_samples[s].weighted_seg_len_sum_;
-
- if (obs_seg_len > 1e-6) {
- if (obs_weighted_seg_len > 1e-6) {
- log_pass_prob_sum += aux_samples[s].log_pass_prob_sum_;
- weighted_seg_len_sum += obs_weighted_seg_len;
- }
- // add observation and vis,pre to list
- obs_vector.push_back(aux_samples[s].obs_ / obs_seg_len);
- pre_vector.push_back(aux_samples[s].pre_ / obs_seg_len);
- vis_vector.push_back(aux_samples[s].vis_ / obs_seg_len);
- }
- }
- // update the occlusion density
- if (weighted_seg_len_sum > 1e-6) {
- data.alpha = (float)(-log_pass_prob_sum / weighted_seg_len_sum);
- }
-
- // do bounds check on new alpha value
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(cell);
- const float cell_len = float(cell_bb.width());
- const float max_alpha = -std::log(1.0f - max_cell_P_)/cell_len;
- const float min_alpha = -std::log(1.0f - min_cell_P_)/cell_len;
- if (data.alpha > max_alpha) {
- data.alpha = max_alpha;
- }
- if (data.alpha < min_alpha) {
- data.alpha = min_alpha;
- }
- if (!((data.alpha >= min_alpha) && (data.alpha <= max_alpha)) ){
- std::cerr << "\nerror: data.alpha = " << data.alpha << '\n';
- //std::cerr << " log_alpha_sum = " << log_alpha_sum << ", n_actual_samples = " << n_actual_samples << '\n';
- }
- // update with new appearance
- const float min_sigma = 0.02f;
- boxm_apm_traits<APM>::apm_processor::compute_appearance(obs_vector, pre_vector, vis_vector, data.appearance_, min_sigma);
-
- //std::cout << "cell OUT " << data.alpha << data.appearence_ << std::endl << std::endl;
- cell->set_data(data);
- }
- scene_.write_active_block();
- for (unsigned int i=0; i<aux_readers.size(); ++i) {
- aux_readers[i]->close();
- }
- iter++;
- }
-#ifdef DEBUG
- std::cout << "done with all cells" << std::endl;
-#endif
- // clear the aux scenes so that its starts with the refined scene next time
- for (unsigned i=0; i<aux_scenes.size(); i++) {
- aux_scenes[i].clean_scene();
- }
-
- return true;
-}
-
-
-#define BOXM_OPT2_OPTIMIZER_INSTANTIATE(T1,T2,T3) \
- template class boxm_opt2_optimizer<T1,T2,T3 >
-
-#endif // boxm_opt2_optimizer_hxx_
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_opt3_optimizer.h b/contrib/brl/bseg/boxm/algo/rt/boxm_opt3_optimizer.h
deleted file mode 100644
index d19ab2d9f4..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_opt3_optimizer.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef boxm_opt3_optimizer_h_
-#define boxm_opt3_optimizer_h_
-
-#include <vector>
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_scene.h>
-
-#include <boxm/sample/boxm_rt_sample.h>
-
-template<class T_loc, boxm_apm_type APM, boxm_apm_type AUX_APM>
-class boxm_opt3_optimizer
-{
- public:
- boxm_opt3_optimizer(boxm_scene<boct_tree<T_loc, boxm_sample<APM> > > &scene,
- std::vector<std::string> image_ids);
-
- ~boxm_opt3_optimizer()= default;
-
- bool optimize_cells();
-
- protected:
- std::vector<std::string> image_ids_;
-
- boxm_scene<boct_tree<T_loc, boxm_sample<APM> > > &scene_;
-
- const float max_cell_P_;
- const float min_cell_P_;
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_opt3_optimizer.hxx b/contrib/brl/bseg/boxm/algo/rt/boxm_opt3_optimizer.hxx
deleted file mode 100644
index da5f7ba0fb..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_opt3_optimizer.hxx
+++ /dev/null
@@ -1,172 +0,0 @@
-#ifndef boxm_opt3_optimizer_hxx_
-#define boxm_opt3_optimizer_hxx_
-
-#include <utility>
-#include <vector>
-#include <iostream>
-#include <string>
-#include "boxm_opt3_optimizer.h"
-
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_aux_scene.h>
-#include <boxm/sample/boxm_opt3_sample.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-
-#include <vnl/vnl_random.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <class T_loc, boxm_apm_type APM, boxm_apm_type AUX_APM>
-boxm_opt3_optimizer<T_loc,APM,AUX_APM>::boxm_opt3_optimizer(boxm_scene<boct_tree<T_loc, boxm_sample<APM> > > &scene,
- std::vector<std::string> image_ids)
- : image_ids_(std::move(image_ids)), scene_(scene), max_cell_P_(0.995f), min_cell_P_(0.0001f)
-{}
-
-
-template <class T_loc, boxm_apm_type APM, boxm_apm_type AUX_APM>
-bool boxm_opt3_optimizer<T_loc,APM,AUX_APM>::optimize_cells()
-{
- constexpr unsigned int n_samples_per_obs = 10;
-
- // get auxiliary scenes associated with each input image
- typedef boxm_opt3_sample<AUX_APM> aux_type;
-
- typedef boct_tree<T_loc, boxm_sample<APM> > tree_type;
-
- typedef typename boxm_apm_traits<APM>::obs_datatype obs_t;
-
- std::vector<boxm_aux_scene<T_loc, boxm_sample<APM>, aux_type> > aux_scenes;
- for (unsigned int i=0; i<image_ids_.size(); ++i) {
- boxm_aux_scene<T_loc, boxm_sample<APM>, aux_type> aux_scene(&scene_,image_ids_[i],boxm_aux_scene<T_loc, boxm_sample<APM>, aux_type>::LOAD, APM);
- aux_scenes.push_back(aux_scene);
- }
-
- std::vector<float> vis_vector;
- std::vector<obs_t> obs_vector;
- vnl_random rand_gen;
- std::vector<boxm_opt3_sample<AUX_APM> > aux_samples;
-
- // for each block
- boxm_block_iterator<tree_type> iter(&scene_);
- iter.begin();
- while (!iter.end())
- {
- scene_.load_block(iter.index());
- boxm_block<tree_type>* block = *iter;
- boct_tree<T_loc, boxm_sample<APM> >* tree = block->get_tree();
- std::vector<boct_tree_cell<T_loc,boxm_sample<APM> >*> cells = tree->leaf_cells();
-
- // get a vector of incremental readers for each aux scene.
- std::vector<boct_tree_cell_reader<T_loc, aux_type>* > aux_readers(aux_scenes.size());
- for (unsigned int i=0; i<aux_scenes.size(); ++i) {
- aux_readers[i] = aux_scenes[i].get_block_incremental(iter.index());
- }
-
- // iterate over cells
- for (unsigned i=0; i<cells.size(); ++i)
- {
- aux_samples.clear();
- boct_tree_cell<T_loc,boxm_sample<APM> >* cell = cells[i];
- boxm_sample<APM> data = cell->data();
-
- for (unsigned j=0; j<aux_readers.size(); j++) {
- boct_tree_cell<T_loc, aux_type> temp_cell;
-
- if (!aux_readers[j]->next(temp_cell)) {
- std::cerr << "error: incremental reader returned false.\n";
- return false;
- }
- //boxm_opt_sample<typename boxm_apm_traits<APM>::obs_datatype> aux_cell = temp_cell.data();
- if (!temp_cell.code_.isequal(&(cell->code_))) {
- std::cerr << "error: temp_cell idx does not match cell idx.\n";
- return false;
- }
- aux_samples.push_back(temp_cell.data());
- }
-
- vis_vector.clear();
- obs_vector.clear();
-
- double log_alpha_sum = 0.0;
- unsigned int n_actual_observations = 0;
-
- for (unsigned int s=0; s<aux_samples.size(); ++s) {
- double total_seg_len = aux_samples[s].seg_len_sum_;
-
- if (total_seg_len > 1e-6) {
- ++n_actual_observations;
- // compute mean vis
- float obs_vis = (float)(aux_samples[s].weighted_vis_sum_ / total_seg_len);
- // draw samples from obs_dist
-
- for (unsigned int n=0; n<n_samples_per_obs; ++n) {
- obs_t obs_sample = boxm_apm_traits<AUX_APM>::apm_processor::sample(aux_samples[s].obs_dist_, rand_gen);
- //obs_t obs_sample = boxm_apm_traits<AUX_APM>::apm_processor::expected_color(aux_samples[s].obs_dist_);
- obs_vector.push_back(obs_sample);
- vis_vector.push_back(obs_vis);
- }
- double alpha_s = -aux_samples[s].log_pass_prob_sum_ / total_seg_len;
- log_alpha_sum += std::log(alpha_s);
- }
- }
- float alpha_new = 0.0f;
- if (n_actual_observations > 0) {
- //std::cout << "cell IN " << data.alpha << ' ' << data.appearance_<< std::endl;
- // compute new alpha value
- alpha_new = (float)std::exp(log_alpha_sum / n_actual_observations);
-
- // do bounds check on new alpha value
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(cell);
- const float cell_len = float(cell_bb.width());
- const float max_alpha = -std::log(1.0f - max_cell_P_)/cell_len;
- const float min_alpha = -std::log(1.0f - min_cell_P_)/cell_len;
- if (alpha_new > max_alpha) {
- alpha_new = max_alpha;
- }
- if (alpha_new < min_alpha) {
- alpha_new = min_alpha;
- }
- if (!((alpha_new >= min_alpha) && (alpha_new <= max_alpha)) ){
- std::cerr << std::endl << "error: alpha_new = " << alpha_new << '\n'
- << "n_actual_observations = " << n_actual_observations << " log_alpha_sum = " << log_alpha_sum << '\n';
- alpha_new = min_alpha;
- }
- else {
- data.alpha = alpha_new;
- }
- // update with new appearance
- //std::cout << obs_vector.size() << ' ' << std::endl;
- if (obs_vector.size() != n_samples_per_obs * n_actual_observations) {
- std::cerr << "error: n_samples_per_obs = " << n_samples_per_obs << " n_actual_observations = " << n_actual_observations << " obs_vector.size() " << obs_vector.size() << '\n';
- }
- boxm_apm_traits<APM>::apm_processor::compute_appearance(obs_vector, vis_vector, data.appearance_, 0.025f);
- //std::cout << "cell OUT " << data.alpha << data.appearance_ << std::endl << std::endl;
- cell->set_data(data);
- }
- }
- scene_.write_active_block();
- for (unsigned int i=0; i<aux_readers.size(); ++i) {
- aux_readers[i]->close();
- }
- iter++;
- }
-#ifdef DEBUG
- std::cout << "done with all cells" << std::endl;
-#endif
- // clear the aux scenes so that its starts with the refined scene next time
- for (unsigned i=0; i<aux_scenes.size(); i++) {
- aux_scenes[i].clean_scene();
- }
-
- return true;
-}
-
-
-#define BOXM_OPT3_OPTIMIZER_INSTANTIATE(T1,T2,T3) \
- template class boxm_opt3_optimizer<T1,T2,T3 >
-
-#endif // boxm_opt3_optimizer_hxx_
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_opt_appearance_estimator.h b/contrib/brl/bseg/boxm/algo/rt/boxm_opt_appearance_estimator.h
deleted file mode 100644
index c6f87c3817..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_opt_appearance_estimator.h
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef boxm_opt_appearance_estimator_h_
-#define boxm_opt_appearance_estimator_h_
-
-#include <vector>
-#include <iostream>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#if 0
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#endif
-
-template <boxm_apm_type APM>
-void boxm_opt_compute_appearance(std::vector<typename boxm_apm_traits<APM>::obs_datatype> const& obs,
- std::vector<float> const& pre,
- std::vector<float> const& vis,
- typename boxm_apm_traits<APM>::apm_datatype &model)
-{
- const float min_sigma=0.1f;
- // initialize appearance model estimate using visibility probabilities as weights.
- boxm_apm_traits<APM>::apm_processor::compute_appearance(obs,vis,model,min_sigma);
-#if 1
- // use EM to refine estimate until convergence.
- unsigned int nobs= obs.size();
- if (nobs == 0) {
- // nothing to do.
- return;
- }
- std::vector<float> obs_weights = vis;
-
- const float epsilon = 1e-4f;
- constexpr unsigned int max_its = 100;
- const float min_weight_change = 1e-5f;
- for (unsigned int i=0; i<max_its; ++i) {
- float max_weight_change = 0.0f;
- // EXPECTATION
- for (unsigned int n=0; n<nobs; ++n) {
- // for each observation, assign probabilities to each of 3 possibilities
- // P1: observation is generated by appearance model.
- // P2: point is visible, but observation is generated by a point "behind" this one. (i.e. point is not on a surface)
- // P3: point is not visible - observation is generated by a point "ahead" of this one.
- const float P1 = vis[n] * boxm_apm_traits<APM>::apm_processor::prob_density(model,obs[n]);
- const float P2 = 0.0f; //post_prob[n];
- const float P3 = pre[n];
- const float normalizing_factor = P1 + P2 + P3;
- float new_obs_weight = 0;
- if (normalizing_factor > epsilon) {
- new_obs_weight = P1 / normalizing_factor;
- }
-
- // compute delta weight for convergence check
- float weight_delta = std::fabs(obs_weights[n] - new_obs_weight);
- if (weight_delta > max_weight_change) {
- max_weight_change = weight_delta;
- }
- obs_weights[n] = new_obs_weight;
- }
- // check for convergence
- if (max_weight_change < min_weight_change) {
-#if 0
- if (nobs > 1) {
- std::cout << "EM converged in " << i << " iterations." << std::endl;
- float total_prob = 0.0f;
- for (unsigned int n=0; n<nobs; ++n) {
- total_prob += obs_weights[n];
- }
- std::cout << "total prob for " << nobs << " observations = " << total_prob << std::endl
- << "sigma = " << model.sigma() << ", gauss_weight = " << model.gauss_weight() << std::endl;
- }
-#endif
- break;
- }
- // MAXIMIZATION
- boxm_apm_traits<APM>::apm_processor::update_appearance(obs,obs_weights,model,min_sigma);
- }
-
- // adjust model to account for small sample sizes.
- boxm_apm_traits<APM>::apm_processor::finalize_appearance(obs,obs_weights,model);
-#endif
- return;
-}
-
-#endif // boxm_opt_appearance_estimator_h_
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_opt_rt_bayesian_optimizer.h b/contrib/brl/bseg/boxm/algo/rt/boxm_opt_rt_bayesian_optimizer.h
deleted file mode 100644
index 7275093568..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_opt_rt_bayesian_optimizer.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef boxm_opt_rt_bayesian_optimizer_h_
-#define boxm_opt_rt_bayesian_optimizer_h_
-
-#include <vector>
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/sample/boxm_rt_sample.h>
-
-template<class T_loc, boxm_apm_type APM, boxm_aux_type AUX>
-class boxm_opt_rt_bayesian_optimizer
-{
- public:
- boxm_opt_rt_bayesian_optimizer(boxm_scene<boct_tree<T_loc, boxm_sample<APM> > > &scene,
- std::vector<std::string> image_ids);
-
- ~boxm_opt_rt_bayesian_optimizer()= default;
-
- bool optimize_cells(double damping_factor);
-
- protected:
- std::vector<std::string> image_ids_;
-
- boxm_scene<boct_tree<T_loc, boxm_sample<APM> > > &scene_;
-
- const float max_cell_P_;
- const float min_cell_P_;
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_opt_rt_bayesian_optimizer.hxx b/contrib/brl/bseg/boxm/algo/rt/boxm_opt_rt_bayesian_optimizer.hxx
deleted file mode 100644
index 10f61e8572..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_opt_rt_bayesian_optimizer.hxx
+++ /dev/null
@@ -1,151 +0,0 @@
-#ifndef boxm_opt_rt_bayesian_optimizer_hxx_
-#define boxm_opt_rt_bayesian_optimizer_hxx_
-
-#include <utility>
-#include <vector>
-#include <iostream>
-#include <string>
-#include "boxm_opt_rt_bayesian_optimizer.h"
-#include "boxm_opt_appearance_estimator.h"
-
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_aux_scene.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <class T_loc, boxm_apm_type APM, boxm_aux_type AUX>
-boxm_opt_rt_bayesian_optimizer<T_loc,APM,AUX>::boxm_opt_rt_bayesian_optimizer(boxm_scene<boct_tree<T_loc, boxm_sample<APM> > > &scene,
- std::vector<std::string> image_ids)
-: image_ids_(std::move(image_ids)), scene_(scene), max_cell_P_(0.995f), min_cell_P_(0.0001f)
-{}
-
-
-template <class T_loc, boxm_apm_type APM, boxm_aux_type AUX>
-bool boxm_opt_rt_bayesian_optimizer<T_loc,APM,AUX>::optimize_cells(double damping_factor)
-{
- // get auxiliary scenes associated with each input image
- typedef typename boxm_aux_traits<AUX>::sample_datatype aux_type;
-
- typedef boct_tree<T_loc, boxm_sample<APM> > tree_type;
-
- std::vector<boxm_aux_scene<T_loc, boxm_sample<APM>, aux_type> > aux_scenes;
- for (unsigned int i=0; i<image_ids_.size(); ++i) {
- boxm_aux_scene<T_loc, boxm_sample<APM>, aux_type> aux_scene(&scene_,image_ids_[i],boxm_aux_scene<T_loc, boxm_sample<APM>, aux_type>::LOAD, APM);
- aux_scenes.push_back(aux_scene);
- }
-
- std::vector<boxm_rt_sample<typename boxm_apm_traits<APM>::obs_datatype> > aux_samples;
-
- // for each block
- boxm_block_iterator<tree_type> iter(&scene_);
- iter.begin();
- while (!iter.end())
- {
- scene_.load_block(iter.index());
- boxm_block<tree_type>* block = *iter;
- boct_tree<T_loc, boxm_sample<APM> >* tree = block->get_tree();
- std::vector<boct_tree_cell<T_loc,boxm_sample<APM> >*> cells = tree->leaf_cells();
-
- // get a vector of incremental readers for each aux scene.
- std::vector<boct_tree_cell_reader<T_loc, aux_type>* > aux_readers(aux_scenes.size());
- for (unsigned int i=0; i<aux_scenes.size(); ++i) {
- aux_readers[i] = aux_scenes[i].get_block_incremental(iter.index());
- }
- // iterate over cells
- for (unsigned i=0; i<cells.size(); ++i)
- {
- aux_samples.clear();
- boct_tree_cell<T_loc,boxm_sample<APM> >* cell = cells[i];
- boxm_sample<APM> data = cell->data();
- //std::cout << "cell IN " << data.alpha << data.appearence_<< std::endl;
- for (unsigned j=0; j<aux_readers.size(); j++) {
- boct_tree_cell<T_loc, aux_type> temp_cell;
-
- if (!aux_readers[j]->next(temp_cell)) {
- std::cerr << "error: incremental reader returned false.\n";
- return false;
- }
- //boxm_opt_sample<typename boxm_apm_traits<APM>::obs_datatype> aux_cell = temp_cell.data();
- if (!temp_cell.code_.isequal(&(cell->code_))) {
- std::cerr << "error: temp_cell idx does not match cell idx.\n";
- return false;
- }
- if (temp_cell.data().seg_len_ > 0.0f) {
- aux_samples.push_back(temp_cell.data());
- }
- }
-
- //boxm_sample<APM> &cell_data = cell_it->data();
- std::vector<float> pre_vector(aux_samples.size());
- std::vector<float> vis_vector(aux_samples.size());
- //std::vector<float> post_prob_vector(aux_samples.size());
- std::vector<typename boxm_apm_traits<APM>::obs_datatype> obs_vector(aux_samples.size());
- double Beta = 1.0;
- for (unsigned int s=0; s<aux_samples.size(); ++s) {
- float seg_len = aux_samples[s].seg_len_;
- if (seg_len > 1e-5) {
- Beta *= (aux_samples[s].Beta_ / seg_len);
- obs_vector[s] = aux_samples[s].obs_ / seg_len;
- pre_vector[s] = aux_samples[s].pre_ / seg_len;
- vis_vector[s] = aux_samples[s].vis_ / seg_len;
- //post_prob_vector[s] = aux_samples[s].post_prob_ / seg_len;
- }
- else {
- pre_vector[s] = 0.0f;
- vis_vector[s] = 0.0f;
- //post_prob_vector[s] = 0.0f;
- obs_vector[s] = typename boxm_apm_traits<APM>::obs_datatype(0);
- }
- }
- double damped_Beta = (Beta + damping_factor)/(damping_factor*Beta + 1.0);
-
- if ((damped_Beta < 0.00000001) && (damped_Beta > -0.00000001))
- std::cout << "ERROR: damped_Beta is:" << damped_Beta << std::endl;
-
- data.alpha *= (float)damped_Beta;
- // do bounds check on new alpha value
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(cell);
- const float cell_len = float(cell_bb.width());
- const float max_alpha = -std::log(1.0f - max_cell_P_)/cell_len;
- const float min_alpha = -std::log(1.0f - min_cell_P_)/cell_len;
- if (data.alpha > max_alpha) {
- data.alpha = max_alpha;
- }
- if (data.alpha < min_alpha) {
- data.alpha = min_alpha;
- }
- if (!((data.alpha >= min_alpha) && (data.alpha <= max_alpha)) ){
- std::cerr << "\nerror: data.alpha = " << data.alpha << '\n'
- << "damped_Beta = " << damped_Beta << '\n';
- }
- // update with new appearance
- boxm_opt_compute_appearance<APM>(obs_vector, pre_vector, vis_vector, data.appearance_);
- //std::cout << "cell OUT " << data.alpha << data.appearence_ << std::endl << std::endl;
- cell->set_data(data);
- }
- scene_.write_active_block();
- for (unsigned int i=0; i<aux_readers.size(); ++i) {
- aux_readers[i]->close();
- }
- iter++;
- }
-#ifdef DEBUG
- std::cout << "done with all cells" << std::endl;
-#endif
- // clear the aux scenes so that its starts with the refined scene next time
- for (unsigned i=0; i<aux_scenes.size(); i++) {
- aux_scenes[i].clean_scene();
- }
-
- return true;
-}
-
-
-#define BOXM_OPT_RT_BAYESIAN_OPTIMIZER_INSTANTIATE(T1,T2,T3) \
-template class boxm_opt_rt_bayesian_optimizer<T1,T2,T3 >
-
-#endif // boxm_opt_rt_bayesian_optimizer_hxx_
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_pre_infinity_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_pre_infinity_functor.h
deleted file mode 100644
index 0d50efd8a4..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_pre_infinity_functor.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef boxm_pre_infinity_functor_h
-#define boxm_pre_infinity_functor_h
-//:
-// \file
-#include <iostream>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <vil/vil_image_view.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <boxm_apm_type APM, class T_aux>
-class boxm_pre_infinity_functor
-{
- public:
- //: "default" constructor
- boxm_pre_infinity_functor(vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> const& image,
- vil_image_view<float> &pre_inf, vil_image_view<float> &vis_inf)
- : alpha_integral_(image.ni(),image.nj(),1), obs_(image), vis_img_(vis_inf), pre_img_(pre_inf)
- {
- alpha_integral_.fill(0.0f);
- pre_img_.fill(0.0f);
- vis_img_.fill(1.0f);
- //only reads info from the scene
- scene_read_only_=true;
- //needs to write aux
- is_aux_=true;
- }
-
- inline bool step_cell(unsigned int i, unsigned int j,
- vgl_point_3d<double> s0, vgl_point_3d<double> s1,
- boxm_sample<APM> &cell_value, T_aux & aux_val)
- {
- // compute segment length
- const float seg_len = (float)(s1 - s0).length();
- // compute average intensity for the cell
- const float mean_obs_ =aux_val.obs_/aux_val.seg_len_;
- // compute appearance probability of observation
- const float PI = boxm_apm_traits<APM>::apm_processor::prob_density(cell_value.appearance(),mean_obs_); // aux_val.PI_;
- // update alpha integral
- alpha_integral_(i,j) += cell_value.alpha * seg_len;
- // compute new visibility probability with updated alpha_integral
- const float vis_prob_end = std::exp(-alpha_integral_(i,j));
- // compute weight for this cell
- const float Omega = vis_img_(i,j) - vis_prob_end;
- // and update pre
- pre_img_(i,j) += PI * Omega;
- // update visibility probability
- vis_img_(i,j) = vis_prob_end;
- return true;
- }
-
- public:
- bool scene_read_only_;
- bool is_aux_;
- vil_image_view<float> alpha_integral_;
- private:
- vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> const& obs_;
- vil_image_view<float> &vis_img_;
- vil_image_view<float> &pre_img_;
-};
-
-#endif // boxm_pre_infinity_functor_h
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_depth_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_depth_functor.h
deleted file mode 100644
index bfd4c3b08d..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_depth_functor.h
+++ /dev/null
@@ -1,109 +0,0 @@
-#ifndef boxm_render_expected_depth_functor_h
-#define boxm_render_expected_depth_functor_h
-//:
-// \file
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_scene.h>
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/sample/boxm_rt_sample.h>
-
-#include <vil/vil_transform.h>
-#include <vpgl/vpgl_camera.h>
-
-template <boxm_apm_type APM, class T_aux>
-class boxm_render_expected_depth_functor
-{
- public:
- //: "default" constructor
- boxm_render_expected_depth_functor(vil_image_view<float> &expected,
- vil_image_view<float> &mask_vis,
- vgl_point_3d<double> cam_center,
- unsigned int ni,unsigned nj,
- bool scene_read_only=false,
- bool is_aux=true)
- : expected_(expected), vis_img_(mask_vis), alpha_integral_(ni,nj,1), center_(cam_center)
- {
- alpha_integral_.fill(0.0f);
- expected_.fill(0.0f);
- vis_img_.fill(1.0f);
- scene_read_only_=scene_read_only;
- is_aux_=is_aux;
- }
-
- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d<double> s0, vgl_point_3d<double> s1,
- boxm_sample<APM> &cell_value, T_aux /*aux_val*/)
- {
- // compute segment length
- const float seg_len = (float)(s1 - s0).length();
- const float depthexp = (float)(s1 - center_).length();
-#if 0
- // compute appearance probability of observation
- const float exp = boxm_apm_traits<APM>::apm_processor::expected_color(cell_value.appearance());
-#endif
- // update alpha integral
- alpha_integral_(i,j) += cell_value.alpha * seg_len;
- // compute new visibility probability with updated alpha_integral
- const float vis_prob_end = std::exp(-alpha_integral_(i,j));
- // compute weight for this cell
- const float Omega = vis_img_(i,j) - vis_prob_end;
- // and update expected image
- expected_(i,j) += depthexp * Omega;
- // update visibility probability
- vis_img_(i,j) = vis_prob_end;
- return true;
- }
-
- public:
- bool scene_read_only_;
- bool is_aux_;
-
- private:
- vil_image_view<float> &expected_;
- vil_image_view<float> &vis_img_;
- vil_image_view<float> alpha_integral_;
- vgl_point_3d<double> center_;
-};
-
-
-//: Functor class to normalize expected image
-class normalize_expected_functor_depth_rt
-{
- public:
- normalize_expected_functor_depth_rt(float depth_max):depth_max_(depth_max) {}
-
- void operator()(float mask, float &pix) const
- {
- pix += mask*depth_max_;
- }
-
- private:
- float depth_max_;
-};
-
-
-template <class T_loc, class T_data>
-void boxm_render_depth_rt(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<float> &expected,
- vil_image_view<float> &mask,
- int bin = -1, // FIXME - unused
- bool use_black_background = false) // FIXME - unused
-{
- if (vpgl_perspective_camera<double> *pcam=dynamic_cast<vpgl_perspective_camera<double> *>(cam.ptr()))
- {
- typedef boxm_aux_traits<BOXM_AUX_NULL>::sample_datatype sample_datatype;
- boxm_aux_scene<T_loc, T_data, boxm_rt_sample<sample_datatype> > aux_scene(&scene,boxm_aux_traits<BOXM_AUX_NULL>::storage_subdir(), boxm_aux_scene<T_loc, T_data, boxm_rt_sample<sample_datatype> >::LOAD);
-
- typedef boxm_render_expected_depth_functor<T_data::apm_type,boxm_rt_sample<sample_datatype> > expfunctor;
- boxm_raytrace_function<expfunctor,T_loc, T_data,boxm_rt_sample<sample_datatype> > raytracer(scene,aux_scene,cam.ptr(),expected.ni(),expected.nj());
- expfunctor exp_functor(expected,mask,pcam->camera_center(),expected.ni(),expected.nj(),true,false);
- raytracer.run(exp_functor);
-
- float max_depth=(float)boxm_utils::max_point_to_box_dist(scene.get_world_bbox(),pcam->camera_center());
-
- normalize_expected_functor_depth_rt norm_fn(max_depth);
- vil_transform2<float,float, normalize_expected_functor_depth_rt >(mask,expected,norm_fn);
- }
-}
-
-#endif // boxm_render_expected_depth_functor_h
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_edge_image_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_edge_image_functor.h
deleted file mode 100644
index c210b8d20f..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_edge_image_functor.h
+++ /dev/null
@@ -1,109 +0,0 @@
-#ifndef boxm_render_expected_edge_image_functor_h
-#define boxm_render_expected_edge_image_functor_h
-//:
-// \file
-#include <iostream>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <boxm/sample/algo/boxm_mob_grey_processor.h>
-
-#include <vnl/vnl_math.h>
-#include <vil/vil_transform.h>
-#include <sdet/sdet_img_edge.h>
-
-#ifdef DEBUG
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#endif
-
-template <boxm_apm_type APM, class T_aux>
-class boxm_render_expected_edge_image_functor
-{
- public:
- //: "default" constructor
- boxm_render_expected_edge_image_functor(vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> &expected,
- vil_image_view<float> &mask_vis, // FIXME: unused...
- unsigned int /*ni*/=0, unsigned /*nj*/=0,
- bool scene_read_only=false,
- bool is_aux=true)
- : expected_(expected)
- {
- typename boxm_apm_traits<APM>::obs_datatype nil(0);
- expected_.fill(nil);
- scene_read_only_=scene_read_only;
- is_aux_=is_aux;
- }
-
- inline bool step_cell(unsigned int i, unsigned int j,
- vgl_point_3d<double> /*s0*/, // currently unused, see below
- vgl_point_3d<double> /*s1*/,
- boxm_edge_sample<typename boxm_apm_traits<APM>::obs_datatype> &cell_value,
- T_aux /*aux_val*/)
- {
- // compute segment length
- //const float seg_len = (float)(s1-s0).length(); // FIXME: unused...
-
- // TODO: revise with segment length
- const float exp = cell_value.edge_prob_;
-
- // keep the max value in expected image
- // if (expected_(i,j) < exp)
- expected_(i,j) = std::max(expected_(i,j), exp);
-
- return true;
- }
-
- bool scene_read_only_;
- bool is_aux_;
-
- private:
- vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> &expected_;
-};
-
-
-//: Functor class to normalize expected image
-template<class T_data>
-class normalize_expected_functor_edge
-{
- public:
- normalize_expected_functor_edge(float n_normal, unsigned int dof) : n_normal_(n_normal), dof_(dof)
- {
-#ifdef DEBUG
- std::cout << "Degrees of freedom: " << dof << std::endl;
-#endif
- }
-
- void operator()(float mask, float &pix) const
- {
- pix = sdet_img_edge::convert_edge_statistics_to_probability(pix,n_normal_,dof_);
- }
-
- float n_normal_;
- unsigned int dof_;
-};
-
-
-template <class T_loc, class T_data>
-void boxm_render_edge_image_rt(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<float> &expected,
- vil_image_view<float> & mask,
- float n_normal,
- unsigned int num_samples, //degrees of freedom
- int bin = -1) // FIXME - unused
-{
- typedef boxm_aux_traits<BOXM_AUX_NULL>::sample_datatype sample_datatype;
- boxm_aux_scene<T_loc, T_data,boxm_aux_edge_sample<sample_datatype> > aux_scene(&scene,boxm_aux_traits<BOXM_AUX_NULL>::storage_subdir(), boxm_aux_scene<T_loc, T_data,boxm_aux_edge_sample<sample_datatype> >::LOAD);
- typedef boxm_render_expected_edge_image_functor<BOXM_EDGE_FLOAT,sample_datatype > expfunctor;
- boxm_raytrace_function<expfunctor,T_loc, T_data > raytracer(scene,cam.ptr(),expected.ni(),expected.nj());
- expfunctor exp_functor(expected,mask,expected.ni(),expected.nj(),true,false);
- raytracer.run(exp_functor);
-
- normalize_expected_functor_edge<T_data> norm_fn(n_normal,num_samples-1);
- vil_transform2<float,float, normalize_expected_functor_edge<T_data> >(mask,expected,norm_fn);
-}
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_edge_tangent_image_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_edge_tangent_image_functor.h
deleted file mode 100644
index 17f8da724c..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_edge_tangent_image_functor.h
+++ /dev/null
@@ -1,126 +0,0 @@
-#ifndef boxm_render_expected_edge_tangent_image_functor_h
-#define boxm_render_expected_edge_tangent_image_functor_h
-//:
-// \file
-#include <iostream>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <boxm/sample/algo/boxm_mob_grey_processor.h>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-#include <vnl/vnl_math.h>
-#include <vil/vil_image_view.h>
-#include <sdet/sdet_img_edge.h>
-#include <vgl/vgl_distance.h>
-#ifdef DEBUG
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#endif
-
-template <boxm_apm_type APM, class T_aux>
-class boxm_render_expected_edge_tangent_image_functor
-{
- public:
- //: "default" constructor
- boxm_render_expected_edge_tangent_image_functor(vil_image_view<float > &expected,
- vpgl_camera_double_sptr cam,
- //float threshold,
- unsigned int /*ni*/=0, unsigned /*nj*/=0,
- bool scene_read_only=false,
- bool is_aux=true)
- : expected_(expected), num_obs_(expected.ni(),expected.nj()), cam_(cam), residual(1.0)
- {
- expected_.fill(1.0);
- num_obs_.fill(0);
- scene_read_only_=scene_read_only;
- is_aux_=is_aux;
- }
-
- inline bool step_cell(unsigned int i, unsigned int j,
- vgl_point_3d<double> /*s0*/, // FIXME - unused
- vgl_point_3d<double> /*s1*/, // FIXME - unused
- boxm_inf_line_sample<typename boxm_apm_traits<APM>::obs_datatype> &cell_value,
- T_aux /*aux_val*/)
- {
- //std::cout<< cell_value.residual_<<' ';
-#if 0
- if (cell_value.residual_<residual) {
- if (expected_(i,j) > cell_value.residual_)
- expected_(i,j) = cell_value.residual_;
- }
-#endif
- if (cell_value.residual_<residual) {
- if (expected_(i,j) > cell_value.residual_) {
- double u1,v1,u2,v2;
- vgl_point_3d<float> p1=cell_value.line_clipped_.point1();
- vgl_point_3d<float> p2=cell_value.line_clipped_.point2();
- cam_->project(p1.x(),p1.y(),p1.z(),u1,v1);
- cam_->project(p2.x(),p2.y(),p2.z(),u2,v2);
- vgl_point_2d<double> img_p1(u1,v1);
- vgl_point_2d<double> img_p2(u2,v2);
- double dist = length(img_p1-img_p2);
- if (dist > 1.0) // for img lines shorter than a pixel don't bother
- {
- double dist_to_seg = vgl_distance_to_linesegment<double>(u1, v1, u2, v2, i, j);
- if (dist_to_seg <= 0.5) { // if the current pixel is less than 0.5 pixels closer to the projected line then mark it
- expected_(i,j)=cell_value.residual_;
- }
- }
- }
- }
-#if 0
- if (cell_value.num_obs_>2 && cell_value.residual_<residual && cell_value.num_obs_>num_obs_(i,j))
- {
- num_obs_(i,j)=cell_value.num_obs_;
- double u1,v1,u2,v2;
- vgl_point_3d<float> p1=cell_value.line_clipped_.point1();
- vgl_point_3d<float> p2=cell_value.line_clipped_.point2();
- cam_->project(p1.x(),p1.y(),p1.z(),u1,v1);
- cam_->project(p2.x(),p2.y(),p2.z(),u2,v2);
- if ((u1-u2)==0 && v1-v2==0)
- {
- expected_(i,j,0)=-1;
- expected_(i,j,1)=-1;
- expected_(i,j,2)=-1;
- }
- else
- {
- expected_(i,j,0)=float(u1+u2)/2;
- expected_(i,j,1)=float(v1+v2)/2;
- expected_(i,j,2)=float(vnl_math::angle_0_to_2pi(std::atan2(v2-v1,u2-u1)));
- }
- }
-#endif // 0
- return true;
- }
-
- bool scene_read_only_;
- bool is_aux_;
-
- private:
- vil_image_view<float > &expected_;
- vil_image_view<unsigned> num_obs_;
- vpgl_camera_double_sptr cam_;
- float residual;
-};
-
-template <class T_loc, class T_data>
-void boxm_render_edge_tangent_image_rt(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<float> &expected)
- // float n_normal, // FIXME - unused
- // unsigned int num_samples, // FIXME - unused
- // float threshold) // degrees of freedom
-{
- typedef boxm_aux_traits<BOXM_AUX_NULL>::sample_datatype sample_datatype;
- boxm_aux_scene<T_loc, T_data,boxm_edge_tangent_sample<sample_datatype> > aux_scene(&scene,boxm_aux_traits<BOXM_AUX_NULL>::storage_subdir(), boxm_aux_scene<T_loc, T_data,boxm_edge_tangent_sample<sample_datatype> >::LOAD);
- typedef boxm_render_expected_edge_tangent_image_functor<BOXM_EDGE_LINE,sample_datatype > expfunctor;
- boxm_raytrace_function<expfunctor,T_loc, T_data> raytracer(scene, cam.ptr(),expected.ni(),expected.nj());
- expfunctor exp_functor(expected,cam,/*threshold,*/expected.ni(),expected.nj(),true,false);
- raytracer.run(exp_functor);
-}
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_image_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_image_functor.h
deleted file mode 100644
index 51a2c930ce..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_image_functor.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef boxm_render_expected_image_functor_h
-#define boxm_render_expected_image_functor_h
-//:
-// \file
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <boxm/sample/algo/boxm_mob_grey_processor.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <vil/vil_transform.h>
-
-template <boxm_apm_type APM, class T_aux>
-class boxm_render_expected_image_functor
-{
- public:
- //: "default" constructor
- boxm_render_expected_image_functor(vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> &expected,
- vil_image_view<float> &mask_vis,
- unsigned int ni,unsigned nj,
- bool scene_read_only=false,bool is_aux=true)
- : expected_(expected), vis_img_(mask_vis), alpha_integral_(ni,nj, 1)
- {
- alpha_integral_.fill(0.0f);
- typename boxm_apm_traits<APM>::obs_datatype nil(0);
- expected_.fill(nil);
- vis_img_.fill(1.0f);
- scene_read_only_=scene_read_only;
- is_aux_=is_aux;
- }
-
- inline bool step_cell(unsigned int i, unsigned int j,
- vgl_point_3d<double> s0, vgl_point_3d<double> s1,
- boxm_sample<APM> &cell_value,
- T_aux /*aux_val*/)
- {
- // compute segment length
- const float seg_len = (float)(s1 - s0).length();
- // compute appearance probability of observation
- const float exp = boxm_apm_traits<APM>::apm_processor::expected_color(cell_value.appearance());
- // update alpha integral
- alpha_integral_(i,j) += cell_value.alpha * seg_len;
-
- // compute new visibility probability with updated alpha_integral
- const float vis_prob_end = std::exp(-alpha_integral_(i,j));
- // compute weight for this cell
- const float Omega = vis_img_(i,j) - vis_prob_end;
- // and update expected image
- expected_(i,j) += exp* Omega;
- // update visibility probability
- vis_img_(i,j) = vis_prob_end;
-
- return true;
- }
-
- bool scene_read_only_;
- bool is_aux_;
-
- private:
- vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> &expected_;
- vil_image_view<float> &vis_img_;
- vil_image_view<float> alpha_integral_;
-};
-
-
-//: Functor class to normalize expected image
-template<class T_data>
-class normalize_expected_functor_rt
-{
- public:
- normalize_expected_functor_rt(bool use_black_background) : use_black_background_(use_black_background) {}
-
- void operator()(float mask, typename T_data::obs_datatype &pix) const
- {
- if (!use_black_background_) {
- pix += mask*0.5f;
- }
- }
- bool use_black_background_;
-};
-
-
-template <class T_loc, class T_data>
-void boxm_render_image_rt(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<typename T_data::obs_datatype> &expected,
- vil_image_view<float> & mask,
- int /*bin*/ = -1,
- bool use_black_background = false)
-{
- typedef boxm_aux_traits<BOXM_AUX_NULL>::sample_datatype sample_datatype;
- boxm_aux_scene<T_loc, T_data,boxm_rt_sample<sample_datatype> > aux_scene(&scene,boxm_aux_traits<BOXM_AUX_NULL>::storage_subdir(), boxm_aux_scene<T_loc, T_data,boxm_rt_sample<sample_datatype> >::LOAD);
- typedef boxm_render_expected_image_functor<T_data::apm_type,boxm_rt_sample<sample_datatype> > expfunctor;
- boxm_raytrace_function<expfunctor,T_loc, T_data,boxm_rt_sample<sample_datatype> > raytracer(scene,aux_scene,cam.ptr(),expected.ni(),expected.nj());
- expfunctor exp_functor(expected,mask,expected.ni(),expected.nj(),true,false);
- raytracer.run(exp_functor);
-
- normalize_expected_functor_rt<T_data> norm_fn(use_black_background);
- vil_transform2<float,typename T_data::obs_datatype, normalize_expected_functor_rt<T_data> >(mask,expected,norm_fn);
-}
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_shadow_image_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_shadow_image_functor.h
deleted file mode 100644
index acbde275c3..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_render_expected_shadow_image_functor.h
+++ /dev/null
@@ -1,120 +0,0 @@
-#ifndef boxm_render_expected_shadow_image_functor_h
-#define boxm_render_expected_shadow_image_functor_h
-//:
-// \file
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/boxm_aux_scene.h>
-
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/sample/boxm_opt2_sample.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <boxm/sample/algo/boxm_mob_grey_processor.h>
-
-#include <vil/vil_transform.h>
-
-template <class T_loc, boxm_apm_type APM, boxm_aux_type AUX>
-class boxm_render_expected_shadow_image_functor
-{
- public:
- typedef typename boxm_aux_traits<AUX>::sample_datatype T_aux;
- //: "default" constructor
- boxm_render_expected_shadow_image_functor(vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> &expected,
- vil_image_view<float> &mask_vis,
- unsigned int ni,unsigned nj,
- bool scene_read_only=false,bool is_aux=true)
- : expected_(expected), vis_img_(mask_vis), alpha_integral_(ni,nj, 1)
- {
- alpha_integral_.fill(0.0f);
- typename boxm_apm_traits<APM>::obs_datatype nil(0);
- expected_.fill(nil);
- vis_img_.fill(1.0f);
- scene_read_only_=scene_read_only;
- is_aux_=is_aux;
- }
-
- inline bool step_cell(unsigned int i, unsigned int j,
- vgl_point_3d<double> s0, vgl_point_3d<double> s1,
- boxm_sample<APM> &cell_value,
- T_aux& aux_val)
- {
- // compute segment length
- const float seg_len = (float)(s1 - s0).length();
- // compute appearance probability of observation
- const float exp = boxm_apm_traits<APM>::apm_processor::expected_color(cell_value.appearance());
-
- //compute sun visibility
- float length_sum = aux_val.seg_len_;
- float avg_sun_vis = 1.0f;
- if (length_sum>0.0f)
- avg_sun_vis = aux_val.vis_/length_sum;
-
- // update alpha integral
- alpha_integral_(i,j) += cell_value.alpha * seg_len;
-
- // compute new visibility probability with updated alpha_integral
- const float vis_prob_end = std::exp(-alpha_integral_(i,j));
- // compute weight for this cell
- const float Omega = vis_img_(i,j) - vis_prob_end;
- // and update expected image
- expected_(i,j) += exp * Omega * avg_sun_vis;
- // update visibility probability
- vis_img_(i,j) = vis_prob_end;
- return true;
- }
-
- bool scene_read_only_;
- bool is_aux_;
-
- private:
- vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> &expected_;
- vil_image_view<float> &vis_img_;
- vil_image_view<float> alpha_integral_;
-};
-
-
-//: Functor class to normalize expected image
-template<class T_data>
-class normalize_shadow_functor
-{
- public:
-
- normalize_shadow_functor(bool use_black_background)
- {use_black_background_ = use_black_background;}
-
- void operator()(float mask, typename T_data::obs_datatype &pix) const
- {
- if (!use_black_background_) {
- pix += mask*0.5f;
- }
- }
- bool use_black_background_;
-};
-
-
-template <class T_loc, boxm_apm_type APM , boxm_aux_type AUX>
-void boxm_render_shadow_image_rt(boxm_scene<boct_tree<T_loc, boxm_sample<APM> > > &scene,
- std::string const& aux_scene_id,
- vpgl_camera_double_sptr cam,
- vil_image_view<typename boxm_sample<APM>::obs_datatype> &expected,
- vil_image_view<float> & mask,
- bool use_black_background = false)
-{
- typedef boxm_sample<APM> T_data;
- typedef typename boxm_aux_traits<AUX>::sample_datatype T_aux;
- boxm_aux_scene<T_loc, T_data, T_aux> aux_scene(&scene, aux_scene_id, boxm_aux_scene<T_loc, T_data, T_aux>::LOAD);
-
- typedef boxm_render_expected_shadow_image_functor<T_loc, APM, AUX > exp_funct;
-
- boxm_raytrace_function<exp_funct, T_loc, T_data, T_aux > raytracer(scene,aux_scene,cam.ptr(),expected.ni(),expected.nj());
- exp_funct expf(expected,mask,expected.ni(),expected.nj(),true,true);
- raytracer.run(expf);
-
- normalize_shadow_functor<T_data> norm_fn(use_black_background);
- vil_transform2<float,typename T_data::obs_datatype, normalize_shadow_functor<T_data> >(mask,expected,norm_fn);
-
- // aux_scene.clean_scene();
-}
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_rpc_registration.h b/contrib/brl/bseg/boxm/algo/rt/boxm_rpc_registration.h
deleted file mode 100644
index 78df79d9c4..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_rpc_registration.h
+++ /dev/null
@@ -1,447 +0,0 @@
-#ifndef boxm_rpc_registration_h_
-#define boxm_rpc_registration_h_
-//:
-// \file
-// This part contains the correction rpc camera parameters using the expected
-// edge image obtained from the world (scene) and edge map of the current image.
-// if the camera parameters are manually corrected by the user, this part should
-// be omitted by setting the "rpc_correction_flag" parameter to 0 (false) in the
-// boxm_rpc_registration_process.
-//
-// \author Ibrahim Eden
-// \date Jan, 2009
-//
-// \verbatim
-// Modifications
-// Feb 1st, 2010 Gamze Tunali
-// This piece of code is moved from bvxm_rpc_registration process to this file
-// as a standalone function to be used in boxm/opt/boxm_rpc_registration_process
-// \endverbatim
-
-
-#include <iostream>
-#include <fstream>
-#include <limits>
-#include <vpgl/vpgl_rational_camera.h>
-#include <vpgl/vpgl_local_rational_camera.h>
-#include <vpgl/algo/vpgl_backproject.h>
-#include <vpgl/vpgl_lvcs.h>
-
-#include <brip/brip_vil_float_ops.h>
-
-#include <boxm/boxm_scene.h>
-#include <boxm/util/boxm_utils.h>
-
-#include <vgl/vgl_point_2d.h>
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_vector_3d.h>
-#include <vgl/vgl_plane_3d.h>
-#include <vil/vil_image_view.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-int convert_uncertainty_from_meters_to_pixels(float uncertainty,
- vpgl_lvcs lvcs,
- vpgl_camera_double_sptr camera)
-{
- // estimate the offset search size in the image space
- vgl_box_3d<double> box_uncertainty(-uncertainty,-uncertainty,-uncertainty,uncertainty,uncertainty,uncertainty);
- std::vector<vgl_point_3d<double> > box_uncertainty_corners = boxm_utils::corners_of_box_3d(box_uncertainty);
- vgl_box_2d<double> roi_uncertainty;
-
- for (auto curr_corner : box_uncertainty_corners) {
- vgl_point_3d<double> curr_pt;
- if (camera->type_name()=="vpgl_local_rational_camera") {
- curr_pt.set(curr_corner.x(),curr_corner.y(),curr_corner.z());
- }
- else if (camera->type_name()=="vpgl_rational_camera") {
- double lon, lat, gz;
- lvcs.local_to_global(curr_corner.x(), curr_corner.y(), curr_corner.z(),
- vpgl_lvcs::wgs84, lon, lat, gz, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- curr_pt.set(lon, lat, gz);
- }
- else // dummy initialisation, to avoid compiler warning
- curr_pt.set(-1e99, -1e99, -1.0);
-
- double curr_u,curr_v;
- camera->project(curr_pt.x(),curr_pt.y(),curr_pt.z(),curr_u,curr_v);
- vgl_point_2d<double> p2d_uncertainty(curr_u,curr_v);
- roi_uncertainty.add(p2d_uncertainty);
- }
-
- return vnl_math::ceil(0.5*std::max(roi_uncertainty.width(),roi_uncertainty.height()));
-}
-
-template<class T_loc, class T_data>
-bool boxm_rpc_registration(boxm_scene_base_sptr scene_base,//<boct_tree<T_loc, T_data > &scene,
- vil_image_view<vxl_byte> edge_image,
- vil_image_view<vxl_byte> expected_edge_image,
- vpgl_camera_double_sptr camera,
- vpgl_camera_double_sptr camera_out,
- bool rpc_shift_3d_flag,
- float uncertainty,
- float n_normal, // FIXME - unused
- unsigned num_observations)
-{
- double max_prob = std::numeric_limits<double>::min();
- unsigned int best_offset_u = 0, best_offset_v = 0;
-
- typedef boct_tree<T_loc,T_data> tree_type;
- boxm_scene<tree_type> *scene = dynamic_cast<boxm_scene<tree_type>*>(scene_base.ptr());
-
- int offset_search_size = convert_uncertainty_from_meters_to_pixels(uncertainty, scene->lvcs(), camera);
- int ni = edge_image.ni();
- int nj = edge_image.nj();
-
- // this is the two level offset search algorithm
- int offset_lower_limit_u = -offset_search_size;
- int offset_lower_limit_v = -offset_search_size;
- int offset_upper_limit_u = offset_search_size;
- int offset_upper_limit_v = offset_search_size;
- std::cout << "Estimating image offsets:" << std::endl;
- for (int u=offset_lower_limit_u; u<=offset_upper_limit_u; u++) {
- std::cout << '.';
- for (int v=offset_lower_limit_v; v<=offset_upper_limit_v; v++) {
- // for each offset pair (u,v)
- double prob = 0.0;
- double norm = 0.0;
- // find the total probability of the edge image given the expected edge image
- for (int m=offset_search_size; m<ni-offset_search_size; m++) {
- for (int n=offset_search_size; n<nj-offset_search_size; n++) {
- if (edge_image(m,n)==255) {
- prob += expected_edge_image(m-u,n-v);
- }
- norm += expected_edge_image(m-u,n-v);
- }
- }
-
- if (norm>0.0)
- prob/=norm;
-
- // if maximum is found
- if (prob > max_prob) {
- max_prob = prob;
- best_offset_u = u;
- best_offset_v = v;
- }
- }
- }
- std::cout << std::endl;
-
- std::cout << "Estimated changes in offsets (u,v)=(" << best_offset_u << ',' << best_offset_v << ')' << std::endl;
- // local variables
- std::ifstream file_inp;
- std::ofstream file_out;
- file_out.clear();
- file_out.open("offsets.txt",std::ofstream::app);
- file_out << best_offset_u << ' ' << best_offset_v << '\n';
- file_out.close();
-
- double nlx=0.f,nly=0.f,nlz=0.f;
- double motion_mult = 0.0;
- if (rpc_shift_3d_flag)
- {
- vpgl_local_rational_camera<double> *cam_input_temp = dynamic_cast<vpgl_local_rational_camera<double>*>(camera.ptr());
-
- vgl_point_3d<double> origin_3d(0.0,0.0,0.0);
- vgl_point_2d<double> origin_2d = cam_input_temp->project(origin_3d);
-
- vgl_plane_3d<double> curr_plane(0.0,0.0,1.0,-0.001);
- vgl_point_3d<double> init_point(0.0,0.0,0.001);
- vgl_point_3d<double> world_point;
- vpgl_backproject::bproj_plane(cam_input_temp,origin_2d,curr_plane,init_point,world_point);
-
- vgl_vector_3d<double> motion_plane_normal = world_point - origin_3d;
- motion_plane_normal = normalize(motion_plane_normal);
- vgl_plane_3d<double> motion_plane(motion_plane_normal,origin_3d);
-
- init_point.set(origin_3d.x(),origin_3d.y(),origin_3d.z());
- vgl_point_3d<double> moved_origin;
- vgl_point_2d<double> origin_2d_shift(origin_2d.x()+best_offset_u,origin_2d.y()+best_offset_v);
- vpgl_backproject::bproj_plane(cam_input_temp,origin_2d_shift,motion_plane,init_point,moved_origin);
-
- vgl_vector_3d<double> motion = moved_origin - origin_3d;
-
- motion_mult = 1.0/((double)(num_observations+1));
- motion = motion*motion_mult;
-
- double lx,ly,lz;
- vgl_point_3d<double> rpc_origin = scene->rpc_origin();
- lx = rpc_origin.x();
- ly = rpc_origin.y();
- lz = rpc_origin.z();
-
- lx = lx*(1.0f-(double)motion_mult);
- ly = ly*(1.0f-(double)motion_mult);
- lz = lz*(1.0f-(double)motion_mult);
-
- vgl_point_3d<double> pt_3d_est_vec(lx,ly,lz);
- vgl_point_3d<double> pt_3d_updated = pt_3d_est_vec + motion;
-
- nlx = (double)pt_3d_updated.x();
- nly = (double)pt_3d_updated.y();
- nlz = (double)pt_3d_updated.z();
-
- vgl_point_3d<double> new_rpc_origin(nlx,nly,nlz);
- scene->set_rpc_origin(new_rpc_origin);
- }
-
- // correct the output for (local) rational camera using the estimated offset pair (max_u,max_v)
- // the following block of code takes care of different input camera types
- // e.g., vpgl_local_rational_camera and vpgl_rational_camera
- bool is_local_cam = true;
- bool is_rational_cam = true;
- vpgl_local_rational_camera<double> *cam_inp_local;
- if (!(cam_inp_local = dynamic_cast<vpgl_local_rational_camera<double>*>(camera.ptr()))) {
- is_local_cam = false;
- }
- vpgl_rational_camera<double> *cam_inp_rational;
- if (!(cam_inp_rational = dynamic_cast<vpgl_rational_camera<double>*>(camera.ptr()))) {
- is_rational_cam = false;
- }
-
- if (is_local_cam) {
- vpgl_local_rational_camera<double> cam_out_local(*cam_inp_local);
- double offset_u,offset_v;
- cam_out_local.image_offset(offset_u,offset_v);
- offset_u += (best_offset_u*(1.0-motion_mult));
- offset_v += (best_offset_v*(1.0-motion_mult));
- cam_out_local.set_image_offset(offset_u,offset_v);
- camera_out = new vpgl_local_rational_camera<double>(cam_out_local);
- }
- else if (is_rational_cam) {
- vpgl_rational_camera<double> cam_out_rational(*cam_inp_rational);
- double offset_u,offset_v;
- cam_out_rational.image_offset(offset_u,offset_v);
- offset_u += (best_offset_u*(1.0-motion_mult));
- offset_v += (best_offset_v*(1.0-motion_mult));
- cam_out_rational.set_image_offset(offset_u,offset_v);
- camera_out = new vpgl_rational_camera<double>(cam_out_rational);
- }
- else {
- std::cerr << "error: process expects camera to be a vpgl_rational_camera or vpgl_local_rational_camera.\n";
- return false;
- }
-
- return true;
-}
-
-
-template<class T_loc, class T_data>
-bool boxm_rpc_registration(boxm_scene_base_sptr scene_base,//<boct_tree<T_loc, T_data > &scene,
- vil_image_view<float> edge_image,
- vil_image_view<float > expected_edge_image,
- vpgl_camera_double_sptr camera,
- vpgl_camera_double_sptr camera_out,
- bool rpc_shift_3d_flag,
- float uncertainty,
- unsigned num_observations)
-{
- double max_cost = std::numeric_limits<double>::max();
- unsigned int best_offset_u = 0, best_offset_v = 0;
- double subpixel_best_offset_u = 0.0, subpixel_best_offset_v = 0.0;
-
- typedef boct_tree<T_loc,T_data> tree_type;
- boxm_scene<tree_type> *scene = dynamic_cast<boxm_scene<tree_type>*>(scene_base.ptr());
-
- int offset_search_size = convert_uncertainty_from_meters_to_pixels(uncertainty, scene->lvcs(), camera);
- int ni = edge_image.ni();
- int nj = edge_image.nj();
-
- std::cout<<ni<<','<<nj<<','<<expected_edge_image.ni()<<','<<expected_edge_image.nj();
- // this is the two level offset search algorithm
- int offset_lower_limit_u = -offset_search_size;
- int offset_lower_limit_v = -offset_search_size;
- int offset_upper_limit_u = offset_search_size;
- int offset_upper_limit_v = offset_search_size;
- std::cout << "Estimating image offsets:" << std::endl;
- for (int u=offset_lower_limit_u; u<=offset_upper_limit_u; u++) {
- std::cout << '.';
- for (int v=offset_lower_limit_v; v<=offset_upper_limit_v; v++) {
- // for each offset pair (u,v)
- double cost = 0.0;
- double norm = 0.0;
- // find the total probability of the edge image given the expected edge image
- for (int m=offset_search_size+1; m<ni-offset_search_size-1; m++) {
- for (int n=offset_search_size+1; n<nj-offset_search_size-1; n++) {
- if (edge_image(m,n,0)>-1 && edge_image(m,n,1)>-1 && edge_image(m,n,2)>-1) {
- if (expected_edge_image(m-u,n-v,0)>0 && expected_edge_image(m-u,n-v,1)>0 && expected_edge_image(m-u,n-v,2)>0) {
- //std::cout<<'.';
- float sintheta1=std::sin(edge_image(m,n,2));
- float costheta1=std::cos(edge_image(m,n,2));
-
- float sintheta2=std::sin(expected_edge_image(m-u,n-v,2));
- float costheta2=std::cos(expected_edge_image(m-u,n-v,2));
-#if 0
- float dx=expected_edge_image(m-u,n-v,0)+u-edge_image(m,n,0);
- float dy=expected_edge_image(m-u,n-v,1)+v-edge_image(m,n,1);
-
- float dist=std::sqrt(dx*dx+dy*dy);
- if (dist<min_dist)
- min_dist=dist;
-
- float dist1=std::sqrt((dx*sintheta1*sintheta1+dy*sintheta1*costheta1)*(dx*sintheta1*sintheta1+dy*sintheta1*costheta1)
- +(dy*costheta1*costheta1+dx*sintheta1*costheta1)*(dy*costheta1*costheta1+dx*sintheta1*costheta1));
- float dist2=std::sqrt((dx*sintheta2*sintheta2+dy*sintheta2*costheta2)*(dx*sintheta2*sintheta2+dy*sintheta2*costheta2)
- +(dy*costheta2*costheta2+dx*sintheta2*costheta2)*(dy*costheta2*costheta2+dx*sintheta2*costheta2));
- if ((dist1+dist2)/2<min_dist)
- min_dist=(dist1+dist2)/2;
-#endif // 0
- float dist=(1-std::fabs(sintheta1*sintheta2+costheta2*costheta1));//+std::sqrt(dx*dx+dy*dy);
- cost += dist;//(dist1+dist2)/2;
- }
- else
- {
- cost+=0.5;
- }
- norm += 1;
- }
- }
- }
-
- if (norm>0.0)
- cost/=norm;
-
- //std::cout<<cost<<"u "<<u<<" v"<<v<<'\n';
- // if maximum is found
- if (cost < max_cost) {
- max_cost = cost;
- best_offset_u = u;
- best_offset_v = v;
- }
- }
- }
- std::cout << "Estimated changes in offsets (u,v)=(" << best_offset_u << ',' << best_offset_v << ')' << std::endl;
- double subpixel_offset_limit=0.5;
- max_cost = std::numeric_limits<double>::max();
- for (double u=-subpixel_offset_limit; u<=subpixel_offset_limit; ) {
- std::cout << '.';
- for (double v=-subpixel_offset_limit; v<=subpixel_offset_limit; ) {
- // for each offset pair (u,v)
- double cost = 0.0;
- // find the total probability of the edge image given the expected edge image
- for (int m=offset_search_size; m<ni-offset_search_size; m++) {
- for (int n=offset_search_size; n<nj-offset_search_size; n++) {
- if (edge_image(m,n,0)!=-1 || edge_image(m,n,1)!=-1 || edge_image(m,n,2)!=-1) {
- if (expected_edge_image(m-best_offset_u,n-best_offset_v,0)>0 && expected_edge_image(m-best_offset_u,n-best_offset_v,1)>0 && expected_edge_image(m-best_offset_u,n-best_offset_v,2)>0) {
- double dx=expected_edge_image(m-best_offset_u,n-best_offset_v,0)+best_offset_u+u-edge_image(m,n,0);
- double dy=expected_edge_image(m-best_offset_u,n-best_offset_v,1)+best_offset_v+v-edge_image(m,n,1);
- double dist=std::sqrt(dx*dx+dy*dy);
- cost += dist;
- }
- }
- }
- }
- //std::cout<<cost<<' ';
- if (cost < max_cost) {
- max_cost = cost;
- subpixel_best_offset_u = (double)u;
- subpixel_best_offset_v = (double)v;
- }
-
- v=v+0.05;
- }
- u+=0.05;
- }
- std::cout << "Estimated changes in offsets (u,v)=(" << subpixel_best_offset_u << ',' << subpixel_best_offset_v << ')' << std::endl;
-
- // local variables
- std::ifstream file_inp;
- std::ofstream file_out;
- file_out.clear();
- file_out.open("offsets.txt",std::ofstream::app);
- file_out << best_offset_u +subpixel_best_offset_u<< ' ' << best_offset_v+subpixel_best_offset_v << '\n';
- file_out.close();
-
- double nlx=0.f,nly=0.f,nlz=0.f;
- double motion_mult = 0.0;
- if (rpc_shift_3d_flag)
- {
- vpgl_local_rational_camera<double> *cam_input_temp = dynamic_cast<vpgl_local_rational_camera<double>*>(camera.ptr());
-
- vgl_point_3d<double> origin_3d(0.0,0.0,0.0);
- vgl_point_2d<double> origin_2d = cam_input_temp->project(origin_3d);
-
- vgl_plane_3d<double> curr_plane(0.0,0.0,1.0,-0.001);
- vgl_point_3d<double> init_point(0.0,0.0,0.001);
- vgl_point_3d<double> world_point;
- vpgl_backproject::bproj_plane(cam_input_temp,origin_2d,curr_plane,init_point,world_point);
-
- vgl_vector_3d<double> motion_plane_normal = world_point - origin_3d;
- motion_plane_normal = normalize(motion_plane_normal);
- vgl_plane_3d<double> motion_plane(motion_plane_normal,origin_3d);
-
- init_point.set(origin_3d.x(),origin_3d.y(),origin_3d.z());
- vgl_point_3d<double> moved_origin;
- vgl_point_2d<double> origin_2d_shift(origin_2d.x()+best_offset_u,origin_2d.y()+best_offset_v);
- vpgl_backproject::bproj_plane(cam_input_temp,origin_2d_shift,motion_plane,init_point,moved_origin);
-
- vgl_vector_3d<double> motion = moved_origin - origin_3d;
-
- motion_mult = 1.0/((double)(num_observations+1));
- motion = motion*motion_mult;
-
- double lx,ly,lz;
- vgl_point_3d<double> rpc_origin = scene->rpc_origin();
- lx = rpc_origin.x();
- ly = rpc_origin.y();
- lz = rpc_origin.z();
-
- lx = lx*(1.0f-(double)motion_mult);
- ly = ly*(1.0f-(double)motion_mult);
- lz = lz*(1.0f-(double)motion_mult);
-
- vgl_point_3d<double> pt_3d_est_vec(lx,ly,lz);
- vgl_point_3d<double> pt_3d_updated = pt_3d_est_vec + motion;
-
- nlx = (double)pt_3d_updated.x();
- nly = (double)pt_3d_updated.y();
- nlz = (double)pt_3d_updated.z();
-
- vgl_point_3d<double> new_rpc_origin(nlx,nly,nlz);
- scene->set_rpc_origin(new_rpc_origin);
- }
-
- // correct the output for (local) rational camera using the estimated offset pair (max_u,max_v)
- // the following block of code takes care of different input camera types
- // e.g., vpgl_local_rational_camera and vpgl_rational_camera
- bool is_local_cam = true;
- bool is_rational_cam = true;
- vpgl_local_rational_camera<double> *cam_inp_local;
- if (!(cam_inp_local = dynamic_cast<vpgl_local_rational_camera<double>*>(camera.ptr()))) {
- is_local_cam = false;
- }
- vpgl_rational_camera<double> *cam_inp_rational;
- if (!(cam_inp_rational = dynamic_cast<vpgl_rational_camera<double>*>(camera.ptr()))) {
- is_rational_cam = false;
- }
-
- if (is_local_cam) {
- vpgl_local_rational_camera<double> cam_out_local(*cam_inp_local);
- double offset_u,offset_v;
- cam_out_local.image_offset(offset_u,offset_v);
- offset_u += (best_offset_u*(1.0-motion_mult));
- offset_v += (best_offset_v*(1.0-motion_mult));
- cam_out_local.set_image_offset(offset_u,offset_v);
- camera_out = new vpgl_local_rational_camera<double>(cam_out_local);
- }
- else if (is_rational_cam) {
- vpgl_rational_camera<double> cam_out_rational(*cam_inp_rational);
- double offset_u,offset_v;
- cam_out_rational.image_offset(offset_u,offset_v);
- offset_u += (best_offset_u*(1.0-motion_mult));
- offset_v += (best_offset_v*(1.0-motion_mult));
- cam_out_rational.set_image_offset(offset_u,offset_v);
- camera_out = new vpgl_rational_camera<double>(cam_out_rational);
- }
- else {
- std::cerr << "error: process expects camera to be a vpgl_rational_camera or vpgl_local_rational_camera.\n";
- return false;
- }
-
- return true;
-}
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_app_initializer.h b/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_app_initializer.h
deleted file mode 100644
index 0d4d93d05d..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_app_initializer.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef boxm_shadow_app_initializer_h_
-#define boxm_shadow_app_initializer_h_
-
-#include <vector>
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_scene.h>
-
-#include <boxm/sample/boxm_rt_sample.h>
-
-template<class T_loc, boxm_apm_type APM, boxm_aux_type AUX>
-class boxm_shadow_app_initializer
-{
-public:
-
- boxm_shadow_app_initializer(boxm_scene<boct_tree<T_loc, boxm_sample<APM> > > &scene,
- std::vector<std::string> image_ids,
- float min_app_sigma,
- float shadow_prior,
- float shadow_mean, float shadow_sigma,
- bool verbose=false);
-
- ~boxm_shadow_app_initializer()= default;
-
- bool initialize();
-
-protected:
-
- std::vector<std::string> image_ids_;
-
- boxm_scene<boct_tree<T_loc, boxm_sample<APM> > > &scene_;
-
- float min_app_sigma_;
- float shadow_prior_;
- float shadow_mean_;
- float shadow_sigma_;
- bool verbose_;
-};
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_app_initializer.hxx b/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_app_initializer.hxx
deleted file mode 100644
index 22c469ec72..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_app_initializer.hxx
+++ /dev/null
@@ -1,122 +0,0 @@
-#ifndef boxm_shadow_app_initializer_hxx_
-#define boxm_shadow_app_initializer_hxx_
-
-#include <utility>
-#include <vector>
-#include <iostream>
-#include <string>
-#include "boxm_shadow_app_initializer.h"
-#include "boxm_shadow_appearance_estimator.h"
-
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_aux_scene.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <class T_loc, boxm_apm_type APM, boxm_aux_type AUX>
-boxm_shadow_app_initializer<T_loc,APM,AUX>::boxm_shadow_app_initializer(
- boxm_scene<boct_tree<T_loc, boxm_sample<APM> > > &scene,
- std::vector<std::string> image_ids, float min_app_sigma,
- float shadow_prior, float shadow_mean, float shadow_sigma,
- bool verbose)
- : image_ids_(std::move(image_ids)), scene_(scene), min_app_sigma_(min_app_sigma),
- shadow_prior_(shadow_prior), shadow_mean_(shadow_mean),
- shadow_sigma_(shadow_sigma),verbose_(verbose)
-{}
-
-
-template <class T_loc, boxm_apm_type APM, boxm_aux_type AUX>
-bool boxm_shadow_app_initializer<T_loc,APM,AUX>::initialize()
-{
- // get auxiliary scenes associated with each input image
- typedef typename boxm_aux_traits<AUX>::sample_datatype aux_type;
-
- typedef boct_tree<T_loc, boxm_sample<APM> > tree_type;
-
- std::vector<boxm_aux_scene<T_loc, boxm_sample<APM>, aux_type> > aux_scenes;
- for (unsigned int i=0; i<image_ids_.size(); ++i) {
- boxm_aux_scene<T_loc, boxm_sample<APM>, aux_type> aux_scene(&scene_,image_ids_[i],boxm_aux_scene<T_loc, boxm_sample<APM>, aux_type>::LOAD);
- aux_scenes.push_back(aux_scene);
- }
-
- std::vector<boxm_rt_sample<typename boxm_apm_traits<APM>::obs_datatype> > aux_samples;
-
- // for each block
- boxm_block_iterator<tree_type> iter(&scene_);
- iter.begin();
- while (!iter.end())
- {
- scene_.load_block(iter.index());
- boxm_block<tree_type>* block = *iter;
- boct_tree<T_loc, boxm_sample<APM> >* tree = block->get_tree();
- std::vector<boct_tree_cell<T_loc,boxm_sample<APM> >*> cells = tree->leaf_cells();
-
- // get a vector of incremental readers for each aux scene.
- std::vector<boct_tree_cell_reader<T_loc, aux_type>* > aux_readers(aux_scenes.size());
- for (unsigned int i=0; i<aux_scenes.size(); ++i) {
- aux_readers[i] = aux_scenes[i].get_block_incremental(iter.index());
- }
- // iterate over cells
- for (unsigned i=0; i<cells.size(); ++i)
- {
- aux_samples.clear();
- boct_tree_cell<T_loc,boxm_sample<APM> >* cell = cells[i];
- boxm_sample<APM> data = cell->data();
- //std::cout << "cell IN " << data.alpha << data.appearence_<< std::endl;
- for (unsigned j=0; j<aux_readers.size(); j++) {
- boct_tree_cell<T_loc, aux_type> temp_cell;
-
- if (!aux_readers[j]->next(temp_cell)) {
- std::cerr << "error: incremental reader returned false.\n";
- return false;
- }
- if (!temp_cell.code_.isequal(&(cell->code_))) {
- std::cerr << "error: temp_cell idx does not match cell idx.\n";
- return false;
- }
- if (temp_cell.data().seg_len_ > 0.0f) {
- aux_samples.push_back(temp_cell.data());
- }
- }
- typedef typename boxm_apm_traits<APM>::obs_datatype obs_type;
- std::vector<obs_type> obs_vector;
- for (unsigned int s=0; s<aux_samples.size(); ++s) {
- float seg_len = aux_samples[s].seg_len_;
- obs_type obs = aux_samples[s].obs_;
- if ( seg_len > 1e-5 && (obs > obs_type(0)) ){
- obs_vector.push_back(obs / seg_len);
- }
- }
- unsigned n_obs = obs_vector.size();
- if(n_obs>1){
- std::vector<float> pre_vector(n_obs, 0.0f);
- std::vector<float> vis_vector(n_obs, 1.0f);
- boxm_compute_shadow_appearance<APM>(obs_vector, pre_vector,
- vis_vector, data.appearance_,
- min_app_sigma_, shadow_prior_,
- shadow_mean_, shadow_sigma_,
- verbose_);
- cell->set_data(data);
- }
- }
- scene_.write_active_block();
- for (unsigned int i=0; i<aux_readers.size(); ++i) {
- aux_readers[i]->close();
- }
- iter++;
- }
- // clear the aux scenes
- for (unsigned i=0; i<aux_scenes.size(); i++)
- aux_scenes[i].clean_scene();
- return true;
-}
-
-
-#define BOXM_SHADOW_APP_INITIALIZER_INSTANTIATE(T1,T2,T3) \
-template class boxm_shadow_app_initializer<T1,T2,T3 >
-
-#endif // boxm_shadow_app_initializer_hxx_
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_appearance_estimator.h b/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_appearance_estimator.h
deleted file mode 100644
index 15dd5763ba..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_appearance_estimator.h
+++ /dev/null
@@ -1,114 +0,0 @@
-#ifndef boxm_shadow_appearance_estimator_h_
-#define boxm_shadow_appearance_estimator_h_
-
-#include <vector>
-#include <iostream>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#if 1
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#endif
-
-template <boxm_apm_type APM>
-void boxm_compute_shadow_appearance(std::vector<typename boxm_apm_traits<APM>::obs_datatype> const& obs,
- std::vector<float> const& pre,
- std::vector<float> const& vis,
- typename boxm_apm_traits<APM>::apm_datatype &model,
- float min_app_sigma,
- float shadow_prior,
- float shadow_mean, float shadow_sigma,
- bool verbose = false)
-{
- std::vector<float> obs_weights(vis.size(), 0.0f);
- std::vector<float> sh_density(vis.size(), 0.0f);
- //assume that the initial appearance distribution is uniform on [0 1]
- //thus a reasonable initialization for weights is
- //
- // vis(1-Psh)/( (1-Psh) + Psh psh(obs) )
- //
- //, where Psh is shadow_prior and psh(x) is the shadow density function,
- // sh_density. vis is the visibilty probability
- //
- boxm_simple_grey shadow_dist(shadow_mean, shadow_sigma);
- for(unsigned n = 0; n<obs.size(); ++n)
- {
- //2.0 x density since centered on zero
- sh_density[n] =
- 2.0f*boxm_simple_grey_processor::prob_density(shadow_dist, obs[n]);
- float neu = vis[n]*(1-shadow_prior);
- float weight =
- neu/(neu + sh_density[n]*shadow_prior);
- obs_weights[n]=weight;
- }
- std::vector<float> initial_weights = obs_weights;
- // initial estimate for the illuminated appearance model
- boxm_apm_traits<APM>::apm_processor::compute_appearance(obs,obs_weights,model,min_app_sigma);
- double initial_mean = model.color();
- double initial_sigma = model.sigma();
-#if 1
- // use EM to refine estimate until convergence.
- unsigned int nobs= obs.size();
- if (nobs == 0) {
- // nothing to do.
- return;
- }
- const float epsilon = 1e-4f;
- constexpr unsigned int max_its = 100;
- const float min_weight_change = 1e-5f;
- unsigned int i=0;
- for (; i<max_its; ++i) {
- float max_weight_change = 0.0f;
- // EXPECTATION - determine the weights
- for (unsigned int n=0; n<nobs; ++n) {
-
- float PI = vis[n] * boxm_apm_traits<APM>::apm_processor::prob_density(model,obs[n]);
- float neu = PI*(1-shadow_prior);
- float den = (PI + pre[n])*(1-shadow_prior) + shadow_prior*sh_density[n];
- float new_obs_weight = 0;
- if (den > epsilon) {
- new_obs_weight = neu / den;
- }
- // compute delta weight for convergence check
- float weight_delta = std::fabs(obs_weights[n] - new_obs_weight);
- if (weight_delta > max_weight_change) {
- max_weight_change = weight_delta;
- }
- obs_weights[n] = new_obs_weight;
- }
- // check for convergence
- if (max_weight_change < min_weight_change)
- break;
- // MAXIMIZATION - determine the parameters of the appearance distribution
- boxm_apm_traits<APM>::apm_processor::update_appearance(obs,obs_weights,model,min_app_sigma);
- }
- if(verbose) {
- bool print = false;
- for(unsigned n = 0; n<obs.size(); ++n)
- if(obs[n]>0) print = true;
- if(i<max_its&&print){
- std::cout << "converged after " << i << " iterations.\n";
- std::cout << " initial mean = " << initial_mean << " final mean = "
- << model.color() << '\n';
- std::cout << " initial sigma = " << initial_sigma << " final sigma = "
- << model.sigma() << '\n';
- }else{ std::cout << "failed to converge\n";}
-
- std::cout << "Initial (Observations, Weights):\n";
- for(unsigned n=0; n<obs.size(); ++n)
- std::cout << '('<< obs[n] << ' ' << initial_weights[n] << ") ";
- std::cout << '\n';
- std::cout << "Final (Observations, Weights):\n";
- for(unsigned n=0; n<obs.size(); ++n)
- std::cout << '('<< obs[n] << ' ' << obs_weights[n] << ") ";
- std::cout << '\n';
- }
-
- // adjust model to account for small sample sizes.
- boxm_apm_traits<APM>::apm_processor::finalize_appearance(obs,obs_weights,model);
-#endif
- return;
-}
-
-#endif // boxm_shadow_appearance_estimator_h_
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_bayes_optimizer.h b/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_bayes_optimizer.h
deleted file mode 100644
index beaa3b2c7d..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_bayes_optimizer.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef boxm_shadow_bayes_optimizer_h_
-#define boxm_shadow_bayes_optimizer_h_
-
-#include <vector>
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vgl/vgl_point_3d.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_scene.h>
-
-#include <boxm/sample/boxm_rt_sample.h>
-
-template<class T_loc, boxm_apm_type APM, boxm_aux_type AUX>
-class boxm_shadow_bayes_optimizer
-{
-public:
-
- boxm_shadow_bayes_optimizer(boxm_scene<boct_tree<T_loc, boxm_sample<APM> > > &scene,
- std::vector<std::string> image_ids,
- float min_app_sigma,
- float shadow_prior,
- float shadow_mean, float shadow_sigma,
- bool verbose=false,
- vgl_point_3d<double> debug_pt =
- vgl_point_3d<double>(0,0,0)
- );
-
- ~boxm_shadow_bayes_optimizer()= default;
-
- bool optimize_cells(double damping_factor);
-
-protected:
-
- std::vector<std::string> image_ids_;
-
- boxm_scene<boct_tree<T_loc, boxm_sample<APM> > > &scene_;
-
- const float max_cell_P_;
- const float min_cell_P_;
- float min_app_sigma_;
- float shadow_prior_;
- float shadow_mean_;
- float shadow_sigma_;
- bool verbose_;
- vgl_point_3d<double> debug_pt_;
-};
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_bayes_optimizer.hxx b/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_bayes_optimizer.hxx
deleted file mode 100644
index a2d24ee683..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_shadow_bayes_optimizer.hxx
+++ /dev/null
@@ -1,195 +0,0 @@
-#ifndef boxm_shadow_bayes_optimizer_hxx_
-#define boxm_shadow_bayes_optimizer_hxx_
-
-#include <utility>
-#include <vector>
-#include <iostream>
-#include <string>
-#include "boxm_shadow_bayes_optimizer.h"
-#include "boxm_shadow_appearance_estimator.h"
-
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_aux_scene.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <class T_loc, boxm_apm_type APM, boxm_aux_type AUX>
-boxm_shadow_bayes_optimizer<T_loc,APM,AUX>::boxm_shadow_bayes_optimizer(boxm_scene<boct_tree<T_loc, boxm_sample<APM> > > &scene,
- std::vector<std::string> image_ids, float min_app_sigma,
- float shadow_prior, float shadow_mean, float shadow_sigma,
- bool verbose, vgl_point_3d<double> debug_pt)
- : image_ids_(std::move(image_ids)), scene_(scene), max_cell_P_(0.995f), min_cell_P_(0.0001f),
- min_app_sigma_(min_app_sigma), shadow_prior_(shadow_prior),
- shadow_mean_(shadow_mean), shadow_sigma_(shadow_sigma),
- verbose_(verbose), debug_pt_(debug_pt)
-{}
-
-
-template <class T_loc, boxm_apm_type APM, boxm_aux_type AUX>
-bool boxm_shadow_bayes_optimizer<T_loc,APM,AUX>::optimize_cells(double damping_factor)
-{
- // get auxiliary scenes associated with each input image
- typedef typename boxm_aux_traits<AUX>::sample_datatype aux_type;
-
- typedef boct_tree<T_loc, boxm_sample<APM> > tree_type;
-
- std::vector<boxm_aux_scene<T_loc, boxm_sample<APM>, aux_type> > aux_scenes;
- for (unsigned int i=0; i<image_ids_.size(); ++i) {
- boxm_aux_scene<T_loc, boxm_sample<APM>, aux_type> aux_scene(&scene_,image_ids_[i],boxm_aux_scene<T_loc, boxm_sample<APM>, aux_type>::LOAD);
- aux_scenes.push_back(aux_scene);
- }
-
- std::vector<boxm_rt_sample<typename boxm_apm_traits<APM>::obs_datatype> > aux_samples;
-
- // for each block
- boxm_block_iterator<tree_type> iter(&scene_);
- iter.begin();
- while (!iter.end())
- {
- scene_.load_block(iter.index());
- boxm_block<tree_type>* block = *iter;
- boct_tree<T_loc, boxm_sample<APM> >* tree = block->get_tree();
- boct_tree_cell<T_loc,boxm_sample<APM> >* debug_cell = nullptr;
- if (verbose_)
- debug_cell = tree->locate_point_global(debug_pt_);
- std::vector<boct_tree_cell<T_loc,boxm_sample<APM> >*> cells = tree->leaf_cells();
-
- // get a vector of incremental readers for each aux scene.
- std::vector<boct_tree_cell_reader<T_loc, aux_type>* > aux_readers(aux_scenes.size());
- for (unsigned int i=0; i<aux_scenes.size(); ++i) {
- aux_readers[i] = aux_scenes[i].get_block_incremental(iter.index());
- }
- // iterate over cells
- for (unsigned i=0; i<cells.size(); ++i)
- {
- aux_samples.clear();
- boct_tree_cell<T_loc,boxm_sample<APM> >* cell = cells[i];
- boxm_sample<APM> data = cell->data();
- for (unsigned j=0; j<aux_readers.size(); j++) {
- boct_tree_cell<T_loc, aux_type> temp_cell;
-
- if (!aux_readers[j]->next(temp_cell)) {
- std::cerr << "error: incremental reader returned false.\n";
- return false;
- }
- if (!temp_cell.code_.isequal(&(cell->code_))) {
- std::cerr << "error: temp_cell idx does not match cell idx.\n";
- return false;
- }
- if (temp_cell.data().seg_len_ > 0.0f) {
- aux_samples.push_back(temp_cell.data());
- }
- }
- unsigned n_samp = aux_samples.size();
- std::vector<float> pre_vector(n_samp);
- std::vector<float> vis_vector(n_samp);
- // new discrete probability code
- float log_sum = 0.0f;
- float total_length_sum = 0.0f;
- //===
- typedef typename boxm_apm_traits<APM>::obs_datatype obs_type;
- std::vector<obs_type> obs_vector(n_samp);
-//#if 0 // old beta calculation
- double Beta = 1.0;
-//#endif
- if (verbose_&&cell == debug_cell){
- std::cout << "Contents of Debug Cell\n"
- << "s vis[s] pre[s] beta[s]\n";
- }
- double vis_sum = 0;
- for (unsigned int s=0; s<n_samp; ++s) {
- float seg_len_sum = aux_samples[s].seg_len_;
- obs_type obs = aux_samples[s].obs_;
- if (seg_len_sum > 1e-5) {
- obs_vector[s] = obs / seg_len_sum;
- float pre = aux_samples[s].pre_ / seg_len_sum;
- float vis = aux_samples[s].vis_ / seg_len_sum;
- pre_vector[s] = pre;
- vis_vector[s] = vis;
-
-//#if 0 // old beta calculation
- double beta_s = (aux_samples[s].Beta_ / seg_len_sum);
- Beta *= beta_s;
-//#else // New discrete prob code
- log_sum += aux_samples[s].log_sum_;
- total_length_sum += seg_len_sum;
-//#endif
- // ====
- if (cell == debug_cell)
- {
- std::cout << s << ' ' << vis << ' ' << pre << ' '
- << beta_s << '\n';
- }
- }
- else {
- pre_vector[s] = 0.0f;
- vis_vector[s] = 0.0f;
- obs_vector[s] = typename boxm_apm_traits<APM>::obs_datatype(0);
- }
- }
- vis_sum /= n_samp;
-
-#if 0 // old beta calculation
- double damped_Beta = 1.0;
- if (n_samp>1.0){
- damped_Beta = std::pow(Beta, 1.0/n_samp);
- }
-#else
- double damped_Beta = (Beta + damping_factor)/(damping_factor*Beta + 1.0);
-
- if ((damped_Beta < 0.00000001) && (damped_Beta > -0.00000001))
- std::cout << "ERROR: damped_Beta is:" << damped_Beta << std::endl;
-
- data.alpha *= static_cast<float>(damped_Beta);
-
- float alpha_post = data.alpha;
- if (total_length_sum > 0.0f) alpha_post = log_sum/total_length_sum;
- data.alpha = alpha_post;
-#endif
- // do bounds check on new alpha value
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(cell);
- const float cell_len = float(cell_bb.width());
- const float max_alpha = -std::log(1.0f - max_cell_P_)/cell_len;
- const float min_alpha = -std::log(1.0f - min_cell_P_)/cell_len;
- if (data.alpha > max_alpha) {
- data.alpha = max_alpha;
- }
- if (data.alpha < min_alpha) {
- data.alpha = min_alpha;
- }
- if (!((data.alpha >= min_alpha) && (data.alpha <= max_alpha)) ){
- std::cerr << "\nerror: data.alpha = " << data.alpha << std::endl;
- }
- // update with new appearance
- bool print_p = false;
- if (verbose_&&cell == debug_cell){
- std::cout << "Cell Level = " << cell->level()
- << " AlphaPosterior = " << data.alpha << '\n';
- print_p = true;
- }
- boxm_compute_shadow_appearance<APM>(obs_vector, pre_vector, vis_vector, data.appearance_, min_app_sigma_, shadow_prior_, shadow_mean_, shadow_sigma_, print_p);
- cell->set_data(data);
- }
- scene_.write_active_block();
- for (unsigned int i=0; i<aux_readers.size(); ++i) {
- aux_readers[i]->close();
- }
- ++iter;
- }
-
- // clear the aux scenes so that its starts with the refined scene next time
- for (unsigned i=0; i<aux_scenes.size(); i++) {
- aux_scenes[i].clean_scene();
- }
-
- return true;
-}
-
-
-#define BOXM_SHADOW_BAYES_OPTIMIZER_INSTANTIATE(T1,T2,T3) \
-template class boxm_shadow_bayes_optimizer<T1,T2,T3 >
-
-#endif // boxm_shadow_bayes_optimizer_hxx_
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_sun_vis_prob_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_sun_vis_prob_functor.h
deleted file mode 100644
index 798aac81a9..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_sun_vis_prob_functor.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef boxm_sun_vis_prob_functor_h
-#define boxm_sun_vis_prob_functor_h
-//:
-//\file
-#include <iostream>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/sample/boxm_opt2_sample.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/basic/boxm_seg_length_functor.h>
-#include "boxm_pre_infinity_functor.h"
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <bpgl/algo/bpgl_camera_from_box.h>
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_box_3d.h>
-#include <vgl/vgl_vector_3d.h>
-#include <vil/vil_image_view.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-
-template <boxm_apm_type APM, class T_aux>
-class boxm_sun_vis_prob_functor
-{
- public:
- //: "default" constructor
- boxm_sun_vis_prob_functor(unsigned sun_ni, unsigned sun_nj)
- : sun_ni_(sun_ni), sun_nj_(sun_nj)
- {
- alpha_integral_ = vil_image_view<float>(sun_ni_, sun_nj_);
- alpha_integral_.fill(0.0f);
-
- //only reads info from the scene
- scene_read_only_=true;
- //needs to write aux
- is_aux_=true;
- }
-
- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d<double> s0, vgl_point_3d<double> s1, boxm_sample<APM> &cell_value, T_aux & aux_val)
- {
- // compute segment length
- const float seg_len = (float)(s1 - s0).length();
-
- // accumulate segment length
- aux_val.seg_len_ += seg_len;
-
- // current sun visibility
- const float sun_vis = std::exp(-alpha_integral_(i,j));
-
- // update sun vis
- aux_val.vis_ += sun_vis * seg_len;
-
- // update alpha integral along sun ray i, j
- alpha_integral_(i,j) += cell_value.alpha * seg_len;
-
- return true;
- }
-
- public:
- bool scene_read_only_;
- bool is_aux_;
-
- private:
- unsigned sun_ni_;
- unsigned sun_nj_;
- vil_image_view<float> alpha_integral_;
-};
-
-template <class T_loc, class T_data, boxm_aux_type AUX_T>
-void boxm_sun_vis_prob(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vgl_vector_3d<double> sun_angle,
- std::string sun_occ_name)
-{
- // scene bounding box
- vgl_box_3d<double> world_bb = scene.get_world_bbox();
- unsigned max_level = scene.max_level();
- unsigned sun_ni = 1<<max_level;//twice as many
- unsigned sun_nj = sun_ni;
- vpgl_affine_camera<double> sun_cam =
- bpgl_camera_from_box::affine_camera_from_box(world_bb, -sun_angle, sun_ni, sun_nj);
-
- vpgl_camera_double_sptr cam = new vpgl_affine_camera<double> (sun_cam);
-
- typedef typename boxm_aux_traits<AUX_T>::sample_datatype sample_datatype;
- boxm_aux_scene<T_loc, T_data, sample_datatype> aux_scene(&scene,sun_occ_name, boxm_aux_scene<T_loc, T_data, sample_datatype>::CLONE);
-
- std::cout<<"Sun visibility"<<std::endl;
- // functor to accumulate sun visibility
- typedef boxm_sun_vis_prob_functor<T_data::apm_type, sample_datatype> sun_vis;
-
- // set up the raytrace function
- boxm_raytrace_function<sun_vis,T_loc, T_data, sample_datatype> raytracer_vis(scene,aux_scene,cam.ptr(),sun_ni,sun_nj);
-
- // construct the sun visibility functor need only sun ray space dimensions
- sun_vis sun_vis_functor(sun_ni, sun_nj);
-
- // run the functor over the octree
- raytracer_vis.run(sun_vis_functor);
- std::cout<<"Sun Occlusion Done."<<std::endl;
-}
-
-#endif // boxm_sun_vis_prob_functor_h
diff --git a/contrib/brl/bseg/boxm/algo/rt/boxm_update_image_functor.h b/contrib/brl/bseg/boxm/algo/rt/boxm_update_image_functor.h
deleted file mode 100644
index cc1567a545..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/boxm_update_image_functor.h
+++ /dev/null
@@ -1,172 +0,0 @@
-#ifndef boxm_update_image_functor_h
-#define boxm_update_image_functor_h
-//:
-// \file
-#include <iostream>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <boxm/basic/boxm_seg_length_functor.h>
-#include <boxm/algo/rt/boxm_pre_infinity_functor.h>
-#include <vil/vil_math.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <boxm_apm_type APM, class T_aux>
-class boxm_update_image_functor_pass_2
-{
- public:
- //: "default" constructor
- boxm_update_image_functor_pass_2(vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> const& image,
- vil_image_view<float> const& normalizing_img)
- : obs_(image), norm_(normalizing_img), vis_img_(image.ni(),image.nj(),1), pre_img_(image.ni(),image.nj(),1), alpha_integral_(image.ni(),image.nj(),1)
- {
- alpha_integral_.fill(0.0f);
- pre_img_.fill(0.0f);
- vis_img_.fill(1.0f);
- //only reads info from the scene
- scene_read_only_=true;
- //needs to write aux
- is_aux_=true;
- }
-
- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d<double> s0, vgl_point_3d<double> s1, boxm_sample<APM> &cell_value, T_aux & aux_val)
- {
- // compute segment length
- const float seg_len = (float)(s1 - s0).length();
- // compute appearance probability of observation
- float mean_obs= aux_val.obs_/aux_val.seg_len_;
- const float PI = boxm_apm_traits<APM>::apm_processor::prob_density(cell_value.appearance(), mean_obs);
- // update alpha integral
- alpha_integral_(i,j) += cell_value.alpha * seg_len;
-
- // compute new visibility probability with updated alpha_integral
- const float vis_prob_end = std::exp(-alpha_integral_(i,j));
- // compute weight for this cell
- const float Omega = vis_img_(i,j) - vis_prob_end;
- // update vis and pre
- pre_img_(i,j) += PI * Omega;
- vis_img_(i,j) = vis_prob_end;
- aux_val.vis_+=seg_len*vis_img_(i,j);
-
- if(norm_(i,j)>1e-10f)
- aux_val.updatefactor_+=(((pre_img_(i,j)+vis_img_(i,j)*PI)/norm_(i,j))* seg_len);
-
- return true;
- }
-
- public:
- bool scene_read_only_;
- bool is_aux_;
-
- private:
- vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> const& obs_;
- vil_image_view<float> const& norm_;
- //vil_image_view<float> const& pre_inf_;
- vil_image_view<float> vis_img_;
- vil_image_view<float> pre_img_;
- vil_image_view<float> alpha_integral_;
-};
-
-template <boxm_apm_type APM, class T_aux>
-class boxm_update_image_functor_pass_3
-{
- public:
- //: default constructor
- boxm_update_image_functor_pass_3()
- {
- //only reads info from the scene
- scene_read_only_=false;
- //needs to write aux
- is_aux_=true;
- }
-
- inline bool step_cell(boxm_sample<APM> &cell_value, T_aux & aux_val)
- {
- if (aux_val.seg_len_>1e-10)
- {
- boxm_apm_traits<APM>::apm_processor::update(cell_value.appearance(),
- aux_val.obs_/aux_val.seg_len_,
- aux_val.vis_/aux_val.seg_len_);
- cell_value.alpha*=(aux_val.updatefactor_/aux_val.seg_len_);
- aux_val.seg_len_=0;
- aux_val.obs_=0;
- aux_val.vis_=0;
- aux_val.updatefactor_=0.0;
- }
- return true;
- }
-
- public:
- bool scene_read_only_;
- bool is_aux_;
-};
-
-template <class T_loc, class T_data>
-void boxm_update_image_rt(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<typename T_data::obs_datatype> &obs,
- bool black_background = false)
-{
- typedef boxm_aux_traits<BOXM_AUX_OPT_RT_GREY>::sample_datatype sample_datatype;
- boxm_aux_scene<T_loc, T_data, sample_datatype > aux_scene(&scene,boxm_aux_traits<BOXM_AUX_OPT_RT_GREY>::storage_subdir(), boxm_aux_scene<T_loc, T_data, sample_datatype>::CLONE);
- typedef boxm_seg_length_functor<T_data::apm_type, sample_datatype> pass_0;
- boxm_raytrace_function<pass_0, T_loc, T_data, sample_datatype> raytracer_0(scene, aux_scene, cam.ptr(),obs.ni(),obs.nj());
- std::cerr << "PASS 0\n";
- pass_0 pass_0_functor(obs,obs.ni(),obs.nj());
- raytracer_0.run(pass_0_functor);
-
- vil_image_view<float> pre_inf(obs.ni(),obs.nj(),1);
- vil_image_view<float> vis_inf(obs.ni(),obs.nj(),1);
-
- typedef boxm_pre_infinity_functor<T_data::apm_type,sample_datatype> pass_1;
- boxm_raytrace_function<pass_1,T_loc, T_data,sample_datatype> raytracer_1(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
- std::cerr << "PASS 1\n";
- pass_1 pass_1_functor(obs,pre_inf,vis_inf);
- raytracer_1.run(pass_1_functor);
-
- vil_image_view<float> PI_inf(obs.ni(), obs.nj(),1);
-
- typename T_data::apm_datatype background_apm;
-
- if (black_background) {
- std::cerr << "using black background model\n";
- for (unsigned int i=0; i<4; ++i) {
- T_data::apm_processor::update(background_apm, 0.0f, 1.0f);
- float peak=T_data::apm_processor::prob_density(background_apm,0.0f);
- std::cout<<"Peak: "<<peak<<std::endl;
- }
- typename vil_image_view<typename T_data::obs_datatype>::const_iterator img_it = obs.begin();
- typename vil_image_view<float>::iterator PI_it = PI_inf.begin();
- for (; img_it != obs.end(); ++img_it, ++PI_it) {
- *PI_it = T_data::apm_processor::prob_density(background_apm,*img_it);
- }
- }
- else {
- PI_inf.fill(0.5f);
- }
-
- vil_image_view<float> inf_term(obs.ni(), obs.nj());
- vil_math_image_product<float,float,float>(vis_inf,PI_inf,inf_term);
- vil_image_view<float> norm_img(obs.ni(), obs.nj());
- vil_math_image_sum<float,float,float>(pre_inf,inf_term,norm_img);
- std::cerr << "PASS 2\n";
- typedef boxm_update_image_functor_pass_2<T_data::apm_type,boxm_aux_traits<BOXM_AUX_OPT_RT_GREY>::sample_datatype> pass_2;
- boxm_raytrace_function<pass_2,T_loc, T_data,boxm_aux_traits<BOXM_AUX_OPT_RT_GREY>::sample_datatype> raytracer_2(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
- pass_2 pass_2_functor(obs,norm_img);
- raytracer_2.run(pass_2_functor);
- std::cerr << "PASS 3\n";
- typedef boxm_update_image_functor_pass_3<T_data::apm_type,boxm_aux_traits<BOXM_AUX_OPT_RT_GREY>::sample_datatype> pass_3;
- boxm_iterate_cells_function<pass_3,T_loc, T_data,boxm_aux_traits<BOXM_AUX_OPT_RT_GREY>::sample_datatype> cell_tracer_3(scene,aux_scene,cam.ptr(),obs.ni(),obs.nj());
-
- pass_3 pass_3_functor;
- cell_tracer_3.run(pass_3_functor);
-
- aux_scene.clean_scene();
- std::cerr << "DONE.\n";
-}
-
-#endif // boxm_update_image_functor_h
diff --git a/contrib/brl/bseg/boxm/algo/rt/dummy.cxx b/contrib/brl/bseg/boxm/algo/rt/dummy.cxx
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/rt/pro/CMakeLists.txt
deleted file mode 100644
index 112a19f789..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# boxm's Process Library
-
-# bprb depends on expat and boxm_pro depends on bprb primarily
-FIND_PACKAGE(EXPAT REQUIRED)
-FIND_PACKAGE(EXPATPP REQUIRED)
-if(EXPAT_FOUND)
- include_directories( ${BRL_INCLUDE_DIR}/bpro )
- include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb )
- include_directories( ${BRL_INCLUDE_DIR}/bseg )
- # include_directories( ${GEL_INCLUDE_DIR}/mrc/vpgl )
- # include_directories( ${GEL_INCLUDE_DIR}/mrc )
-
- set(boxm_algo_rt_pro_sources
- boxm_algo_rt_processes.h
- boxm_algo_rt_register.h boxm_algo_rt_register.cxx
- )
-
- #aux_source_directory(Templates boxm_algo_rt_pro_sources)
- aux_source_directory(processes boxm_algo_rt_pro_sources)
-
- vxl_add_library(LIBRARY_NAME boxm_algo_rt_pro LIBRARY_SOURCES ${boxm_algo_rt_pro_sources} )
-
- target_link_libraries(boxm_algo_rt_pro boxm_algo_rt boxm_algo_pro boxm boxm_sample boxm_sample_algo boct bprb brdb brip sdet ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vnl_algo ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vcl)
-
- if( BUILD_TESTING )
- add_subdirectory(tests)
- endif()
-
-endif()
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_processes.h b/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_processes.h
deleted file mode 100644
index 1ec223e9d5..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_processes.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef boxm_algo_rt_processes_h_
-#define boxm_algo_rt_processes_h_
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_macros.h>
-
-//the init functions
-DECLARE_FUNC_CONS(boxm_opt_bayesian_update_process);
-DECLARE_FUNC_CONS(boxm_update_rt_process);
-DECLARE_FUNC_CONS(boxm_render_expected_rt_process);
-DECLARE_FUNC_CONS(boxm_render_expected_depth_rt_process);
-DECLARE_FUNC_CONS(boxm_generate_opt_samples_process);
-DECLARE_FUNC_CONS(boxm_generate_edge_samples_process);
-DECLARE_FUNC_CONS(boxm_edge_update_process);
-DECLARE_FUNC_CONS(boxm_render_expected_edge_process);
-DECLARE_FUNC_CONS(boxm_rpc_registration_process);
-DECLARE_FUNC_CONS(boxm_line_backproject_process);
-DECLARE_FUNC_CONS(boxm_generate_opt2_samples_process);
-DECLARE_FUNC_CONS(boxm_opt2_update_process);
-DECLARE_FUNC_CONS(boxm_generate_opt3_samples_process);
-DECLARE_FUNC_CONS(boxm_opt3_update_process);
-DECLARE_FUNC_CONS(boxm_render_expected_edge_vrml_process);
-DECLARE_FUNC_CONS(boxm_ray_statistics_process);
-DECLARE_FUNC_CONS(boxm_change_probability_process);
-DECLARE_FUNC_CONS(boxm_estimate_camera_process);
-DECLARE_FUNC_CONS(boxm_edge_refine_updates_process);
-
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_register.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_register.cxx
deleted file mode 100644
index d0ebc7375e..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_register.cxx
+++ /dev/null
@@ -1,33 +0,0 @@
-#include "boxm_algo_rt_register.h"
-
-#include <bprb/bprb_macros.h>
-#include <bprb/bprb_batch_process_manager.h>
-#include <bprb/bprb_func_process.h>
-
-#include "boxm_algo_rt_processes.h"
-
-void boxm_algo_rt_register::register_datatype()
-{
-}
-
-void boxm_algo_rt_register::register_process()
-{
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_opt_bayesian_update_process,"boxmOptBayesianUpdateProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_update_rt_process,"boxmUpdateRTProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_render_expected_rt_process, "boxmRenderExpectedRTProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_render_expected_depth_rt_process, "boxmRenderExpectedDepthRTProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_generate_opt_samples_process, "boxmGenerateOptSamplesProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_generate_edge_samples_process, "boxmGenerateEdgeSamplesProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_edge_update_process, "boxmEdgeUpdateProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_render_expected_edge_process, "boxmRenderExpectedEdgeProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_rpc_registration_process, "boxmRPCRegistrationProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_line_backproject_process, "boxmLineBackprojectProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_opt2_update_process,"boxmOpt2UpdateProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_opt3_update_process,"boxmOpt3UpdateProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_generate_opt2_samples_process,"boxmGenerateOpt2SamplesProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_generate_opt3_samples_process,"boxmGenerateOpt3SamplesProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_ray_statistics_process,"boxmRayStatisticsProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_change_probability_process,"boxmChangeProbabilityProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_estimate_camera_process,"boxmEstimateCameraProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_edge_refine_updates_process, "boxmEdgeRefineUpdatesProcess");
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_register.h b/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_register.h
deleted file mode 100644
index c060c1220f..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/boxm_algo_rt_register.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef boxm_algo_rt_register_h_
-#define boxm_algo_rt_register_h_
-
-class boxm_algo_rt_register
-{
- public:
- static void register_datatype();
- static void register_process();
-};
-
-#endif // boxm_algo_rt_register_h_
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_change_probabilty_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_change_probabilty_process.cxx
deleted file mode 100644
index d7d9002e0c..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_change_probabilty_process.cxx
+++ /dev/null
@@ -1,120 +0,0 @@
-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_change_probabilty_process.cxx
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A class for obtaining expected depth map for the world
-//
-// \author Vishal Jain
-// \date Aug 26, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/rt/boxm_change_probability_functor.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <vil/vil_image_view.h>
-#include <vil/vil_convert.h>
-
-namespace boxm_change_probability_process_globals
-{
- constexpr unsigned n_inputs_ = 3;
- constexpr unsigned n_outputs_ = 2;
-}
-
-bool boxm_change_probability_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_change_probability_process_globals;
-
- //process takes 4 inputs
- //input[0]: scene binary file
- //input[1]: camera
- //input[2]: ni of the expected image
- //input[3]: nj of the expected image
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vil_image_view_base_sptr";
- input_types_[2] = "vpgl_camera_double_sptr";
- //input_types_[3] = "unsigned";
- //input_types_[4] = "unsigned";
-
- // process has 2 outputs:
- // output[0]: rendered image
- // output[0]: mask
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "vil_image_view_base_sptr";
- output_types_[1] = "vil_image_view_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_change_probability_process(bprb_func_process& pro)
-{
- using namespace boxm_change_probability_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get the inputs
- unsigned i = 0;
- boxm_scene_base_sptr scene_ptr = pro.get_input<boxm_scene_base_sptr>(i++);
- vil_image_view_base_sptr input_img_ptr=pro.get_input<vil_image_view_base_sptr>(i++);
- vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(i++);
-
- unsigned ni=input_img_ptr->ni();
- unsigned nj=input_img_ptr->nj();
- vil_image_view_base_sptr img;
- vil_image_view_base_sptr img_mask;
-
-
- // check the scene's app model
- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) {
- vil_image_view<float> mask(ni,nj,1);
- vil_image_view<float> expected(ni,nj,1);
-
- auto *img_byte
- = dynamic_cast<vil_image_view<vxl_byte>*>(input_img_ptr.ptr());
- vil_image_view<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> img_in(img_byte->ni(), img_byte->nj(), 1);
- vil_convert_stretch_range_limited(*img_byte ,img_in, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f);
-
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > type;
- auto* scene = dynamic_cast<boxm_scene<type>*> (scene_ptr.as_pointer());
- boxm_change_prob_rt<short, boxm_sample<BOXM_APM_MOG_GREY> >(*scene,img_in, camera, expected, mask);
- img_mask = new vil_image_view<float>(mask);
- img = new vil_image_view<float>(expected);
- }
- else if (scene_ptr->appearence_model() == BOXM_APM_SIMPLE_GREY) {
- vil_image_view<float> mask(ni,nj,1);
- vil_image_view<float> expected(ni,nj,1);
- auto *img_byte
- = dynamic_cast<vil_image_view<vxl_byte>*>(input_img_ptr.ptr());
- vil_image_view<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> img_in(img_byte->ni(), img_byte->nj(), 1);
- vil_convert_stretch_range_limited(*img_byte ,img_in, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f);
-
- typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > type;
- auto* scene = dynamic_cast<boxm_scene<type>*> (scene_ptr.as_pointer());
- boxm_change_prob_rt<short, boxm_sample<BOXM_APM_SIMPLE_GREY> >(*scene,img_in, camera, expected, mask);
- img_mask = new vil_image_view<float>(mask);
- img = new vil_image_view<float>(expected);
- }
- else {
- std::cout << "boxm_render_expected_process: undefined APM type" << std::endl;
- return false;
- }
-
- unsigned j = 0;
- pro.set_output_val<vil_image_view_base_sptr>(j++, img);
- pro.set_output_val<vil_image_view_base_sptr>(j++, img_mask);
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_edge_update_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_edge_update_process.cxx
deleted file mode 100644
index 1593ab6590..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_edge_update_process.cxx
+++ /dev/null
@@ -1,280 +0,0 @@
-//This is brl/bseg/boxm/algo/rt/pro/processes/boxm_edge_update_process.cxx
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A process for updating a boxm_scene with a set of edge images
-// \author Gamze Tunali
-// \date Jan, 2010
-//
-// \verbatim
-// Modifications
-//
-// \endverbatim
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <brdb/brdb_value.h>
-#include <bprb/bprb_parameters.h>
-
-#include <boct/boct_tree.h>
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-
-#include <boxm/sample/boxm_edge_sample.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-#include <boxm/algo/rt/boxm_edge_tangent_updater.h>
-#include <boxm/algo/rt/boxm_edge_updater.h>
-
-#include <vil/vil_load.h>
-#include <vpgl/vpgl_camera.h>
-#include <vpgl/vpgl_rational_camera.h>
-#include <vpgl/vpgl_local_rational_camera.h>
-
-namespace boxm_edge_update_process_globals
-{
- constexpr unsigned int n_inputs_ = 6;
- constexpr unsigned int n_outputs_ = 0;
- //Define parameters here
-}
-
-
-//: set input and output types
-bool boxm_edge_update_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_edge_update_process_globals;
-
- // process takes 6 inputs:
- //input[0]: The scene
- //input[1]: Image list filename
- //input[2]: Use ransac?
- //input[3]: consensus cnt, param of ransac algo, value depends on number of training images
- // unless planes from this number of images agree at a voxel on a hypothesis, a 3D edge won't be formed,
- // there should be at least this number of training images during the update for any kind of consensus to be met at any voxel
- // (if consensus cnt < training img cnt --> edge world will be empty)
- //input[4]: orthogonality threshold, a good value 0.01, param of ransac algo, would see more 3D edges as this value gets bigger, but they would be less and less good
- //input[5]: volume ratio denominator: a good value 128 , param of ransac algo, would see more 3D edges as this value gets bigger, but they would be less and less good
- // algo checks whether a current plane is within cell_volume/denominator radius of current hypothesis
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vcl_string";
- input_types_[2] = "bool";
- input_types_[3] = "int";
- input_types_[4] = "float";
- input_types_[5] = "float";
- // process has 0 outputs:
- std::vector<std::string> output_types_(n_outputs_);
-
- if (!pro.set_input_types(input_types_))
- return false;
-
- if (!pro.set_output_types(output_types_))
- return false;
-
- return true;
-}
-
-//: Execute the process
-bool boxm_edge_update_process(bprb_func_process& pro)
-{
- using namespace boxm_edge_update_process_globals;
-
- // check number of inputs
- if (pro.n_inputs() != n_inputs_)
- {
- std::cout << pro.name() << "The number of inputs should be " << n_inputs_ << std::endl;
- return false;
- }
-
- // get the parameters
- // (none)
-
- // get the inputs
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(0);
- std::string image_list_fname = pro.get_input<std::string>(1);
- bool use_ransac=pro.get_input<bool>(2);
- int consensus_cnt = pro.get_input<int>(3);
- auto ortho_thres = pro.get_input<float>(4);
- auto vol_ratio = pro.get_input<float>(5);
-
- // extract list of image_ids from file
- std::ifstream ifs(image_list_fname.c_str());
- if (!ifs.good()) {
- std::cerr << "error opening file " << image_list_fname << '\n';
- return false;
- }
- std::vector<std::string> image_ids;
- unsigned int n_images = 0;
- ifs >> n_images;
- std::cout << "using image ids: ";
- for (unsigned int i=0; i<n_images; ++i) {
- std::string img_id;
- ifs >> img_id;
- std::cout << img_id << std::endl;
- image_ids.push_back(img_id);
- std::cout << img_id << ' ';
- }
- ifs.close();
- std::cout << std::endl;
-
- if (scene_base->appearence_model() == BOXM_EDGE_FLOAT) {
- std::cout << "appearance model EDGE_FLOAT\n";
- typedef boct_tree<short,boxm_edge_sample<float> > tree_type;
- auto *scene = dynamic_cast<boxm_scene<tree_type>*>(scene_base.ptr());
- if (!scene) {
- std::cerr << "error casting scene_base to scene\n";
- return false;
- }
- boxm_edge_updater<short,float,float> updater(*scene, image_ids);
- updater.add_cells();
- }
- if (scene_base->appearence_model() == BOXM_EDGE_LINE) {
- std::cout << "appearance model EDGE_LINE\n";
- typedef boct_tree<short,boxm_inf_line_sample<float> > tree_type;
- auto *scene = dynamic_cast<boxm_scene<tree_type>*>(scene_base.ptr());
- if (!scene) {
- std::cerr << "error casting scene_base to scene\n";
- return false;
- }
-
- boxm_edge_tangent_updater<short,float,float> updater(*scene, image_ids, use_ransac, ortho_thres, vol_ratio, consensus_cnt);
- updater.add_cells();
- }
- //store output
- // (none)
-
- return true;
-}
-
-//: set input and output types
-bool boxm_edge_refine_updates_process_cons(bprb_func_process& pro)
-{
- // process takes 3 inputs:
- //input[0]: The scene
- //input[1]: Image list filename
- //input[2]: camera list filename
- //input[3]: consensus cnt,
- std::vector<std::string> input_types_(4);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vcl_string";
- input_types_[2] = "vcl_string";
- input_types_[3] = "int";
- // process has 0 outputs:
- std::vector<std::string> output_types_(0);
-
- if (!pro.set_input_types(input_types_))
- return false;
-
- if (!pro.set_output_types(output_types_))
- return false;
-
- return true;
-}
-
-//: Execute the process
-bool boxm_edge_refine_updates_process(bprb_func_process& pro)
-{
- using namespace boxm_edge_update_process_globals;
-
- // check number of inputs
- if (pro.n_inputs() != 4)
- {
- std::cout << pro.name() << "The number of inputs should be " << 4 << std::endl;
- return false;
- }
-
- // get the parameters
- // (none)
-
- // get the inputs
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(0);
- std::string image_list_fname = pro.get_input<std::string>(1);
- std::string cam_list_fname = pro.get_input<std::string>(2);
- int consensus_cnt = pro.get_input<int>(3);
-
- // extract list of image_ids from file
- std::ifstream ifs(image_list_fname.c_str());
- if (!ifs.good()) {
- std::cerr << "error opening file " << image_list_fname << '\n';
- return false;
- }
- std::vector<vil_image_view<float> > images;
- unsigned int n_images = 0;
- ifs >> n_images;
- std::cout << "using image ids: ";
- for (unsigned int i=0; i<n_images; ++i) {
- std::string img_id;
- ifs >> img_id;
- std::cout << "loading: " << img_id << std::endl;
-
- vil_image_view_base_sptr loaded_image = vil_load(img_id.c_str() );
- if ( !loaded_image || loaded_image->pixel_format() != VIL_PIXEL_FORMAT_FLOAT) {
- std::cerr << "Failed to load image file: " << img_id << " or format is not FLOAT img!\n";
- return false;
- }
- vil_image_view<float> img(loaded_image);
- images.push_back(img);
- }
- ifs.close();
-
- // extract list of image_ids from file
- std::ifstream ifsc(cam_list_fname.c_str());
- if (!ifsc.good()) {
- std::cerr << "error opening file " << cam_list_fname << '\n';
- return false;
- }
-
- std::vector<vpgl_camera_double_sptr> cameras;
- unsigned int n_cameras = 0;
- ifsc >> n_cameras;
- if (n_cameras != n_images) {
- std::cerr << "camera file and image file do not contain equal numbers of items!\n";
- return false;
- }
-
- std::cout << "using cameras: ";
- for (unsigned int i=0; i<n_cameras; ++i) {
- std::string img_id;
- ifsc >> img_id;
- std::cout << "loading camera: " << img_id << std::endl;
-
- vpgl_camera_double_sptr ratcam = read_local_rational_camera<double>(img_id);
- if ( !ratcam.as_pointer() ) {
- std::cerr << "Rational camera isn't local... trying global\n";
- ratcam = read_rational_camera<double>(img_id);
- if ( !ratcam.as_pointer() ) {
- std::cout << " camera: " << img_id << " is not local or global rational camera, not supporting any other type for now!\n";
- return false;
- }
- }
-
- cameras.push_back(ratcam);
- }
- ifsc.close();
- std::cout << std::endl;
-
- if (scene_base->appearence_model() == BOXM_EDGE_FLOAT) {
- std::cout << "appearance model EDGE_FLOAT\n";
- std::cerr << "this process is not defined for this type of scene!\n";
- return false;
- }
- if (scene_base->appearence_model() == BOXM_EDGE_LINE) {
- std::cout << "appearance model EDGE_LINE\n";
- typedef boct_tree<short,boxm_inf_line_sample<float> > tree_type;
- auto *scene = dynamic_cast<boxm_scene<tree_type>*>(scene_base.ptr());
- if (!scene) {
- std::cerr << "error casting scene_base to scene\n";
- return false;
- }
-
- boxm_edge_tangent_refine_updates<short,float,float> refiner(*scene, consensus_cnt, images, cameras);
- refiner.refine_cells();
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_estimate_camera_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_estimate_camera_process.cxx
deleted file mode 100644
index d1010864dd..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_estimate_camera_process.cxx
+++ /dev/null
@@ -1,199 +0,0 @@
-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_estimate_camera_process.cxx
-//:
-// \file
-#include <iostream>
-#include <cstdio>
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-#include <brdb/brdb_value.h>
-
-#include <brip/brip_vil_float_ops.h>
-
-#include <vnl/algo/vnl_amoeba.h>
-
-#include <vpgl/vpgl_perspective_camera.h>
-#include <bpgl/bpgl_camera_estimator.h>
-#include <bpgl/bpgl_camera_estimator_amoeba.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <cassert>
-
-#include <boxm/algo/rt/boxm_expected_edge_functor.h>
-
-//: globals
-namespace boxm_estimate_camera_process_globals
-{
- constexpr unsigned n_inputs_ = 3;
- constexpr unsigned n_outputs_ = 3;
-
- // parameter strings
- const std::string theta_range_ = "theta_range";
- const std::string theta_step_ = "theta_step";
- const std::string phi_range_ = "phi_range";
- const std::string phi_step_ = "phi_step";
- const std::string rot_range_ = "rot_range";
- const std::string rot_step_ = "rot_step";
- const std::string max_iter_rot_angle_ = "max_iter_rot_angle";
- const std::string max_iter_cam_center_ = "max_iter_cam_center";
-}
-
-//: set input and output types
-bool boxm_estimate_camera_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_estimate_camera_process_globals;
-
- // process takes 3 inputs:
- //input[0]: The scene
- //input[1]: Initial camera
- //input[2]: Edge image
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "boxm_scene_base_sptr";
- input_types_[i++] = "vpgl_camera_double_sptr";
- input_types_[i++] = "vil_image_view_base_sptr";
- if (!pro.set_input_types(input_types_))
- return false;
-
- // process has 3 outputs:
- // output[0]: The optimized camera
- // output[1]: Expected edge image (after camera correction)
- // output[2]: Expected edge image (before camera correction)
-
- std::vector<std::string> output_types_(n_outputs_);
- unsigned j = 0;
- output_types_[j++] = "vpgl_camera_double_sptr";
- output_types_[j++] = "vil_image_view_base_sptr";
- output_types_[j++] = "vil_image_view_base_sptr";
- return pro.set_output_types(output_types_);
-}
-
-//: optimizes camera parameters based on edges
-bool boxm_estimate_camera_process(bprb_func_process& pro)
-{
- using namespace boxm_estimate_camera_process_globals;
-
- //check number of inputs
- if ( pro.n_inputs() < n_inputs_ ) {
- std::cout << pro.name() << " The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- // get the inputs
- unsigned i = 0;
-
- // scene
- boxm_scene_base_sptr scene_ptr = pro.get_input<boxm_scene_base_sptr>(i++);
-
- // camera
- vpgl_camera_double_sptr cam_inp = pro.get_input<vpgl_camera_double_sptr>(i++);
- auto *cam_init = dynamic_cast<vpgl_perspective_camera<double>*>(cam_inp.ptr());
-
- // image
- vil_image_view_base_sptr img_e_sptr = pro.get_input<vil_image_view_base_sptr>(i++);
- vil_image_view<vxl_byte> img_e_vb(img_e_sptr);
-
- vil_image_view<float> img_e;
- brip_vil_float_ops::normalize_to_interval<vxl_byte,float>(img_e_vb,img_e,0.0f,1.0f);
-
- unsigned ni = img_e.ni();
- unsigned nj = img_e.nj();
-
- double deg2rad = vnl_math::pi_over_180;
-
- // parameters are in degrees
- double theta_range = 12.0, theta_step = 0.05, phi_range = 12.0, phi_step = 0.05, rot_range = 10.0, rot_step = 1.0;
- int max_iter_rot_angle = 5, max_iter_cam_center = 50;
-
- pro.parameters()->get_value(theta_range_, theta_range);
- pro.parameters()->get_value(theta_step_, theta_step);
- pro.parameters()->get_value(phi_range_, phi_range);
- pro.parameters()->get_value(phi_step_, phi_step);
- pro.parameters()->get_value(rot_range_, rot_range);
- pro.parameters()->get_value(rot_step_, rot_step);
- pro.parameters()->get_value(max_iter_rot_angle_, max_iter_rot_angle);
- pro.parameters()->get_value(max_iter_cam_center_, max_iter_cam_center);
-
-#if 0
- std::cout << "printing boxm_estimate_camera_process parameters:\n"
- << "theta_range: " << theta_range << '\n'
- << "theta_step: " << theta_step << '\n'
- << "phi_range: " << phi_range << '\n'
- << "phi_step: " << phi_step << '\n'
- << "rot_range: " << rot_range << '\n'
- << "rot_step: " << rot_step << '\n'
- << "max_iter_rot_angle: " << max_iter_rot_angle << '\n'
- << "max_iter_cam_center: " << max_iter_cam_center << '\n';
-#endif
-
- // change the parameters into radians
- theta_range *= deg2rad; theta_step *= deg2rad; phi_range *= deg2rad; phi_step *= deg2rad; rot_range *= deg2rad; rot_step *= deg2rad;
-
- auto *img_eei = new vil_image_view<float>(ni,nj,1);
- img_eei->fill(0.0f);
-
- if (scene_ptr->appearence_model() == BOXM_EDGE_LINE) {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short, boxm_inf_line_sample<float> > type;
- auto* scene = dynamic_cast<boxm_scene<type>*> (scene_ptr.as_pointer());
- if (!scene) {
- std::cerr << "boxm_render_expected_edge_process: the scene is not of expected type\n";
- return false;
- }
-
- // create the functor that finds edges
- typedef boxm_expected_edge_functor<short, boxm_inf_line_sample<float> > func_type;
- func_type func(*scene);
- bpgl_camera_estimator<func_type > cam_estimator(func);
- cam_estimator.set_estimation_params(theta_range,theta_step,phi_range,phi_step,rot_range,rot_step,max_iter_rot_angle);
-
- func.apply(cam_inp,img_eei);
-
- auto *img_eei_before_correction = new vil_image_view<vxl_byte>(ni,nj,1);
- brip_vil_float_ops::normalize_to_interval<float,vxl_byte>(*img_eei,*img_eei_before_correction,0.0f,255.0f);
-
- bpgl_camera_estimator_amoeba<func_type> cost_ftn(cam_estimator,img_e,cam_inp);
- vnl_vector<double> x(2,1.0);
- vnl_amoeba amoeba(cost_ftn);
- amoeba.verbose = 1;
- amoeba.default_verbose = true;
- amoeba.set_relative_diameter(3.0);
- amoeba.set_max_iterations(max_iter_cam_center);
- amoeba.minimize(x);
- auto *cam_est = new vpgl_perspective_camera<double>(*cam_init);
- cost_ftn.get_result(x,cam_est);
-
- vpgl_camera_double_sptr cam_ptr = new vpgl_perspective_camera<double>(*cam_est);
- func.apply(cam_ptr,img_eei);
-
- auto *img_eei_vb = new vil_image_view<vxl_byte>(ni,nj,1);
- brip_vil_float_ops::normalize_to_interval<float,vxl_byte>(*img_eei,*img_eei_vb,0.0f,255.0f);
-
- delete cam_est;
- delete img_eei;
-
- // output
- unsigned j = 0;
- // update the camera and store
- pro.set_output_val<vpgl_camera_double_sptr>(j++, cam_ptr);
- // update the edge image after update and store
- pro.set_output_val<vil_image_view_base_sptr>(j++, img_eei_vb);
- // update the edge image before update and store
- pro.set_output_val<vil_image_view_base_sptr>(j++, img_eei_before_correction);
-
- return true;
- }
- else
- {
- std::cerr << "boxm_estimate_camera_process: Multibin version not yet implemented\n";
- return false;
- }
- }
- else {
- std::cerr << "boxm_estimate_camera_process: undefined APM type\n";
- return false;
- }
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_edge_samples_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_edge_samples_process.cxx
deleted file mode 100644
index bb10974eef..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_edge_samples_process.cxx
+++ /dev/null
@@ -1,139 +0,0 @@
-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_edge_samples_process.cxx
-//:
-// \file
-// \brief Process to update the scene from an image and camera pair
-//
-// \author Gamze Tunali
-// \date Sep 15, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/rt/boxm_generate_edge_sample_functor.h>
-#include <boxm/algo/rt/boxm_generate_edge_tangent_sample_functor.h>
-#include <boxm/sample/boxm_edge_sample.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-
-#include <vil/vil_image_view_base.h>
-#include <vil/vil_image_view.h>
-#include <vil/vil_math.h>
-
-#include <sdet/sdet_img_edge.h>
-
-namespace boxm_generate_edge_samples_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 1;
-}
-
-bool boxm_generate_edge_samples_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_generate_edge_samples_process_globals;
-
- //process takes 5 inputs
- //input[0]: The cropped edge image
- //input[1]: The camera of the observation
- //input[2]: The scene
- //input[3]: image name for saving scene
- //input[4]: n_normal
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vil_image_view_base_sptr";
- input_types_[1] = "vpgl_camera_double_sptr";
- input_types_[2] = "boxm_scene_base_sptr";
- input_types_[3] = "vcl_string";
- input_types_[4] = "float";
-
- //output
- unsigned j = 0;
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[j++] = "float"; // new n_normal value
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_generate_edge_samples_process(bprb_func_process& pro)
-{
- using namespace boxm_generate_edge_samples_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ) {
- std::cout << pro.name() << "boxm_generate_edge_samples_process: The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get inputs:
- unsigned i = 0;
- vil_image_view_base_sptr edge_image = pro.get_input<vil_image_view_base_sptr>(i++);
- vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(i++);
- boxm_scene_base_sptr scene = pro.get_input<boxm_scene_base_sptr>(i++);
- std::string img_name = pro.get_input<std::string>(i++);
- auto n_normal = pro.get_input<float>(i++);
-
- // get parameters
- int edge_prob_mask_size = 21;
- pro.parameters()->get_value("edge_prob_mask_size",edge_prob_mask_size);
- float edge_prob_mask_sigma = 1.0f;
- pro.parameters()->get_value("edge_prob_mask_sigma",edge_prob_mask_sigma);
-
- // check the input validity
- if ((edge_image == nullptr) || (camera == nullptr) || (scene == nullptr)) {
- std::cout << "boxm_generate_edge_samples_process: null input value, cannot run" << std::endl;
- return false;
- }
-
- float new_n_normal=0.0;
-
-
- if (scene->appearence_model() == BOXM_EDGE_FLOAT) {
- vil_image_view<float> edge_prob_image;
- sdet_img_edge::estimate_edge_prob_image(edge_image, edge_prob_image, edge_prob_mask_size, edge_prob_mask_sigma);
- float edge_prob_image_mean;
- vil_math_mean(edge_prob_image_mean,edge_prob_image,0);
- vil_image_view<float> img(edge_prob_image);
- new_n_normal = n_normal + edge_prob_image_mean;
- if (!scene->multi_bin())
- {
- typedef boct_tree<short, boxm_edge_sample<float> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- boxm_generate_edge_sample_rt<short,boxm_edge_sample<float> > (*s, camera, img, img_name);
- }
- else
- {
- std::cout<<"boxm_generate_edge_samples_process: Multibin -- Not yet implemented"<<std::endl;
- }
- }
- if (scene->appearence_model() == BOXM_EDGE_LINE) {
- // get the edges as an image with 3 planes (a,b,c)
- if (!scene->multi_bin())
- {
- typedef boxm_inf_line_sample<float> sample_type;
- typedef boct_tree<short, sample_type> tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- // for this case, the image should be with 4 planes, representing plane definitions
- vil_image_view<float> img(edge_image);
- boxm_generate_edge_tangent_sample_rt<short,sample_type> (*s, camera, img, img_name);
- }
- else
- {
- std::cout<<"boxm_generate_edge_samples_process: Multibin -- Not yet implemented"<<std::endl;
- }
- }
- else {
- std::cout << "boxm_generate_edge_samples_process: undefined APM type" << std::endl;
- return false;
- }
-
- pro.set_output_val<float>(0, float(new_n_normal));
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt2_samples_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt2_samples_process.cxx
deleted file mode 100644
index 06261e8d44..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt2_samples_process.cxx
+++ /dev/null
@@ -1,142 +0,0 @@
-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt2_samples_process.cxx
-//:
-// \file
-// \brief Process to generate samples needed for boxm_opt2_optimizer_process from a given image/camera pair
-//
-// \author Daniel Crispell
-// \date Feb 17, 2010
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/rt/boxm_generate_opt2_sample_functor.h>
-
-#include <vil/vil_convert.h>
-#include <vil/vil_image_view_base.h>
-#include <vil/vil_image_view.h>
-#include <boxm/sample/boxm_sample.h>
-
-namespace boxm_generate_opt2_samples_process_globals
-{
- constexpr unsigned n_inputs_ = 7;
- constexpr unsigned n_outputs_ = 0;
-}
-
-bool boxm_generate_opt2_samples_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_generate_opt2_samples_process_globals;
-
- // process takes 7 inputs and no output
- //input[0]: The observation image
- //input[1]: The camera of the observation
- //input[2]: The scene
- //input[3]: image name for saving scene
- //input[4]: shadow prior
- //input[5]: shadow sigma
- //input[6]: use black background
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vil_image_view_base_sptr";
- input_types_[1] = "vpgl_camera_double_sptr";
- input_types_[2] = "boxm_scene_base_sptr";
- input_types_[3] = "vcl_string";
- input_types_[4] = "float";
- input_types_[5] = "float";
- input_types_[6] = "bool";
-
- std::vector<std::string> output_types_(n_outputs_);
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_generate_opt2_samples_process(bprb_func_process& pro)
-{
- using namespace boxm_generate_opt2_samples_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << "boxm_generate_opt2_samples_process: The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get inputs:
- vil_image_view_base_sptr input_image = pro.get_input<vil_image_view_base_sptr>(0);
- vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(1);
- boxm_scene_base_sptr scene = pro.get_input<boxm_scene_base_sptr>(2);
- std::string img_name = pro.get_input<std::string>(3); // TODO - unused!!
- auto shadow_prior = pro.get_input<float>(4);
- auto shadow_sigma = pro.get_input<float>(5);
- bool use_black_background = pro.get_input<bool>(6);
-
- // check the input validity
- if ((input_image == nullptr) || (camera == nullptr) || (scene == nullptr)) {
- std::cout << "boxm_generate_opt2_samples_process: null input value, cannot run" << std::endl;
- return false;
- }
-
- switch (scene->appearence_model())
- {
- case BOXM_APM_SIMPLE_GREY:
- {
- auto *img_byte = dynamic_cast<vil_image_view<vxl_byte>*>(input_image.ptr());
- vil_image_view<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1);
- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f);
- // create alternate appearance models
- std::vector<float> alt_appearance_priors;
- std::vector<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype> alt_appearance_models;
- if (shadow_prior > 0.0f) {
- boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype shadow_model(0.0f, shadow_sigma);
- alt_appearance_priors.push_back(shadow_prior);
- alt_appearance_models.push_back(shadow_model);
- }
- if (!scene->multi_bin()) {
- typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- boxm_generate_opt2_samples<short, boxm_sample<BOXM_APM_SIMPLE_GREY>, BOXM_AUX_OPT2_GREY >(*s, camera, img, img_name, alt_appearance_priors, alt_appearance_models, use_black_background);
- }
- else {
- std::cerr << "error: multi-bin scenes not supported\n";
- }
- break;
- }
- case BOXM_APM_MOG_GREY:
- {
- auto *img_byte = dynamic_cast<vil_image_view<vxl_byte>*>(input_image.ptr());
- vil_image_view<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1);
- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f);
- // create alternate appearance models
- std::vector<float> alt_appearance_priors;
- std::vector<boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype> alt_appearance_models;
- if (shadow_prior > 0.0f) {
- boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype shadow_model;
- // insert a single mode with mean at 0
- bsta_gauss_sf1 single_mode(0.0f, shadow_sigma*shadow_sigma);
- shadow_model.insert(bsta_num_obs<bsta_gauss_sf1>(single_mode), 1.0f);
- alt_appearance_priors.push_back(shadow_prior);
- alt_appearance_models.push_back(shadow_model);
- }
- if (!scene->multi_bin()) {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- boxm_generate_opt2_samples<short, boxm_sample<BOXM_APM_MOG_GREY>, BOXM_AUX_OPT2_GREY >(*s, camera, img, img_name, alt_appearance_priors, alt_appearance_models, use_black_background);
- }
- else {
- std::cerr << "error: multi-bin scenes not supported\n";
- }
- break;
- }
- default:
- std::cout << "boxm_generate_opt2_samples_process: unsupported APM type" << std::endl;
- return false;
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt3_samples_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt3_samples_process.cxx
deleted file mode 100644
index 0eb591c79c..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt3_samples_process.cxx
+++ /dev/null
@@ -1,114 +0,0 @@
-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt3_samples_process.cxx
-//:
-// \file
-// \brief Process to generate samples needed for boxm_opt3_optimizer_process from a given image/camera pair
-//
-// \author Daniel Crispell
-// \date Feb 17, 2010
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/rt/boxm_generate_opt3_sample_functor.h>
-
-#include <vil/vil_convert.h>
-#include <vil/vil_image_view_base.h>
-#include <vil/vil_image_view.h>
-#include <boxm/sample/boxm_sample.h>
-
-namespace boxm_generate_opt3_samples_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 0;
-}
-
-bool boxm_generate_opt3_samples_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_generate_opt3_samples_process_globals;
-
- // process takes 5 inputs and no output
- //input[0]: The observation image
- //input[1]: The camera of the observation
- //input[2]: The scene
- //input[3]: image name for saving scene
- //input[4]: use black background
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vil_image_view_base_sptr";
- input_types_[1] = "vpgl_camera_double_sptr";
- input_types_[2] = "boxm_scene_base_sptr";
- input_types_[3] = "vcl_string";
- input_types_[4] = "bool";
-
- std::vector<std::string> output_types_(n_outputs_);
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_generate_opt3_samples_process(bprb_func_process& pro)
-{
- using namespace boxm_generate_opt3_samples_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << "boxm_generate_opt3_samples_process: The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get inputs:
- unsigned i = 0;
- vil_image_view_base_sptr input_image = pro.get_input<vil_image_view_base_sptr>(i++);
- vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(i++);
- boxm_scene_base_sptr scene = pro.get_input<boxm_scene_base_sptr>(i++);
- std::string img_name = pro.get_input<std::string>(i++); // TODO - unused!!
- bool use_black_background = pro.get_input<bool>(i++);
-
- // check the input validity
- if ((input_image == nullptr) || (camera == nullptr) || (scene == nullptr)) {
- std::cout << "boxm_generate_opt3_samples_process: null input value, cannot run" << std::endl;
- return false;
- }
-
- switch (scene->appearence_model())
- {
- case BOXM_APM_SIMPLE_GREY:
- {
- auto *img_byte = dynamic_cast<vil_image_view<vxl_byte>*>(input_image.ptr());
- vil_image_view<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1);
- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f);
- if (!scene->multi_bin())
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- boxm_generate_opt3_sample<short, boxm_sample<BOXM_APM_SIMPLE_GREY>, BOXM_AUX_OPT3_MOG_GREY>(*s, camera,img, img_name, use_black_background);
- }
- break;
- }
- case BOXM_APM_MOG_GREY:
- {
- auto *img_byte = dynamic_cast<vil_image_view<vxl_byte>*>(input_image.ptr());
- vil_image_view<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1);
- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f);
- if (!scene->multi_bin())
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- boxm_generate_opt3_sample<short, boxm_sample<BOXM_APM_MOG_GREY>, BOXM_AUX_OPT3_MOG_GREY>(*s, camera,img, img_name, use_black_background);
- }
- break;
- }
- default:
- std::cout << "boxm_generate_opt3_samples_process: unsupported APM type" << std::endl;
- return false;
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt_samples_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt_samples_process.cxx
deleted file mode 100644
index fac0d9d3ae..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt_samples_process.cxx
+++ /dev/null
@@ -1,102 +0,0 @@
-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_generate_opt_samples_process.cxx
-//:
-// \file
-// \brief Process to update the scene from an image and camera pair
-//
-// \author Gamze Tunali
-// \date Sep 15, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/rt/boxm_generate_opt_sample_functor.h>
-
-#include <vil/vil_convert.h>
-#include <vil/vil_image_view_base.h>
-#include <vil/vil_image_view.h>
-#include <boxm/sample/boxm_sample.h>
-
-namespace boxm_generate_opt_samples_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 0;
-}
-
-bool boxm_generate_opt_samples_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_generate_opt_samples_process_globals;
-
- // process takes 5 inputs and no output
- //input[0]: The observation image
- //input[1]: The camera of the observation
- //input[2]: The scene
- //input[3]: image name for saving scene
- //input[4]: use black background
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vil_image_view_base_sptr";
- input_types_[1] = "vpgl_camera_double_sptr";
- input_types_[2] = "boxm_scene_base_sptr";
- input_types_[3] = "vcl_string";
- input_types_[4] = "bool";
-
- std::vector<std::string> output_types_(n_outputs_);
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_generate_opt_samples_process(bprb_func_process& pro)
-{
- using namespace boxm_generate_opt_samples_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << "boxm_generate_opt_samples_process: The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get inputs:
- unsigned i = 0;
- vil_image_view_base_sptr input_image = pro.get_input<vil_image_view_base_sptr>(i++);
- vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(i++);
- boxm_scene_base_sptr scene = pro.get_input<boxm_scene_base_sptr>(i++);
- std::string img_name = pro.get_input<std::string>(i++); // TODO - unused!!
- bool use_black_background = pro.get_input<bool>(i++);
-
- // check the input validity
- if ((input_image == nullptr) || (camera == nullptr) || (scene == nullptr)) {
- std::cout << "boxm_generate_opt_samples_process: null input value, cannot run" << std::endl;
- return false;
- }
-
- if (scene->appearence_model() == BOXM_APM_SIMPLE_GREY) {
- auto *img_byte
- = dynamic_cast<vil_image_view<vxl_byte>*>(input_image.ptr());
- vil_image_view<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1);
- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f);
- if (!scene->multi_bin())
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- boxm_generate_opt_sample_rt(*s, camera,img,img_name,use_black_background);
- }
- else
- {
- std::cout<<"Not yet implemented"<<std::endl;
- }
- }
- else {
- std::cout << "boxm_generate_opt_samples_process: undefined APM type" << std::endl;
- return false;
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt2_update_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt2_update_process.cxx
deleted file mode 100644
index 30a4014572..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt2_update_process.cxx
+++ /dev/null
@@ -1,153 +0,0 @@
-//This is brl/bseg/boxm/algo/rt/pro/processes/boxm_opt2_update_process.cxx
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A process for updating a boxm_scene with a set of images. No damping parameter is required
-// \author Daniel Crispell
-// \date February 17, 2010
-//
-// \verbatim
-// Modifications
-// \endverbatim
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <brdb/brdb_value.h>
-#include <bprb/bprb_parameters.h>
-
-#include <boct/boct_tree.h>
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-
-#include <boxm/sample/boxm_opt2_sample.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/algo/rt/boxm_opt2_optimizer.h>
-
-namespace boxm_opt2_update_process_globals
-{
- constexpr unsigned int n_inputs_ = 2;
- constexpr unsigned int n_outputs_ = 0;
- //Define parameters here
-}
-
-
-//: set input and output types
-bool boxm_opt2_update_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_opt2_update_process_globals;
-
- // process takes 2 inputs:
- //input[0]: The scene
- //input[1]: The filename of the text file containing list of image names
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vcl_string";
-
- // process has 0 outputs:
- std::vector<std::string> output_types_(n_outputs_);
-
- if (!pro.set_input_types(input_types_))
- return false;
-
- if (!pro.set_output_types(output_types_))
- return false;
-
- return true;
-}
-
-//: Execute the process
-bool boxm_opt2_update_process(bprb_func_process& pro)
-{
- using namespace boxm_opt2_update_process_globals;
-
- // check number of inputs
- if (pro.n_inputs() != n_inputs_)
- {
- std::cout << pro.name() << "The number of inputs should be " << n_inputs_ << std::endl;
- return false;
- }
-
- // get the parameters
- // (none)
-
- // get the inputs
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(0);
- boxm_apm_type apm_type = scene_base->appearence_model();
-
- std::string image_list_fname = pro.get_input<std::string>(1);
-
- // extract list of image_ids from file
- std::ifstream ifs(image_list_fname.c_str());
- if (!ifs.good()) {
- std::cerr << "error opening file " << image_list_fname << '\n';
- return false;
- }
- std::vector<std::string> image_ids;
- unsigned int n_images = 0;
- ifs >> n_images;
- for (unsigned int i=0; i<n_images; ++i) {
- std::string img_id;
- ifs >> img_id;
- image_ids.push_back(img_id);
- }
- ifs.close();
-
- switch (apm_type)
- {
- case BOXM_APM_SIMPLE_GREY:
- {
- typedef boct_tree<short,boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
- auto *scene = dynamic_cast<boxm_scene<tree_type>*>(scene_base.ptr());
- if (!scene) {
- std::cerr << "error casting scene_base to scene\n";
- return false;
- }
- boxm_opt2_optimizer<short,BOXM_APM_SIMPLE_GREY, BOXM_AUX_OPT2_GREY> optimizer(*scene, image_ids);
- optimizer.update();
-
- break;
- }
- case BOXM_APM_MOG_GREY:
- {
- typedef boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto *scene = dynamic_cast<boxm_scene<tree_type>*>(scene_base.ptr());
- if (!scene) {
- std::cerr << "error casting scene_base to scene\n";
- return false;
- }
- boxm_opt2_optimizer<short,BOXM_APM_MOG_GREY, BOXM_AUX_OPT2_GREY> optimizer(*scene, image_ids);
- optimizer.update();
-
- break;
- }
-#if 0 // commented out
- case BOXM_APM_SIMPLE_RGB:
- {
- boxm_scene<BOXM_APM_SIMPLE_RGB> *scene = dynamic_cast<boxm_scene<BOXM_APM_SIMPLE_RGB>*>(scene_base.ptr());
- if (!scene) {
- std::cerr << "error casting scene_base to scene\n";
- return false;
- }
- boxm_opt_rt_bayesian_optimizer<BOXM_APM_SIMPLE_RGB, BOXM_AUX_OPT_RT_RGB> optimizer(*scene, image_ids);
- optimizer.optimize_cells(damping_factor);
-
- break;
- }
-#endif // 0
- default:
- std::cerr << "error - boxm_opt2_update_process: unsupported appearance model type " << apm_type << '\n';
- return false;
- }
-
- //store output
- // (none)
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt3_update_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt3_update_process.cxx
deleted file mode 100644
index 47f40dd19a..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt3_update_process.cxx
+++ /dev/null
@@ -1,153 +0,0 @@
-//This is brl/bseg/boxm/algo/rt/pro/processes/boxm_opt3_update_process.cxx
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A process for updating a boxm_scene with a set of images. No damping parameter is required
-// \author Daniel Crispell
-// \date February 17, 2010
-//
-// \verbatim
-// Modifications
-// \endverbatim
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <brdb/brdb_value.h>
-#include <bprb/bprb_parameters.h>
-
-#include <boct/boct_tree.h>
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-
-#include <boxm/sample/boxm_opt3_sample.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/algo/rt/boxm_opt3_optimizer.h>
-
-namespace boxm_opt3_update_process_globals
-{
- constexpr unsigned int n_inputs_ = 2;
- constexpr unsigned int n_outputs_ = 0;
- //Define parameters here
-}
-
-
-//: set input and output types
-bool boxm_opt3_update_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_opt3_update_process_globals;
-
- // process takes 2 inputs:
- //input[0]: The scene
- //input[1]: The filename of the text file containing list of image names
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vcl_string";
-
- // process has 0 outputs:
- std::vector<std::string> output_types_(n_outputs_);
-
- if (!pro.set_input_types(input_types_))
- return false;
-
- if (!pro.set_output_types(output_types_))
- return false;
-
- return true;
-}
-
-//: Execute the process
-bool boxm_opt3_update_process(bprb_func_process& pro)
-{
- using namespace boxm_opt3_update_process_globals;
-
- // check number of inputs
- if (pro.n_inputs() != n_inputs_)
- {
- std::cout << pro.name() << "The number of inputs should be " << n_inputs_ << std::endl;
- return false;
- }
-
- // get the parameters
- // (none)
-
- // get the inputs
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(0);
- boxm_apm_type apm_type = scene_base->appearence_model();
-
- std::string image_list_fname = pro.get_input<std::string>(1);
-
- // extract list of image_ids from file
- std::ifstream ifs(image_list_fname.c_str());
- if (!ifs.good()) {
- std::cerr << "error opening file " << image_list_fname << '\n';
- return false;
- }
- std::vector<std::string> image_ids;
- unsigned int n_images = 0;
- ifs >> n_images;
- for (unsigned int i=0; i<n_images; ++i) {
- std::string img_id;
- ifs >> img_id;
- image_ids.push_back(img_id);
- }
- ifs.close();
-
- switch (apm_type)
- {
- case BOXM_APM_SIMPLE_GREY:
- {
- typedef boct_tree<short,boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
- auto *scene = dynamic_cast<boxm_scene<tree_type>*>(scene_base.ptr());
- if (!scene) {
- std::cerr << "error casting scene_base to scene\n";
- return false;
- }
- boxm_opt3_optimizer<short,BOXM_APM_SIMPLE_GREY,BOXM_APM_MOG_GREY> optimizer(*scene, image_ids);
- optimizer.optimize_cells();
-
- break;
- }
- case BOXM_APM_MOG_GREY:
- {
- typedef boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto *scene = dynamic_cast<boxm_scene<tree_type>*>(scene_base.ptr());
- if (!scene) {
- std::cerr << "error casting scene_base to scene\n";
- return false;
- }
- boxm_opt3_optimizer<short,BOXM_APM_MOG_GREY,BOXM_APM_MOG_GREY> optimizer(*scene, image_ids);
- optimizer.optimize_cells();
-
- break;
- }
-#if 0 // commented out
- case BOXM_APM_SIMPLE_RGB:
- {
- boxm_scene<BOXM_APM_SIMPLE_RGB> *scene = dynamic_cast<boxm_scene<BOXM_APM_SIMPLE_RGB>*>(scene_base.ptr());
- if (!scene) {
- std::cerr << "error casting scene_base to scene\n";
- return false;
- }
- boxm_opt_rt_bayesian_optimizer<BOXM_APM_SIMPLE_RGB, BOXM_AUX_OPT_RT_RGB> optimizer(*scene, image_ids);
- optimizer.optimize_cells(damping_factor);
-
- break;
- }
-#endif // 0
- default:
- std::cerr << "error - boxm_opt3_update_process: unsupported appearance model type " << apm_type << '\n';
- return false;
- }
-
- //store output
- // (none)
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt_bayesian_update_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt_bayesian_update_process.cxx
deleted file mode 100644
index 56d4d9051d..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_opt_bayesian_update_process.cxx
+++ /dev/null
@@ -1,145 +0,0 @@
-//This is brl/bseg/boxm/algo/rt/pro/processes/boxm_opt_bayesian_update_process.cxx
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A process for updating a boxm_scene with a set of images, using a damped version of Bayes' rule
-// \author Daniel Crispell
-// \date April 2, 2009
-//
-// \verbatim
-// Modifications
-// Aug 3, 2009 Gamze Tunali - Moved from lemsvxl/psm_opt to vxl
-// \endverbatim
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <brdb/brdb_value.h>
-#include <bprb/bprb_parameters.h>
-
-#include <boct/boct_tree.h>
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/algo/rt/boxm_opt_rt_bayesian_optimizer.h>
-
-namespace boxm_opt_bayesian_update_process_globals
-{
- constexpr unsigned int n_inputs_ = 3;
- constexpr unsigned int n_outputs_ = 0;
- //Define parameters here
-}
-
-
-//: set input and output types
-bool boxm_opt_bayesian_update_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_opt_bayesian_update_process_globals;
-
- // process takes 3 inputs:
- //input[0]: The scene
- //input[1]: The damping value
- //input[2]: The filename of the text file containing list of image names
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "float";
- input_types_[2] = "vcl_string";
-
- // process has 0 outputs:
- std::vector<std::string> output_types_(n_outputs_);
-
- if (!pro.set_input_types(input_types_))
- return false;
-
- if (!pro.set_output_types(output_types_))
- return false;
-
- return true;
-}
-
-//: Execute the process
-bool boxm_opt_bayesian_update_process(bprb_func_process& pro)
-{
- using namespace boxm_opt_bayesian_update_process_globals;
-
- // check number of inputs
- if (pro.n_inputs() != n_inputs_)
- {
- std::cout << pro.name() << "The number of inputs should be " << n_inputs_ << std::endl;
- return false;
- }
-
- // get the parameters
- // (none)
-
- // get the inputs
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(0);
- boxm_apm_type apm_type = scene_base->appearence_model();
-
- auto damping_factor = pro.get_input<float>(1);
-
- std::string image_list_fname = pro.get_input<std::string>(2);
-
- // extract list of image_ids from file
- std::ifstream ifs(image_list_fname.c_str());
- if (!ifs.good()) {
- std::cerr << "error opening file " << image_list_fname << std::endl;
- return false;
- }
- std::vector<std::string> image_ids;
- unsigned int n_images = 0;
- ifs >> n_images;
- for (unsigned int i=0; i<n_images; ++i) {
- std::string img_id;
- ifs >> img_id;
- image_ids.push_back(img_id);
- }
- ifs.close();
-
- switch (apm_type)
- {
- case BOXM_APM_SIMPLE_GREY:
- {
- typedef boct_tree<short,boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
- auto *scene = dynamic_cast<boxm_scene<tree_type>*>(scene_base.ptr());
- if (!scene) {
- std::cerr << "error casting scene_base to scene\n";
- return false;
- }
- boxm_opt_rt_bayesian_optimizer<short,BOXM_APM_SIMPLE_GREY,BOXM_AUX_OPT_RT_GREY> optimizer(*scene, image_ids);
- optimizer.optimize_cells(damping_factor);
-
- break;
- }
-#if 0 // commented out
- case BOXM_APM_SIMPLE_RGB:
- {
- boxm_scene<BOXM_APM_SIMPLE_RGB> *scene = dynamic_cast<boxm_scene<BOXM_APM_SIMPLE_RGB>*>(scene_base.ptr());
- if (!scene) {
- std::cerr << "error casting scene_base to scene\n";
- return false;
- }
- boxm_opt_rt_bayesian_optimizer<BOXM_APM_SIMPLE_RGB, BOXM_AUX_OPT_RT_RGB> optimizer(*scene, image_ids);
- optimizer.optimize_cells(damping_factor);
-
- break;
- }
-#endif // 0
- default:
- std::cerr << "error - boxm_opt_bayesian_update_process: unsupported appearance model type " << apm_type << std::endl;
- return false;
- }
-
- //store output
- // (none)
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_ray_statistics_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_ray_statistics_process.cxx
deleted file mode 100644
index 5507b5b55b..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_ray_statistics_process.cxx
+++ /dev/null
@@ -1,107 +0,0 @@
-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_ray_statistics_process.cxx
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A process for describing the attributes of a scene
-//
-// \author J.L. Mundy
-// \date January 24, 2010
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/boxm_compute_scene_statistics.h>
-#include <boxm/boxm_apm_traits.h>
-#include <bsta/bsta_histogram_sptr.h>
-#include <boxm/algo/rt/boxm_compute_num_rays_statistics.h>
-
-namespace boxm_ray_statistics_process_globals
-{
- constexpr unsigned n_inputs_ = 4;
- constexpr unsigned n_outputs_ = 1;
-}
-
-bool boxm_ray_statistics_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_ray_statistics_process_globals;
-
- //process takes 2 input
- //input[0]: scene binary file
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vpgl_camera_double_sptr";
- input_types_[2] = "unsigned"; //ni
- input_types_[3] = "unsigned"; //nj
-
- // process has 1 output:
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "bsta_histogram_sptr"; // No of rays per cell Histogram
- //output_types_[1] = "bsta_histogram_sptr"; // Sigma Histogram
- //output_types_[2] = "bsta_histogram_sptr"; // Level Histogram
- //output_types_[3] = "unsigned"; // Number of leaves
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-//: This process produces one output:
-// * The distribution of "Omega" values where Omega = 1-e^( alpha x length )
-// The following three outputs are no longer present:
-// * The distribution of "Sigma" values where Sigma is the std_dev of
-// the appearance model. (currently implemented only for simple grey)
-// * The histogram of levels for leaves in the octree
-// * The number of leaves in the tree
-//
-bool boxm_ray_statistics_process(bprb_func_process& pro)
-{
- using namespace boxm_ray_statistics_process_globals;
-
- if ( !pro.verify_inputs() ) {
- std::cerr << pro.name() << ": invalid inputs\n";
- return false;
- }
- // assign tree type
- boxm_scene_base_sptr scene_ptr = pro.get_input<boxm_scene_base_sptr>(0);
- vpgl_camera_double_sptr cam_ptr = pro.get_input<vpgl_camera_double_sptr>(1);
- auto ni = pro.get_input<unsigned>(2);
- auto nj = pro.get_input<unsigned>(3);
-
- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto* scene = dynamic_cast<boxm_scene<tree_type> *> (scene_ptr.as_pointer());
-
- bsta_histogram<float> num_rays_hist;
- if (!compute_ray_statistics<short, boxm_sample<BOXM_APM_MOG_GREY> >(*scene, cam_ptr,num_rays_hist,ni,nj))
- return false;
- pro.set_output_val<bsta_histogram_sptr>(0, new bsta_histogram<float>(num_rays_hist)); }
- else
- {
- std::cerr<<"boxm_ray_statistics_process not yet implemented for multi-bin/Gaussian mixture\n";
- return false;
- }
- }
- else if (scene_ptr->appearence_model() == BOXM_APM_SIMPLE_GREY)
- {
- if (!scene_ptr->multi_bin()) {
- typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
- auto* scene = dynamic_cast<boxm_scene<tree_type> *> (scene_ptr.as_pointer());
-
- bsta_histogram<float> num_rays_hist;
- if (!compute_ray_statistics<short,boxm_sample<BOXM_APM_SIMPLE_GREY> >(*scene, cam_ptr,num_rays_hist,ni,nj))
- return false;
- pro.set_output_val<bsta_histogram_sptr>(0, new bsta_histogram<float>(num_rays_hist));
- }
- else {
- std::cerr<<"boxm_ray_statistics_process not yet implemented for multi-bin/simple_grey\n";
- return false;
- }
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_depth_rt_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_depth_rt_process.cxx
deleted file mode 100644
index 5af8acd7f8..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_depth_rt_process.cxx
+++ /dev/null
@@ -1,114 +0,0 @@
-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_depth_rt_process.cxx
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A class for obtaining expected depth map for the world
-//
-// \author Vishal Jain
-// \date Aug 26, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/rt/boxm_render_expected_depth_functor.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <vil/vil_image_view.h>
-
-namespace boxm_render_expected_depth_rt_process_globals
-{
- constexpr unsigned n_inputs_ = 4;
- constexpr unsigned n_outputs_ = 2;
-}
-
-bool boxm_render_expected_depth_rt_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_render_expected_depth_rt_process_globals;
-
- //process takes 4 inputs
- //input[0]: scene binary file
- //input[1]: camera
- //input[2]: ni of the expected image
- //input[3]: nj of the expected image
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vpgl_camera_double_sptr";
- input_types_[2] = "unsigned";
- input_types_[3] = "unsigned";
-
- // process has 2 outputs:
- // output[0]: rendered image
- // output[0]: mask
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "vil_image_view_base_sptr";
- output_types_[1] = "vil_image_view_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_render_expected_depth_rt_process(bprb_func_process& pro)
-{
- using namespace boxm_render_expected_depth_rt_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get the inputs
- unsigned i = 0;
- boxm_scene_base_sptr scene_ptr = pro.get_input<boxm_scene_base_sptr>(i++);
- vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(i++);
- auto ni = pro.get_input<unsigned>(i++);
- auto nj = pro.get_input<unsigned>(i++);
- vil_image_view_base_sptr img;
- vil_image_view_base_sptr img_mask;
-
-
- // check the scene's app model
- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) {
- vil_image_view<float> mask(ni,nj,1);
- vil_image_view<float> expected(ni,nj,1);
-
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > type;
- auto* scene = dynamic_cast<boxm_scene<type>*> (scene_ptr.as_pointer());
- boxm_render_depth_rt<short, boxm_sample<BOXM_APM_MOG_GREY> >(*scene, camera, expected, mask);
- img_mask = new vil_image_view<float>(mask);
- img = new vil_image_view<float>(expected);
- } else if (scene_ptr->appearence_model() == BOXM_APM_MOB_GREY) {
- vil_image_view<float> mask(ni,nj,1);
- vil_image_view<float> expected(ni,nj,1);
-
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOB_GREY> > type;
- auto* scene = dynamic_cast<boxm_scene<type>*> (scene_ptr.as_pointer());
- boxm_render_depth_rt<short, boxm_sample<BOXM_APM_MOB_GREY> >(*scene, camera, expected, mask);
- img_mask = new vil_image_view<float>(mask);
- img = new vil_image_view<float>(expected);
- } else if (scene_ptr->appearence_model() == BOXM_APM_SIMPLE_GREY) {
- vil_image_view<float> mask(ni,nj,1);
- vil_image_view<float> expected(ni,nj,1);
-
- typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > type;
- auto* scene = dynamic_cast<boxm_scene<type>*> (scene_ptr.as_pointer());
- boxm_render_depth_rt<short, boxm_sample<BOXM_APM_SIMPLE_GREY> >(*scene, camera, expected, mask);
- img_mask = new vil_image_view<float>(mask);
- img = new vil_image_view<float>(expected);
- } else {
- std::cout << "boxm_render_expected_process: undefined APM type" << std::endl;
- return false;
- }
-
- unsigned j = 0;
- pro.set_output_val<vil_image_view_base_sptr>(j++, img);
- pro.set_output_val<vil_image_view_base_sptr>(j++, img_mask);
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_edge_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_edge_process.cxx
deleted file mode 100644
index 74ee8c9a88..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_edge_process.cxx
+++ /dev/null
@@ -1,162 +0,0 @@
-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_edge_process.cxx
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A class for obtaining roc curve from change detection results.
-//
-// \author Gamze Tunali
-// \date Apr 14, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/rt/boxm_render_expected_edge_image_functor.h>
-#include <boxm/algo/rt/boxm_render_expected_edge_tangent_image_functor.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-#include <vil/vil_image_view.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-namespace boxm_render_expected_edge_process_globals
-{
- constexpr unsigned n_inputs_ = 7;
- constexpr unsigned n_outputs_ = 2;
-}
-
-bool boxm_render_expected_edge_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_render_expected_edge_process_globals;
-
- //process takes 7 inputs
- //input[0]: scene binary file
- //input[1]: camera
- //input[2]: ni of the expected image
- //input[3]: nj of the expected image
- //input[4]: n_normal
- //input[5]: num samples used for update
- //input[6]: Threshold for edges
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vpgl_camera_double_sptr";
- input_types_[2] = "unsigned";
- input_types_[3] = "unsigned";
- input_types_[4] = "float";
- input_types_[5] = "unsigned";
- input_types_[6] = "float";
-
- // process has 2 outputs:
- // output[0]: rendered image
- // output[1]: mask
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "vil_image_view_base_sptr";
- output_types_[1] = "vil_image_view_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_render_expected_edge_process(bprb_func_process& pro)
-{
- using namespace boxm_render_expected_edge_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ) {
- std::cerr << pro.name() << ": The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get the inputs
- unsigned i = 0;
- boxm_scene_base_sptr scene_ptr = pro.get_input<boxm_scene_base_sptr>(i++);
- vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(i++);
- auto ni = pro.get_input<unsigned>(i++);
- auto nj = pro.get_input<unsigned>(i++);
- auto n_normal = pro.get_input<float>(i++);
- // number of updates
- auto num_updates = pro.get_input<unsigned>(i++);
- //float threshold = pro.get_input<float>(i++); // FIXME: unused; see line 138
- vil_image_view_base_sptr img;
- vil_image_view_base_sptr img_mask;
-
- // check the scene's app model
- if (scene_ptr->appearence_model() == BOXM_EDGE_FLOAT) {
- vil_image_view<boxm_apm_traits<BOXM_EDGE_FLOAT>::obs_datatype> expected(ni,nj);
- vil_image_view<float> mask(ni,nj);
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short, boxm_edge_sample<float> > type;
- auto* scene = dynamic_cast<boxm_scene<type>*> (scene_ptr.as_pointer());
- if (!scene) {
- std::cerr << "boxm_render_expected_edge_process: the scene is not of expected type\n";
- return false;
- }
- boxm_render_edge_image_rt<short, boxm_edge_sample<float> >(*scene, camera, expected, mask,n_normal,num_updates);
- }
- else
- {
- std::cerr << "Ray tracing version not yet implemented\n";
- return false;
- }
- img_mask = new vil_image_view<float>(mask);
-
- auto *expected_byte = new vil_image_view<vxl_byte>(ni,nj,expected.nplanes());
- for (unsigned i=0; i<ni; i++) {
- for (unsigned j=0; j<nj; j++) {
- (*expected_byte)(i,j) = static_cast<unsigned char>(255.0*(expected(i,j)));
- }
- }
- img = expected_byte;
- img_mask = new vil_image_view<float>(mask);
-
- auto *ex = new vil_image_view<float>(ni,nj,expected.nplanes());
- for (unsigned i=0; i<ni; i++) {
- for (unsigned j=0; j<nj; j++) {
- (*ex)(i,j) = expected(i,j);//static_cast<unsigned char>(255.0*(expected(i,j)));
- }
- }
- img = ex;
- unsigned j = 0;
- pro.set_output_val<vil_image_view_base_sptr>(j++, img);
- pro.set_output_val<vil_image_view_base_sptr>(j++, img_mask);
- return true;
- }
-
- if (scene_ptr->appearence_model() == BOXM_EDGE_LINE) {
- vil_image_view<float > expected(ni,nj,1);
- vil_image_view<float> mask(ni,nj);
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short, boxm_inf_line_sample<float> > type;
- auto* scene = dynamic_cast<boxm_scene<type>*> (scene_ptr.as_pointer());
- if (!scene) {
- std::cerr << "boxm_render_expected_edge_process: the scene is not of expected type\n";
- return false;
- }
- boxm_render_edge_tangent_image_rt<short, boxm_inf_line_sample<float> >(*scene, camera, expected);//, n_normal,num_updates, threshold);
-
- auto *edge_image=new vil_image_view<float >(ni,nj,1);
- *edge_image=expected;
-
- unsigned j = 0;
- pro.set_output_val<vil_image_view_base_sptr>(j++,edge_image);
- pro.set_output_val<vil_image_view_base_sptr>(j++,edge_image);
- return true;
- }
- else
- {
- std::cerr << "Ray tracing version not yet implemented\n";
- return false;
- }
- }
- else {
- std::cerr << "boxm_render_expected_edge_process: undefined APM type\n";
- return false;
- }
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_rt_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_rt_process.cxx
deleted file mode 100644
index f92621784d..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_rt_process.cxx
+++ /dev/null
@@ -1,143 +0,0 @@
-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_render_expected_rt_process.cxx
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A class for rendering an expected image of a given scene and camera.
-//
-// \author Gamze Tunali
-// \date Apr 14, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/rt/boxm_render_expected_image_functor.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-
-#include <vil/vil_convert.h>
-
-namespace boxm_render_expected_rt_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 2;
-}
-
-bool boxm_render_expected_rt_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_render_expected_rt_process_globals;
-
- //process takes 5 inputs
- //input[0]: scene binary file
- //input[1]: camera
- //input[2]: ni of the expected image
- //input[3]: nj of the expected image
- //input[4]: black background?
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vpgl_camera_double_sptr";
- input_types_[2] = "unsigned";
- input_types_[3] = "unsigned";
- input_types_[4] = "bool";
-
- // process has 2 outputs:
- // output[0]: rendered image
- // output[0]: mask
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "vil_image_view_base_sptr";
- output_types_[1] = "vil_image_view_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_render_expected_rt_process(bprb_func_process& pro)
-{
- using namespace boxm_render_expected_rt_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get the inputs
- unsigned i = 0;
- boxm_scene_base_sptr scene_ptr = pro.get_input<boxm_scene_base_sptr>(i++);
- vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(i++);
- auto ni = pro.get_input<unsigned>(i++);
- auto nj = pro.get_input<unsigned>(i++);
- bool use_black_background = pro.get_input<bool>(i++);
-
- vil_image_view_base_sptr img;
- vil_image_view_base_sptr img_mask;
- // check the scene's app model
- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) {
- vil_image_view<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> expected(ni,nj);
- vil_image_view<float> mask(ni,nj);
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > type;
- auto* scene = dynamic_cast<boxm_scene<type>*> (scene_ptr.as_pointer());
- boxm_render_image_rt<short, boxm_sample<BOXM_APM_MOG_GREY> >(*scene, camera, expected, mask,-1,use_black_background);
- }
- else
- {
- std::cout<<"Ray tracing version not yet implemented"<<std::endl;
- return false;
- }
- img_mask = new vil_image_view<float>(mask);
-
- auto *expected_byte = new vil_image_view<unsigned char>(expected.ni(),expected.nj(),expected.nplanes());
- vil_convert_stretch_range_limited(expected,*expected_byte, 0.0f, 1.0f);
- img = expected_byte;
- } else if (scene_ptr->appearence_model() == BOXM_APM_SIMPLE_GREY) {
- vil_image_view<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> expected(ni,nj);
- vil_image_view<float> mask(ni,nj);
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > type;
- auto* scene = dynamic_cast<boxm_scene<type>*> (scene_ptr.as_pointer());
- boxm_render_image_rt<short, boxm_sample<BOXM_APM_SIMPLE_GREY> >(*scene, camera, expected, mask,-1,use_black_background);
- }
- else
- {
- std::cout<<"Ray tracing version not yet implemented"<<std::endl;
- return false;
- }
- //img = new vil_image_view<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype>(expected);
- img_mask = new vil_image_view<float>(mask);
-
- auto *expected_byte = new vil_image_view<unsigned char>(expected.ni(),expected.nj(),expected.nplanes());
- vil_convert_stretch_range_limited(expected,*expected_byte, 0.0f, 1.0f);
- img = expected_byte;
- } else if (scene_ptr->appearence_model() == BOXM_APM_MOB_GREY) {
- vil_image_view<boxm_apm_traits<BOXM_APM_MOB_GREY>::obs_datatype> expected(ni,nj);
- vil_image_view<float> mask(ni,nj);
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOB_GREY> > type;
- auto* scene = dynamic_cast<boxm_scene<type>*> (scene_ptr.as_pointer());
- boxm_render_image_rt<short, boxm_sample<BOXM_APM_MOB_GREY> >(*scene, camera, expected, mask,-1,use_black_background);
- }
- img_mask = new vil_image_view<float>(mask);
-
- auto *expected_byte = new vil_image_view<unsigned char>(expected.ni(),expected.nj(),expected.nplanes());
- vil_convert_stretch_range_limited(expected,*expected_byte, 0.0f, 1.0f);
- img = expected_byte;
- } else {
- std::cout << "boxm_render_expected_process: undefined APM type" << std::endl;
- return false;
- }
-
- unsigned j = 0;
- pro.set_output_val<vil_image_view_base_sptr>(j++, img);
- pro.set_output_val<vil_image_view_base_sptr>(j++, img_mask);
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_rpc_registration_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_rpc_registration_process.cxx
deleted file mode 100644
index b3c1ee031e..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_rpc_registration_process.cxx
+++ /dev/null
@@ -1,119 +0,0 @@
-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_rpc_registration_process.cxx
-#include <iostream>
-#include <cstdio>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A process for registering the RPC camera based on the edges in the world
-// \author Gamze Tunali
-// \date Feb 1st, 2010
-
-#include <bprb/bprb_parameters.h>
-#include <brdb/brdb_value.h>
-#include <boxm/algo/rt/boxm_rpc_registration.h>
-#include <vil/vil_image_view.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-//: globals
-namespace boxm_rpc_registration_process_globals
-{
- constexpr unsigned n_inputs_ = 8;
- constexpr unsigned n_outputs_ = 1;
-}
-
-//: set input and output types
-bool boxm_rpc_registration_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_rpc_registration_process_globals;
-
- // process takes 8 inputs:
- // input[0]: The scene
- // input[1]: The current camera
- // input[2]: The current edge image
- // input[3]: The expected edge image
- // input[4]: The flag indicating whether to align the 3D voxel world along with image
- // input[5]: Uncertainty in meters
- // input[6]: n_normal
- // input[7]: num_observation
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "boxm_scene_base_sptr";
- input_types_[i++] = "vpgl_camera_double_sptr";
- input_types_[i++] = "vil_image_view_base_sptr";
- input_types_[i++] = "vil_image_view_base_sptr";
- input_types_[i++] = "bool";
- input_types_[i++] = "float";
- input_types_[i++] = "float";
- input_types_[i++] = "unsigned";
-
- // process has 1 output:
- // output[0]: The optimized camera
- std::vector<std::string> output_types_(n_outputs_);
- unsigned j = 0;
- output_types_[j++] = "vpgl_camera_double_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-//: optimizes rpc camera parameters based on edges
-bool boxm_rpc_registration_process(bprb_func_process& pro)
-{
- using namespace boxm_rpc_registration_process_globals;
-
- //check number of inputs
- if ( pro.n_inputs() < n_inputs_ ) {
- std::cout << pro.name() << " The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- // get the inputs
- unsigned i = 0;
-
- // scene
- boxm_scene_base_sptr scene = pro.get_input<boxm_scene_base_sptr>(i++);
-
- // camera
- vpgl_camera_double_sptr camera_inp = pro.get_input<vpgl_camera_double_sptr>(i++);
-
- // image
- vil_image_view_base_sptr edge_image_sptr = pro.get_input<vil_image_view_base_sptr>(i++);
-
- vil_image_view_base_sptr expected_edge_image_sptr = pro.get_input<vil_image_view_base_sptr>(i++);
-
- // boolean parameter specifying the voxel world alignment state
- bool rpc_shift_3d_flag = pro.get_input<bool>(i++);
-
- // uncertainty in meters
- auto uncertainty = pro.get_input<float>(i++);
-
- // n_normal
- auto n_normal = pro.get_input<float>(i++);
-
- // number of observations
- auto num_observation = pro.get_input<unsigned>(i++);
-
- std::string edge_type="subpixel";//pro.get_input<std::string>(i++);
-
- vpgl_camera_double_sptr camera_out;
-
- if (edge_type=="subpixel")
- {
- vil_image_view<float > expected_edge_image(expected_edge_image_sptr);
- vil_image_view<float> edge_image(edge_image_sptr);
- boxm_rpc_registration<short,boxm_inf_line_sample<float> >(scene,edge_image,expected_edge_image,camera_inp, camera_out, rpc_shift_3d_flag,uncertainty, num_observation);
- }
- else {
- vil_image_view<vxl_byte> expected_edge_image(expected_edge_image_sptr);
- vil_image_view<vxl_byte> edge_image(edge_image_sptr);
- boxm_rpc_registration<short,boxm_edge_sample<float> >(scene,edge_image,expected_edge_image,camera_inp, camera_out, rpc_shift_3d_flag,uncertainty,n_normal, num_observation);
- }
-
- // output
- unsigned j = 0;
- // update the camera and store
- pro.set_output_val<vpgl_camera_double_sptr>(j++, camera_out);
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_update_rt_process.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_update_rt_process.cxx
deleted file mode 100644
index 128496aee8..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/processes/boxm_update_rt_process.cxx
+++ /dev/null
@@ -1,136 +0,0 @@
-// This is brl/bseg/boxm/algo/rt/pro/processes/boxm_update_rt_process.cxx
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief Process to update the scene from an image and camera pair
-//
-// \author Gamze Tunali
-// \date Apr 21, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/rt/boxm_update_image_functor.h>
-#include <boxm/boxm_apm_traits.h> // for BOXM_APM_MOG_GREY
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <boxm/sample/algo/boxm_mob_grey_processor.h>
-
-#include <vil/vil_convert.h>
-#include <vil/vil_image_view_base.h>
-#include <vil/vil_image_view.h>
-#include <boxm/sample/boxm_sample.h>
-
-namespace boxm_update_rt_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 0;
-}
-
-bool boxm_update_rt_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_update_rt_process_globals;
-
- // process takes 5 inputs and no output
- //input[0]: The observation image
- //input[1]: The camera of the observation
- //input[2]: The scene
- //input[3]: The bin index to be updated
- //input[4]: Use black background?
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vil_image_view_base_sptr";
- input_types_[1] = "vpgl_camera_double_sptr";
- input_types_[2] = "boxm_scene_base_sptr";
- input_types_[3] = "unsigned";
- input_types_[4] = "bool";
-
- std::vector<std::string> output_types_(n_outputs_);
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_update_rt_process(bprb_func_process& pro)
-{
- using namespace boxm_update_rt_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << "boxm_update_rt_process: The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get inputs:
- unsigned i = 0;
- vil_image_view_base_sptr input_image = pro.get_input<vil_image_view_base_sptr>(i++);
- vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(i++);
- boxm_scene_base_sptr scene = pro.get_input<boxm_scene_base_sptr>(i++);
- /* unsigned bin_index = */ pro.get_input<unsigned>(i++);
- bool use_black_background = pro.get_input<bool>(i++);
-
- // check the input validity
- if ((input_image == nullptr) || (camera == nullptr) || (scene == nullptr)) {
- std::cout << "boxm_update_rt_process: null input value, cannot run" << std::endl;
- return false;
- }
-
- // Mixture of Gaussians
- if (scene->appearence_model() == BOXM_APM_MOG_GREY) {
- auto *img_byte
- = dynamic_cast<vil_image_view<vxl_byte>*>(input_image.ptr());
- vil_image_view<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1);
- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f);
- if (!scene->multi_bin())
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- boxm_update_image_rt<short, boxm_sample<BOXM_APM_MOG_GREY> >(*s, camera,img, use_black_background);
- }
- else
- {
- std::cout<<"Not yet implemented"<<std::endl;
- }
- // Mixture of Beta's
- } else if (scene->appearence_model() == BOXM_APM_MOB_GREY) {
- auto *img_byte
- = dynamic_cast<vil_image_view<vxl_byte>*>(input_image.ptr());
- vil_image_view<boxm_apm_traits<BOXM_APM_MOB_GREY>::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1);
- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f);
- if (!scene->multi_bin())
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOB_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- boxm_update_image_rt<short, boxm_sample<BOXM_APM_MOB_GREY> >(*s, camera,img, use_black_background);
- }
- else
- {
- std::cout<<"Not yet implemented"<<std::endl;
- }
- } else if (scene->appearence_model() == BOXM_APM_SIMPLE_GREY) {
- auto *img_byte
- = dynamic_cast<vil_image_view<vxl_byte>*>(input_image.ptr());
- vil_image_view<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1);
- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f);
- if (!scene->multi_bin())
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- boxm_update_image_rt(*s, camera,img, use_black_background);
- }
- else
- {
- std::cout<<"Not yet implemented"<<std::endl;
- }
- }
- else {
- std::cout << "boxm_update_rt_process: undefined APM type" << std::endl;
- return false;
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/rt/pro/tests/CMakeLists.txt
deleted file mode 100644
index 1b63879e8e..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/tests/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-add_executable( boxm_algo_rt_pro_test_include test_include.cxx )
-target_link_libraries( boxm_algo_rt_pro_test_include boxm_algo_rt_pro)
diff --git a/contrib/brl/bseg/boxm/algo/rt/pro/tests/test_include.cxx b/contrib/brl/bseg/boxm/algo/rt/pro/tests/test_include.cxx
deleted file mode 100644
index f43a3a7286..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/pro/tests/test_include.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/algo/rt/pro/boxm_algo_rt_processes.h>
-#include <boxm/algo/rt/pro/boxm_algo_rt_register.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm/algo/rt/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/rt/tests/CMakeLists.txt
deleted file mode 100644
index 73a8978f93..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/tests/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-add_executable( boxm_algo_rt_test_all
- test_driver.cxx
- test_bayesian_optimizer.cxx
- test_edges.cxx
- test_shadow_appearance.cxx
- )
-
-target_link_libraries( boxm_algo_rt_test_all boxm_algo_rt boxm boxm_util boxm_sample boct ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vpl ${VXL_LIB_PREFIX}vul)
-
-add_test( NAME boxm_algo_rt_test_bayesian_optimizer COMMAND $<TARGET_FILE:boxm_algo_rt_test_all> test_bayesian_optimizer )
-add_test( NAME boxm_algo_rt_test_edges COMMAND $<TARGET_FILE:boxm_algo_rt_test_all> test_edges )
-add_test( NAME boxm_algo_rt_test_shadow_appearance COMMAND $<TARGET_FILE:boxm_algo_rt_test_all> test_shadow_appearance )
-add_executable( boxm_algo_rt_test_include test_include.cxx )
-target_link_libraries( boxm_algo_rt_test_include boxm_algo_rt)
-add_executable( boxm_algo_rt_test_template_include test_template_include.cxx )
-target_link_libraries( boxm_algo_rt_test_template_include boxm_algo_rt)
diff --git a/contrib/brl/bseg/boxm/algo/rt/tests/test_bayesian_optimizer.cxx b/contrib/brl/bseg/boxm/algo/rt/tests/test_bayesian_optimizer.cxx
deleted file mode 100644
index 5ec14a4181..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/tests/test_bayesian_optimizer.cxx
+++ /dev/null
@@ -1,102 +0,0 @@
-#include <testlib/testlib_test.h>
-
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_aux_scene.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/algo/rt/boxm_opt_rt_bayesian_optimizer.h>
-#include <boct/boct_tree.h>
-#include <vul/vul_file.h>
-
-static void test_bayesian_optimizer()
-{
- typedef boxm_sample<BOXM_APM_SIMPLE_GREY> data_type;
- typedef boxm_rt_sample<float> aux_type;
-
- // create the main scene
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(10,10,20);
- vgl_vector_3d<double> block_dim(10,10,10);
- vgl_vector_3d<unsigned> world_dim(1,1,1);
- boxm_scene<boct_tree<short,data_type> > scene(lvcs, origin, block_dim, world_dim);
- scene.set_octree_levels(3,2);
- scene.set_paths("./boxm_scene", "block");
- scene.set_appearance_model(BOXM_APM_SIMPLE_GREY);
- x_write(std::cout, scene, "scene");
- vul_file::make_directory("./boxm_scene");
- scene.write_scene();
- //vsl_b_ofstream os("scene.bin");
- //scene.b_write(os);
- //os.close();
-
- boxm_block_iterator<boct_tree<short,data_type> > iter(&scene);
- // default model
- boxm_simple_grey apm(0.3f, 0.4f, 0.5f);
-
- boxm_sample<BOXM_APM_SIMPLE_GREY> default_sample;
- default_sample.alpha=0.001f;
- default_sample.set_appearance(apm);
-
- // sample 1
- boxm_sample<BOXM_APM_SIMPLE_GREY> s1_sample;
- s1_sample.alpha=0.6f;
- s1_sample.set_appearance(apm);
-
- // sample 2
- boxm_sample<BOXM_APM_SIMPLE_GREY> s2_sample;
- s2_sample.alpha=0.6f;
- s2_sample.set_appearance(apm);
-
- while (!iter.end())
- {
- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z());
- boxm_block<boct_tree<short,data_type> > * block=scene.get_active_block();
- boct_tree<short,data_type> * tree= block->get_tree();//new boct_tree<short,data_type>(3,2);
- boct_tree_cell<short,data_type>* cel11=tree->locate_point(vgl_point_3d<double>(0.01,0.01,0.01));
- cel11->set_data(s2_sample);
- boct_tree_cell<short,data_type>* cell2=tree->locate_point(vgl_point_3d<double>(0.51,0.51,0.01));
- cell2->set_data(s1_sample);
- block->init_tree(tree);
- block->get_tree()->print();
- scene.write_active_block();
- iter++;
- }
-
- // create the auxiliary scenes for each image
- std::vector<std::string> image_names;
- image_names.emplace_back("image1");
- image_names.emplace_back("image2");
- image_names.emplace_back("image3");
- std::vector<boxm_scene<boct_tree<short,aux_type> >*> aux_scenes(image_names.size());
-
- // create aux scenes
- for (unsigned i=0; i<image_names.size(); i++) {
- aux_scenes[i] = new boxm_scene<boct_tree<short,aux_type> >(scene.lvcs(), scene.origin(), scene.block_dim(), scene.world_dim());
- aux_scenes[i]->set_path(scene.path(), image_names[i]);
- iter.begin();
- while (!iter.end()) {
- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z());
- boxm_block<boct_tree<short,data_type> > * block=scene.get_active_block();
- boct_tree<short,data_type>* tree=block->get_tree();
- boct_tree<short,aux_type>* aux_tree = tree->clone_to_type<aux_type>();
- boct_tree_cell<short,aux_type>* cell1=aux_tree->locate_point(vgl_point_3d<double>(0.01,0.01,0.01));
- boxm_rt_sample<float> rt;
- rt.seg_len_=1.0;
- cell1->set_data(rt);
- boct_tree_cell<short,aux_type>* cell2=aux_tree->locate_point(vgl_point_3d<double>(0.51,0.51,0.01));
- rt.seg_len_=0.5;
- cell2->set_data(rt);
- aux_scenes[i]->set_block(iter.index(), new boxm_block<boct_tree<short,aux_type> >(block->bounding_box(), aux_tree));
- aux_scenes[i]->write_active_block();
- ++iter;
- }
- }
-
- boxm_opt_rt_bayesian_optimizer<short,BOXM_APM_SIMPLE_GREY,BOXM_AUX_OPT_RT_GREY> opt(scene, image_names);
- opt.optimize_cells(0.01);
-
- for (unsigned i=0; i<image_names.size(); i++) {
- delete aux_scenes[i];
- }
-}
-
-TESTMAIN(test_bayesian_optimizer);
diff --git a/contrib/brl/bseg/boxm/algo/rt/tests/test_driver.cxx b/contrib/brl/bseg/boxm/algo/rt/tests/test_driver.cxx
deleted file mode 100644
index 7473709bdf..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/tests/test_driver.cxx
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <testlib/testlib_register.h>
-
-DECLARE( test_bayesian_optimizer );
-DECLARE( test_edges );
-DECLARE( test_shadow_appearance );
-
-void register_tests()
-{
- REGISTER( test_bayesian_optimizer );
- REGISTER( test_edges );
- REGISTER( test_shadow_appearance );
-}
-
-
-DEFINE_MAIN;
diff --git a/contrib/brl/bseg/boxm/algo/rt/tests/test_edges.cxx b/contrib/brl/bseg/boxm/algo/rt/tests/test_edges.cxx
deleted file mode 100644
index 6f6a62f9c6..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/tests/test_edges.cxx
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <testlib/testlib_test.h>
-#include <boxm/algo/rt/boxm_edge_tangent_updater.h>
-
-#include <boxm/boxm_scene.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boct/boct_tree.h>
-
-static void test_edges()
-{
- typedef boxm_inf_line_sample<float> data_type;
- // create the main scene
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(10,10,20);
- vgl_vector_3d<double> block_dim(10,10,10);
- vgl_vector_3d<unsigned> world_dim(1,1,1);
- boxm_scene<boct_tree<short,data_type> > scene(lvcs, origin, block_dim, world_dim);
- // create the auxiliary scenes for each image
- std::vector<std::string> image_names;
- image_names.emplace_back("image1");
- image_names.emplace_back("image2");
- image_names.emplace_back("image3");
- //boxm_edge_tangent_updater<short, float, aux_type> u(scene,imgs);
-}
-
-TESTMAIN(test_edges);
diff --git a/contrib/brl/bseg/boxm/algo/rt/tests/test_include.cxx b/contrib/brl/bseg/boxm/algo/rt/tests/test_include.cxx
deleted file mode 100644
index 6b1edbffb5..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/tests/test_include.cxx
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <boxm/algo/rt/boxm_change_3d_functor.h>
-#include <boxm/algo/rt/boxm_change_probability_functor.h>
-#include <boxm/algo/rt/boxm_compute_num_rays_statistics.h>
-#include <boxm/algo/rt/boxm_edge_tangent_updater.h>
-#include <boxm/algo/rt/boxm_edge_updater.h>
-#include <boxm/algo/rt/boxm_expected_edge_functor.h>
-#include <boxm/algo/rt/boxm_generate_edge_sample_functor.h>
-#include <boxm/algo/rt/boxm_generate_edge_tangent_sample_functor.h>
-#include <boxm/algo/rt/boxm_generate_opt2_sample_functor.h>
-#include <boxm/algo/rt/boxm_generate_opt3_sample_functor.h>
-#include <boxm/algo/rt/boxm_generate_opt_sample_functor.h>
-#include <boxm/algo/rt/boxm_generate_shadow_sample_functor.h>
-#include <boxm/algo/rt/boxm_opt2_optimizer.h>
-#include <boxm/algo/rt/boxm_opt3_optimizer.h>
-#include <boxm/algo/rt/boxm_opt_appearance_estimator.h>
-#include <boxm/algo/rt/boxm_opt_rt_bayesian_optimizer.h>
-#include <boxm/algo/rt/boxm_pre_infinity_functor.h>
-#include <boxm/algo/rt/boxm_render_expected_depth_functor.h>
-#include <boxm/algo/rt/boxm_render_expected_edge_image_functor.h>
-#include <boxm/algo/rt/boxm_render_expected_edge_tangent_image_functor.h>
-#include <boxm/algo/rt/boxm_render_expected_image_functor.h>
-#include <boxm/algo/rt/boxm_render_expected_shadow_image_functor.h>
-#include <boxm/algo/rt/boxm_rpc_registration.h>
-#include <boxm/algo/rt/boxm_shadow_app_initializer.h>
-#include <boxm/algo/rt/boxm_shadow_appearance_estimator.h>
-#include <boxm/algo/rt/boxm_shadow_bayes_optimizer.h>
-#include <boxm/algo/rt/boxm_sun_vis_prob_functor.h>
-#include <boxm/algo/rt/boxm_update_image_functor.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm/algo/rt/tests/test_shadow_appearance.cxx b/contrib/brl/bseg/boxm/algo/rt/tests/test_shadow_appearance.cxx
deleted file mode 100644
index f97877bc43..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/tests/test_shadow_appearance.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-#include <testlib/testlib_test.h>
-
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/algo/rt/boxm_shadow_appearance_estimator.h>
-#include <boct/boct_tree.h>
-#include <boxm/algo/rt/boxm_shadow_app_initializer.h>
-
-namespace test_shadow_appearance_globals
-{
- typedef boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype obs_type;
- typedef boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype app_type;
-}
-
-
-static void test_shadow_appearance()
-{
- using namespace test_shadow_appearance_globals;
- //normalized observations square building (I-A)/(mu+ - A), partly in shadow
- double obs_arr[] = {0.600555,0.7,0.061111,0.748335,0.77611,0.68611,
- 0.148889,0.855555,0.664445,0.651665,0.101111,
- 0.0272222,0.67278,0.70389,0.1733335,0.77111,
- 0.701665,0.64778,0.65111,0.72611,0.82889,0.735,
- 0.077222,0.0816665,0.051111,0.71722,0.61722,
- 0.065,0.095,0.0866665,0.58611,0.665555};
- std::vector<obs_type> obs;
- std::vector<float> pre, vis;
- for (double i : obs_arr) {
- obs.push_back(static_cast<obs_type>(i));
- pre.push_back(0.0f);
- vis.push_back(1.0f);
- }
- float min_app_sigma = 0.05f;
- float shadow_prior = 0.5f;
- float shadow_mean = 0.0f;
- float shadow_sigma = 0.05f;
- bool verbose = true;
- app_type model;
- boxm_compute_shadow_appearance<BOXM_APM_SIMPLE_GREY>(obs, pre, vis,
- model,
- min_app_sigma,
- shadow_prior,
- shadow_mean,
- shadow_sigma,
- verbose);
- double er = std::fabs(0.70034355-model.color())+
- std::fabs(model.sigma()- 1.0/11.954589);
- TEST_NEAR("test shadow appearance EM", er, 0.0, 1e-6);
- // normalized observations for dark road surface
-double dark_obs_arr[] ={0.0477778,0.0666665,0.0072222,0.175,0.12,
- 0.162778,0.003333335,0.188889,0.233889,
- 0.0605555,0.0077778,0.004444445,0.0883335,
- 0.15,0.0716665,0.1233335,0.1983335,0.15,
- 0.0883335,0.03944445,0.122222,0.125,0.25,
- 0.005,0.0122222,0.1,0.1166665,0.03166665,
- 0.015,0.01,0.1016665,0.167222};
- std::vector<obs_type> dark_obs;
- for (double i : dark_obs_arr)
- dark_obs.push_back(static_cast<obs_type>(i));
- app_type dark_model;
- boxm_compute_shadow_appearance<BOXM_APM_SIMPLE_GREY>(dark_obs, pre, vis,
- dark_model,
- min_app_sigma,
- shadow_prior,
- shadow_mean,
- shadow_sigma,
- verbose);
- double dark_er = std::fabs(0.14765342-dark_model.color())
- + std::fabs(dark_model.sigma()- 1.0/16.097824);
- TEST_NEAR("test dark surface shadow appearance EM", dark_er, 0.0, 1e-6);
-}
-
-TESTMAIN(test_shadow_appearance);
diff --git a/contrib/brl/bseg/boxm/algo/rt/tests/test_template_include.cxx b/contrib/brl/bseg/boxm/algo/rt/tests/test_template_include.cxx
deleted file mode 100644
index 03c12cb61b..0000000000
--- a/contrib/brl/bseg/boxm/algo/rt/tests/test_template_include.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <boxm/algo/rt/boxm_edge_tangent_updater.hxx>
-#include <boxm/algo/rt/boxm_edge_updater.hxx>
-#include <boxm/algo/rt/boxm_opt2_optimizer.hxx>
-#include <boxm/algo/rt/boxm_opt3_optimizer.hxx>
-#include <boxm/algo/rt/boxm_opt_rt_bayesian_optimizer.hxx>
-#include <boxm/algo/rt/boxm_shadow_app_initializer.hxx>
-#include <boxm/algo/rt/boxm_shadow_bayes_optimizer.hxx>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm/algo/sp/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/sp/CMakeLists.txt
deleted file mode 100644
index 16a9fc1839..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-# brl/bseg/boxm/algo/CMakeLists.txt
-include_directories( ${MUL_INCLUDE_DIR} )
-set(boxm_algo_sp_sources
- boxm_compute_volume_visibility.h
- boxm_depth_image_triangle.h
- boxm_render_image.h
- boxm_render_image_triangle.h
- boxm_update.h
- boxm_update_triangle.h
- dummy.cxx
- )
-
-vxl_add_library(LIBRARY_NAME boxm_algo_sp LIBRARY_SOURCES ${boxm_algo_sp_sources})
-
-#processes
-add_subdirectory(pro)
-
-if( BUILD_TESTING )
- add_subdirectory(tests)
-endif()
-
-target_link_libraries(boxm_algo_sp boxm boxm_util boxm_sample boxm_sample_algo boxm_basic bsta imesh ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vcl)
diff --git a/contrib/brl/bseg/boxm/algo/sp/boxm_compute_volume_visibility.h b/contrib/brl/bseg/boxm/algo/sp/boxm_compute_volume_visibility.h
deleted file mode 100644
index 1f1bbbd6c9..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/boxm_compute_volume_visibility.h
+++ /dev/null
@@ -1,172 +0,0 @@
-#ifndef boxm_compute_volume_visibility_h
-#define boxm_compute_volume_visibility_h
-#include <iostream>
-#include <vgl/vgl_box_3d.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/util/boxm_utils.h>
-#include <vpgl/vpgl_perspective_camera.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <class T_loc, class T_data>
-float boxm_compute_point_visibility(vgl_point_3d<double> point,
- boxm_scene<boct_tree<T_loc, T_data > > & scene,
- vpgl_camera_double_sptr & camera )
-{
- typedef boct_tree<T_loc,T_data > tree_type;
- // locate the cells corresponding to query volume.
- if (camera->type_name().compare("vpgl_perspective_camera")==0) {
- // make a test for vertices for behind-front case
- vpgl_perspective_camera<double>* cam = static_cast<vpgl_perspective_camera<double>*>(camera.ptr());
-
- std::cout<<"The point is "<<point;
- if (cam->is_behind_camera(vgl_homg_point_3d<double>(point)))
- return 1.0f;
- // first block of intersection
-
- // case 1 : when the camera lies inside the scene
- vgl_homg_point_3d<double> cam_center_homg = cam->camera_center();
- vgl_point_3d<double> cam_center(cam_center_homg);
- vgl_point_3d<int> curr_block_index;
-
- vgl_vector_3d<double> dir=(point-cam_center);
- double lambda0=dir.length();
- dir/=lambda0;
-
- boxm_block<tree_type> * curr_block=scene.get_block(cam_center);
- vgl_point_3d<double> entry_point=cam_center;
- double lambda=0;
-
- // case 2: camera lies outside the scene
- if (!curr_block)
- {
- vgl_box_3d<double> world_bb=scene.get_world_bbox();
- boct_face_idx face_id;
- if (!boxm_utils::cube_entry_point(world_bb,cam_center,dir,entry_point,lambda,face_id))
- return 1.0f;
- if (!scene.get_block_index(entry_point,curr_block_index))
- return 1.0f;
- }
- else
- {
- scene.get_block_index(cam_center,curr_block_index);
- }
-
- scene.load_block(curr_block_index);
- curr_block=scene.get_active_block();
- bool continue_flag=true;
-
- tree_type * tree=curr_block->get_tree();
-
- vgl_point_3d<double> exit_point;
- boct_face_idx face_id=NONE;
- double alpha_int=0;
- boct_tree_cell<T_loc,T_data > * curr_cell=tree->locate_point_global(entry_point);
- while (continue_flag)
- {
- // do processing in the block
- if (curr_cell)
- {
- if (boxm_utils::cube_exit_point(tree->cell_bounding_box(curr_cell),
- cam_center,dir,exit_point,lambda,face_id))
- {
- if (lambda>lambda0)
- continue_flag=false;
- else
- {
- std::vector<boct_tree_cell<T_loc,T_data > * > neighbors;
- curr_cell->find_neighbors(face_id,neighbors,tree->root_level());
-
- vgl_vector_3d<double> len(exit_point-entry_point);
- T_data data=curr_cell->data();
- alpha_int-=data.alpha*len.length();
- curr_cell=nullptr;
-#if 0
- std::cout<<"Lambda= "<<lambda<<" lambda0= "<<lambda0
- <<" exit_point="<<exit_point<<"# of neighbors"<< neighbors.size()<<std::endl;
-#endif
- double min_dist=1e5;
- int min_i=-1;
- for (unsigned i=0;i<neighbors.size();++i)
- {
- vgl_box_3d<double> bbox=tree->cell_bounding_box(neighbors[i]);
- double dist=0;
- if (exit_point.x()<bbox.min_x())
- dist+=std::fabs(exit_point.x()-bbox.min_x());
- if (exit_point.x()>bbox.max_x())
- dist+=std::fabs(exit_point.x()-bbox.max_x());
- if (exit_point.y()<bbox.min_y())
- dist+=std::fabs(exit_point.y()-bbox.min_y());
- if (exit_point.y()>bbox.max_y())
- dist+=std::fabs(exit_point.y()-bbox.max_y());
- if (exit_point.z()<bbox.min_z())
- dist+=std::fabs(exit_point.z()-bbox.min_z());
- if (exit_point.z()>bbox.max_z())
- dist+=std::fabs(exit_point.z()-bbox.max_z());
-
- if (dist<min_dist)
- {
- min_dist=dist;
- min_i=i;
- }
- }
- if (min_i>=0)
- curr_cell=neighbors[min_i];
- else if (neighbors.size()>0)
- {
- std::cout<<"ERROR"<<std::endl;return -1.0f;
- }
- entry_point=exit_point;
- }
- }
- }
- // when the block is exhausted obtain a new block
- else
- {
- if (face_id==X_LOW)
- curr_block_index.set(curr_block_index.x()-1,curr_block_index.y(),curr_block_index.z());
- if (face_id==X_HIGH)
- curr_block_index.set(curr_block_index.x()+1,curr_block_index.y(),curr_block_index.z());
- if (face_id==Y_LOW)
- curr_block_index.set(curr_block_index.x(),curr_block_index.y()-1,curr_block_index.z());
- if (face_id==Y_HIGH)
- curr_block_index.set(curr_block_index.x(),curr_block_index.y()+1,curr_block_index.z());
- if (face_id==Z_LOW)
- curr_block_index.set(curr_block_index.x(),curr_block_index.y(),curr_block_index.z()-1);
- if (face_id==Z_HIGH)
- curr_block_index.set(curr_block_index.x(),curr_block_index.y(),curr_block_index.z()+1);
-
- if (scene.valid_index(curr_block_index))
- {
- scene.load_block(curr_block_index);
- curr_block=scene.get_active_block();
- tree=curr_block->get_tree();
- curr_cell=tree->locate_point_global(entry_point);
- }
- else
- {
- continue_flag=false;
- }
- }
- }
- return (float)std::exp(alpha_int);
- }
- else
- {
- std::cout<<"Not a perspective camera"<<std::endl;
- return -1.0f;
- }
-}
-
-
-template <class T_loc, class T_data>
-float boxm_compute_volume_visibility(vgl_box_3d<double> bbox,
- boxm_scene<boct_tree<T_loc,T_data> > & scene,
- vpgl_camera_double_sptr & cam )
-{
- // locate the cells corresponding to query volume.
- return boxm_compute_point_visibility<T_loc,T_data>(bbox.centroid(),scene,cam);
-}
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/sp/boxm_depth_image_triangle.h b/contrib/brl/bseg/boxm/algo/sp/boxm_depth_image_triangle.h
deleted file mode 100644
index bb07d38325..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/boxm_depth_image_triangle.h
+++ /dev/null
@@ -1,127 +0,0 @@
-#ifndef boxm_depth_image_triangle_h_
-#define boxm_depth_image_triangle_h_
-//:
-// \file
-#include <vector>
-#include <iostream>
-#include "boxm_render_image.h"
-#include <boct/boct_tree.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/util/boxm_utils.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/basic/boxm_block_vis_graph_iterator.h>
-#include <boxm/basic/boxm_cell_vis_graph_iterator.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/util/boxm_raytrace_operations.h>
-#include <boxm/util/boxm_rational_camera_utils.h>
-#include <vpgl/vpgl_camera.h>
-
-#include <vil/vil_image_view.h>
-#include <vil/vil_math.h>
-#include <vil/vil_transform.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vul/vul_timer.h>
-
-
-template <class T_loc, class T_data>
-void boxm_depth_image_splatting_triangle(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<float> &expected,
- vil_image_view<float> &mask)
-{
- unsigned ni=expected.ni();
- unsigned nj=expected.nj();
- expected.fill(0.0f);
- vgl_plane_3d<double> projection_plane;
- typedef boct_tree<T_loc, T_data> tree_type;
- typedef boct_tree_cell<T_loc, T_data> cell_type;
- vil_image_view<float> vis(expected.ni(),expected.nj(),1);
- vis.fill(1.0f);
- vil_image_view<float> alpha_integral(expected.ni(),expected.nj(),1); alpha_integral.fill(0.0f);
- vil_image_view<float> alpha_img_(expected.ni(),expected.nj(),1);
- vul_timer t;
- // code to iterate over the blocks in order of visibility
- boxm_block_vis_graph_iterator<boct_tree<T_loc, T_data > >
- block_vis_iter(cam, &scene, expected.ni(), expected.nj());
-
- while (block_vis_iter.next())
- {
- std::vector<vgl_point_3d<int> > block_indices = block_vis_iter.frontier_indices();
- for (auto & block_indice : block_indices) // code for each block
- {
- t.mark();
- scene.load_block(block_indice.x(),block_indice.y(),block_indice.z());
- std::cout<<"The time taken to read a block is "<<t.all()<<std::endl;
- boxm_block<tree_type> * curr_block=scene.get_active_block();
- t.mark();
- // project vertices to the image determine which faces of the cell are visible
- boxm_cell_vis_graph_iterator<T_loc, T_data > frontier_it(cam,curr_block->get_tree(),ni,nj);
- std::cout<<"The time taken to build the vis graph is "<<t.all()<<std::endl;
-
- // for each frontier layer of each block
- tree_type * tree=curr_block->get_tree();
- vil_image_view<float> vis_end(expected.ni(),expected.nj(),1);
- vil_image_view<float> temp_depth(expected.ni(),expected.nj(),1);
- vil_image_view<float> temp_weights(expected.ni(),expected.nj(),1);
- vil_image_view<float> pix_weights_(expected.ni(),expected.nj(),1);
- normalize_expected_functor norm_fn;
-
- double xverts[8];
- double yverts[8];
- float vertdists[8];
- while (frontier_it.next())
- {
- std::vector<cell_type *> vis_cells=frontier_it.frontier();
- typename std::vector<cell_type *>::iterator cell_it=vis_cells.begin();
- vis_end.fill(0.0f);
- temp_depth.fill(0.0f);
- temp_weights.fill(0.0f);
- alpha_img_.fill(0.0f);
-
- std::cout<<'.';
-
- for (;cell_it!=vis_cells.end();cell_it++)
- {
- // for each cell
- T_data sample=(*cell_it)->data();
- //if (sample.alpha>0.001)
- {
- // get vertices of cell in the form of a bounding box (cells are always axis-aligned))
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(*cell_it);
- std::vector<vgl_point_3d<double> > corners=boxm_utils::corners_of_box_3d(cell_bb);
- if (dynamic_cast<vpgl_perspective_camera<double> *>(cam.ptr()))
- boxm_utils::project_corners(corners,cam,xverts,yverts,vertdists);
- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts);
- // get alpha
- boxm_alpha_seg_len(xverts, yverts, vertdists, vis_face_ids, sample.alpha, alpha_img_);
- boxm_depth_fill(xverts, yverts, vertdists, vis_face_ids,temp_depth);
- }
- }
- abs_functor abs_fun;
- vil_transform(alpha_img_,alpha_img_,abs_fun);
-
- // compute visibility
- vil_math_image_difference(alpha_integral, alpha_img_, alpha_integral);
- // compute new vis image
- image_exp_functor exp_fun;
- vil_transform(alpha_integral,vis_end,exp_fun);
- // compute weights for each pixel
- vil_math_image_difference(vis,vis_end,pix_weights_);
-
- // scale cell expected image by weighting function..
- vil_math_image_product( temp_depth,pix_weights_, temp_depth);
- // ..and use result to update final expected image
- vil_math_image_sum(temp_depth,expected,expected);
-
- vis.deep_copy(vis_end);
- }
- }
- }
- std::cout<<"\nThe time taken is"<< t.all()<<std::endl;
- return;
-}
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/sp/boxm_render_image.h b/contrib/brl/bseg/boxm/algo/sp/boxm_render_image.h
deleted file mode 100644
index d6cd56258c..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/boxm_render_image.h
+++ /dev/null
@@ -1,166 +0,0 @@
-#ifndef boxm_render_image_h_
-#define boxm_render_image_h_
-
-#include <vector>
-#include <sstream>
-#include <iostream>
-
-#include <boct/boct_tree.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/util/boxm_utils.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/basic/boxm_block_vis_graph_iterator.h>
-#include <boxm/basic/boxm_cell_vis_graph_iterator.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <vpgl/vpgl_camera_double_sptr.h>
-
-#include <vil/vil_image_view.h>
-#include <vil/vil_math.h>
-#include <vil/vil_transform.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vul/vul_timer.h>
-
-class normalize_expected_functor
-{
- public:
- normalize_expected_functor() = default;
-
- void operator()(float norm, float & val) const
- {
- if (norm>0)
- val/=norm;
- }
-};
-
-class image_exp_functor
-{
- public:
- float operator()(float x) const { return x<0?std::exp(x):1.0f; }
-};
-
-
-template <class T_loc, class T_data>
-void boxm_render_image_splatting(boxm_scene<boct_tree<T_loc,T_data> >& scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<typename T_data::obs_datatype>& expected,
- vil_image_view<float>& /*mask*/, // TODO: use this param
- int bin=-1,
- bool /*use_black_background*/ = false) // TODO: use this param
-{
- unsigned ni=expected.ni();
- unsigned nj=expected.nj();
- expected.fill(0.0f);
-
- typedef boct_tree<T_loc, T_data> tree_type;
- typedef boct_tree_cell<T_loc, T_data> cell_type;
- vil_image_view<float> vis(expected.ni(),expected.nj(),1);
- vis.fill(1.0f);
- vil_image_view<float> alpha_integral(expected.ni(),expected.nj(),1); alpha_integral.fill(0.0f);
-
- vul_timer t;
- // code to iterate over the blocks in order of visibility
- boxm_block_vis_graph_iterator<boct_tree<T_loc, T_data > >
- block_vis_iter(cam, &scene, expected.ni(), expected.nj());
-
- int cnt=0;
- while (block_vis_iter.next()) {
- std::vector<vgl_point_3d<int> > block_indices = block_vis_iter.frontier_indices();
- for (auto & block_indice : block_indices) { // code for each block
-
- t.mark();
- scene.load_block(block_indice.x(),block_indice.y(),block_indice.z());
- std::cout<<"The time taken to read a block is "<<t.all()<<std::endl;
-
- boxm_block<tree_type> * curr_block=scene.get_active_block();
- std::cout<<"Block: "<<curr_block->bounding_box()<<std::endl
- <<"Tree: "<<curr_block->get_tree()->number_levels()
- << " #of leaf cells "<<curr_block->get_tree()->leaf_cells().size()<<std::endl;
-
- t.mark();
- // project vertices to the image determine which faces of the cell are visible
- boxm_cell_vis_graph_iterator<T_loc, T_data > frontier_it(cam,curr_block->get_tree(),ni,nj);
- std::cout<<"The time taken to build the vis graph is "<<t.all()<<std::endl;
-
- // for each frontier layer of each block
- tree_type * tree=curr_block->get_tree();
- vil_image_view<float> front_xyz(expected.ni(),expected.nj(),3);
- vil_image_view<float> back_xyz(expected.ni(),expected.nj(),3);
- vil_image_view<float> alphas(expected.ni(),expected.nj(),1);
- vil_image_view<float> vis_end(expected.ni(),expected.nj(),1);
- vil_image_view<float> temp_expected(expected.ni(),expected.nj(),1);
- vil_image_view<float> temp_weights(expected.ni(),expected.nj(),1);
- normalize_expected_functor norm_fn;
-
- double xverts[8];
- double yverts[8];
-
- while (frontier_it.next())
- {
- std::vector<cell_type *> vis_cells=frontier_it.frontier();
- typename std::vector<cell_type *>::iterator cell_it=vis_cells.begin();
- front_xyz.fill(0.0f);
- back_xyz.fill(0.0f);
- alphas.fill(0.0f);
- vis_end.fill(0.0f);
- temp_expected.fill(0.0f);
- temp_weights.fill(0.0f);
- std::cout<<'.';
- for (;cell_it!=vis_cells.end();cell_it++)
- {
- // for each cell
- T_data sample=(*cell_it)->data();
- //if (sample.alpha>0.001)
- {
- // get vertices of cell in the form of a bounding box (cells are always axis-aligned))
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(*cell_it);
- std::vector<vgl_point_3d<double> > corners=boxm_utils::corners_of_box_3d(cell_bb);
- boxm_utils::project_corners(corners,cam,xverts,yverts);
- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts);
- boxm_utils::project_cube_xyz(corners,vis_face_ids,front_xyz,back_xyz,xverts,yverts);
- // get expected color of cell
- typename T_data::obs_datatype cell_expected =T_data::apm_processor::expected_color(sample.appearance(bin));
- // get alpha
- boxm_utils::project_cube_fill_val( vis_face_ids,alphas,sample.alpha, xverts,yverts);
- // fill expected value image
- //boxm_utils::project_cube_fill_val( vis_face_ids,temp_expected,(float)cell_expected, xverts,yverts);
- boxm_utils::project_cube_fill_val_aa( vis_face_ids,temp_expected,temp_weights,(float)cell_expected, xverts,yverts);
- }
- }
- // compute the length of ray segment at each pixel
- vil_image_view<float> len_seg(expected.ni(),expected.nj(),1);
-
- len_seg.fill(0.0f);
- std::stringstream s,s1;
-
- vil_math_image_difference<float,float>(back_xyz,front_xyz,back_xyz);
- vil_math_sum_sqr<float,float>(back_xyz,len_seg);
- vil_math_sqrt<float>(len_seg);
- vil_math_image_product(len_seg,alphas, alphas);
- vil_transform2(temp_weights,temp_expected,norm_fn);
- ++cnt;
-
- // compute visibility
- vil_math_image_difference(alpha_integral, alphas, alpha_integral);
- // compute new vis image
- image_exp_functor exp_fun;
- vil_transform(alpha_integral,vis_end,exp_fun);
- // compute weights for each pixel
- vil_math_image_difference(vis,vis_end,vis);
- // scale cell expected image by weighting function..
- vil_math_image_product( temp_expected,vis, temp_expected);
- // ..and use result to update final expected image
- vil_math_image_sum(temp_expected,expected,expected);
-
- vis.deep_copy(vis_end);
- }
- scene.write_active_block();
- }
- }
- std::cout<<"\nThe time taken is"<< t.all()<<std::endl;
- return;
-}
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/sp/boxm_render_image_triangle.h b/contrib/brl/bseg/boxm/algo/sp/boxm_render_image_triangle.h
deleted file mode 100644
index abcca0dbe5..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/boxm_render_image_triangle.h
+++ /dev/null
@@ -1,167 +0,0 @@
-#ifndef boxm_render_image_triangle_h_
-#define boxm_render_image_triangle_h_
-//:
-// \file
-#include <vector>
-#include <iostream>
-#include "boxm_render_image.h"
-#include <boct/boct_tree.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/util/boxm_utils.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/basic/boxm_block_vis_graph_iterator.h>
-#include <boxm/basic/boxm_cell_vis_graph_iterator.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/util/boxm_raytrace_operations.h>
-#include <boxm/util/boxm_rational_camera_utils.h>
-#include <vpgl/vpgl_perspective_camera.h>
-
-#include <vil/vil_image_view.h>
-#include <vil/vil_math.h>
-#include <vil/vil_transform.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vul/vul_timer.h>
-
-
-//: Functor class to normalize expected image
-template<class T_data>
-class normalize_expected_functor_splatting
-{
- public:
- normalize_expected_functor_splatting(bool use_black_background) : use_black_background_(use_black_background) {}
-
- void operator()(float mask, typename T_data::obs_datatype &pix) const
- {
- if (!use_black_background_) {
- pix += mask*0.5f;
- }
- }
- bool use_black_background_;
-};
-
-template <class T_loc, class T_data>
-void boxm_render_image_splatting_triangle(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<typename T_data::obs_datatype> &expected,
- vil_image_view<float> &/*mask*/, // FIXME: use this param
- int bin=-1,
- bool use_black_background = false)
-{
- unsigned ni=expected.ni();
- unsigned nj=expected.nj();
- expected.fill(0.0f);
- vgl_plane_3d<double> projection_plane;
- if (vpgl_rational_camera<double> * rcam = dynamic_cast<vpgl_rational_camera<double> *>(cam.ptr())) {
- vgl_box_3d<double> bbox=scene.get_world_bbox();
- vgl_plane_3d<double> top(0,0,1,-bbox.max_z());
- vgl_plane_3d<double> bottom(0,0,1,-bbox.min_z());
- projection_plane=boxm_rational_camera_utils::boxm_find_parallel_image_plane(rcam, top, bottom,expected.ni(),expected.nj());
- }
- typedef boct_tree<T_loc, T_data> tree_type;
- typedef boct_tree_cell<T_loc, T_data> cell_type;
- vil_image_view<float> vis(expected.ni(),expected.nj(),1);
- vis.fill(1.0f);
- vil_image_view<float> alpha_integral(expected.ni(),expected.nj(),1); alpha_integral.fill(0.0f);
- vil_image_view<float> alpha_img_(expected.ni(),expected.nj(),1);
- vul_timer t;
- // code to iterate over the blocks in order of visibility
- boxm_block_vis_graph_iterator<boct_tree<T_loc, T_data > >
- block_vis_iter(cam, &scene, expected.ni(), expected.nj());
-
- while (block_vis_iter.next())
- {
- std::vector<vgl_point_3d<int> > block_indices = block_vis_iter.frontier_indices();
- for (auto & block_indice : block_indices) // code for each block
- {
- t.mark();
- //if (block_indices[i].x()!=2 || block_indices[i].z()!=0)
- // continue;
- scene.load_block(block_indice.x(),block_indice.y(),block_indice.z());
- std::cout<<"The time taken to read a block is "<<t.all()<<std::endl;
- boxm_block<tree_type> * curr_block=scene.get_active_block();
- t.mark();
- // project vertices to the image determine which faces of the cell are visible
- boxm_cell_vis_graph_iterator<T_loc, T_data > frontier_it(cam,curr_block->get_tree(),ni,nj);
- std::cout<<"The time taken to build the vis graph is "<<t.all()<<std::endl;
-
- // for each frontier layer of each block
- tree_type * tree=curr_block->get_tree();
- vil_image_view<float> vis_end(expected.ni(),expected.nj(),1);
- vil_image_view<float> temp_expected(expected.ni(),expected.nj(),1);
- vil_image_view<float> temp_weights(expected.ni(),expected.nj(),1);
- vil_image_view<float> pix_weights_(expected.ni(),expected.nj(),1);
- normalize_expected_functor norm_fn;
-
- double xverts[8];
- double yverts[8];
- float vertdists[8];
- while (frontier_it.next())
- {
- std::vector<cell_type *> vis_cells=frontier_it.frontier();
- typename std::vector<cell_type *>::iterator cell_it=vis_cells.begin();
- vis_end.fill(0.0f);
- temp_expected.fill(0.0f);
- temp_weights.fill(0.0f);
- alpha_img_.fill(0.0f);
-
- std::cout<<'.';
-
- for (;cell_it!=vis_cells.end();cell_it++)
- {
- // for each cell
- T_data sample=(*cell_it)->data();
- //if (sample.alpha>0.001)
- {
- // get vertices of cell in the form of a bounding box (cells are always axis-aligned))
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(*cell_it);
- std::vector<vgl_point_3d<double> > corners=boxm_utils::corners_of_box_3d(cell_bb);
- if (dynamic_cast<vpgl_perspective_camera<double> *>(cam.ptr()))
- {
- boxm_utils::project_corners(corners,cam,xverts,yverts,vertdists);
- }
- else if (vpgl_rational_camera<double> * rcam = dynamic_cast<vpgl_rational_camera<double> *>(cam.ptr())) {
- boxm_rational_camera_utils::project_corners_rational_camera(corners,rcam,projection_plane,xverts,yverts,vertdists);
- }
- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts);
- //boxm_utils::project_cube_xyz(corners,vis_face_ids,front_xyz,back_xyz,xverts,yverts);
- // get expected color of cell
- typename T_data::obs_datatype cell_expected =T_data::apm_processor::expected_color(sample.appearance(bin));
- // get alpha
- boxm_alpha_seg_len(xverts, yverts, vertdists, vis_face_ids, sample.alpha, alpha_img_);
-
- cube_fill_value(xverts, yverts, vis_face_ids, temp_expected, cell_expected); // fill expected value image
- //boxm_utils::project_cube_fill_val( vis_face_ids,temp_expected,(float)cell_expected, xverts,yverts);
- //boxm_utils::project_cube_fill_val_aa( vis_face_ids,temp_expected,temp_weights,(float)cell_expected, xverts,yverts);
- }
- }
- abs_functor abs_fun;
- vil_transform(alpha_img_,alpha_img_,abs_fun);
-
- // compute visibility
- vil_math_image_difference(alpha_integral, alpha_img_, alpha_integral);
- // compute new vis image
- image_exp_functor exp_fun;
- vil_transform(alpha_integral,vis_end,exp_fun);
- // compute weights for each pixel
- vil_math_image_difference(vis,vis_end,pix_weights_);
-
- // scale cell expected image by weighting function..
- vil_math_image_product( temp_expected,pix_weights_, temp_expected);
- // ..and use result to update final expected image
- vil_math_image_sum(temp_expected,expected,expected);
-
- vis.deep_copy(vis_end);
- }
- }
- }
- normalize_expected_functor_splatting<T_data> norm_fn(use_black_background);
- vil_transform2<float,typename T_data::obs_datatype, normalize_expected_functor_splatting<T_data> >(vis,expected,norm_fn);
-
- std::cout<<"\nThe time taken is"<< t.all()<<std::endl;
- return;
-}
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/sp/boxm_update.h b/contrib/brl/bseg/boxm/algo/sp/boxm_update.h
deleted file mode 100644
index 9642cdd4c1..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/boxm_update.h
+++ /dev/null
@@ -1,374 +0,0 @@
-#ifndef boxm_update_h_
-#define boxm_update_h_
-//:
-//\file
-#include <iostream>
-#include "boxm_render_image.h"
-#include <boct/boct_tree.h>
-#include <boct/boct_tree_cell.h>
-#include <boxm/util/boxm_utils.h>
-#include <boxm/boxm_block.h>
-#include <boxm/basic/boxm_cell_vis_graph_iterator.h>
-#include <boxm/basic/boxm_block_vis_graph_iterator.h>
-#include <boxm/util/boxm_rational_camera_utils.h>
-#include <vil/vil_math.h>
-#include <vil/vil_save.h>
-#include <vul/vul_timer.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-//: functor used for normalizing cell_expected image
-template <class T_loc, class T_data>
-void boxm_update_pass1(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<typename T_data::obs_mathtype> &img,
- vil_image_view<float> &norm_img,
- typename T_data::apm_datatype background_model, int bin)
-{
- typedef boct_tree<T_loc, T_data> tree_type;
- typedef boct_tree_cell<T_loc, T_data> cell_type;
- unsigned ni=img.ni();
- unsigned nj=img.nj();
- double xverts[8];
- double yverts[8];
- float vertdists[8];
-
- vil_image_view<float> pre(ni,nj,1); pre.fill(0.0f);
- vil_image_view<float> vis(ni,nj,1); vis.fill(1.0f);
- vil_image_view<float> alpha_integral(ni,nj,1); alpha_integral.fill(0.0f);
- vil_image_view<float> PI_img(ni,nj,1); PI_img.fill(0.0f);
-
-#if 0 // TODO: vgl_plane_3d<double> has no constructor with 3 double params....???!!!
- // and projection_plane is unused ..!!
- if (vpgl_rational_camera<double> const* rcam = dynamic_cast<vpgl_rational_camera<double> const*>(cam.as_pointer())) {
- vgl_box_3d<double> bbox=scene.get_world_bbox();
- vgl_plane_3d<double> top(bbox.min_x(),bbox.min_y(),bbox.max_z());
- vgl_plane_3d<double> bottom(bbox.min_x(),bbox.min_y(),bbox.min_z());
- vgl_plane_3d<double> projection_plane=boxm_rational_camera_utils::boxm_find_parallel_image_plane(rcam, top, bottom,img.ni(),img.nj());
- }
-#endif // 0
- // code to iterate over the blocks in order of visibility
- boxm_block_vis_graph_iterator<boct_tree<T_loc, T_data > > block_vis_iter(cam, &scene, ni,nj);
- while (block_vis_iter.next()) {
- std::vector<vgl_point_3d<int> > block_indices = block_vis_iter.frontier_indices();
- for (auto & block_indice : block_indices) { // code for each block
- scene.load_block(block_indice.x(),block_indice.y(),block_indice.z());
- boxm_block<tree_type> * curr_block=scene.get_active_block();
- // project vertices to the image determine which faces of the cell are visible
- boxm_cell_vis_graph_iterator<T_loc,T_data > frontier_it(cam,curr_block->get_tree(),ni,nj);
-
- // for each frontier layer of each block
- tree_type * tree=curr_block->get_tree();
- vil_image_view<float> front_xyz(ni,nj,1);
- vil_image_view<float> back_xyz(ni,nj,1);
- vil_image_view<float> alphas(ni,nj,1);
- vil_image_view<float> vis_end(ni,nj,1);
- vil_image_view<float> temp_expected(ni,nj,1);
- int cnt=0;
- while (frontier_it.next())
- {
- ++cnt;
- std::vector<cell_type *> vis_cells=frontier_it.frontier();
- typename std::vector<cell_type *>::iterator cell_it=vis_cells.begin();
- front_xyz.fill(0.0f);
- back_xyz.fill(0.0f);
- alphas.fill(0.0f);
- vis_end.fill(0.0f);
- temp_expected.fill(0.0f);
- PI_img.fill(0.0f);
- std::cout<<cnt<<' ';
- for (;cell_it!=vis_cells.end();cell_it++)
- {
- // for each cell
- T_data sample=(*cell_it)->data();
- // get vertices of cell in the form of a bounding box (cells are always axis-aligned))
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(*cell_it);
- std::vector<vgl_point_3d<double> > corners=boxm_utils::corners_of_box_3d(cell_bb);
- if (vpgl_camera_double_sptr pcam = dynamic_cast<vpgl_perspective_camera<double>*>(cam.as_pointer()))
- {
- boxm_utils::project_corners(corners,pcam,xverts,yverts,vertdists);
- }
- else if (vpgl_rational_camera<double>* rcam = dynamic_cast<vpgl_rational_camera<double>*>(cam.as_pointer())) {
- boxm_rational_camera_utils::project_corners_rational_camera(corners,rcam,vgl_plane_3d<double>(),xverts,yverts,vertdists);
- // TODO: 3rd argument should most likely be a "real" plane!!!
- }
-
- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts);
- boxm_utils::project_cube_xyz(corners,vis_face_ids,front_xyz,back_xyz,xverts,yverts,vertdists);
- // get alpha
- boxm_utils::project_cube_fill_val( vis_face_ids,alphas,sample.alpha, xverts,yverts);
- }
- // compute the length of ray segment at each pixel
- vil_image_view<float> len_seg(ni,nj,1);len_seg.fill(0.0f);
- vil_math_image_difference<float,float>(back_xyz,front_xyz,len_seg);
- //vil_math_sum_sqr<float,float>(back_xyz,len_seg);
- //vil_math_sqrt<float>(len_seg);
-
- for (cell_it=vis_cells.begin();cell_it!=vis_cells.end();cell_it++)
- {
- T_data sample=(*cell_it)->data();
- // get vertices of cell in the form of a bounding box (cells are always axis-aligned))
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(*cell_it);
- std::vector<vgl_point_3d<double> > corners=boxm_utils::corners_of_box_3d(cell_bb);
- boxm_utils::project_corners(corners,cam,xverts,yverts);
- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts);
-
- typename T_data::obs_datatype cell_mean_obs;
- if (boxm_utils::cube_weighted_mean(vis_face_ids, img, len_seg,cell_mean_obs,xverts,yverts)) {
- // get probability density of mean observation
- float cell_PI = T_data::apm_processor::prob_density(sample.appearance(bin), cell_mean_obs);
- if (!((cell_PI >= 0) && (cell_PI < 1e8)) ) {
- std::cout << "\ncell_PI = " << cell_PI << '\n'
- << " cell_obs = " << cell_mean_obs << '\n'
- << " cell id = " << *cell_it << std::endl;
- }
- // fill obs probability density image
- boxm_utils::project_cube_fill_val(vis_face_ids,PI_img,cell_PI, xverts,yverts);
- }
- }
- vil_math_image_product(len_seg,alphas, alphas);
- // compute visibility
- vil_math_image_difference(alpha_integral, alphas, alpha_integral);
- // compute new vis image
- image_exp_functor exp_fun;
- vil_transform(alpha_integral,vis_end,exp_fun);
- // compute weights for each pixel
- vil_math_image_difference(vis,vis_end,vis);
- // scale cell expected image by weighting function..
- vil_math_image_product( PI_img,vis, PI_img);
- // ..and use result to update final expected image
- vil_math_image_sum(PI_img,pre,pre);
-
- vis.deep_copy(vis_end);
-#if 0
- if (cnt == 70) {
- std::cout << "saving debug images" << std::endl;
- std::string output_dir = "D:/vj/scripts/boxm/exp1/";
- vil_save(len_seg,(output_dir + "len_seg.tiff").c_str());
- vil_save(alphas,(output_dir + "alphas.tiff").c_str());
- vil_save(alpha_integral,(output_dir + "alpha_integral.tiff").c_str());
- vil_save(pre,(output_dir + "pre_img.tiff").c_str());
- vil_save(PI_img,(output_dir + "PI_img.tiff").c_str());
- vil_save(vis,(output_dir + "vis.tiff").c_str());
- vil_save(vis_end,(output_dir + "vis_end.tiff").c_str());
- vil_save(img,(output_dir + "obs.tiff").c_str());
- }
-#endif
- }
-
- scene.write_active_block();
- }
- }
- vil_image_view<float> PI_background(norm_img.ni(),norm_img.nj(),1);
- for (unsigned int j=0; j<img.nj(); ++j) {
- for (unsigned int i=0; i<img.ni(); ++i) {
- // this will have to be modified slightly when we deal with multi-plane images -dec
- PI_background(i,j) = T_data::apm_processor::prob_density(background_model, img(i,j));
- }
- }
-
- vil_math_image_product(PI_background, vis, norm_img);
- vil_math_image_sum(pre,norm_img,norm_img);
- safe_inverse_functor inv_func(1e-8f);
- vil_transform(norm_img, inv_func);
-}
-
-
-template <class T_loc, class T_data>
-void boxm_update_pass2(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<typename T_data::obs_mathtype> &img,
- vil_image_view<float> &norm_img, int bin)
-{
- unsigned ni=img.ni();
- unsigned nj=img.nj();
- typedef boct_tree<T_loc, T_data > tree_type;
- typedef boct_tree_cell<T_loc, T_data > cell_type;
- vil_image_view<float> pre_img(ni,nj,1); pre_img.fill(0.0f);
- vil_image_view<float> vis(ni,nj,1); vis.fill(1.0f);
- vil_image_view<float> alpha_integral(ni,nj,1); alpha_integral.fill(0.0f);
- vil_image_view<float> PI_img(ni,nj,1); PI_img.fill(0.0f);
- vil_image_view<float> pix_weights(ni,nj,1);
- double xverts[8];
- double yverts[8];
- float vertdists[8];
-
- vul_timer t; t.mark();
- // code to iterate over the blocks in order of visibility
- boxm_block_vis_graph_iterator<boct_tree<T_loc,T_data > > block_vis_iter(cam, &scene, ni,nj);
- while (block_vis_iter.next()) {
- std::vector<vgl_point_3d<int> > block_indices = block_vis_iter.frontier_indices();
- for (auto & block_indice : block_indices) { // code for each block
- scene.load_block(block_indice.x(),block_indice.y(),block_indice.z());
- boxm_block<tree_type> * curr_block=scene.get_active_block();
- boxm_cell_vis_graph_iterator<T_loc, T_data > frontier_it(cam,curr_block->get_tree(),ni,nj);
-
- // for each frontier layer of each block
- tree_type * tree=curr_block->get_tree();
- vil_image_view<float> front_xyz(ni,nj,1);
- vil_image_view<float> back_xyz(ni,nj,1);
- vil_image_view<float> alphas(ni,nj,1);
- vil_image_view<float> vis_end(ni,nj,1);
- vil_image_view<float> temp_expected(ni,nj,1);
- vil_image_view<float> update_factor(ni,nj,1);
- unsigned count=0;
- while (frontier_it.next())
- {
- std::vector<cell_type *> vis_cells=frontier_it.frontier();
- typename std::vector<cell_type *>::iterator cell_it=vis_cells.begin();
- front_xyz.fill(0.0f);
- back_xyz.fill(0.0f);
- alphas.fill(0.0f);
- vis_end.fill(0.0f);
- temp_expected.fill(0.0f);
- PI_img.fill(0.0f);
-
- std::cout<<'.';
- for (;cell_it!=vis_cells.end();cell_it++)
- {
- // for each cell
- T_data sample=(*cell_it)->data();
- // get vertices of cell in the form of a bounding box (cells are always axis-aligned))
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(*cell_it);
- std::vector<vgl_point_3d<double> > corners=boxm_utils::corners_of_box_3d(cell_bb);
- boxm_utils::project_corners(corners,cam,xverts,yverts,vertdists);
- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts);
- boxm_utils::project_cube_xyz(corners,vis_face_ids,front_xyz,back_xyz,xverts,yverts,vertdists);
- // get alpha
- boxm_utils::project_cube_fill_val( vis_face_ids,alphas,sample.alpha, xverts,yverts);
- }
- // compute the length of ray segment at each pixel
- vil_image_view<float> len_seg(ni,nj,1);len_seg.fill(0.0f);
- vil_math_image_difference<float,float>(back_xyz,front_xyz,len_seg);
-
- for (cell_it=vis_cells.begin();cell_it!=vis_cells.end();cell_it++)
- {
- // for each cell
- T_data sample=(*cell_it)->data();
-
- // get vertices of cell in the form of a bounding box (cells are always axis-aligned))
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(*cell_it);
- std::vector<vgl_point_3d<double> > corners=boxm_utils::corners_of_box_3d(cell_bb);
- boxm_utils::project_corners(corners,cam,xverts,yverts,vertdists);
- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts);
- //boxm_utils::project_cube_xyz(corners,vis_face_ids,front_xyz,back_xyz,xverts,yverts,vertdists);
- //// get alpha
- //boxm_utils::project_cube_fill_val( vis_face_ids,alphas,sample.alpha, xverts,yverts);
- typename T_data::obs_datatype cell_mean_obs;
- if (boxm_utils::cube_weighted_mean(vis_face_ids, img,len_seg, cell_mean_obs,xverts,yverts)) {
- // get probability density of mean observation
- float cell_PI = T_data::apm_processor::prob_density(sample.appearance(bin), cell_mean_obs);
-#if 0
- if (!((cell_PI >= 0) && (cell_PI < 1e8)) ) {
- std::cout << "\ncell_PI = " << cell_PI << '\n'
- << " cell_obs = " << cell_mean_obs << '\n'
- << " cell id = " << *cell_it << std::endl;
- }
-#endif // 0
- // fill obs probability density image
- boxm_utils::project_cube_fill_val(vis_face_ids,PI_img,(float)cell_PI, xverts,yverts);
- }
- float cell_mean_vis = 0.0f;
- if (boxm_utils::cube_weighted_mean(vis_face_ids, vis, len_seg,cell_mean_vis,xverts,yverts)) {
- // update appearance model
- if (cell_mean_vis > 1e-6) {
- T_data::apm_processor::update(sample.appearance(bin), cell_mean_obs, cell_mean_vis);
- }
- }
- (*cell_it)->set_data(sample);
- }
-#if 0
- // compute the length of ray segment at each pixel
- vil_image_view<float> len_seg(ni,nj,1);len_seg.fill(0.0f);
- vil_math_image_difference<float,float>(back_xyz,front_xyz,len_seg);
- vil_math_sum_sqr<float,float>(back_xyz,len_seg);
- vil_math_sqrt<float>(len_seg);
-#endif // 0
- vil_math_image_product(len_seg,alphas, alphas);
- // compute visibility
- vil_math_image_difference(alpha_integral, alphas, alpha_integral);
- // compute new vis image
- image_exp_functor exp_fun;
- vil_transform(alpha_integral,vis_end,exp_fun);
- // compute weights for each pixel
- vil_math_image_difference(vis,vis_end,pix_weights);
- // multiply PI by vis..
- vil_math_image_product(PI_img, vis, update_factor);
- // ..add preX to get numerator term for update..
- vil_math_image_sum(pre_img, update_factor, update_factor);
- //.. and normalize
- vil_math_image_product(norm_img, update_factor, update_factor);
-
- float max_cell_P=0.99f;
- float min_cell_P=0.001f;
- for (cell_it=vis_cells.begin();cell_it!=vis_cells.end();cell_it++)
- {
- // for each cell
- T_data sample=(*cell_it)->data();
- // get vertices of cell in the form of a bounding box (cells are always axis-aligned))
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(*cell_it);
- std::vector<vgl_point_3d<double> > corners=boxm_utils::corners_of_box_3d(cell_bb);
- boxm_utils::project_corners(corners,cam,xverts,yverts);
- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts);
- //boxm_utils::project_cube_xyz(corners,vis_face_ids,front_xyz,back_xyz,xverts,yverts);
- float mean_update_factor = 0.0f;
- if (boxm_utils::cube_weighted_mean(vis_face_ids, update_factor,len_seg, mean_update_factor,xverts,yverts))
- { // update alpha value
- sample.alpha *= mean_update_factor;
- // do bounds check on new alpha value
- float cell_len = float(cell_bb.max_x() - cell_bb.min_x());
- float max_alpha = -std::log(1.0f - max_cell_P)/cell_len;
- float min_alpha = -std::log(1.0f - min_cell_P)/cell_len;
- if (sample.alpha > max_alpha)
- sample.alpha = max_alpha;
-
- if (sample.alpha < min_alpha)
- sample.alpha = min_alpha;
-
- if (!((sample.alpha >= min_alpha) && (sample.alpha <= max_alpha))) {
- std::cerr << "\nerror: cell.alpha = " << sample.alpha << '\n'
- << "mean_update_factor = " << mean_update_factor << '\n';
- }
- (*cell_it)->set_data(sample);
- }
- }
- // multiply cell_PI by cell weights
- vil_math_image_product(pix_weights, PI_img, PI_img);
- // update pre_img
- vil_math_image_sum(PI_img, pre_img, pre_img);
-
- vis.deep_copy(vis_end);
- }
- scene.write_active_block();
- }
- }
-}
-
-template <class T_loc, class T_data>
-void boxm_update(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vil_image_view<typename T_data::obs_datatype> &img,
- vpgl_camera_double_sptr cam, int bin=-1,
- bool black_background = false)
-{
- typename T_data::apm_datatype background_apm;
-
- if (black_background) {
- std::cout << "using black background model" << std::endl;
- for (unsigned int i=0; i<4; ++i) {
- T_data::apm_processor::update(background_apm, 0.0f, 1.0f);
- T_data::apm_processor::prob_density(background_apm,0.0f);
- }
- }
- vil_image_view<float> norm_img(img.ni(), img.nj(), 1);
- boxm_update_pass1<T_loc,T_data>(scene, cam,img,norm_img,background_apm,bin);
- std::cout << "update: pass1 completed" << std::endl;
- vil_save(norm_img,"D:/vj/scripts/boxm/exp1/norm.tiff");
- boxm_update_pass2<T_loc,T_data>(scene, cam,img,norm_img,bin);
- std::cout << "update: pass2 completed" << std::endl;
-
- return;
-}
-
-#endif // boxm_update_h_
diff --git a/contrib/brl/bseg/boxm/algo/sp/boxm_update_triangle.h b/contrib/brl/bseg/boxm/algo/sp/boxm_update_triangle.h
deleted file mode 100644
index 723284ff3b..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/boxm_update_triangle.h
+++ /dev/null
@@ -1,356 +0,0 @@
-#ifndef boxm_update_triangle_h_
-#define boxm_update_triangle_h_
-//:
-// \file
-#include <iostream>
-#include <boct/boct_tree.h>
-#include <boct/boct_tree_cell.h>
-#include <boxm/util/boxm_utils.h>
-#include <boxm/boxm_block.h>
-#include <boxm/basic/boxm_cell_vis_graph_iterator.h>
-#include <boxm/basic/boxm_block_vis_graph_iterator.h>
-#include <boxm/algo/sp/boxm_render_image.h>
-#include <boxm/util/boxm_raytrace_operations.h>
-#include <boxm/util/boxm_rational_camera_utils.h>
-#include <vpgl/vpgl_rational_camera.h>
-#include <vpgl/vpgl_perspective_camera.h>
-#include <vil/vil_math.h>
-#include <vul/vul_timer.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-//: functor used for normalizing cell_expected image
-template <class T_loc, class T_data>
-void boxm_update_triangle_pass1(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<typename T_data::obs_mathtype> &img,
- vil_image_view<float> &norm_img,
- typename T_data::apm_datatype background_model, int bin)
-{
- typedef boct_tree<T_loc, T_data> tree_type;
- typedef boct_tree_cell<T_loc, T_data> cell_type;
- unsigned ni=img.ni();
- unsigned nj=img.nj();
- double xverts[8];
- double yverts[8];
- float vertdists[8];
-
- vil_image_view<float> pre(ni,nj,1);
- vil_image_view<float> vis(ni,nj,1);
- vil_image_view<float> alpha_integral(ni,nj,1);
- vil_image_view<float> PI_img(ni,nj,1);
- vil_image_view<float> pix_weights_(ni,nj,1);
- vil_image_view<float> alpha_img_(ni,nj,1);
-
- alpha_integral.fill(0.0f);
- pre.fill(0.0f);
- vis.fill(1.0f);
-
- vgl_plane_3d<double> projection_plane;
- if (vpgl_rational_camera<double> * rcam = dynamic_cast<vpgl_rational_camera<double> *>(cam.ptr())) {
- vgl_box_3d<double> bbox=scene.get_world_bbox();
- vgl_plane_3d<double> top(0,0,1,-bbox.max_z());
- vgl_plane_3d<double> bottom(0,0,1,-bbox.min_z());
- projection_plane=boxm_rational_camera_utils::boxm_find_parallel_image_plane(rcam, top, bottom,img.ni(),img.nj());
- }
-
- // code to iterate over the blocks in order of visibility
- boxm_block_vis_graph_iterator<boct_tree<T_loc, T_data > > block_vis_iter(cam, &scene, ni,nj);
- while (block_vis_iter.next())
- {
- std::vector<vgl_point_3d<int> > block_indices = block_vis_iter.frontier_indices();
- for (auto & block_indice : block_indices) // code for each block
- {
- scene.load_block(block_indice.x(),block_indice.y(),block_indice.z());
- boxm_block<tree_type> * curr_block=scene.get_active_block();
- // project vertices to the image determine which faces of the cell are visible
- boxm_cell_vis_graph_iterator<T_loc,T_data > frontier_it(cam,curr_block->get_tree(),ni,nj);
-
- // for each frontier layer of each block
- tree_type * tree=curr_block->get_tree();
- vil_image_view<float> front_xyz(ni,nj,1);
- vil_image_view<float> back_xyz(ni,nj,1);
- vil_image_view<float> alphas(ni,nj,1);
- vil_image_view<float> vis_end(ni,nj,1);
- vil_image_view<float> temp_expected(ni,nj,1);
- int cnt=0;
-
- while (frontier_it.next())
- {
- ++cnt;
- std::vector<cell_type *> vis_cells=frontier_it.frontier();
- typename std::vector<cell_type *>::iterator cell_it=vis_cells.begin();
- alpha_img_.fill(0.0f);
- vis_end.fill(0.0f);
- temp_expected.fill(0.0f);
- PI_img.fill(0.0f);
- for (;cell_it!=vis_cells.end();cell_it++)
- {
- // for each cell
- T_data sample=(*cell_it)->data();
- // get vertices of cell in the form of a bounding box (cells are always axis-aligned))
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(*cell_it);
- std::vector<vgl_point_3d<double> > corners=boxm_utils::corners_of_box_3d(cell_bb);
- if (dynamic_cast<vpgl_perspective_camera<double> *>(cam.ptr()))
- {
- boxm_utils::project_corners(corners,cam,xverts,yverts,vertdists);
- }
- else if (vpgl_rational_camera<double> * rcam = dynamic_cast<vpgl_rational_camera<double> *>(cam.ptr())) {
- boxm_rational_camera_utils::project_corners_rational_camera(corners,rcam,projection_plane,xverts,yverts,vertdists);
- }
- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts);
- //boxm_utils::project_cube_xyz(corners,vis_face_ids,front_xyz,back_xyz,xverts,yverts,vertdists);
- boxm_alpha_seg_len(xverts, yverts, vertdists, vis_face_ids, sample.alpha, alpha_img_);
-
-
- typename T_data::obs_datatype cell_mean_obs;
- if (cube_mean(xverts, yverts, vertdists, vis_face_ids,img,cell_mean_obs)) {
- // get probability density of mean observation
- float cell_PI = T_data::apm_processor::prob_density(sample.appearance(bin), cell_mean_obs);
- if (!((cell_PI >= 0) && (cell_PI < 1e8)) ) {
- std::cout << "\ncell_PI = " << cell_PI << '\n'
- << " cell_obs = " << cell_mean_obs << '\n'
- << " cell id = " << *cell_it << std::endl;
- }
- // fill obs probability density image
- cube_fill_value(xverts, yverts, vis_face_ids, PI_img, cell_PI);
- }
- }
- abs_functor abs_fun;
- vil_transform(alpha_img_,alpha_img_,abs_fun);
- // compute visibility
- vil_math_image_difference(alpha_integral, alpha_img_, alpha_integral);
- // compute new vis image
- image_exp_functor exp_fun;
- vil_transform(alpha_integral,vis_end,exp_fun);
- // compute weights for each pixel
- vil_math_image_difference(vis,vis_end,pix_weights_);
- // scale cell expected image by weighting function..
- vil_math_image_product( pix_weights_,PI_img, PI_img);
- // ..and use result to update final expected image
- vil_math_image_sum(PI_img,pre,pre);
- vis.deep_copy(vis_end);
-#if 0
- if (cnt == 10) {
- std::cout << "saving debug images" << std::endl;
- std::string output_dir = "D:/vj/scripts/boxm/exp1/";
- vil_save(alpha_img_,(output_dir + "alpha_img.tiff").c_str());
- vil_save(alpha_integral,(output_dir + "alpha_integral.tiff").c_str());
- vil_save(pre,(output_dir + "pre_img.tiff").c_str());
- vil_save(PI_img,(output_dir + "PI_img.tiff").c_str());
- vil_save(vis,(output_dir + "vis.tiff").c_str());
- vil_save(vis_end,(output_dir + "vis_end.tiff").c_str());
- vil_save(img,(output_dir + "obs.tiff").c_str());
- }
-#endif
- }
- scene.write_active_block();
- }
- }
- vil_image_view<float> PI_background(norm_img.ni(),norm_img.nj(),1);
- for (unsigned int j=0; j<img.nj(); ++j) {
- for (unsigned int i=0; i<img.ni(); ++i) {
- // this will have to be modified slightly when we deal with multi-plane images -dec
- PI_background(i,j) = T_data::apm_processor::prob_density(background_model, img(i,j));
- }
- }
-
- vil_math_image_product(PI_background, vis, norm_img);
- vil_math_image_sum(pre,norm_img,norm_img);
- safe_inverse_functor inv_func(1e-8f);
- vil_transform(norm_img, inv_func);
-}
-
-
-template <class T_loc, class T_data>
-void boxm_update_triangle_pass2(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vpgl_camera_double_sptr cam,
- vil_image_view<typename T_data::obs_mathtype> &img,
- vil_image_view<float> &norm_img, int bin)
-{
- unsigned ni=img.ni();
- unsigned nj=img.nj();
- typedef boct_tree<T_loc, T_data > tree_type;
- typedef boct_tree_cell<T_loc, T_data > cell_type;
- vil_image_view<float> pre_img(ni,nj,1); pre_img.fill(0.0f);
- vil_image_view<float> vis(ni,nj,1); vis.fill(1.0f);
- vil_image_view<float> alpha_integral(ni,nj,1);
- vil_image_view<float> PI_img(ni,nj,1); PI_img.fill(0.0f);
- vil_image_view<float> pix_weights(ni,nj,1);
- alpha_integral.fill(0.0f);
- pre_img.fill(0.0f);
- vis.fill(1.0f);
-
- double xverts[8];
- double yverts[8];
- float vertdists[8];
- vgl_plane_3d<double> projection_plane;
- if (vpgl_rational_camera<double> * rcam = dynamic_cast<vpgl_rational_camera<double> *>(cam.ptr())) {
- vgl_box_3d<double> bbox=scene.get_world_bbox();
- vgl_plane_3d<double> top(0,0,1,-bbox.max_z());
- vgl_plane_3d<double> bottom(0,0,1,-bbox.min_z());
- projection_plane=boxm_rational_camera_utils::boxm_find_parallel_image_plane(rcam, top, bottom,img.ni(),img.nj());
- }
- vul_timer t; t.mark();
- // code to iterate over the blocks in order of visibility
- boxm_block_vis_graph_iterator<boct_tree<T_loc,T_data > > block_vis_iter(cam, &scene, ni,nj);
- while (block_vis_iter.next()) {
- std::vector<vgl_point_3d<int> > block_indices = block_vis_iter.frontier_indices();
- for (auto & block_indice : block_indices) { // code for each block
- scene.load_block(block_indice.x(),block_indice.y(),block_indice.z());
- boxm_block<tree_type> * curr_block=scene.get_active_block();
- boxm_cell_vis_graph_iterator<T_loc, T_data > frontier_it(cam,curr_block->get_tree(),ni,nj);
-
- // for each frontier layer of each block
- tree_type * tree=curr_block->get_tree();
- vil_image_view<float> alpha_img_(ni,nj,1);
- vil_image_view<float> vis_end(ni,nj,1);
- vil_image_view<float> temp_expected(ni,nj,1);
- vil_image_view<float> update_factor(ni,nj,1);
-
- while (frontier_it.next())
- {
- std::vector<cell_type *> vis_cells=frontier_it.frontier();
- typename std::vector<cell_type *>::iterator cell_it=vis_cells.begin();
- vis_end.fill(0.0f);
- temp_expected.fill(0.0f);
- PI_img.fill(0.0f);
- alpha_img_.fill(0.0f);
-
- std::cout<<'.';
- for (;cell_it!=vis_cells.end();cell_it++)
- {
- // for each cell
- T_data sample=(*cell_it)->data();
- // get vertices of cell in the form of a bounding box (cells are always axis-aligned))
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(*cell_it);
- std::vector<vgl_point_3d<double> > corners=boxm_utils::corners_of_box_3d(cell_bb);
- if (dynamic_cast<vpgl_perspective_camera<double> *>(cam.ptr()))
- {
- boxm_utils::project_corners(corners,cam,xverts,yverts,vertdists);
- }
- else if (vpgl_rational_camera<double> * rcam = dynamic_cast<vpgl_rational_camera<double> *>(cam.ptr())) {
- boxm_rational_camera_utils::project_corners_rational_camera(corners,rcam,projection_plane,xverts,yverts,vertdists);
- }
-
- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts);
- boxm_alpha_seg_len(xverts, yverts, vertdists, vis_face_ids, sample.alpha, alpha_img_);
- typename T_data::obs_datatype cell_mean_obs;
- if (cube_mean(xverts, yverts, vertdists, vis_face_ids,img,cell_mean_obs)) {
- // get probability density of mean observation
- float cell_PI = T_data::apm_processor::prob_density(sample.appearance(bin), cell_mean_obs);
-#if 0
- if (!((cell_PI >= 0) && (cell_PI < 1e8)) ) {
- std::cout << "\ncell_PI = " << cell_PI << '\n'
- << " cell_obs = " << cell_mean_obs << '\n'
- << " cell id = " << *cell_it << std::endl;
- }
-#endif // 0
- // fill obs probability density image
- cube_fill_value(xverts, yverts, vis_face_ids, PI_img, cell_PI);
- }
- float cell_mean_vis = 0.0f;
- if (cube_mean(xverts, yverts, vertdists, vis_face_ids,vis,cell_mean_vis)) {
- // update appearance model
- if (cell_mean_vis > 1e-6) {
- T_data::apm_processor::update(sample.appearance(bin), cell_mean_obs, cell_mean_vis);
- }
- }
- (*cell_it)->set_data(sample);
- }
- abs_functor abs_fun;
- vil_transform(alpha_img_,alpha_img_,abs_fun);
-
- // compute visibility
- vil_math_image_difference(alpha_integral, alpha_img_, alpha_integral);
-
- // compute new vis image
- image_exp_functor exp_fun;
- vil_transform(alpha_integral,vis_end,exp_fun);
- // compute weights for each pixel
- vil_math_image_difference(vis,vis_end,pix_weights);
- // multiply PI by vis..
- vil_math_image_product(PI_img, vis, update_factor);
- // ..add preX to get numerator term for update..
- vil_math_image_sum(pre_img, update_factor, update_factor);
- //.. and normalize
- vil_math_image_product(norm_img, update_factor, update_factor);
-
-
- float max_cell_P=0.99f;
- float min_cell_P=0.001f;
- for (cell_it=vis_cells.begin();cell_it!=vis_cells.end();cell_it++)
- {
- // for each cell
- T_data sample=(*cell_it)->data();
- // get vertices of cell in the form of a bounding box (cells are always axis-aligned))
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(*cell_it);
- std::vector<vgl_point_3d<double> > corners=boxm_utils::corners_of_box_3d(cell_bb);
- if (dynamic_cast<vpgl_perspective_camera<double> *>(cam.ptr()))
- {
- boxm_utils::project_corners(corners,cam,xverts,yverts,vertdists);
- }
- else if (vpgl_rational_camera<double> * rcam = dynamic_cast<vpgl_rational_camera<double> *>(cam.ptr())) {
- boxm_rational_camera_utils::project_corners_rational_camera(corners,rcam,projection_plane,xverts,yverts,vertdists);
- }
- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam,xverts,yverts);
-
- float mean_update_factor = 0.0f;
- if (cube_mean(xverts,yverts,vertdists,vis_face_ids, update_factor, mean_update_factor))
- {
- // update alpha value
- sample.alpha *= mean_update_factor;
- // do bounds check on new alpha value
- float cell_len = float(cell_bb.max_x() - cell_bb.min_x());
- float max_alpha = -std::log(1.0f - max_cell_P)/cell_len;
- float min_alpha = -std::log(1.0f - min_cell_P)/cell_len;
- if (sample.alpha > max_alpha)
- sample.alpha = max_alpha;
-
- if (sample.alpha < min_alpha)
- sample.alpha = min_alpha;
-
- if (!((sample.alpha >= min_alpha) && (sample.alpha <= max_alpha))) {
- std::cerr << "\nerror: cell.alpha = " << sample.alpha << '\n'
- << "mean_update_factor = " << mean_update_factor << '\n';
- }
- (*cell_it)->set_data(sample);
- }
- }
- // multiply cell_PI by cell weights
- vil_math_image_product(pix_weights, PI_img, PI_img);
- // update pre_img
- vil_math_image_sum(PI_img, pre_img, pre_img);
- vis.deep_copy(vis_end);
- }
- scene.write_active_block();
- }
- }
-}
-
-template <class T_loc, class T_data>
-void boxm_update_triangle(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- vil_image_view<typename T_data::obs_datatype> &img,
- vpgl_camera_double_sptr cam, int bin=-1,
- bool black_background = false)
-{
- typename T_data::apm_datatype background_apm;
-
- if (black_background) {
- std::cout << "using black background model" << std::endl;
- for (unsigned int i=0; i<4; ++i) {
- T_data::apm_processor::update(background_apm, 0.0f, 1.0f);
- T_data::apm_processor::prob_density(background_apm,0.0f);
- }
- }
- vil_image_view<float> norm_img(img.ni(), img.nj(), 1);
- boxm_update_triangle_pass1<T_loc,T_data>(scene, cam,img,norm_img,background_apm,bin);
- std::cout << "update: pass1 completed" << std::endl;
- boxm_update_triangle_pass2<T_loc,T_data>(scene, cam,img,norm_img,bin);
- std::cout << "update: pass2 completed" << std::endl;
-
- return;
-}
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/sp/dummy.cxx b/contrib/brl/bseg/boxm/algo/sp/dummy.cxx
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/sp/pro/CMakeLists.txt
deleted file mode 100644
index 41fe3f9dbd..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/pro/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# boxm's Process Library
-
-# bprb depends on expat and bvxm_prodepends on bprb primarily
-FIND_PACKAGE(EXPAT REQUIRED)
-FIND_PACKAGE(EXPATPP REQUIRED)
-if(EXPAT_FOUND)
- include_directories( ${BRL_INCLUDE_DIR}/bpro )
- include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb )
- include_directories( ${BRL_INCLUDE_DIR}/bseg )
- include_directories( ${GEL_INCLUDE_DIR}/mrc/vpgl )
- include_directories( ${GEL_INCLUDE_DIR}/mrc )
-
- set(boxm_algo_sp_pro_sources
- boxm_algo_sp_processes.h
- boxm_algo_sp_register.h boxm_algo_sp_register.cxx
- )
- aux_source_directory(Templates boxm_algo_sp_pro_sources)
- aux_source_directory(processes boxm_algo_sp_pro_sources)
-
- vxl_add_library(LIBRARY_NAME boxm_algo_sp_pro LIBRARY_SOURCES ${boxm_algo_sp_pro_sources} )
- target_link_libraries(boxm_algo_sp_pro boxm boxm_algo_sp boxm_util bprb brdb brip sdet vsol vil_pro ${VXL_LIB_PREFIX}vil_io ${VXL_LIB_PREFIX}vil)
-
- if( BUILD_TESTING )
- add_subdirectory(tests)
- endif()
-
-endif()
diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/Templates/brdb_value_t+vil_image_view_base_sptr-.cxx b/contrib/brl/bseg/boxm/algo/sp/pro/Templates/brdb_value_t+vil_image_view_base_sptr-.cxx
deleted file mode 100644
index 5339909524..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/pro/Templates/brdb_value_t+vil_image_view_base_sptr-.cxx
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <brdb/brdb_value.hxx>
-
-#include <vil/vil_image_view_base.h>
-#include <vil/io/vil_io_smart_ptr.h>
-
-#include <vil/io/vil_io_image_view_base.h>
-
-typedef vil_image_view_base_sptr img_sptr;
-
-BRDB_VALUE_INSTANTIATE(img_sptr, "vil_image_view_base_sptr");
diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_processes.h b/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_processes.h
deleted file mode 100644
index 24cdc3672a..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_processes.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef boxm_algo_sp_processes_h_
-#define boxm_algo_sp_processes_h_
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_macros.h>
-
-//the init functions
-DECLARE_FUNC_CONS(boxm_volume_visibility_process);
-DECLARE_FUNC_CONS(boxm_update_process);
-DECLARE_FUNC_CONS(boxm_render_expected_process);
-
-
-
-#endif
diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_register.cxx b/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_register.cxx
deleted file mode 100644
index 8acaac16c3..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_register.cxx
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "boxm_algo_sp_register.h"
-
-#include <bprb/bprb_macros.h>
-#include <bprb/bprb_batch_process_manager.h>
-#include <bprb/bprb_func_process.h>
-
-#include "boxm_algo_sp_processes.h"
-
-void boxm_algo_sp_register::register_datatype()
-{
-}
-
-void boxm_algo_sp_register::register_process()
-{
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_update_process,"boxmUpdateSPProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_render_expected_process, "boxmRenderExpectedProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_volume_visibility_process, "boxmVolumeVisibilityProcess");
-}
diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_register.h b/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_register.h
deleted file mode 100644
index 5b7f15d213..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/pro/boxm_algo_sp_register.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef boxm_algo_sp_register_h_
-#define boxm_algo_sp_register_h_
-
-class boxm_algo_sp_register
-{
- public:
- static void register_datatype();
- static void register_process();
-};
-
-#endif // boxm_algo_sp_register_h_
diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_render_expected_process.cxx b/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_render_expected_process.cxx
deleted file mode 100644
index 6ffd752df2..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_render_expected_process.cxx
+++ /dev/null
@@ -1,117 +0,0 @@
-// This is brl/bseg/boxm/algo/sp/pro/processes/boxm_render_expected_process.cxx
-
-//:
-// \file
-// \brief A class for obtaining roc curve from change detection results.
-//
-// \author Gamze Tunali
-// \date Apr 14, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/sp/boxm_render_image.h>
-#include <boxm/algo/sp/boxm_render_image_triangle.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <vil/vil_convert.h>
-
-namespace boxm_render_expected_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 2;
-}
-
-bool boxm_render_expected_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_render_expected_process_globals;
-
- //process takes 5 inputs
- //input[0]: scene binary file
- //input[1]: camera
- //input[2]: ni of the expected image
- //input[3]: nj of the expected image
- //input[4]: bin number
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vpgl_camera_double_sptr";
- input_types_[2] = "unsigned";
- input_types_[3] = "unsigned";
- input_types_[4] = "unsigned";
-
- // process has 2 outputs:
- // output[0]: rendered image
- // output[0]: mask
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "vil_image_view_base_sptr";
- output_types_[1] = "vil_image_view_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_render_expected_process(bprb_func_process& pro)
-{
- using namespace boxm_render_expected_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get the inputs
- unsigned i = 0;
- boxm_scene_base_sptr scene_ptr = pro.get_input<boxm_scene_base_sptr>(i++);
- vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(i++);
- auto ni = pro.get_input<unsigned>(i++);
- auto nj = pro.get_input<unsigned>(i++);
-
- vil_image_view_base_sptr img;
- vil_image_view_base_sptr img_mask;
-
- // check the scene's app model
- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) {
- vil_image_view<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> expected(ni,nj);
- vil_image_view<float> mask(ni,nj);
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > type;
- auto* scene = dynamic_cast<boxm_scene<type>*> (scene_ptr.as_pointer());
- boxm_render_image_splatting_triangle<short, boxm_sample<BOXM_APM_MOG_GREY> >(*scene, camera, expected, mask,-1,true);
- }
- else
- {
- auto bin = pro.get_input<unsigned>(i++);
- std::cout<<"Multi Bin"<<std::endl;
- typedef boct_tree<short, boxm_sample_multi_bin<BOXM_APM_MOG_GREY> > type;
- auto* scene = dynamic_cast<boxm_scene<type>*> (scene_ptr.as_pointer());
- boxm_render_image_splatting_triangle<short, boxm_sample_multi_bin<BOXM_APM_MOG_GREY> >(*scene, camera, expected, mask,bin,true);
- }
-
- //img = new vil_image_view<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype>(expected);
- img_mask = new vil_image_view<float>(mask);
-
- auto *expected_byte = new vil_image_view<unsigned char>(expected.ni(),expected.nj(),expected.nplanes());
- vil_convert_stretch_range_limited(expected,*expected_byte, 0.0f, 1.0f);
- img = expected_byte;
- }
- else {
- std::cout << "boxm_render_expected_process: undefined APM type" << std::endl;
- return false;
- }
-
- unsigned j = 0;
- pro.set_output_val<vil_image_view_base_sptr>(j++, img);
- pro.set_output_val<vil_image_view_base_sptr>(j++, img_mask);
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_update_process.cxx b/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_update_process.cxx
deleted file mode 100644
index bf3d27ab6d..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_update_process.cxx
+++ /dev/null
@@ -1,107 +0,0 @@
-// This is brl/bseg/boxm/algo/sp/pro/processes/boxm_update_process.cxx
-//:
-// \file
-// \brief Process to update the scene from an image and camera pair
-//
-// \author Gamze Tunali
-// \date Apr 21, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/sp/boxm_update_triangle.h>
-
-#include <vil/vil_convert.h>
-#include <vil/vil_image_view_base.h>
-#include <vil/vil_image_view.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-
-namespace boxm_update_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 0;
-}
-
-bool boxm_update_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_update_process_globals;
-
- // process takes 5 inputs and no output
- //input[0]: The observation image
- //input[1]: The camera of the observation
- //input[2]: The scene
- //input[3]: The bin index to be updated
- //input[4]: ???
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vil_image_view_base_sptr";
- input_types_[1] = "vpgl_camera_double_sptr";
- input_types_[2] = "boxm_scene_base_sptr";
- input_types_[3] = "unsigned";
- input_types_[4] = "bool";
-
- std::vector<std::string> output_types_(n_outputs_);
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_update_process(bprb_func_process& pro)
-{
- using namespace boxm_update_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << "boxm_update_process: The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get inputs:
- unsigned i = 0;
- vil_image_view_base_sptr input_image = pro.get_input<vil_image_view_base_sptr>(i++);
- vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(i++);
- boxm_scene_base_sptr scene = pro.get_input<boxm_scene_base_sptr>(i++);
- auto bin_index = pro.get_input<unsigned>(i++);
- bool use_black_background = pro.get_input<bool>(i++);
-
- // check the input validity
- if ((input_image == nullptr) || (camera == nullptr) || (scene == nullptr)) {
- std::cout << "boxm_update_process: null input value, cannot run" << std::endl;
- return false;
- }
-
- if (scene->appearence_model() == BOXM_APM_MOG_GREY) {
- auto *img_byte
- = dynamic_cast<vil_image_view<vxl_byte>*>(input_image.ptr());
- vil_image_view<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> img(img_byte->ni(), img_byte->nj(), 1);
- vil_convert_stretch_range_limited(*img_byte ,img, vxl_byte(0), vxl_byte(255), 0.0f, 1.0f);
- if (!scene->multi_bin())
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- //boxm_update<short, boxm_sample<BOXM_APM_MOG_GREY> >(*s, img, camera, false);
- boxm_update_triangle<short, boxm_sample<BOXM_APM_MOG_GREY> >(*s, img, camera, use_black_background);
- }
- else
- {
- std::cout<<"Multi Bin Update"<<std::endl;
- typedef boct_tree<short, boxm_sample_multi_bin<BOXM_APM_MOG_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- boxm_update_triangle<short, boxm_sample_multi_bin<BOXM_APM_MOG_GREY> >(*s, img, camera, bin_index,use_black_background);
- }
- //vil_image_view<float> image = *vil_convert_cast(float(), input_image);
- }
- else {
- std::cout << "boxm_update_process: undefined APM type" << std::endl;
- return false;
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_volume_visibility_process.cxx b/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_volume_visibility_process.cxx
deleted file mode 100644
index 34ecc27c3f..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/pro/processes/boxm_volume_visibility_process.cxx
+++ /dev/null
@@ -1,129 +0,0 @@
-// This is brl/bseg/boxm/algo/sp/pro/processes/boxm_volume_visibility_process.cxx
-//:
-// \file
-// \brief A class for obtaining visibility of a volume
-//
-// \author Vishal Jain
-// \date Apr 30, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/sp/boxm_render_image.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/algo/sp/boxm_compute_volume_visibility.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <vil/vil_convert.h>
-
-namespace boxm_volume_visibility_process_globals
-{
- constexpr unsigned n_inputs_ = 10;
- constexpr unsigned n_outputs_ = 1;
-}
-
-bool boxm_volume_visibility_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_volume_visibility_process_globals;
-
- //process takes 10 inputs
- //input[0]: scene binary file
- //input[1]: camera
- //input[2]: ni of the expected image
- //input[3]: nj of the expected image
- //input[4-9]: bounding box
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vpgl_camera_double_sptr";
- input_types_[2] = "unsigned";
- input_types_[3] = "unsigned";
- input_types_[4] = "float";
- input_types_[5] = "float";
- input_types_[6] = "float";
- input_types_[7] = "float";
- input_types_[8] = "float";
- input_types_[9] = "float";
-
- // process has 1 output:
- // output[0]: rendered image
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "vil_image_view_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_volume_visibility_process(bprb_func_process& pro)
-{
- using namespace boxm_volume_visibility_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get the inputs
- unsigned i = 0;
- boxm_scene_base_sptr scene_ptr = pro.get_input<boxm_scene_base_sptr>(i++);
- vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(i++);
- auto ni = pro.get_input<unsigned>(i++);
- auto nj = pro.get_input<unsigned>(i++);
-
- auto min_x=pro.get_input<float>(i++);
- auto min_y=pro.get_input<float>(i++);
- auto min_z=pro.get_input<float>(i++);
-
- auto max_x=pro.get_input<float>(i++);
- auto max_y=pro.get_input<float>(i++);
- auto max_z=pro.get_input<float>(i++);
-
- vgl_box_3d<double> query(min_x,min_y,min_z,
- max_x,max_y,max_z);
-
- double xverts[8];
- double yverts[8];
-
- boxm_utils::project_corners(boxm_utils::corners_of_box_3d(query),camera,xverts,yverts);
- boct_face_idx face_id=boxm_utils::visible_faces(query,camera,xverts,yverts);
- vil_image_view_base_sptr img;
-
- // check the scene's app model
- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) {
- float val=1.0;
-
- if (!scene_ptr->multi_bin()){
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > type;
- auto* scene = dynamic_cast<boxm_scene<type>*> (scene_ptr.as_pointer());
- val=boxm_compute_volume_visibility<short, boxm_sample<BOXM_APM_MOG_GREY> >(query,*scene, camera);
- }
- else
- {
- typedef boct_tree<short, boxm_sample_multi_bin<BOXM_APM_MOG_GREY> > type;
- auto* scene = dynamic_cast<boxm_scene<type>*> (scene_ptr.as_pointer());
- val=boxm_compute_volume_visibility<short, boxm_sample_multi_bin<BOXM_APM_MOG_GREY> >(query,*scene, camera);
- }
- vil_image_view<float> img_vol(ni,nj);img_vol.fill(0.0);
- boxm_utils::project_cube_fill_val(face_id,img_vol,val,xverts,yverts);
- auto *vol_vis = new vil_image_view<unsigned char>(img_vol.ni(),img_vol.nj(),img_vol.nplanes());
- vil_convert_stretch_range_limited(img_vol,*vol_vis, 0.0f, 1.0f);
- img = vol_vis;
-
- std::cout<<"\n Visibility is "<<val;
- }
- else {
- std::cout << "boxm_volume_visibility_process: undefined APM type" << std::endl;
- return false;
- }
-
- unsigned j = 0;
- pro.set_output_val<vil_image_view_base_sptr>(j++, img);
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/sp/pro/tests/CMakeLists.txt
deleted file mode 100644
index bc15f419d9..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/pro/tests/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-add_executable( boxm_algo_sp_pro_test_include test_include.cxx )
-target_link_libraries( boxm_algo_sp_pro_test_include boxm_algo_sp_pro)
diff --git a/contrib/brl/bseg/boxm/algo/sp/pro/tests/test_include.cxx b/contrib/brl/bseg/boxm/algo/sp/pro/tests/test_include.cxx
deleted file mode 100644
index bfdbc4ffa3..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/pro/tests/test_include.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/algo/sp/pro/boxm_algo_sp_processes.h>
-#include <boxm/algo/sp/pro/boxm_algo_sp_register.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm/algo/sp/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/sp/tests/CMakeLists.txt
deleted file mode 100644
index 99806c193d..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/tests/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-add_executable( boxm_algo_sp_test_all
- test_driver.cxx
- test_compute_visibility.cxx
- test_render_image.cxx
- test_update.cxx
- test_update_multi_bin.cxx
- )
-
-target_link_libraries( boxm_algo_sp_test_all boxm_algo_sp boxm_algo boxm boxm_util boxm_sample boxm_basic boct ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vpl ${VXL_LIB_PREFIX}vul)
-
-add_test( NAME boxm_algo_sp_test_compute_visibility COMMAND $<TARGET_FILE:boxm_algo_sp_test_all> test_compute_visibility )
-add_test( NAME boxm_algo_sp_test_render_image COMMAND $<TARGET_FILE:boxm_algo_sp_test_all> test_render_image )
-if( VXL_RUN_FAILING_TESTS )
-add_test( NAME boxm_algo_sp_test_update COMMAND $<TARGET_FILE:boxm_algo_sp_test_all> test_update )
-endif()
-add_test( NAME boxm_algo_sp_test_update_multi_bin COMMAND $<TARGET_FILE:boxm_algo_sp_test_all> test_update_multi_bin )
-
-add_executable( boxm_algo_sp_test_include test_include.cxx )
-target_link_libraries( boxm_algo_sp_test_include boxm_algo_sp)
diff --git a/contrib/brl/bseg/boxm/algo/sp/tests/test_compute_visibility.cxx b/contrib/brl/bseg/boxm/algo/sp/tests/test_compute_visibility.cxx
deleted file mode 100644
index 69c019a479..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/tests/test_compute_visibility.cxx
+++ /dev/null
@@ -1,90 +0,0 @@
-#include <testlib/testlib_test.h>
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_vector_3d.h>
-#include <vgl/vgl_box_3d.h>
-#include <boxm/algo/sp/boxm_compute_volume_visibility.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/util/boxm_test_util.h>
-
-#include <vpl/vpl.h>
-#include <vul/vul_file.h>
-
-static void test_compute_visibility()
-{
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(0,0,0);
- vgl_vector_3d<double> block_dim(10,10,10);
- vgl_vector_3d<unsigned> world_dim(2,2,3);
- boxm_scene<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > scene(lvcs, origin, block_dim, world_dim);
- scene.set_appearance_model(BOXM_APM_MOG_GREY);
- scene.set_paths("./boxm_scene1", "block");
- vul_file::make_directory("./boxm_scene1");
- std::ofstream os("scene1.xml");
- x_write(os, scene, "scene");
- os.close();
-
- // sample 1
- bsta_gauss_sf1 s1_simple_gauss_sf1(0.5f,0.1f);
- bsta_num_obs<bsta_gauss_sf1> s1_simple_obs_gauss_val_sf1(s1_simple_gauss_sf1,1);
- bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, 3> s1_simple_mix_gauss_val_sf1;
-
- s1_simple_mix_gauss_val_sf1.insert(s1_simple_obs_gauss_val_sf1,1);
-
- typedef bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>,3> s1_simple_bsta_mixture_fixed_sf1_3;
- bsta_num_obs<s1_simple_bsta_mixture_fixed_sf1_3> s1_simple_obs_mix_gauss_val_sf1(s1_simple_mix_gauss_val_sf1);
-
- boxm_sample<BOXM_APM_MOG_GREY> s1_sample;
- s1_sample.alpha=0.6f;
- s1_sample.set_appearance(s1_simple_obs_mix_gauss_val_sf1);
-
- boxm_block_iterator<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > iter(&scene);
-
- while (!iter.end())
- {
- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z());
- boxm_block<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > * block=scene.get_active_block();
- auto * tree=new boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> >(3,2);
- if (iter.index().z()==1)
- {
- std::vector<boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> > * > leaf_cells=tree->leaf_cells();
- s1_sample.alpha=0.6f;
-
- for (auto & leaf_cell : leaf_cells)
- {
- leaf_cell->set_data(s1_sample);
- }
- block->init_tree(tree);
- scene.write_active_block();
- }
- else
- {
- std::vector<boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> > * > leaf_cells= tree->leaf_cells();
- s1_sample.alpha=0.01f;
-
- for (auto & leaf_cell : leaf_cells)
- {
- leaf_cell->set_data(s1_sample);
- }
- block->init_tree(tree);
- scene.write_active_block();
- }
-
- iter++;
- }
- vgl_box_3d<double> world;
- world.add(origin);
- world.add(vgl_point_3d<double>(origin.x()+block_dim.x()*world_dim.x(),
- origin.y()+block_dim.y()*world_dim.y(),
- origin.z()+block_dim.z()*world_dim.z()));
- vpgl_camera_double_sptr camera = generate_camera_top(world);
-
- double X=5,Y=5,Z;
- for (Z=40; Z>-10; --Z)
- {
- boxm_compute_point_visibility<short,boxm_sample<BOXM_APM_MOG_GREY> >(vgl_point_3d<double>(X,Y,Z),scene, camera);
- }
- vpl_rmdir("./boxm_scene1");
- vpl_unlink("./scene1.xml");
-}
-
-TESTMAIN(test_compute_visibility);
diff --git a/contrib/brl/bseg/boxm/algo/sp/tests/test_driver.cxx b/contrib/brl/bseg/boxm/algo/sp/tests/test_driver.cxx
deleted file mode 100644
index 2ea0124c63..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/tests/test_driver.cxx
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <testlib/testlib_register.h>
-
-DECLARE( test_compute_visibility );
-DECLARE( test_render_image );
-DECLARE( test_update );
-DECLARE( test_update_multi_bin );
-
-void register_tests()
-{
- REGISTER( test_compute_visibility );
- REGISTER( test_render_image );
- REGISTER( test_update );
- REGISTER( test_update_multi_bin );
-}
-
-
-DEFINE_MAIN;
diff --git a/contrib/brl/bseg/boxm/algo/sp/tests/test_include.cxx b/contrib/brl/bseg/boxm/algo/sp/tests/test_include.cxx
deleted file mode 100644
index 85e7588707..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/tests/test_include.cxx
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <boxm/algo/sp/boxm_compute_volume_visibility.h>
-#include <boxm/algo/sp/boxm_depth_image_triangle.h>
-#include <boxm/algo/sp/boxm_render_image.h>
-#include <boxm/algo/sp/boxm_render_image_triangle.h>
-#include <boxm/algo/sp/boxm_update.h>
-#include <boxm/algo/sp/boxm_update_triangle.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm/algo/sp/tests/test_render_image.cxx b/contrib/brl/bseg/boxm/algo/sp/tests/test_render_image.cxx
deleted file mode 100644
index c36e76f0dd..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/tests/test_render_image.cxx
+++ /dev/null
@@ -1,103 +0,0 @@
-#include <testlib/testlib_test.h>
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_vector_3d.h>
-#include <vgl/vgl_box_3d.h>
-#include <boxm/util/boxm_test_util.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_scene.h>
-#include <boct/boct_tree_cell.h>
-#include <vpl/vpl.h>
-#include <boxm/algo/sp/boxm_render_image.h>
-#include <vul/vul_file.h>
-#include <vpgl/vpgl_camera_double_sptr.h>
-
-static void test_render_image()
-{
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(0,0,0);
- vgl_vector_3d<double> block_dim(10,10,10);
- vgl_vector_3d<unsigned> world_dim(2,2,3);
- boxm_scene<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > scene(lvcs, origin, block_dim, world_dim);
- scene.set_appearance_model(BOXM_APM_MOG_GREY);
- scene.set_paths("./boxm_scene1", "block");
- vul_file::make_directory("./boxm_scene1");
- std::ofstream os("scene1.xml");
- x_write(os, scene, "scene");
- os.close();
-
- boxm_block_iterator<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > iter(&scene);
- // default model
- bsta_gauss_sf1 simple_gauss_sf1(0.0f,0.1f);
- bsta_num_obs<bsta_gauss_sf1> simple_obs_gauss_val_sf1(simple_gauss_sf1,1);
- bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, 3> simple_mix_gauss_val_sf1;
-
- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f);
- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f);
- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f);
-
- typedef bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>,3> simple_bsta_mixture_fixed_sf1_3;
- bsta_num_obs<simple_bsta_mixture_fixed_sf1_3> simple_obs_mix_gauss_val_sf1(simple_mix_gauss_val_sf1);
-
-
- boxm_sample<BOXM_APM_MOG_GREY> default_sample;
- default_sample.alpha=0.001f;
- default_sample.set_appearance(simple_obs_mix_gauss_val_sf1);
-
- // sample 1
- bsta_gauss_sf1 s1_simple_gauss_sf1(0.5f,0.1f);
- bsta_num_obs<bsta_gauss_sf1> s1_simple_obs_gauss_val_sf1(s1_simple_gauss_sf1,1);
- bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, 3> s1_simple_mix_gauss_val_sf1;
-
- s1_simple_mix_gauss_val_sf1.insert(s1_simple_obs_gauss_val_sf1,1);
-
- typedef bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>,3> s1_simple_bsta_mixture_fixed_sf1_3;
- bsta_num_obs<s1_simple_bsta_mixture_fixed_sf1_3> s1_simple_obs_mix_gauss_val_sf1(s1_simple_mix_gauss_val_sf1);
-
- boxm_sample<BOXM_APM_MOG_GREY> s1_sample;
- s1_sample.alpha=0.6f;
- s1_sample.set_appearance(s1_simple_obs_mix_gauss_val_sf1);
-
- // sample 2
- bsta_gauss_sf1 s2_simple_gauss_sf1(1.0f,0.1f);
- bsta_num_obs<bsta_gauss_sf1> s2_simple_obs_gauss_val_sf1(s2_simple_gauss_sf1,1);
- bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, 3> s2_simple_mix_gauss_val_sf1;
-
- s2_simple_mix_gauss_val_sf1.insert(s2_simple_obs_gauss_val_sf1,1);
-
- typedef bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>,3> s2_simple_bsta_mixture_fixed_sf1_3;
- bsta_num_obs<s2_simple_bsta_mixture_fixed_sf1_3> s2_simple_obs_mix_gauss_val_sf1(s2_simple_mix_gauss_val_sf1);
-
- boxm_sample<BOXM_APM_MOG_GREY> s2_sample;
- s2_sample.alpha=0.6f;
- s2_sample.set_appearance(s2_simple_obs_mix_gauss_val_sf1);
-
-
- while (!iter.end())
- {
- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z());
- boxm_block<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > * block=scene.get_active_block();
- auto * tree=new boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> >(3,2);
- boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >* cel11=tree->locate_point(vgl_point_3d<double>(0.01,0.01,0.01));
- cel11->set_data(s2_sample);
- boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >* cell2=tree->locate_point(vgl_point_3d<double>(0.51,0.51,0.01));
- cell2->set_data(s1_sample);
- block->init_tree(tree);
- scene.write_active_block();
- iter++;
- }
- vgl_box_3d<double> world;
- world.add(origin);
- world.add(vgl_point_3d<double>(origin.x()+world_dim.x(), origin.y()+world_dim.y(), origin.z()+world_dim.z()));
- vpgl_camera_double_sptr camera = generate_camera_top(world);
-
- vil_image_view<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> expected(IMAGE_U,IMAGE_V);
- expected.fill(0.0);
- vil_image_view<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> mask(IMAGE_U,IMAGE_V);
- mask.fill(0.0);
-
- boxm_render_image_splatting<short,boxm_sample<BOXM_APM_MOG_GREY> >(scene,camera,expected,mask);
- vpl_rmdir("boxm_scene1");
- vpl_unlink("scene1.xml");
-}
-
-TESTMAIN(test_render_image);
diff --git a/contrib/brl/bseg/boxm/algo/sp/tests/test_update.cxx b/contrib/brl/bseg/boxm/algo/sp/tests/test_update.cxx
deleted file mode 100644
index 9e530c4af6..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/tests/test_update.cxx
+++ /dev/null
@@ -1,259 +0,0 @@
-#include <iostream>
-#include <sstream>
-#include <testlib/testlib_test.h>
-#include <boxm/util/boxm_test_util.h>
-#include <vgl/vgl_point_2d.h>
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_homg_point_3d.h>
-#include <vgl/vgl_box_2d.h>
-#include <vgl/vgl_box_3d.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/util/boxm_utils.h>
-#include <boct/boct_tree_cell.h>
-#include <boxm/algo/sp/boxm_update_triangle.h>
-#include <boxm/algo/sp/boxm_render_image_triangle.h>
-#include <vul/vul_file.h>
-#include <vpgl/vpgl_camera.h>
-#include <vpgl/vpgl_perspective_camera.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vil/vil_load.h>
-#include <vil/vil_save.h>
-#include <vil/vil_convert.h>
-#if 0
-#include <vpl/vpl.h>
-#endif
-
-std::vector<vpgl_camera_double_sptr > generate_cameras_z(vgl_box_3d<double>& world)
-{
- vgl_point_2d<double> principal_point(IMAGE_U/2., IMAGE_V/2.);
-
- vgl_point_3d<double> centroid = world.centroid();
- double alpha = (vnl_math::pi_over_180)*65; // was: (vnl_math::pi/8.) * 3;
- double delta_alpha = vnl_math::pi/36.;
- std::vector<vgl_point_3d<double> > centers;
- for (unsigned i=0; i<11; i++) {
- // double x = boxm_camera_dist*std::cos(alpha)/10;
- double z = boxm_camera_dist*std::sin(alpha);
- centers.emplace_back(centroid.x(), centroid.y(), centroid.z()+z);
- std::cout << centers[i] << std::endl;
- alpha += delta_alpha;
- }
-
- vgl_box_2d<double> bb;
- std::vector<vpgl_camera_double_sptr> rat_cameras;
- for (unsigned i=0; i<centers.size(); i++)
- {
- vpgl_camera_double_sptr rat_cam = generate_camera_top(world);
- rat_cameras.push_back(rat_cam);
-
- std::vector<vgl_point_3d<double> > corners = boxm_utils::corners_of_box_3d(world);
- for (auto c : corners) {
- double u,v, u2, v2;
- vpgl_perspective_camera<double> persp_cam;
- persp_cam.project(c.x(), c.y() ,c.z(), u, v);
- rat_cam->project(c.x(), c.y() ,c.z(), u2, v2);
- bb.add(vgl_point_2d<double> (u,v));
-
- if (verbose)
- {
- std::cout << "Perspective [" << u << ',' << v << "]\n"
- << "Rational [" << u2 << ',' << v2 << "]\n\n";
- }
- }
- std::cout << bb << std::endl;
- }
- return rat_cameras;
-}
-
-std::vector<vpgl_camera_double_sptr > generate_cameras_yz(vgl_box_3d<double>& world)
-{
- vgl_point_2d<double> principal_point(IMAGE_U/2., IMAGE_V/2.);
-
- vgl_point_3d<double> centroid = world.centroid();
- std::cout << "centroid: " << centroid << std::endl;
- double alpha = (vnl_math::pi/8.) * 3;
- double delta_alpha = vnl_math::pi/40.;
- std::vector<vgl_point_3d<double> > centers;
-
- for (unsigned i=0; i<num_train_images; i++) {
- double x = boxm_camera_dist*std::cos(alpha);
- double y = boxm_camera_dist*std::sin(alpha);
- centers.emplace_back(x+centroid.x(), y+centroid.y(), 450+centroid.z());
- if (verbose)
- std::cout << centers[i] << std::endl;
-
- alpha += delta_alpha;
- }
-
- vgl_box_2d<double> bb;
- std::vector<vpgl_camera_double_sptr> persp_cameras;
- for (unsigned i=0; i<centers.size(); i++)
- {
- vgl_point_3d<double> camera_center = centers[i];
- vpgl_perspective_camera<double> persp_cam;
- generate_persp_camera(boxm_focal_length,principal_point, boxm_x_scale, boxm_y_scale, camera_center, persp_cam);
- persp_cam.look_at(vgl_homg_point_3d<double>(centroid));
- persp_cameras.push_back(new vpgl_perspective_camera<double>(persp_cam));
-
- //save the camera to file
- std::stringstream cam_file;
- vul_file::make_directory("./cams");
- cam_file << "./cams/cam_" << i << ".txt";
- std::ofstream cam_out(cam_file.str().c_str());
- cam_out << persp_cam;
-
- if (verbose) {
- std::vector<vgl_point_3d<double> > corners = boxm_utils::corners_of_box_3d(world);
- for (auto c : corners) {
- double u,v;
- persp_cam.project(c.x(), c.y() ,c.z(), u, v);
- bb.add(vgl_point_2d<double> (u,v));
- std::cout << "Perspective [" << u << ',' << v << "]\n"<< std::endl;
- }
- std::cout << bb << std::endl;
- }
- }
- return persp_cameras;
-}
-
-
-static void test_update()
-{
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(0,0,0);
- vgl_vector_3d<double> block_dim(10,10,10);
- vgl_vector_3d<unsigned> world_dim(2,2,1);
- boxm_scene<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > scene(lvcs, origin, block_dim, world_dim);
-#ifdef SET_APPEARENCE_MODEL_EXISTS
- scene.set_appearence_model(BOXM_APM_MOG_GREY);
-#endif
- scene.set_paths("boxm_scene2", "block");
- vul_file::make_directory("boxm_scene2");
- std::ofstream os("scene2.xml");
- x_write(os, scene, "scene");
- os.close();
-
- boxm_block_iterator<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > iter(&scene);
- // default model
- bsta_gauss_sf1 simple_gauss_sf1(0.0f,0.1f);
- bsta_num_obs<bsta_gauss_sf1> simple_obs_gauss_val_sf1(simple_gauss_sf1,1);
- bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, 3> simple_mix_gauss_val_sf1;
-
- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f);
- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f);
- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f);
-
- typedef bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>,3> simple_bsta_mixture_fixed_sf1_3;
- bsta_num_obs<simple_bsta_mixture_fixed_sf1_3> simple_obs_mix_gauss_val_sf1(simple_mix_gauss_val_sf1);
-
-
- boxm_sample<BOXM_APM_MOG_GREY> default_sample;
- default_sample.alpha=0.001f;
- default_sample.set_appearance(simple_obs_mix_gauss_val_sf1);
-
- // sample 1
- bsta_gauss_sf1 s1_simple_gauss_sf1(0.5f,0.1f);
- bsta_num_obs<bsta_gauss_sf1> s1_simple_obs_gauss_val_sf1(s1_simple_gauss_sf1,1);
- bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, 3> s1_simple_mix_gauss_val_sf1;
-
- s1_simple_mix_gauss_val_sf1.insert(s1_simple_obs_gauss_val_sf1,1);
-
- typedef bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>,3> s1_simple_bsta_mixture_fixed_sf1_3;
- bsta_num_obs<s1_simple_bsta_mixture_fixed_sf1_3> s1_simple_obs_mix_gauss_val_sf1(s1_simple_mix_gauss_val_sf1);
-
- boxm_sample<BOXM_APM_MOG_GREY> s1_sample;
- s1_sample.alpha=0.6f;
- s1_sample.set_appearance(s1_simple_obs_mix_gauss_val_sf1);
-
- // sample 2
- bsta_gauss_sf1 s2_simple_gauss_sf1(1.0f,0.1f);
- bsta_num_obs<bsta_gauss_sf1> s2_simple_obs_gauss_val_sf1(s2_simple_gauss_sf1,1);
- bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, 3> s2_simple_mix_gauss_val_sf1;
-
- s2_simple_mix_gauss_val_sf1.insert(s2_simple_obs_gauss_val_sf1,1);
-
- typedef bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>,3> s2_simple_bsta_mixture_fixed_sf1_3;
- bsta_num_obs<s2_simple_bsta_mixture_fixed_sf1_3> s2_simple_obs_mix_gauss_val_sf1(s2_simple_mix_gauss_val_sf1);
-
- boxm_sample<BOXM_APM_MOG_GREY> s2_sample;
- s2_sample.alpha=0.6f;
- s2_sample.set_appearance(s2_simple_obs_mix_gauss_val_sf1);
-
-
- while (!iter.end())
- {
- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z());
- boxm_block<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > * block=scene.get_active_block();
- auto * tree=new boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> >(4,3);
- boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >* cel11=tree->locate_point(vgl_point_3d<double>(0.01,0.01,0.01));
- cel11->set_data(s2_sample);
- boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >* cell2=tree->locate_point(vgl_point_3d<double>(0.51,0.51,0.01));
- cell2->set_data(s1_sample);
- block->init_tree(tree);
- scene.write_active_block();
- iter++;
- }
- vgl_box_3d<double> world;
- world.add(origin);
- world.add(vgl_point_3d<double>(origin.x()+block_dim.x()*world_dim.x(),
- origin.y()+block_dim.y()*world_dim.y(),
- origin.z()+block_dim.z()*world_dim.z()));
-#if 0
- vpgl_camera_double_sptr camera = generate_camera_top(world);
-#endif
- std::vector<vpgl_camera_double_sptr > cameras = generate_cameras_z(world);
-
- vil_image_view<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> expected(IMAGE_U,IMAGE_V);
- vil_image_view<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> mask(IMAGE_U,IMAGE_V);
-
- for (unsigned i=0; i<cameras.size(); i++) {
- expected.fill(0.0);
- mask.fill(0.0);
-
- boxm_render_image_splatting_triangle<short,boxm_sample<BOXM_APM_MOG_GREY> >(scene,cameras[i],expected,mask);
- std::stringstream ss;
- ss << "./boxm_scene2/img" << i << ".tif";
-#if 0
- vil_image_view<unsigned char> expected_byte(expected.ni(),expected.nj(),expected.nplanes());
- vil_convert_stretch_range_limited(expected,expected_byte, 0.0f, 1.0f);
-#endif
-
- vil_save(expected, ss.str().data());
- }
-#if 0
- vpl_rmdir("./boxm_scene1");
- vpl_unlink("./scene1.xml");
-#endif
- boxm_scene<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > scene_new(lvcs, origin,
- block_dim, world_dim, 4U, 3U);
- scene_new.set_appearance_model(BOXM_APM_MOG_GREY);
- scene_new.set_paths("./boxm_scene_update", "block");
- vul_file::make_directory("./boxm_scene_update");
- std::ofstream os1("./boxm_scene_update/scene.xml");
- x_write(os1, scene_new, "scene");
- os1.close();
-
- // update the world, with all the generated images and cameras
- for (unsigned i=0; i<cameras.size(); i++) {
- std::stringstream ss;
- ss << "./boxm_scene2/img" << i << ".tif";
- expected = vil_load(ss.str().data());
- boxm_update_triangle<short,boxm_sample<BOXM_APM_MOG_GREY> >(scene_new, expected, cameras[i] );
- }
-
- // regenerate the images from world
- for (unsigned i=0; i<cameras.size(); i++) {
- std::stringstream ss; ss << "boxm_scene2/img_new" << i << ".tif";
- vil_image_view<float> expected_new(IMAGE_U,IMAGE_V);
- boxm_render_image_splatting<short,boxm_sample<BOXM_APM_MOG_GREY> >(scene_new,cameras[i],expected_new,mask);
- vil_image_view<unsigned char> expected_byte(expected_new.ni(),expected_new.nj(),expected_new.nplanes());
- vil_convert_stretch_range_limited(expected_new,expected_byte, 0.0f, 1.0f);
-
- vil_save(expected_byte, ss.str().data());
- }
-}
-
-TESTMAIN(test_update);
diff --git a/contrib/brl/bseg/boxm/algo/sp/tests/test_update_multi_bin.cxx b/contrib/brl/bseg/boxm/algo/sp/tests/test_update_multi_bin.cxx
deleted file mode 100644
index 27c310aea1..0000000000
--- a/contrib/brl/bseg/boxm/algo/sp/tests/test_update_multi_bin.cxx
+++ /dev/null
@@ -1,262 +0,0 @@
-#include <iostream>
-#include <sstream>
-#include <testlib/testlib_test.h>
-#include <vgl/vgl_point_2d.h>
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_homg_point_3d.h>
-#include <vgl/vgl_box_2d.h>
-#include <vgl/vgl_box_3d.h>
-#include <boxm/util/boxm_test_util.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <boxm/boxm_scene.h>
-#include <boct/boct_tree_cell.h>
-#include <boxm/algo/sp/boxm_update_triangle.h>
-#include <boxm/algo/sp/boxm_render_image_triangle.h>
-#include <vul/vul_file.h>
-#include <vpgl/vpgl_camera.h>
-#include <vpgl/vpgl_perspective_camera.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vil/vil_load.h>
-#include <vil/vil_save.h>
-#include <vil/vil_convert.h>
-#ifdef CLEANUP
-#include <vpl/vpl.h>
-#endif
-
-std::vector<vpgl_camera_double_sptr > generate_cameras_z_multi_bin(vgl_box_3d<double>& world)
-{
- vgl_point_2d<double> principal_point(IMAGE_U/2., IMAGE_V/2.);
-
- vgl_point_3d<double> centroid = world.centroid();
- double alpha = (vnl_math::pi_over_180)*65; // was: (vnl_math::pi/8.) * 3;
- double delta_alpha = vnl_math::pi/36.;
- std::vector<vgl_point_3d<double> > centers;
- for (unsigned i=0; i<11; i++) {
- double z = boxm_camera_dist*std::sin(alpha);
- centers.emplace_back(centroid.x(), centroid.y(), centroid.z()+z);
- std::cout << centers[i] << std::endl;
- alpha += delta_alpha;
- }
-
- vgl_box_2d<double> bb;
- std::vector<vpgl_camera_double_sptr> rat_cameras;
- for (unsigned i=0; i<centers.size(); i++)
- {
- vpgl_camera_double_sptr rat_cam = generate_camera_top(world);
- rat_cameras.push_back(rat_cam);
-
- std::vector<vgl_point_3d<double> > corners = boxm_utils::corners_of_box_3d(world);
- for (auto c : corners) {
- double u,v, u2, v2;
- vpgl_perspective_camera<double> persp_cam;
- persp_cam.project(c.x(), c.y() ,c.z(), u, v);
- rat_cam->project(c.x(), c.y() ,c.z(), u2, v2);
- bb.add(vgl_point_2d<double> (u,v));
-
- if (verbose)
- {
- std::cout << "Perspective [" << u << ',' << v << "]\n"
- << "Rational [" << u2 << ',' << v2 << "]\n\n";
- }
- }
- std::cout << bb << std::endl;
- }
- return rat_cameras;
-}
-
-std::vector<vpgl_camera_double_sptr > generate_cameras_yz_multi_bin(vgl_box_3d<double>& world)
-{
- vgl_point_2d<double> principal_point(IMAGE_U/2., IMAGE_V/2.);
-
- vgl_point_3d<double> centroid = world.centroid();
- std::cout << "centroid: " << centroid << std::endl;
- double alpha = (vnl_math::pi/8.) * 3;
- double delta_alpha = vnl_math::pi/40.;
- std::vector<vgl_point_3d<double> > centers;
-
- for (unsigned i=0; i<num_train_images; i++) {
- double x = boxm_camera_dist*std::cos(alpha);
- double y = boxm_camera_dist*std::sin(alpha);
- centers.emplace_back(x+centroid.x(), y+centroid.y(), 450+centroid.z());
- if (verbose)
- std::cout << centers[i] << std::endl;
-
- alpha += delta_alpha;
- }
-
- vgl_box_2d<double> bb;
- std::vector<vpgl_camera_double_sptr> persp_cameras;
- for (unsigned i=0; i<centers.size(); i++)
- {
- vgl_point_3d<double> camera_center = centers[i];
- vpgl_perspective_camera<double> persp_cam;
- generate_persp_camera(boxm_focal_length,principal_point, boxm_x_scale, boxm_y_scale, camera_center, persp_cam);
- persp_cam.look_at(vgl_homg_point_3d<double>(centroid));
- persp_cameras.push_back(new vpgl_perspective_camera<double>(persp_cam));
-
- //save the camera to file
- std::stringstream cam_file;
- vul_file::make_directory("./cams");
- cam_file << "./cams/cam_" << i << ".txt";
- std::ofstream cam_out(cam_file.str().c_str());
- cam_out << persp_cam;
-
- if (verbose) {
- std::vector<vgl_point_3d<double> > corners = boxm_utils::corners_of_box_3d(world);
- for (auto c : corners) {
- double u,v;
- persp_cam.project(c.x(), c.y() ,c.z(), u, v);
- bb.add(vgl_point_2d<double> (u,v));
- std::cout << "Perspective [" << u << ',' << v << ']' << std::endl << std::endl;
- }
- std::cout << bb << std::endl;
- }
- }
- return persp_cameras;
-}
-
-
-static void test_update_multi_bin()
-{
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(0,0,0);
- vgl_vector_3d<double> block_dim(10,10,10);
- vgl_vector_3d<unsigned> world_dim(2,2,1);
- boxm_scene<boct_tree<short,boxm_sample_multi_bin<BOXM_APM_MOG_GREY> > > scene(lvcs, origin, block_dim, world_dim);
-#ifdef SET_APPEARENCE_MODEL_EXISTS
- scene.set_appearence_model(BOXM_APM_MOG_GREY);
-#endif
- scene.set_paths("boxm_scene2_mb", "block");
- vul_file::make_directory("boxm_scene2_mb");
- std::ofstream os("scene2.xml");
- x_write(os, scene, "scene");
- os.close();
-
- boxm_block_iterator<boct_tree<short,boxm_sample_multi_bin<BOXM_APM_MOG_GREY> > > iter(&scene);
- // default model
- bsta_gauss_sf1 simple_gauss_sf1(0.0f,0.1f);
- bsta_num_obs<bsta_gauss_sf1> simple_obs_gauss_val_sf1(simple_gauss_sf1,1);
- bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, 3> simple_mix_gauss_val_sf1;
-
- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f);
- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f);
- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f);
-
- typedef bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>,3> simple_bsta_mixture_fixed_sf1_3;
- bsta_num_obs<simple_bsta_mixture_fixed_sf1_3> simple_obs_mix_gauss_val_sf1(simple_mix_gauss_val_sf1);
-
-
- boxm_sample_multi_bin<BOXM_APM_MOG_GREY> default_sample;
- default_sample.alpha=0.001f;
- default_sample.set_appearance(simple_obs_mix_gauss_val_sf1,5);
-
- // sample 1
- bsta_gauss_sf1 s1_simple_gauss_sf1(0.5f,0.1f);
- bsta_num_obs<bsta_gauss_sf1> s1_simple_obs_gauss_val_sf1(s1_simple_gauss_sf1,1);
- bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, 3> s1_simple_mix_gauss_val_sf1;
-
- s1_simple_mix_gauss_val_sf1.insert(s1_simple_obs_gauss_val_sf1,1);
-
- typedef bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>,3> s1_simple_bsta_mixture_fixed_sf1_3;
- bsta_num_obs<s1_simple_bsta_mixture_fixed_sf1_3> s1_simple_obs_mix_gauss_val_sf1(s1_simple_mix_gauss_val_sf1);
-
- boxm_sample_multi_bin<BOXM_APM_MOG_GREY> s1_sample;
- s1_sample.alpha=0.6f;
- s1_sample.set_appearance(s1_simple_obs_mix_gauss_val_sf1,5);
-
- // sample 2
- bsta_gauss_sf1 s2_simple_gauss_sf1(1.0f,0.1f);
- bsta_num_obs<bsta_gauss_sf1> s2_simple_obs_gauss_val_sf1(s2_simple_gauss_sf1,1);
- bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, 3> s2_simple_mix_gauss_val_sf1;
-
- s2_simple_mix_gauss_val_sf1.insert(s2_simple_obs_gauss_val_sf1,1);
-
- typedef bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>,3> s2_simple_bsta_mixture_fixed_sf1_3;
- bsta_num_obs<s2_simple_bsta_mixture_fixed_sf1_3> s2_simple_obs_mix_gauss_val_sf1(s2_simple_mix_gauss_val_sf1);
-
- boxm_sample_multi_bin<BOXM_APM_MOG_GREY> s2_sample;
- s2_sample.alpha=0.6f;
- s2_sample.set_appearance(s2_simple_obs_mix_gauss_val_sf1,3);
-
-
- while (!iter.end())
- {
- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z());
- boxm_block<boct_tree<short,boxm_sample_multi_bin<BOXM_APM_MOG_GREY> > > * block=scene.get_active_block();
- auto * tree=new boct_tree<short,boxm_sample_multi_bin<BOXM_APM_MOG_GREY> >(4,3);
- boct_tree_cell<short,boxm_sample_multi_bin<BOXM_APM_MOG_GREY> >* cel11=tree->locate_point(vgl_point_3d<double>(0.01,0.01,0.01));
- cel11->set_data(s2_sample);
- boct_tree_cell<short,boxm_sample_multi_bin<BOXM_APM_MOG_GREY> >* cell2=tree->locate_point(vgl_point_3d<double>(0.51,0.51,0.01));
- cell2->set_data(s1_sample);
- block->init_tree(tree);
- scene.write_active_block();
- iter++;
- }
- vgl_box_3d<double> world;
- world.add(origin);
- world.add(vgl_point_3d<double>(origin.x()+block_dim.x()*world_dim.x(),
- origin.y()+block_dim.y()*world_dim.y(),
- origin.z()+block_dim.z()*world_dim.z()));
-#if 0
- vpgl_camera_double_sptr camera = generate_camera_top(world);
-#endif
- std::vector<vpgl_camera_double_sptr > cameras = generate_cameras_z_multi_bin(world);
-
- vil_image_view<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> expected(IMAGE_U,IMAGE_V);
- vil_image_view<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> mask(IMAGE_U,IMAGE_V);
-
- for (unsigned i=0; i<cameras.size(); i++) {
- expected.fill(0.0);
- mask.fill(0.0);
-
- boxm_render_image_splatting<short,boxm_sample_multi_bin<BOXM_APM_MOG_GREY> >(scene,cameras[i],expected,mask,3);
- std::stringstream ss;
- ss << "./boxm_scene2_mb/img3" << i << ".tif";
- vil_save(expected, ss.str().data());
-
- expected.fill(0.0);
- boxm_render_image_splatting_triangle<short,boxm_sample_multi_bin<BOXM_APM_MOG_GREY> >(scene,cameras[i],expected,mask,5);
- std::stringstream ss1;
- ss1 << "./boxm_scene2_mb/img5" << i << ".tif";
- vil_save(expected, ss1.str().data());
- }
-#ifdef CLEANUP
- vpl_rmdir("./boxm_scene1");
- vpl_unlink("./scene1.xml");
-#endif
- boxm_scene<boct_tree<short,boxm_sample_multi_bin<BOXM_APM_MOG_GREY> > > scene_new(lvcs, origin,
- block_dim, world_dim, 4U, 3U);
- scene_new.set_appearance_model(BOXM_APM_MOG_GREY);
- scene_new.set_paths("./boxm_scene_update", "block");
- vul_file::make_directory("./boxm_scene_update");
- std::ofstream os1("./boxm_scene_update/scene.xml");
- x_write(os1, scene_new, "scene");
- os1.close();
-
- // update the world, with all the generated images and cameras
- for (unsigned i=0; i<cameras.size(); i++) {
- std::stringstream ss;
- ss << "./boxm_scene2_mb/img3" << i << ".tif";
- expected = vil_load(ss.str().data());
- boxm_update_triangle<short,boxm_sample_multi_bin<BOXM_APM_MOG_GREY> >(scene_new, expected, cameras[i],3 );
- std::stringstream ss1;
- ss1 << "./boxm_scene2_mb/img5" << i << ".tif";
- expected = vil_load(ss1.str().data());
- boxm_update_triangle<short,boxm_sample_multi_bin<BOXM_APM_MOG_GREY> >(scene_new, expected, cameras[i],5 );
- }
-
- // regenerate the images from world
- for (unsigned i=0; i<cameras.size(); i++) {
- std::stringstream ss; ss << "boxm_scene2_mb/img_new" << i << ".tif";
- vil_image_view<float> expected_new(IMAGE_U,IMAGE_V);
- boxm_render_image_splatting_triangle<short,boxm_sample_multi_bin<BOXM_APM_MOG_GREY> >(scene_new,cameras[i],expected_new,mask,3);
- vil_image_view<unsigned char> expected_byte(expected_new.ni(),expected_new.nj(),expected_new.nplanes());
- vil_convert_stretch_range_limited(expected_new,expected_byte, 0.0f, 1.0f);
-
- vil_save(expected_byte, ss.str().data());
- }
-}
-
-TESTMAIN(test_update_multi_bin);
diff --git a/contrib/brl/bseg/boxm/algo/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/algo/tests/CMakeLists.txt
deleted file mode 100644
index 5e823166ae..0000000000
--- a/contrib/brl/bseg/boxm/algo/tests/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-add_executable( boxm_algo_test_all
- test_driver.cxx
- test_fill_in_mesh.cxx
- test_save_scene_raw.cxx
- test_upload_mesh.cxx
- test_boxm_fill_internal_cells.cxx
- test_boxm_scene_crop.cxx
- test_linear_operations.cxx
- test_remove_level0.cxx
-
- )
-
-set(boxm_algo_test_all_sources
- test_utils.h test_utils.cxx
- )
-
-vxl_add_library(LIBRARY_NAME boxm_algo_tests LIBRARY_SOURCES ${boxm_algo_test_all_sources})
-
-target_link_libraries( boxm_algo_tests boxm_algo boxm boxm_sample boxm_util boxm_basic boct ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vnl_io ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vpl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vpgl imesh ${VXL_LIB_PREFIX}vcl)
-target_link_libraries( boxm_algo_test_all boxm_algo_tests boxm_algo boxm boxm_sample boxm_util boxm_basic boct ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vnl_io ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vpl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vpgl imesh ${VXL_LIB_PREFIX}vcl)
-
-add_test( NAME boxm_algo_test_fill_in_mesh COMMAND $<TARGET_FILE:boxm_algo_test_all> test_fill_in_mesh )
-add_test( NAME boxm_algo_test_save_scene_raw COMMAND $<TARGET_FILE:boxm_algo_test_all> test_save_scene_raw )
-add_test( NAME boxm_algo_test_upload_mesh COMMAND $<TARGET_FILE:boxm_algo_test_all> test_upload_mesh )
-add_test( NAME boxm_algo_test_fill_internal_cells COMMAND $<TARGET_FILE:boxm_algo_test_all> test_boxm_fill_internal_cells )
-add_test( NAME boxm_algo_test_scene_crop COMMAND $<TARGET_FILE:boxm_algo_test_all> test_boxm_scene_crop )
-add_test( NAME boxm_algo_test_linear_operations COMMAND $<TARGET_FILE:boxm_algo_test_all> test_linear_operations )
-add_test( NAME boxm_algo_remove_level0 COMMAND $<TARGET_FILE:boxm_algo_test_all> test_remove_level0 )
-
-add_executable( boxm_algo_test_include test_include.cxx )
-target_link_libraries( boxm_algo_test_include boxm_algo)
diff --git a/contrib/brl/bseg/boxm/algo/tests/test_boxm_fill_internal_cells.cxx b/contrib/brl/bseg/boxm/algo/tests/test_boxm_fill_internal_cells.cxx
deleted file mode 100644
index 509f828fb6..0000000000
--- a/contrib/brl/bseg/boxm/algo/tests/test_boxm_fill_internal_cells.cxx
+++ /dev/null
@@ -1,112 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date February 4, 2010
-
-#include <testlib/testlib_test.h>
-#include <boxm/algo/boxm_fill_internal_cells.h>
-#include <boxm/boxm_apm_traits.h>
-
-const bool debug = false;
-
-void build_tree(boct_tree<short,float>* tree)
-{
- std::cout << "Creating Octree" << std::endl;
-
- // Create tree
- tree->split();
- {
- std::vector<boct_tree_cell<short,float>*> leaves = tree->leaf_cells();
- leaves[1]->set_data(0.1f);
- leaves[1]->split();
- for (auto & leave : leaves)
- leave->set_data(0.1f);
- }
-
- if (debug)
- {
- std::cout << "All Levels" << std::endl;
- std::vector<boct_tree_cell<short,float>*> leaves = tree->all_cells();
- for (auto & leave : leaves) {
- std::cout<< leave->get_code().x_loc_ << ','
- << leave->get_code().y_loc_ << ','
- << leave->get_code().z_loc_ << ','
- << leave->get_code().level << ','
- << leave->data() << std::endl;
- }
- }
-}
-
-static void test_boxm_fill_internal_cells()
-{
- //Create a dummy scene
- typedef boct_tree<short,float > tree_type;
- auto *tree = new boct_tree<short,float>(3);
- build_tree(tree);
-
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(0.0,0.0,0.0);
-
- //world coordinate dimensions of a block
- vgl_vector_3d<double> block_dim(10.0,10.0,10.0);
-
- //number of blocks in a scene
- vgl_vector_3d<unsigned> world_dim(1,1,1);
-
- auto *scene= new boxm_scene<tree_type>(lvcs, origin, block_dim, world_dim,true);
- std::string scene_path=".";
- scene->set_paths(scene_path, "in_block");
- scene->set_appearance_model(BOXM_FLOAT);
- scene->clean_scene();
-
- boxm_block_iterator<tree_type > iter =scene->iterator();
- iter.begin();
- scene->load_block(iter.index());
- boxm_block<tree_type> *block = scene->get_active_block();
- block->init_tree(tree);
- scene->write_active_block();
-
- vgl_box_3d<double> bbox(vgl_point_3d<double>(5, 0, 0), vgl_point_3d<double>(9, 4, 4));
-
- boxm_fill_internal_cells<float> filler;
- boxm_scene<tree_type> *scene_out = filler.traverse_and_fill(scene);
-
- //check that output scene is correct
- boxm_block_iterator<tree_type > iter_out =scene_out->iterator();
- iter_out.begin();
- scene_out->load_block(iter_out.index());
- boxm_block<tree_type> *block_out = scene_out->get_active_block();
- boct_tree<short, float> *tree_out= block_out->get_tree();
- std::vector<boct_tree_cell<short,float>*> cells = tree_out->all_cells();
- bool result = true;
- for (auto & cell : cells)
- {
- if (!cell->is_leaf())
- {
- boct_tree_cell<short,float>* children = cell->children();
- float avg =0;
- for (unsigned c=0; c<8; c++)
- {
- avg+=children[c].data();
- }
- result = result && (cell->data()==(avg/8.f));
- }
- }
- TEST("Valid average cells", result, true);
-
- if (debug) {
- std::cout << "Printing Output Tree" << std::endl;
- for (auto & cell : cells) {
- std::cout<< cell->get_code().x_loc_ << ','
- << cell->get_code().y_loc_ << ','
- << cell->get_code().z_loc_ << ','
- << cell->get_code().level << ','
- << cell->data() << std::endl;
- }
- }
-
- scene->clean_scene();
- scene_out->clean_scene();
-}
-
-TESTMAIN(test_boxm_fill_internal_cells);
diff --git a/contrib/brl/bseg/boxm/algo/tests/test_boxm_scene_crop.cxx b/contrib/brl/bseg/boxm/algo/tests/test_boxm_scene_crop.cxx
deleted file mode 100644
index 73eff00099..0000000000
--- a/contrib/brl/bseg/boxm/algo/tests/test_boxm_scene_crop.cxx
+++ /dev/null
@@ -1,129 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date Nov. 16, 2009.
-
-#include <testlib/testlib_test.h>
-#include <boxm/algo/boxm_crop_scene.h>
-#include <boxm/boxm_apm_traits.h>
-
-const bool debug = true;
-
-void fill_sample_octree(boct_tree<short,float>* tree)
-{
- std::cout << "Creating Octree" << std::endl;
-
- //Create tree
- tree->init_cells(0.1f);
- tree->split();
- std::cout << "Level 1" << std::endl;
-
- {
- std::vector<boct_tree_cell<short,float>*> leaves = tree->leaf_cells();
- tree->init_cells(0.1f);
- leaves[1]->set_data(0.5f);
- if (debug)
- for (auto & leave : leaves) {
- std::cout<< leave->get_code().x_loc_ << ','
- << leave->get_code().y_loc_ << ','
- << leave->get_code().z_loc_ << ','
- << leave->data() << std::endl;
- }
-
- leaves[1]->split();
- }
-
- if (debug)
- {
- std::cout << "Level 0" << std::endl;
- std::vector<boct_tree_cell<short,float>*> leaves = tree->cells_at_level((short)0);
- for (auto & leave : leaves) {
- leave->set_data(0.9f);
- std::cout<< leave->get_code().x_loc_ << ','
- << leave->get_code().y_loc_ << ','
- << leave->get_code().z_loc_ << ','
- << leave->get_code().level << ','
- << leave->data() << std::endl;
- }
- }
-
- if (debug)
- {
- std::cout << "All Levels" << std::endl;
- std::vector<boct_tree_cell<short,float>*> leaves = tree->all_cells();
- for (auto & leave : leaves) {
- std::cout<< leave->get_code().x_loc_ << ','
- << leave->get_code().y_loc_ << ','
- << leave->get_code().z_loc_ << ','
- << leave->get_code().level << ','
- << leave->data() << std::endl;
- }
- }
-}
-
-static void test_boxm_scene_crop()
-{
- //Create a dummy scene
- typedef boct_tree<short,float > tree_type;
- auto *tree = new boct_tree<short,float>(3);
- fill_sample_octree(tree);
-
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(0.0,0.0,0.0);
-
- //world coordinate dimensions of a block
- vgl_vector_3d<double> block_dim(10.0,10.0,10.0);
-
- //number of blocks in a scene
- vgl_vector_3d<unsigned> world_dim(1,1,1);
-
- auto *scene= new boxm_scene<tree_type>(lvcs, origin, block_dim, world_dim,true);
- std::string scene_path=".";
- scene->set_paths(scene_path, "in_block");
- scene->set_appearance_model(BOXM_FLOAT);
- scene->clean_scene();
-
- boxm_block_iterator<tree_type > iter =scene->iterator();
- iter.begin();
- scene->load_block(iter.index());
- boxm_block<tree_type> *block = scene->get_active_block();
- block->init_tree(tree);
- scene->write_active_block();
-
- vgl_box_3d<double> bbox(vgl_point_3d<double>(5, 0, 0), vgl_point_3d<double>(9, 4, 4));
-
- boxm_scene<tree_type> *scene_out = boxm_crop_scene<float>(scene, bbox);
-
- //check that output scene is correct
- boxm_block_iterator<tree_type > iter_out =scene_out->iterator();
- iter_out.begin();
- scene_out->load_block(iter_out.index());
- boxm_block<tree_type> *block_out = scene_out->get_active_block();
- boct_tree<short, float> *tree_out= block_out->get_tree();
-
- std::vector<boct_tree_cell<short,float>*> leaves_out = tree_out->leaf_cells();
- bool result = true;
- for (auto & i : leaves_out)
- {
- result = result && (std::abs(i->data() - 0.9)< 1e-5);
- }
-
- TEST("Valid cropped tree", result, true);
-
- std::vector<boct_tree_cell<short,float>*> leaves = tree_out->all_cells();
- if (debug) {
- std::cout << "Printing Output Tree" << std::endl;
- for (auto & leave : leaves) {
- std::cout<< leave->get_code().x_loc_ << ','
- << leave->get_code().y_loc_ << ','
- << leave->get_code().z_loc_ << ','
- << leave->get_code().level << ','
- << leave->data() << std::endl;
- }
- }
-
- scene->clean_scene();
- scene_out->clean_scene();
-}
-
-TESTMAIN(test_boxm_scene_crop);
diff --git a/contrib/brl/bseg/boxm/algo/tests/test_driver.cxx b/contrib/brl/bseg/boxm/algo/tests/test_driver.cxx
deleted file mode 100644
index 299ce36aab..0000000000
--- a/contrib/brl/bseg/boxm/algo/tests/test_driver.cxx
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <testlib/testlib_register.h>
-
-DECLARE( test_fill_in_mesh );
-DECLARE( test_save_scene_raw );
-DECLARE( test_upload_mesh );
-DECLARE( test_boxm_fill_internal_cells );
-DECLARE( test_boxm_scene_crop );
-DECLARE( test_linear_operations );
-DECLARE( test_remove_level0 );
-
-void register_tests()
-{
- REGISTER( test_fill_in_mesh );
- REGISTER( test_save_scene_raw );
- REGISTER( test_upload_mesh );
- REGISTER( test_boxm_fill_internal_cells );
- REGISTER( test_boxm_scene_crop );
- REGISTER( test_linear_operations );
- REGISTER( test_remove_level0 );
-}
-
-
-DEFINE_MAIN;
diff --git a/contrib/brl/bseg/boxm/algo/tests/test_fill_in_mesh.cxx b/contrib/brl/bseg/boxm/algo/tests/test_fill_in_mesh.cxx
deleted file mode 100644
index 564a5c4359..0000000000
--- a/contrib/brl/bseg/boxm/algo/tests/test_fill_in_mesh.cxx
+++ /dev/null
@@ -1,121 +0,0 @@
-#include <iostream>
-#include <limits>
-#include <testlib/testlib_test.h>
-
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/boxm_fill_in_mesh.h>
-#include <boxm/algo/boxm_save_block_raw.h>
-#include <boct/boct_tree_cell.h>
-
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_vector_3d.h>
-#include <vpl/vpl.h>
-#include <vul/vul_file.h>
-#include <vpgl/vpgl_lvcs.h>
-#include <imesh/imesh_mesh.h>
-#include <imesh/imesh_fileio.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-static void test_fill_in_mesh()
-{
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(0,0,0);
- vgl_vector_3d<double> block_dim(10,10,10);
- vgl_vector_3d<unsigned> world_dim(1,1,1);
- boxm_scene<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > scene(lvcs, origin, block_dim, world_dim);
- scene.set_appearance_model(BOXM_APM_MOG_GREY);
- scene.set_paths("./boxm_fill_in", "block");
- vul_file::make_directory("./boxm_fill_in");
- std::ofstream os("scene.xml");
- x_write(os, scene, "scene");
- os.close();
-
- //// create a mesh
- unsigned int num_faces=6;
- std::unique_ptr<imesh_vertex_array<3> > verts(new imesh_vertex_array<3>(8));
- std::unique_ptr<imesh_face_array > faces(new imesh_face_array(num_faces));
- imesh_vertex<3>& vert0 = (*verts)[0]; imesh_vertex<3>& vert4 = (*verts)[4];
- vert0[0]=2; vert4[0]=2;
- vert0[1]=2; vert4[1]=2;
- vert0[2]=4; vert4[2]=8;
- imesh_vertex<3>& vert1 = (*verts)[1]; imesh_vertex<3>& vert5 = (*verts)[5];
- vert1[0]=4; vert5[0]=4;
- vert1[1]=2; vert5[1]=2;
- vert1[2]=4; vert5[2]=8;
- imesh_vertex<3>& vert2 = (*verts)[2]; imesh_vertex<3>& vert6 = (*verts)[6];
- vert2[0]=4; vert6[0]=4;
- vert2[1]=4; vert6[1]=4;
- vert2[2]=4; vert6[2]=8;
-
- imesh_vertex<3>& vert3 = (*verts)[3]; imesh_vertex<3>& vert7 = (*verts)[7];
- vert3[0]=2; vert7[0]=2;
- vert3[1]=4; vert7[1]=4;
- vert3[2]=4; vert7[2]=8;
-
- std::vector<unsigned int> face(4,0);
- face[0]=4;face[1]=5;face[2]=6;face[3]=7;
- (*faces)[0]=face;
- face[0]=3;face[1]=2;face[2]=1;face[3]=0;
- (*faces)[1]=face;
- face[0]=0;face[1]=4;face[2]=7;face[3]=3;
- (*faces)[2]=face;
- face[0]=1;face[1]=2;face[2]=6;face[3]=5;
- (*faces)[3]=face;
- face[0]=1;face[1]=5;face[2]=4;face[3]=0;
- (*faces)[4]=face;
- face[0]=3;face[1]=7;face[2]=6;face[3]=2;
- (*faces)[5]=face;
-
-
- imesh_mesh mesh;
-#if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520)
- std::unique_ptr<imesh_vertex_array_base> tempv(std::move(verts));
- mesh.set_vertices(std::move(tempv));
- std::unique_ptr<imesh_face_array_base> tempf(std::move(faces));
- mesh.set_faces(std::move(tempf));
-#else
- mesh.set_vertices(std::unique_ptr<imesh_vertex_array_base>(verts));
- mesh.set_faces(std::unique_ptr<imesh_face_array_base>(faces));
-#endif
-
- typedef boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- boxm_block_iterator<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > iter(&scene);
- while (!iter.end())
- {
- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z());
- boxm_block<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > * block=scene.get_active_block();
- auto * tree=new boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> >(7,6);
- boxm_sample<BOXM_APM_MOG_GREY> s;
- s.alpha=std::numeric_limits<float>::max();
- tree->init_cells(s);
- block->init_tree(tree);
- scene.write_active_block();
- iter++;
- }
-
- boxm_sample<BOXM_APM_MOG_GREY> val;
- val.alpha=0;
- std::vector<imesh_mesh> meshes; meshes.push_back(mesh);
- boxm_fill_in_mesh_into_scene<short, boxm_sample<BOXM_APM_MOG_GREY> >(scene, meshes, false, val);
-
- std::vector<std::string> fnames;
- boxm_block_iterator<tree_type> it(&scene);
-
- // check the first block
- scene.load_block(it.index().x(),it.index().y(),it.index().z());
- boxm_block<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > * block=scene.get_active_block();
- boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > * tree=block->get_tree();
-
-
- boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >* cell0 = tree->locate_point_global(vgl_point_3d<double>(3,3,6));
- TEST("Centroid of the mesh is in the octree", cell0->data().alpha, 0.0f);
-
-
- vpl_rmdir("boxm_fill_in");
- vpl_unlink("scene.xml");
-}
-
-TESTMAIN(test_fill_in_mesh);
diff --git a/contrib/brl/bseg/boxm/algo/tests/test_include.cxx b/contrib/brl/bseg/boxm/algo/tests/test_include.cxx
deleted file mode 100644
index c59d7e8540..0000000000
--- a/contrib/brl/bseg/boxm/algo/tests/test_include.cxx
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <boxm/algo/boxm_compute_scene_difference.h>
-#include <boxm/algo/boxm_compute_scene_statistics.h>
-#include <boxm/algo/boxm_crop_scene.h>
-#include <boxm/algo/boxm_fill_in_mesh.h>
-#include <boxm/algo/boxm_fill_internal_cells.h>
-#include <boxm/algo/boxm_init_scene.h>
-#include <boxm/algo/boxm_linear_operations.h>
-#include <boxm/algo/boxm_merge_mog.h>
-#include <boxm/algo/boxm_refine.h>
-#include <boxm/algo/boxm_save_block_raw.h>
-#include <boxm/algo/boxm_save_scene_raw.h>
-#include <boxm/algo/boxm_save_scene_raw_general.h>
-#include <boxm/algo/boxm_scene_levels_utils.h>
-#include <boxm/algo/boxm_split_sample.h>
-#include <boxm/algo/boxm_upload_mesh.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm/algo/tests/test_linear_operations.cxx b/contrib/brl/bseg/boxm/algo/tests/test_linear_operations.cxx
deleted file mode 100644
index 0e4fe4f91c..0000000000
--- a/contrib/brl/bseg/boxm/algo/tests/test_linear_operations.cxx
+++ /dev/null
@@ -1,82 +0,0 @@
-//:
-// \file
-// \brief Test linear combinations of blocks
-// \author Isabel Restrepo
-// \date 2-Feb-2011
-
-#include <testlib/testlib_test.h>
-#include <boxm/algo/boxm_linear_operations.h>
-#include "test_utils.h"
-
-void test_linear_operations()
-{
- clean_up();
- //create scene
- boxm_scene<boct_tree<short, float> > *scene1 = create_scene(2,2,2,true, "test_scene1");
- boxm_scene<boct_tree<short, float> > *scene2 = create_scene(2,2,2,true, "test_scene2");
-
- float s1 = 2.0, s2=3.0;
- for (unsigned i = 0; i< 2; i++)
- for (unsigned j = 0; j < 2; j++)
- for (unsigned k = 0; k< 2; k++)
- {
- scene1->load_block(i,j,k);
- scene2->load_block(i,j,k);
-
- boxm_block<boct_tree<short, float> > *block1 = scene1->get_block(i,j,k);
- boxm_block<boct_tree<short, float> > *block2 = scene2->get_block(i,j,k);
-
- //The result is block1 = s1*block1+ s2*block2
- boxm_linear_combination(block1, block2, s1, s2);
-
- //make sure to write the block back to disk
- scene1->write_active_block();
-
- //clean memory
- scene1->unload_active_blocks();
- scene2->unload_active_blocks();
- }
-
-
- //Test the output scene. Scene1 should contain the result i.e (2*0.8 + 3*0.8) and scene2 should be unchanged
- boxm_cell_iterator<boct_tree<short, float> > it1 =
- scene1->cell_iterator(&boxm_scene<boct_tree<short, float> >::load_block, true);
-
- boxm_cell_iterator<boct_tree<short, float > > it2 =
- scene2->cell_iterator(&boxm_scene<boct_tree<short, float> >::load_block, true);
-
- it1.begin();
- it2.begin();
- bool result = true;
-
- while ( !(it1.end() || it2.end()) ) {
-
- boct_tree_cell<short,float > *cell1 = *it1;
- boct_tree_cell<short,float > *cell2 = *it2;
-
- if (std::abs(cell1->data()- 4.0f) > 1.0e-7){
- std::cerr << "Data1 is incorrect: "<< cell1->data() <<"Error: " << std::abs(cell1->data()- 4.0f) << '\n';
- result = false;
- break;
- }
-
- if (std::abs(cell2->data()- 0.8f) > 1.0e-7){
- std::cerr << "Data2 is incorrect: " << cell2->data()<<'\n';
- result = false;
- break;
- }
-
- ++it1;
- ++it2;
- }
-
-#ifdef DEBUG_LEAKS
- std::cerr << "Leaks at test_linear_operations " << boct_tree_cell<short, float >::nleaks() << std::endl;
-#endif
-
- TEST("Output data is correct", result, true);
- clean_up();
-}
-
-
-TESTMAIN(test_linear_operations);
diff --git a/contrib/brl/bseg/boxm/algo/tests/test_remove_level0.cxx b/contrib/brl/bseg/boxm/algo/tests/test_remove_level0.cxx
deleted file mode 100644
index 1243faf34f..0000000000
--- a/contrib/brl/bseg/boxm/algo/tests/test_remove_level0.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date Nov 23 2011
-
-#include <testlib/testlib_test.h>
-#include "test_utils.h"
-
-#include <boxm/algo/boxm_scene_levels_utils.h>
-
-
-void test_remove_level0()
-{
- clean_up();
- //create scene
- boxm_scene<boct_tree<short, float> > *scene1 = create_scene(2,2,2,true, "test_scene1");
-
- //clone the input scene
- boxm_scene<boct_tree<short, float> > *scene2 = new boxm_scene<boct_tree<short, float> >(scene1->lvcs(), scene1->origin(), scene1->block_dim(),
- scene1->world_dim(), scene1->max_level(), scene1->init_level(),
- scene1->load_all_blocks(), scene1->save_internal_nodes());
-
- std::stringstream block_pref;
- block_pref << scene1->block_prefix() << "_max_level_" << (scene1->max_level() - 1);
- scene2->set_paths(scene1->path(), block_pref.str());
- scene2->set_appearance_model(scene1->appearence_model());
-
- std::cout << "Cloning\n";
- scene1->clone_blocks(*scene2);
- std::cout << "Restructuring\n";
- boxm_remove_level_0_leaves(scene2);
- std::cout << "Done\n";
-
- //Show contents of the scenes scene
- boxm_block_iterator<boct_tree<short, float> > it1 = scene1->iterator();
- boxm_block_iterator<boct_tree<short, float> > it2 = scene2->iterator();
- for (it1.begin(), it2.begin(); !it1.end() && !it2.end(); ++it1, ++it2)
- {
- scene1->load_block(it1.index());
- scene2->load_block(it2.index());
-
- boxm_block<boct_tree<short, float> > *block1 = scene1->get_active_block();
- boxm_block<boct_tree<short, float> > *block2 = scene2->get_active_block();
-
- block1->get_tree()->print();
- block2->get_tree()->print();
- }
-
- scene1->unload_active_blocks();
- scene2->unload_active_blocks();
-}
-
-
-TESTMAIN(test_remove_level0);
diff --git a/contrib/brl/bseg/boxm/algo/tests/test_save_scene_raw.cxx b/contrib/brl/bseg/boxm/algo/tests/test_save_scene_raw.cxx
deleted file mode 100644
index 62b425171a..0000000000
--- a/contrib/brl/bseg/boxm/algo/tests/test_save_scene_raw.cxx
+++ /dev/null
@@ -1,122 +0,0 @@
-#include <testlib/testlib_test.h>
-
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/boxm_save_scene_raw.h>
-#include <boxm/algo/boxm_refine.h>
-#include <boct/boct_tree_cell.h>
-
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_vector_3d.h>
-#include <vgl/vgl_box_3d.h>
-#include <vul/vul_file.h>
-#include <vpgl/vpgl_lvcs.h>
-
-static int test_save_scene_raw()
-{
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(0,0,0);
- vgl_vector_3d<double> block_dim(5,5,5);
- vgl_vector_3d<unsigned> world_dim(1,1,1);
- boxm_scene<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > scene(lvcs, origin, block_dim, world_dim);
- scene.set_appearance_model(BOXM_APM_MOG_GREY);
- scene.set_paths("boxm_scene1", "block");
- vul_file::make_directory("boxm_scene1");
- std::ofstream os("scene1.xml");
- x_write(os, scene, "scene");
- os.close();
-
- unsigned max_level=10, init_level=3;
-
- boxm_block_iterator<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > iter(&scene);
- // default model
- bsta_gauss_sf1 simple_gauss_sf1(0.0f,0.1f);
- bsta_num_obs<bsta_gauss_sf1> simple_obs_gauss_val_sf1(simple_gauss_sf1,1);
- bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, 3> simple_mix_gauss_val_sf1;
-
- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f);
- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f);
- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,0.1f);
-
- typedef bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>,3> simple_bsta_mixture_fixed_sf1_3;
- bsta_num_obs<simple_bsta_mixture_fixed_sf1_3> simple_obs_mix_gauss_val_sf1(simple_mix_gauss_val_sf1);
-
-
- boxm_sample<BOXM_APM_MOG_GREY> default_sample;
- default_sample.alpha=0.001f;
- default_sample.set_appearance(simple_obs_mix_gauss_val_sf1);
-
- // sample 1
- bsta_gauss_sf1 s1_simple_gauss_sf1(0.5f,0.1f);
- bsta_num_obs<bsta_gauss_sf1> s1_simple_obs_gauss_val_sf1(s1_simple_gauss_sf1,1);
- bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, 3> s1_simple_mix_gauss_val_sf1;
-
- s1_simple_mix_gauss_val_sf1.insert(s1_simple_obs_gauss_val_sf1,1);
-
- typedef bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>,3> s1_simple_bsta_mixture_fixed_sf1_3;
- bsta_num_obs<s1_simple_bsta_mixture_fixed_sf1_3> s1_simple_obs_mix_gauss_val_sf1(s1_simple_mix_gauss_val_sf1);
-
-
- boxm_sample<BOXM_APM_MOG_GREY> s1_sample;
- s1_sample.alpha=0.6f;
- s1_sample.set_appearance(s1_simple_obs_mix_gauss_val_sf1);
-
- // sample 2
- bsta_gauss_sf1 s2_simple_gauss_sf1(1.0f,0.1f);
- bsta_num_obs<bsta_gauss_sf1> s2_simple_obs_gauss_val_sf1(s2_simple_gauss_sf1,1);
- bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, 3> s2_simple_mix_gauss_val_sf1;
-
- s2_simple_mix_gauss_val_sf1.insert(s2_simple_obs_gauss_val_sf1,1);
-
- typedef bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>,3> s2_simple_bsta_mixture_fixed_sf1_3;
- bsta_num_obs<s2_simple_bsta_mixture_fixed_sf1_3> s2_simple_obs_mix_gauss_val_sf1(s2_simple_mix_gauss_val_sf1);
-
-
- boxm_sample<BOXM_APM_MOG_GREY> s2_sample;
- s2_sample.alpha=0.6f;
- s2_sample.set_appearance(s2_simple_obs_mix_gauss_val_sf1);
-
-
- float count=0.1f;
- while (!iter.end())
- {
- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z());
- boxm_block<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > * block=scene.get_active_block();
- boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > * tree;
- if (iter.index().x()==0 && iter.index().y()==0 && iter.index().z()==0) {
- tree = new boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> >(max_level,init_level);
- }
- else {
- tree=new boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> >(max_level,init_level-1);
- }
- boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >* cel11=tree->locate_point(vgl_point_3d<double>(0.01,0.01,0.9));
- s2_sample.alpha=count;
-
- cel11->set_data(s2_sample);
- //boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >* cell2=tree->locate_point(vgl_point_3d<double>(0.51,0.51,0.51));
- //cell2->set_data(s2_sample);
- block->init_tree(tree);
- scene.write_active_block();
- iter++;
- count+=0.1f;
- }
-
-
- vgl_box_3d<double> world;
- world.add(origin);
- world.add(vgl_point_3d<double>(origin.x()+world_dim.x(), origin.y()+world_dim.y(), origin.z()+world_dim.z()));
-
- float thresh=0.02f;
- bool reset=false;
- for (unsigned i=0; i<10; i++) {
- boxm_refine_scene<short, boxm_sample<BOXM_APM_MOG_GREY> >(scene, thresh, reset);
- boxm_save_scene_raw<short,boxm_sample<BOXM_APM_MOG_GREY> >(scene, "scene.raw", 0);
-#ifdef DEBUG_LEAKS
- std::cerr << "Leaks at test_save_scene_raw " << boct_tree_cell<short, float >::nleaks() << std::endl;
-#endif
- }
-
- SUMMARY();
-}
-
-TESTMAIN(test_save_scene_raw);
diff --git a/contrib/brl/bseg/boxm/algo/tests/test_upload_mesh.cxx b/contrib/brl/bseg/boxm/algo/tests/test_upload_mesh.cxx
deleted file mode 100644
index ced456755e..0000000000
--- a/contrib/brl/bseg/boxm/algo/tests/test_upload_mesh.cxx
+++ /dev/null
@@ -1,127 +0,0 @@
-#include <iostream>
-#include <limits>
-#include <testlib/testlib_test.h>
-
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/algo/boxm_upload_mesh.h>
-#include <boxm/algo/boxm_save_block_raw.h>
-#include <boct/boct_tree_cell.h>
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_vector_3d.h>
-#include <vpl/vpl.h>
-#include <vul/vul_file.h>
-#include <vpgl/vpgl_lvcs.h>
-#include <imesh/imesh_mesh.h>
-#include <imesh/imesh_fileio.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-static void test_upload_mesh()
-{
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(0,0,0);
- vgl_vector_3d<double> block_dim(10,10,10);
- vgl_vector_3d<unsigned> world_dim(2,2,1);
- boxm_scene<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > scene(lvcs, origin, block_dim, world_dim);
- scene.set_appearance_model(BOXM_APM_MOG_GREY);
-
-#if 0
- if (vul_file_is_directory("./boxm_upload"))
- {
- vul_file_iterator fiter("./boxm_upload/*");
- while (!fiter)
- {
- vpl_unlink(fiter());
- fiter++;
- }
- vpl_rmdir("./boxm_upload");
- }
-#endif // 0
-
- scene.set_paths("./boxm_upload", "block");
- vul_file::make_directory("./boxm_upload");
- std::ofstream os("scene.xml");
- x_write(os, scene, "scene");
- os.close();
-
- // create a mesh
- unsigned int num_faces=1;
- std::unique_ptr<imesh_vertex_array<3> > verts(new imesh_vertex_array<3>(3));
- std::unique_ptr<imesh_face_array > faces(new imesh_face_array(num_faces));
- imesh_vertex<3>& vert0 = (*verts)[0];
- vert0[0]=2;
- vert0[1]=2;
- vert0[2]=4;
- imesh_vertex<3>& vert1 = (*verts)[1];
- vert1[0]=8;
- vert1[1]=2;
- vert1[2]=4;
- imesh_vertex<3>& vert2 = (*verts)[2];
- vert2[0]=8;
- vert2[1]=8;
- vert2[2]=4;
-
- for (unsigned int f=0; f<num_faces; ++f) {
- std::vector<unsigned int>& face = (*faces)[f];
- unsigned int cnt=3;
- face.resize(cnt,0);
- for (unsigned int v=0; v<cnt; ++v)
- face[v]=v;
- }
- imesh_mesh mesh;
-#if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520)
- std::unique_ptr<imesh_vertex_array_base> tempv(std::move(verts));
- mesh.set_vertices(std::move(tempv));
- std::unique_ptr<imesh_face_array_base> tempf(std::move(faces));
- mesh.set_faces(std::move(tempf));
-#else
- mesh.set_vertices(std::unique_ptr<imesh_vertex_array_base>(verts));
- mesh.set_faces(std::unique_ptr<imesh_face_array_base>(faces));
-#endif
-
- typedef boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- boxm_block_iterator<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > iter(&scene);
- while (!iter.end())
- {
- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z());
- boxm_block<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > * block=scene.get_active_block();
- auto * tree=new boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> >(6,5);
- boxm_sample<BOXM_APM_MOG_GREY> s;
- s.alpha=std::numeric_limits<float>::max();
- tree->init_cells(s);
- block->init_tree(tree);
- scene.write_active_block();
- iter++;
- }
-
- boxm_sample<BOXM_APM_MOG_GREY> val;
- val.alpha=0;
- boxm_upload_mesh_into_scene<short, boxm_sample<BOXM_APM_MOG_GREY> >(scene, mesh, false, val);
-
- std::vector<std::string> fnames;
- boxm_block_iterator<tree_type> it(&scene);
- it.begin();
- // check the first block
- scene.load_block(it.index().x(),it.index().y(),it.index().z());
- boxm_block<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > * block=scene.get_active_block();
- boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > * tree=block->get_tree();
-
- boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >* cell0 = tree->locate_point_global(vert0.operator vgl_point_3d<double>());
- TEST("Vertex 0 is in the octree", cell0->data().alpha, 0.0f);
-
- boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >* cell1 = tree->locate_point_global(vert1.operator vgl_point_3d<double>());
- TEST("Vertex 1 is in the octree", cell1->data().alpha, 0.0f);
-
- boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >* cell2 = tree->locate_point_global(vert2.operator vgl_point_3d<double>());
- TEST("Vertex 2 is in the octree", cell2->data().alpha, 0.0f);
-
- boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >* cell = tree->locate_point_global(vgl_point_3d<double>(1,1,1));
- TEST_NEAR("A non-polygon point should be non-zero", cell->data().alpha, std::numeric_limits<float>::max(), 1e-6);
-
- vpl_rmdir("./boxm_upload");
- vpl_unlink("./scene.xml");
-}
-
-TESTMAIN(test_upload_mesh);
diff --git a/contrib/brl/bseg/boxm/algo/tests/test_utils.cxx b/contrib/brl/bseg/boxm/algo/tests/test_utils.cxx
deleted file mode 100644
index f286501eee..0000000000
--- a/contrib/brl/bseg/boxm/algo/tests/test_utils.cxx
+++ /dev/null
@@ -1,71 +0,0 @@
-#include "test_utils.h"
-//:
-// \file
-// \author Isabel Restrepo
-// \date 15-Aug-2010
-
-#include <vul/vul_file.h>
-#include <vul/vul_file_iterator.h>
-#include <vpl/vpl.h>
-
-#include <utility>
-
-void init_tree(boct_tree<short,float> *tree, unsigned i)
-{
- tree-> split(); //now we have 8 cells
- //tree->print();
- std::vector<boct_tree_cell<short,float>*> leaves = tree->leaf_cells();
- leaves[i]->set_data(0.8f);
- leaves[i]->split();
-}
-
-boxm_scene<boct_tree<short, float> >* create_scene(unsigned world_dimx,unsigned world_dimy,unsigned world_dimz, bool uniform, std::string scene_name)
-{
- //crete the input scene
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(0,0,0);
-
- vgl_vector_3d<double> block_dim(10, 10, 10); //world coordinate dimensions of a block
-
- vgl_vector_3d<unsigned> world_dim(world_dimx,world_dimy,world_dimz); //number of blocks in a scene
-
- auto *scene = new boxm_scene<boct_tree<short, float> >(lvcs, origin, block_dim, world_dim);
- std::string scene_path("./");
- scene->set_paths(scene_path, std::move(scene_name));
-
- unsigned cell_index = 7;
- boxm_block_iterator<boct_tree<short, float> > iter=scene->iterator();
- iter.begin();
- while (!iter.end())
- {
- scene->load_block(iter.index());
- boxm_block<boct_tree<short, float> > *block = scene->get_active_block();
- // Construct an empty tree with 3 maximum levels 1 levele initialized to 0.0
-
- float init_val = 0.5f;
- if (uniform)
- init_val = 0.8f;
-
- auto *tree = new boct_tree<short,float>(init_val, 3, 1);
- //tree->print();
- init_tree(tree, cell_index);
- //tree->print();
- block->init_tree(tree);
- scene->write_active_block();
- if (cell_index == 0) cell_index = 7;
- cell_index--;
- ++iter;
- }
- return scene;
-}
-
-void clean_up()
-{
- //clean temporary files
- vul_file_iterator file_it("./*.bin");
- for (; file_it; ++file_it)
- {
- vpl_unlink(file_it());
- vul_file::delete_file_glob(file_it());
- }
-}
diff --git a/contrib/brl/bseg/boxm/algo/tests/test_utils.h b/contrib/brl/bseg/boxm/algo/tests/test_utils.h
deleted file mode 100644
index f646d0b390..0000000000
--- a/contrib/brl/bseg/boxm/algo/tests/test_utils.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef boxm_algo_test_utils_h_
-#define boxm_algo_test_utils_h_
-//:
-// \file
-// \brief A file containing utility functions for other tests
-// \author Isabel Restrepo
-// \date 13-Aug-2010
-
-#include <boxm/boxm_scene.h>
-
-void init_tree(boct_tree<short,float> *tree, unsigned i);
-
-boxm_scene<boct_tree<short, float> >* create_scene(unsigned world_dimx = 2,unsigned world_dimy = 2,unsigned world_dimz = 2,
- bool uniform = false, std::string scene_name = "test_scene");
-
-void clean_up();
-
-#endif
diff --git a/contrib/brl/bseg/boxm/basic/CMakeLists.txt b/contrib/brl/bseg/boxm/basic/CMakeLists.txt
deleted file mode 100644
index a5e13d6975..0000000000
--- a/contrib/brl/bseg/boxm/basic/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-# brl/bseg/boxm/basic/CMakeLists.txt
-include_directories( ${MUL_INCLUDE_DIR} )
-set(boxm_basic_sources
- boxm_block_vis_graph_iterator.h boxm_block_vis_graph_iterator.hxx
- boxm_block_vis_graph_node.h
- boxm_cell_vis_graph_iterator.h boxm_cell_vis_graph_iterator.hxx
- boxm_raytrace_function.h
- boxm_seg_length_functor.h
- boxm_num_rays_functor.h
- boxm_util_data_types.h boxm_util_data_types.cxx
- )
-
-aux_source_directory(Templates boxm_basic_sources)
-
-vxl_add_library(LIBRARY_NAME boxm_basic LIBRARY_SOURCES ${boxm_basic_sources})
-
-if( BUILD_TESTING )
- add_subdirectory(tests)
-endif()
-
-target_link_libraries(boxm_basic boxm boxm_util boxm_sample boxm_sample_algo boct ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vpgl_algo ${VXL_LIB_PREFIX}vgl_io ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl_io ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vcl)
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx
deleted file mode 100644
index b4bce045ed..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.bsta_num_obs+bsta_gauss_sf1---.cxx
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_gauss_sf1.h>
-#include <boxm/boxm_scene.hxx>
-
-typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
-typedef boct_tree<short,gauss_type> tree_type;
-
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.float--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.float--.cxx
deleted file mode 100644
index 4129f1a830..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.float--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,float > tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.int--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.int--.cxx
deleted file mode 100644
index 450ee3e72c..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.int--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,int> tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.vgl_point_3d+double---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.vgl_point_3d+double---.cxx
deleted file mode 100644
index 2cd39a3534..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_iterator+boct_tree+short.vgl_point_3d+double---.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-#include <vgl/vgl_point_3d.h>
-
-typedef boct_tree<short,vgl_point_3d<double> > tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_edge_sample+float---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_edge_sample+float---.cxx
deleted file mode 100644
index 60ef86952b..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_edge_sample+float---.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/basic/boxm_block_vis_graph_iterator.hxx>
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_edge_sample.h>
-
-typedef boct_tree<short, boxm_edge_sample<float> > tree_type;
-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_edge_tangent_sample+float---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_edge_tangent_sample+float---.cxx
deleted file mode 100644
index d4a5a0384f..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_edge_tangent_sample+float---.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <boxm/basic/boxm_block_vis_graph_iterator.hxx>
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-
-typedef boct_tree<short, boxm_edge_tangent_sample<float> > tree_type;
-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(tree_type);
-
-typedef boct_tree<short, boxm_inf_line_sample<float> > aux_tree_type;
-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(aux_tree_type);
-
-typedef boct_tree<short, float > aux_tree_type2;
-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(aux_tree_type2);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx
deleted file mode 100644
index 10b6aa91a5..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/basic/boxm_block_vis_graph_iterator.hxx>
-#include <boxm/sample/boxm_sample.h>
-#include <boct/boct_tree.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-
-typedef boct_tree<short, boxm_sample<BOXM_APM_MOB_GREY> > tree_type;
-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx
deleted file mode 100644
index 72ebcd47fb..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/basic/boxm_block_vis_graph_iterator.hxx>
-#include <boxm/sample/boxm_sample.h>
-#include <boct/boct_tree.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-
-typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx
deleted file mode 100644
index 0fcf5fd35c..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/basic/boxm_block_vis_graph_iterator.hxx>
-#include <boxm/sample/boxm_sample.h>
-#include <boct/boct_tree.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-
-typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx
deleted file mode 100644
index 3ad032ddf2..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/basic/boxm_block_vis_graph_iterator.hxx>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <boct/boct_tree.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-
-typedef boct_tree<short, boxm_sample_multi_bin<BOXM_APM_MOG_GREY> > tree_type;
-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.vgl_point_3d+double---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.vgl_point_3d+double---.cxx
deleted file mode 100644
index 9ee11b98ea..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_iterator+boct_tree+short.vgl_point_3d+double---.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/basic/boxm_block_vis_graph_iterator.hxx>
-#include <boct/boct_tree.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-
-typedef boct_tree<short, vgl_point_3d<double> > tree_type;
-BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_node+boct_tree+short.vgl_point_3d+double---.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_node+boct_tree+short.vgl_point_3d+double---.cxx
deleted file mode 100644
index c2743dff25..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_block_vis_graph_node+boct_tree+short.vgl_point_3d+double---.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/basic/boxm_block_vis_graph_node.h>
-#include <boct/boct_tree.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-
-typedef boct_tree<short, vgl_point_3d<double> > tree_type;
-BOXM_BLOCK_VIS_GRAPH_NODE_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_edge_sample+float--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_edge_sample+float--.cxx
deleted file mode 100644
index fb158b16d1..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_edge_sample+float--.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/basic/boxm_cell_vis_graph_iterator.hxx>
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_edge_sample.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-
-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short, boxm_edge_sample<float>);
-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short, boxm_aux_edge_sample<float>);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_edge_tangent_sample+float--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_edge_tangent_sample+float--.cxx
deleted file mode 100644
index b561f8e125..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_edge_tangent_sample+float--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/basic/boxm_cell_vis_graph_iterator.hxx>
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_edge_tangent_sample.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-
-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short, boxm_edge_tangent_sample<float>);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_inf_line_sample+float--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_inf_line_sample+float--.cxx
deleted file mode 100644
index 343941bf71..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_inf_line_sample+float--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/basic/boxm_cell_vis_graph_iterator.hxx>
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_inf_line_sample.h>
-#include <vgl/io/vgl_io_point_3d.h>
-
-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short, boxm_inf_line_sample<float>);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx
deleted file mode 100644
index 69a4394c0b..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/basic/boxm_cell_vis_graph_iterator.hxx>
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_sample.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-
-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short,boxm_sample<BOXM_APM_MOB_GREY>);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx
deleted file mode 100644
index 2bf0739edf..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/basic/boxm_cell_vis_graph_iterator.hxx>
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_sample.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-
-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short,boxm_sample<BOXM_APM_MOG_GREY>);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx
deleted file mode 100644
index 29aadb8cb1..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/basic/boxm_cell_vis_graph_iterator.hxx>
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_sample.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-
-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short,boxm_sample<BOXM_APM_SIMPLE_GREY>);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx
deleted file mode 100644
index ed5b966521..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/basic/boxm_cell_vis_graph_iterator.hxx>
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_sample_multi_bin.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-
-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short,boxm_sample_multi_bin<BOXM_APM_MOG_GREY>);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.vgl_point_3d+double--.cxx b/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.vgl_point_3d+double--.cxx
deleted file mode 100644
index c961518029..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/boxm_cell_vis_graph_iterator+short.vgl_point_3d+double--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boxm/basic/boxm_cell_vis_graph_iterator.hxx>
-#include <boct/boct_tree.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-
-BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(short,vgl_point_3d<double>);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/brdb_value_t+boxm_array_1d_float_sptr-.cxx b/contrib/brl/bseg/boxm/basic/Templates/brdb_value_t+boxm_array_1d_float_sptr-.cxx
deleted file mode 100644
index 84a7a2e75f..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/brdb_value_t+boxm_array_1d_float_sptr-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <brdb/brdb_value.hxx>
-#include <boxm/basic/boxm_util_data_types.h>
-
-BRDB_VALUE_INSTANTIATE(boxm_array_1d_float_sptr,"boxm_array_1d_float_sptr");
diff --git a/contrib/brl/bseg/boxm/basic/Templates/vbl_io_smart_ptr+boxm_array_1d_float-.cxx b/contrib/brl/bseg/boxm/basic/Templates/vbl_io_smart_ptr+boxm_array_1d_float-.cxx
deleted file mode 100644
index d887b99938..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/vbl_io_smart_ptr+boxm_array_1d_float-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <vbl/io/vbl_io_smart_ptr.hxx>
-#include <boxm/basic/boxm_util_data_types.h>
-
-VBL_IO_SMART_PTR_INSTANTIATE(boxm_array_1d_float);
diff --git a/contrib/brl/bseg/boxm/basic/Templates/vbl_smart_ptr+boxm_array_1d_float-.cxx b/contrib/brl/bseg/boxm/basic/Templates/vbl_smart_ptr+boxm_array_1d_float-.cxx
deleted file mode 100644
index 2a77fe6767..0000000000
--- a/contrib/brl/bseg/boxm/basic/Templates/vbl_smart_ptr+boxm_array_1d_float-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <vbl/vbl_smart_ptr.hxx>
-#include <boxm/basic/boxm_util_data_types.h>
-
-VBL_SMART_PTR_INSTANTIATE(boxm_array_1d_float);
diff --git a/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_iterator.h b/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_iterator.h
deleted file mode 100644
index 70f36b1047..0000000000
--- a/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_iterator.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef boxm_block_vis_graph_iterator_h_
-#define boxm_block_vis_graph_iterator_h_
-//:
-// \file
-#include <vector>
-#include <iostream>
-#include <map>
-#include "boxm_block_vis_graph_node.h"
-#include <boxm/boxm_block.h>
-#include <boxm/boxm_scene.h>
-#include <vpgl/vpgl_camera_double_sptr.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <class T>
-class boxm_block_vis_graph_iterator
-{
- public:
- boxm_block_vis_graph_iterator(vpgl_camera_double_sptr cam, boxm_scene<T>* scene,
- unsigned img_ni, unsigned img_nj, bool rev_iter=false);
-
- ~boxm_block_vis_graph_iterator()= default;
-
- bool next();
-
- std::vector<boxm_block<T>*> frontier_blocks();
-
- std::vector<vgl_point_3d<int> > frontier_indices() const {return to_process_indices_; }
-
- void set_reverse_iter(bool reverse) { reverse_it_ = reverse; }
-
- private:
-
- typedef std::map<vgl_point_3d<int>, boxm_block_vis_graph_node<T>, vgl_point_3d_cmp<int> > vis_graph_type;
-
- //: visibility graph, indexed by the block indices
- vis_graph_type vis_graph_;
-
- //: blocks that can be seen by the camera unoccluded
- std::vector<typename vis_graph_type::iterator> curr_blocks_;
-
- std::vector<vgl_point_3d<int> > to_process_indices_;
-
- //: the camera
- vpgl_camera_double_sptr camera_;
-
- boxm_scene<T>* scene_;
-
- bool reverse_it_;
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_iterator.hxx b/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_iterator.hxx
deleted file mode 100644
index 4baa6d8992..0000000000
--- a/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_iterator.hxx
+++ /dev/null
@@ -1,173 +0,0 @@
-#ifndef boxm_block_vis_graph_iterator_hxx_
-#define boxm_block_vis_graph_iterator_hxx_
-
-#include "boxm_block_vis_graph_iterator.h"
-#include "boxm_block_vis_graph_node.h"
-#include <boxm/util/boxm_utils.h>
-#include <boct/boct_tree_cell.h>
-
-template <class T>
-boxm_block_vis_graph_iterator<T>::boxm_block_vis_graph_iterator(vpgl_camera_double_sptr cam,
- boxm_scene<T>* scene,
- unsigned img_ni,
- unsigned img_nj,
- bool rev_iter)
- : camera_(cam), scene_(scene), reverse_it_(rev_iter)
-{
- // compute the visibility graph
- boxm_block_iterator<T> iter = scene->iterator();
- for (; !iter.end(); iter++) {
- boxm_block<T>* block = *iter;
- if (boxm_utils::is_visible(block->bounding_box(), cam, img_ni, img_nj))
- vis_graph_.insert(std::make_pair<vgl_point_3d<int>,boxm_block_vis_graph_node<T> >(iter.index(),boxm_block_vis_graph_node<T>()));
- }
-
- typename vis_graph_type::iterator vis_iter;
- for (vis_iter=vis_graph_.begin(); vis_iter!=vis_graph_.end(); vis_iter++) {
- vgl_point_3d<int> idx = vis_iter->first;
- boxm_block<T>* block = scene->get_block(idx);
- boct_face_idx vis_faces = boxm_utils::visible_faces(block->bounding_box(), cam);
-
- vgl_point_3d<int> neighbor_idx = vis_iter->first;
- bool face_in = false;
- if (vis_faces & X_HIGH) {
- // check for neighbor on X_HIGH face
- if (reverse_it_)
- neighbor_idx += vgl_vector_3d<int>(-1,0,0);
- else
- neighbor_idx += vgl_vector_3d<int>(1,0,0);
- face_in = true;
- } else if (vis_faces & X_LOW) {
- // check for neighbor on X_LOW face
- if (reverse_it_)
- neighbor_idx += vgl_vector_3d<int>(1,0,0);
- else
- neighbor_idx += vgl_vector_3d<int>(-1,0,0);
- face_in = true;
- }
-
- if (face_in) {
- typename vis_graph_type::iterator nit = vis_graph_.find(neighbor_idx);
- if (nit == vis_graph_.end()) {
- vis_iter->second.in_count++;
- curr_blocks_.push_back(vis_iter);
- } else {
- vis_iter->second.in_count++;
- nit->second.out_links.push_back(vis_iter);
- }
- }
-
- face_in = false;
- neighbor_idx = vis_iter->first;
- if (vis_faces & Y_HIGH) {
- // check for neighbor on Y_HIGH face
- if (reverse_it_)
- neighbor_idx += vgl_vector_3d<int>(0,-1,0);
- else
- neighbor_idx += vgl_vector_3d<int>(0,1,0);
- face_in = true;
- } else if (vis_faces & Y_LOW) {
- // check for neighbor on Y_LOW face
- if (reverse_it_)
- neighbor_idx += vgl_vector_3d<int>(0,1,0);
- else
- neighbor_idx += vgl_vector_3d<int>(0,-1,0);
- face_in = true;
- }
-
- if (face_in) {
- typename vis_graph_type::iterator nit = vis_graph_.find(neighbor_idx);
- if (nit == vis_graph_.end()) {
- vis_iter->second.in_count++;
- curr_blocks_.push_back(vis_iter);
- } else {
- vis_iter->second.in_count++;
- nit->second.out_links.push_back(vis_iter);
- }
- }
-
- face_in=false;
- neighbor_idx = vis_iter->first;
- if (vis_faces & Z_HIGH) {
- // check for neighbor on Z_HIGH face
- if (reverse_it_)
- neighbor_idx += vgl_vector_3d<int>(0,0,-1);
- else
- neighbor_idx += vgl_vector_3d<int>(0,0,1);
- face_in = true;
- }else if (vis_faces & Z_LOW) {
- // check for neighbor on Y_LOW face
- if (reverse_it_)
- neighbor_idx += vgl_vector_3d<int>(0,0,1);
- else
- neighbor_idx += vgl_vector_3d<int>(0,0,-1);
- face_in = true;
- }
-
- if (face_in) {
- typename vis_graph_type::iterator nit = vis_graph_.find(neighbor_idx);
- if (nit == vis_graph_.end()) {
- vis_iter->second.in_count++;
- curr_blocks_.push_back(vis_iter);
- }
- else {
- vis_iter->second.in_count++;
- nit->second.out_links.push_back(vis_iter);
- }
- }
- }
-}
-
-template <class T>
-bool boxm_block_vis_graph_iterator<T>::next()
-{
- typename std::vector<typename vis_graph_type::iterator>::iterator block_iter = curr_blocks_.begin();
- std::vector<typename vis_graph_type::iterator> to_process;
-
- for (; block_iter != curr_blocks_.end(); block_iter++) {
- //std::cout << (*block_iter)->first;
- //std::cout << (*block_iter)->second.in_count << std::endl;
- if (--((*block_iter)->second.in_count) == 0)
- to_process.push_back(*block_iter);
- }
-
- if (to_process.size() == 0) {
- to_process_indices_.resize(0);
- return false;
- }
- to_process_indices_.resize(to_process.size());
-
- std::vector<vgl_point_3d<int> >::iterator to_proc_it = to_process_indices_.begin();
- for (block_iter = to_process.begin(); block_iter != to_process.end(); ++block_iter, ++to_proc_it) {
- *to_proc_it = (*block_iter)->first;
- }
-
- // add linked blocks to list for next iteration
- curr_blocks_.clear();
- for (block_iter = to_process.begin(); block_iter != to_process.end(); ++block_iter) {
- std::vector<typename vis_graph_type::iterator > &links = (*block_iter)->second.out_links;
- typename std::vector<typename vis_graph_type::iterator >::iterator neighbor_it = links.begin();
- for (; neighbor_it != links.end(); ++neighbor_it) {
- curr_blocks_.push_back(*neighbor_it);
- }
- }
- return true;
-}
-
-template <class T>
-std::vector<boxm_block<T>*> boxm_block_vis_graph_iterator<T>::frontier_blocks()
-{
- std::vector<boxm_block<T>*> frontier;
-
- std::vector<vgl_point_3d<int> > blocks = to_process_indices_;
- for (auto index : blocks) {
- frontier.push_back(scene_->get_block(index)); //.x(), index.y(), index.z());
- }
-
- return frontier;
-}
-
-#define BOXM_BLOCK_VIS_GRAPH_ITERATOR_INSTANTIATE(T) \
-template class boxm_block_vis_graph_iterator<T >
-
-#endif
diff --git a/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_node.h b/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_node.h
deleted file mode 100644
index 1d615b1477..0000000000
--- a/contrib/brl/bseg/boxm/basic/boxm_block_vis_graph_node.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef boxm_block_vis_graph_node_h_
-#define boxm_block_vis_graph_node_h_
-//:
-// \file
-#include <vector>
-#include <iostream>
-#include <map>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vgl/vgl_point_3d.h>
-
-//: A comparison functor for vgl_point_3d's. Needed to create a std::set of vgl_point_3d<int>'s.
-template <class T>
-class vgl_point_3d_cmp
-{
- public:
- vgl_point_3d_cmp() = default;
-
- bool operator()(vgl_point_3d<T> const& v0, vgl_point_3d<T> const& v1) const
- {
- if (v0.z() != v1.z())
- return v0.z() < v1.z();
- else if (v0.y() != v1.y())
- return v0.y() < v1.y();
- else
- return v0.x() < v1.x();
- }
-};
-
-template <class T>
-class boxm_block_vis_graph_node
-{
- public:
- typedef std::map<vgl_point_3d<int>, boxm_block_vis_graph_node<T>, vgl_point_3d_cmp<int> > vis_graph_type;
-
- boxm_block_vis_graph_node() : in_count(0) {}
- ~boxm_block_vis_graph_node()= default;
-
- int dec_in_count() { return --in_count; }
-
- //: the number of incoming edges to this node
- int in_count;
-
- //: graph links to the outgoing blocks
- std::vector<typename vis_graph_type::iterator> out_links;
-};
-
-#define BOXM_BLOCK_VIS_GRAPH_NODE_INSTANTIATE(T) \
-template class boxm_block_vis_graph_node<T >
-
-#endif
diff --git a/contrib/brl/bseg/boxm/basic/boxm_cell_vis_graph_iterator.h b/contrib/brl/bseg/boxm/basic/boxm_cell_vis_graph_iterator.h
deleted file mode 100644
index 6bc8372e16..0000000000
--- a/contrib/brl/bseg/boxm/basic/boxm_cell_vis_graph_iterator.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef boxm_cell_vis_graph_iterator_h_
-#define boxm_cell_vis_graph_iterator_h_
-//:
-// \file
-#include <iostream>
-#include <vector>
-#include <boct/boct_tree_cell.h>
-#include <boct/boct_tree.h>
-#include <vpgl/vpgl_camera_double_sptr.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <class T_loc, class T_data>
-class boxm_cell_vis_graph_iterator
-{
- public:
- boxm_cell_vis_graph_iterator(vpgl_camera_double_sptr cam,
- boct_tree<T_loc,T_data>* tree,
- unsigned img_ni,
- unsigned img_nj);
-
- ~boxm_cell_vis_graph_iterator() = default;
-
- bool next();
-
- std::vector<boct_tree_cell<T_loc,T_data>*> frontier() { return frontier_; }
-
- void set_reverse_iter(bool reverse) { reverse_iter_ = reverse; }
-
- private:
- //: the camera
- vpgl_camera_double_sptr camera_;
-
- //: blocks that can be seen by the camera unoccluded
- std::vector<boct_tree_cell<T_loc,T_data>*> frontier_;
- std::vector<boct_tree_cell<T_loc,T_data>*> curr_cells_;
- bool reverse_iter_;
-
- unsigned img_ni_;
- unsigned img_nj_;
-
- //: recursive function
- void check_cell_visibility(boct_tree<T_loc,T_data>* tree,
- boct_tree_cell<T_loc,T_data>* tree_cell);
-
- void form_graph_per_cell(boct_tree_cell<T_loc,T_data>* cell,
- boct_face_idx face_idx,
- boct_tree<T_loc,T_data>* tree);
-
- std::vector<boct_tree_cell<T_loc,T_data>* > list_of_vis_nodes_;
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/basic/boxm_cell_vis_graph_iterator.hxx b/contrib/brl/bseg/boxm/basic/boxm_cell_vis_graph_iterator.hxx
deleted file mode 100644
index 4108982a68..0000000000
--- a/contrib/brl/bseg/boxm/basic/boxm_cell_vis_graph_iterator.hxx
+++ /dev/null
@@ -1,131 +0,0 @@
-#ifndef boxm_cell_vis_graph_iterator_hxx_
-#define boxm_cell_vis_graph_iterator_hxx_
-
-#include "boxm_cell_vis_graph_iterator.h"
-#include <boxm/util/boxm_utils.h>
-
-template <class T_loc,class T_data>
-boxm_cell_vis_graph_iterator<T_loc,T_data>::boxm_cell_vis_graph_iterator(vpgl_camera_double_sptr cam,
- boct_tree<T_loc,T_data>* tree,
- unsigned img_ni,
- unsigned img_nj) : camera_(cam),img_ni_(img_ni), img_nj_(img_nj)
-{
- if (!tree)
- {
- std::cout<<"No Tree found"<<std::endl;
- }
- else
- {
- list_of_vis_nodes_.clear();
- // check if each node is visible or notr
- check_cell_visibility(tree,tree->root());
- // compute the visibility graph
- for (unsigned i=0;i<list_of_vis_nodes_.size();i++)
- {
- boct_face_idx vis_faces = boxm_utils::visible_faces(tree->cell_bounding_box(list_of_vis_nodes_[i]), cam);
- if (vis_faces & ::X_HIGH) {
- form_graph_per_cell(list_of_vis_nodes_[i],X_HIGH,tree);
- }
- else if (vis_faces & ::X_LOW) {
- form_graph_per_cell(list_of_vis_nodes_[i],X_LOW,tree);
- }
- if (vis_faces & ::Y_HIGH) {
- form_graph_per_cell(list_of_vis_nodes_[i],Y_HIGH,tree);
- }
- else if (vis_faces & ::Y_LOW) {
- form_graph_per_cell(list_of_vis_nodes_[i],Y_LOW,tree);
- }
- if (vis_faces & ::Z_HIGH) {
- form_graph_per_cell(list_of_vis_nodes_[i],Z_HIGH,tree);
- }
- else if (vis_faces & ::Z_LOW) {
- form_graph_per_cell(list_of_vis_nodes_[i],Z_LOW,tree);
- }
- }
- list_of_vis_nodes_.clear();
- }
-}
-
-template <class T_loc,class T_data>
-bool boxm_cell_vis_graph_iterator<T_loc,T_data>::next()
-{
- std::vector<boct_tree_cell<T_loc,T_data>* > to_process;
- std::vector<boct_tree_cell<T_loc,T_data>* > to_process_refine;
-
- typename std::vector<boct_tree_cell<T_loc,T_data>* >::iterator cell_it = curr_cells_.begin();
- for (; cell_it != curr_cells_.end(); ++cell_it) {
- // decrement each cell's count in list. if count == 0, add to list of nodes to process
- if (--((*cell_it)->vis_node()->incoming_count) == 0) {
- to_process.push_back(*cell_it);
- }
- }
- if (to_process.size() == 0) {
- return false;
- }
- frontier_.clear();
-
- for (cell_it = to_process.begin(); cell_it != to_process.end(); ++cell_it) {
- frontier_.push_back((*cell_it));
- }
- // add linked cells to list for next iteration
- curr_cells_.clear();
- for (cell_it = to_process.begin(); cell_it != to_process.end(); ++cell_it) {
- std::vector<boct_tree_cell<T_loc,T_data>* > links = (*cell_it)->vis_node()->outgoing_links;
- typename std::vector<boct_tree_cell<T_loc,T_data>* >::iterator neighbor_it = links.begin();
- for (; neighbor_it != links.end(); ++neighbor_it) {
- curr_cells_.push_back(*neighbor_it);
- }
- }
- return true;
-}
-
-template<class T_loc,class T_data>
-void boxm_cell_vis_graph_iterator<T_loc,T_data>::check_cell_visibility(boct_tree<T_loc,T_data>* tree,
- boct_tree_cell<T_loc,T_data>* tree_cell)
-{
- vgl_box_3d<double> bbox=tree->cell_bounding_box(tree_cell);
- if (boxm_utils::is_visible(bbox, camera_,img_ni_, img_nj_, true))
- {
- // base case for recursion
- if (tree_cell->is_leaf())
- {
- boct_cell_vis_graph_node<T_loc,T_data> * node=new boct_cell_vis_graph_node<T_loc,T_data>();
- node->visible=true;
- tree_cell->set_vis_node(node);
- list_of_vis_nodes_.push_back(tree_cell);
- }
- else
- {
- boct_tree_cell<T_loc,T_data>* children = tree_cell->children();
- for (unsigned i=0; i<8; i++)
- check_cell_visibility(tree,&children[i]);
- }
- }
-}
-
-template<class T_loc,class T_data>
-void boxm_cell_vis_graph_iterator<T_loc,T_data>::form_graph_per_cell(boct_tree_cell<T_loc,T_data>* cell,boct_face_idx face_idx,boct_tree<T_loc,T_data>* tree)
-{
- boct_cell_vis_graph_node<T_loc,T_data>* vis_node=cell->vis_node();
- std::vector<boct_tree_cell<T_loc,T_data>*> neighbors;
- cell->find_neighbors(face_idx, neighbors,tree->root_level());
- typename std::vector<boct_tree_cell<T_loc,T_data>*>::iterator neighbor_it = neighbors.begin();
- bool visible_neighbors=false;
- for (; neighbor_it != neighbors.end(); ++neighbor_it) {
- boct_cell_vis_graph_node<T_loc,T_data>* neighbor_vis_node=(*neighbor_it)->vis_node();
- if (neighbor_vis_node) {
- vis_node->incoming_count++;
- neighbor_vis_node->outgoing_links.push_back(cell);
- visible_neighbors=true;
- }
- }
- if (!visible_neighbors) {
- vis_node->incoming_count++;
- curr_cells_.push_back(cell);
- }
-}
-
-#define BOXM_CELL_VIS_GRAPH_ITERATOR_INSTANTIATE(T1,T2) \
-template class boxm_cell_vis_graph_iterator<T1,T2 >
-
-#endif // boxm_cell_vis_graph_iterator_hxx_
diff --git a/contrib/brl/bseg/boxm/basic/boxm_num_rays_functor.h b/contrib/brl/bseg/boxm/basic/boxm_num_rays_functor.h
deleted file mode 100644
index 98703eec22..0000000000
--- a/contrib/brl/bseg/boxm/basic/boxm_num_rays_functor.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef boxm_num_rays_functor_h
-#define boxm_num_rays_functor_h
-//:
-// \file
-#include <iostream>
-#include <boxm/boxm_scene.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <bsta/bsta_histogram.h>
-#include <boxm/boxm_apm_traits.h>
-#include "boxm_raytrace_function.h"
-
-//: this functor is to compute no of rays passing through a cell
-// Works for boxm_scalar_sample
-template <boxm_apm_type APM, class T_aux>
-class boxm_num_rays_functor
-{
- public:
- boxm_num_rays_functor()
- {
- scene_read_only_=true;
- is_aux_=true;
- }
-
- inline bool step_cell(unsigned int /*i*/, unsigned int /*j*/, // FIXME: both unused!
- vgl_point_3d<double> s0, vgl_point_3d<double> s1,
- boxm_sample<APM> & /*cell_value*/, // FIXME: unused...
- T_aux &aux_val)
- {
- const float seg_len = (float)(s1 - s0).length();
-
- aux_val.scalar_sum_+=1;
- //std::cout<<aux_val.scalar_sum_<<' ';
- aux_val.seg_len_ += seg_len;
- return true;
- }
-
- public:
- bool scene_read_only_;
- bool is_aux_;
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/basic/boxm_raytrace_function.h b/contrib/brl/bseg/boxm/basic/boxm_raytrace_function.h
deleted file mode 100644
index 88897fd462..0000000000
--- a/contrib/brl/bseg/boxm/basic/boxm_raytrace_function.h
+++ /dev/null
@@ -1,618 +0,0 @@
-#ifndef boxm_raytrace_function_h_
-#define boxm_raytrace_function_h_
-//:
-// \file
-
-#include <iostream>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/util/boxm_utils.h>
-#include <boxm/util/boxm_raytrace_operations.h>
-#include <boxm/basic/boxm_block_vis_graph_iterator.h>
-#include <boxm/boxm_aux_scene.h>
-#include <boxm/boxm_aux_traits.h>
-
-#include <vpgl/vpgl_camera.h>
-#include <vpgl/vpgl_perspective_camera.h>
-#include <vpgl/vpgl_affine_camera.h>
-#include <vpgl/algo/vpgl_backproject.h>
-#include <vpgl/algo/vpgl_ray.h>
-
-#include <vgl/vgl_point_2d.h>
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_vector_3d.h>
-#include <vgl/vgl_box_2d.h>
-#include <vgl/vgl_box_3d.h>
-#include <vgl/vgl_intersection.h>
-#include <vgl/vgl_homg_point_2d.h>
-#include <vgl/vgl_line_3d_2_points.h>
-
-#include <vul/vul_timer.h>
-
-#include <cassert>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template<class F, class T_loc, class T_data, class T_aux = typename boxm_aux_traits<BOXM_AUX_NULL>::sample_datatype>
-class boxm_raytrace_function
-{
- // null scene used as placeholder for operations that don't require an auxiliary scene
- boxm_aux_scene<T_loc, T_data, boxm_aux_traits<BOXM_AUX_NULL>::sample_datatype> null_scene_;
-
- public:
- typedef boct_tree<T_loc,T_data> tree_type;
- typedef boct_tree<T_loc,T_aux> aux_tree_type;
- typedef boct_tree_cell<T_loc,T_data> cell_type;
-
- //: constructor for functions with no auxiliary scene needed
- boxm_raytrace_function(boxm_scene<tree_type> &scene,
- vpgl_camera_double_sptr cam,
- unsigned int ni, unsigned int nj,
- bool reverse_traversal = false,
- unsigned int i0 = 0, unsigned int j0 = 0
- )
- : scene_(scene), aux_scene_(null_scene_), reverse_traversal_(reverse_traversal), cam_(cam), img_i0_(i0), img_j0_(j0), img_ni_(ni), img_nj_(nj), debug_lvl_(0) {}
-
- //: constructor for functions using an auxiliary scene
- boxm_raytrace_function(boxm_scene<tree_type> &scene,
- boxm_aux_scene<T_loc, T_data, T_aux> &aux_scene,
- vpgl_camera_double_sptr cam,
- unsigned int ni, unsigned int nj,
- bool reverse_traversal = false,
- unsigned int i0 = 0, unsigned int j0 = 0)
- : scene_(scene), aux_scene_(aux_scene), reverse_traversal_(reverse_traversal), cam_(cam), img_i0_(i0), img_j0_(j0), img_ni_(ni), img_nj_(nj), debug_lvl_(0) {}
-
- bool run_single_ray(F& step_functor,float i, float j)
- {
- vil_image_view<bool> continue_trace(img_ni_, img_nj_);
- continue_trace.fill(true);
- // code to iterate over the blocks in order of visibility
- boxm_block_vis_graph_iterator<tree_type > block_vis_iter(cam_, &scene_, img_ni_,img_nj_);
- while (block_vis_iter.next())
- {
- std::vector<vgl_point_3d<int> > block_indices = block_vis_iter.frontier_indices();
- for (unsigned i=0; i<block_indices.size(); i++) // code for each block
- {
- scene_.load_block(block_indices[i]);
- boxm_block<tree_type> * curr_block=scene_.get_active_block();
- boxm_block<aux_tree_type> * curr_aux_block=NULL;
- if (step_functor.is_aux_)
- curr_aux_block=aux_scene_.get_block(block_indices[i]);
-
- if (debug_lvl_ > 0)
- std::cout << "processing block at index (" <<block_indices[i] << ')' << std::endl;
- // make sure block projects to inside of image
- vgl_box_3d<double> block_bb = curr_block->bounding_box();
-
- if (!boxm_utils::is_visible(block_bb,cam_,img_ni_,img_nj_))
- continue;
-
-
- vgl_box_2d<double> img_bb;
-
- // initialize ray_origin() function for this block
- if (!generate_ray_init(block_bb, img_bb)) {
- continue;
- }
- tree_type * tree=curr_block->get_tree();
-
- aux_tree_type * aux_tree=NULL;
- if (step_functor.is_aux_)
- {
- aux_tree=curr_aux_block->get_tree();
- }
-
- // get direction of vector and enter point - this depends on which camera type we have
- vgl_point_3d<double> ray_origin;
- vgl_vector_3d<double> direction;
- vgl_point_3d<double> enter_pt(0.0,0.0,0.0);
- std::vector<vgl_point_3d<double> > plane_intersections(6);
- // add 0.5 to get center of pixel
- generate_ray(i , j, block_bb, ray_origin, direction);
-
- // compute intersection of each plane with ray
- double lambda[6];
- lambda[0] = (block_bb.min_x() - ray_origin.x())/direction.x();
- lambda[1] = (block_bb.max_x() - ray_origin.x())/direction.x();
- lambda[2] = (block_bb.min_y() - ray_origin.y())/direction.y();
- lambda[3] = (block_bb.max_y() - ray_origin.y())/direction.y();
- lambda[4] = (block_bb.min_z() - ray_origin.z())/direction.z();
- lambda[5] = (block_bb.max_z() - ray_origin.z())/direction.z();
-
- if (block_bb.contains(ray_origin))
- enter_pt=ray_origin;
- else
- {
- for (unsigned int face=0; face<6; ++face) {
- plane_intersections[face] = ray_origin + (direction * lambda[face]);
- }
-
- // determine which point is the entrance point based on direction
- const double epsilon = 1e-6; // use in place of zero to avoid badly conditioned lambdas
- if ( (plane_intersections[5].x() >= block_bb.min_x()) && (plane_intersections[5].x() <= block_bb.max_x()) &&
- (plane_intersections[5].y() >= block_bb.min_y()) && (plane_intersections[5].y() <= block_bb.max_y()) &&
- (direction.z() < -epsilon) )
- {
- // ray intersects the zmax plane
- // check zmax first since it is probably the most common
- enter_pt = plane_intersections[5];
- }
- else if ( (plane_intersections[0].y() >= block_bb.min_y()) && (plane_intersections[0].y() <= block_bb.max_y()) &&
- (plane_intersections[0].z() >= block_bb.min_z()) && (plane_intersections[0].z() <= block_bb.max_z()) &&
- (direction.x() > epsilon) )
- {
- // ray intersects the xmin plane
- enter_pt = plane_intersections[0];
- }
- else if ( (plane_intersections[1].y() >= block_bb.min_y()) && (plane_intersections[1].y() <= block_bb.max_y()) &&
- (plane_intersections[1].z() >= block_bb.min_z()) && (plane_intersections[1].z() <= block_bb.max_z()) &&
- (direction.x() < -epsilon) )
- {
- // ray intersects the xmax plane
- enter_pt = plane_intersections[1];
- }
- else if ( (plane_intersections[2].x() >= block_bb.min_x()) && (plane_intersections[2].x() <= block_bb.max_x()) &&
- (plane_intersections[2].z() >= block_bb.min_z()) && (plane_intersections[2].z() <= block_bb.max_z()) &&
- (direction.y() > epsilon) )
- {
- // ray intersects the ymin plane
- enter_pt = plane_intersections[2];
- }
- else if ( (plane_intersections[3].x() >= block_bb.min_x()) && (plane_intersections[3].x() <= block_bb.max_x()) &&
- (plane_intersections[3].z() >= block_bb.min_z()) && (plane_intersections[3].z() <= block_bb.max_z()) &&
- (direction.y() < -epsilon) )
- {
- // ray intersects the ymax plane
- enter_pt = plane_intersections[3];
- }
- else if ( (plane_intersections[4].x() >= block_bb.min_x()) && (plane_intersections[4].x() <= block_bb.max_x()) &&
- (plane_intersections[4].y() >= block_bb.min_y()) && (plane_intersections[4].y() <= block_bb.max_y()) &&
- (direction.z() > epsilon) )
- {
- // ray intersects the zmin plane
- enter_pt = plane_intersections[4];
- }
- else {
- // no entry point into this block found
- continue;
- }
- }
- boct_tree_cell<T_loc,T_data > * curr_cell=tree->locate_point_global(enter_pt);
- while (true)
- {
- boct_loc_code<T_loc> cell_code(curr_cell->get_code());
-
- boct_tree_cell<T_loc,T_aux > * curr_aux_cell=NULL;
- if (step_functor.is_aux_)
- curr_aux_cell=aux_tree->get_cell(cell_code);
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(curr_cell);
- // find exit point of cell
- vgl_point_3d<double> exit_pt;
- double lambda=0;
- boct_face_idx face_id=NONE;
- bool found_exit =boxm_utils::cube_exit_point(cell_bb,enter_pt,direction, exit_pt,lambda,face_id);
- if (!found_exit) {
- std::cerr << "error: could not find cell exit point\n"
- << " enter_pt = [" << enter_pt.x() << ", " << enter_pt.y() << ", " << enter_pt.z() << "]\n"
- << " direction = [" << direction.x() << ", " << direction.y() << ", " << direction.z() << "]\n"
- << " cell_bb = [" << cell_bb.min_x() <<", " << cell_bb.max_x() << "] [" << cell_bb.min_y()
- << ", " << cell_bb.max_y() << "] [" << cell_bb.min_z() << ", " << cell_bb.max_z() <<"]\n";
- assert(found_exit);
- break;
- }
- T_data cell_val=curr_cell->data();
- T_aux aux_val;
- if (step_functor.is_aux_)
- aux_val=curr_aux_cell->data();
- continue_trace(i-img_i0_, j-img_j0_) = step_functor.step_cell(enter_pt, exit_pt, cell_val,aux_val);
- curr_cell->set_data(cell_val);
- if (step_functor.is_aux_)
- curr_aux_cell->set_data(aux_val);
- // normalize the point to [0-1]to obtain the index.
- vgl_point_3d<double> exit_pt_norm((exit_pt.x()-block_bb.min_x())/block_bb.width(),
- (exit_pt.y()-block_bb.min_y())/block_bb.height(),
- (exit_pt.z()-block_bb.min_z())/block_bb.depth());
- // obtain the code for the exit point
- boct_loc_code<T_loc> exit_loc_code(exit_pt_norm,tree->root_level());
- cell_type *neighborcell=NULL;
- if (curr_cell->find_neighbor(face_id,neighborcell,tree->root_level()))
- curr_cell=neighborcell->traverse_force(exit_loc_code);
- else
- {
- std::cerr << "NO NEIGHBORS FOUND!\n";
- break;
- }
- enter_pt=exit_pt;
- }
- if (!step_functor.scene_read_only_)
- scene_.write_active_block();
- if (step_functor.is_aux_)
- aux_scene_.write_active_block();
- }
- }
- scene_.unload_active_blocks();
- aux_scene_.unload_active_blocks();
- return true;
- }
-
- bool run(F& step_functor)
- {
- vul_timer timer;
- float total_load_time = 0.0f;
- float total_compute_time = 0.0f;
- float total_save_time = 0.0f;
- vil_image_view<bool> continue_trace(img_ni_, img_nj_);
- continue_trace.fill(true);
- // code to iterate over the blocks in order of visibility
- boxm_block_vis_graph_iterator<tree_type > block_vis_iter(cam_, &scene_, img_ni_,img_nj_);
- while (block_vis_iter.next())
- {
- std::vector<vgl_point_3d<int> > block_indices = block_vis_iter.frontier_indices();
- for (auto & block_indice : block_indices) // code for each block
- {
- timer.mark();
- scene_.load_block(block_indice);
- boxm_block<tree_type> * curr_block=scene_.get_active_block();
-
- if (debug_lvl_ > 0)
- std::cout << "processing block at index (" <<block_indice << ')' << std::endl;
- // make sure block projects to inside of image
- vgl_box_3d<double> block_bb = curr_block->bounding_box();
-
- if (!boxm_utils::is_visible(block_bb,cam_,img_ni_,img_nj_))
- continue;
- vgl_box_2d<double> img_bb;
- // initialize ray_origin() function for this block
- if (!generate_ray_init(block_bb, img_bb)) {
- continue;
- }
-
- tree_type * tree=curr_block->get_tree();
-
- boxm_block<aux_tree_type> * curr_aux_block=nullptr;
- aux_tree_type * aux_tree=nullptr;
- if (step_functor.is_aux_)
- {
- curr_aux_block=aux_scene_.get_block(block_indice);
- aux_tree=curr_aux_block->get_tree();
- }
- float load_time = (float)timer.all() / 1e3f;
- total_load_time += load_time;
- timer.mark();
- // for each image pixel
- for (unsigned int i = int(img_bb.min_x()+0.99); i <= img_bb.max_x(); ++i)
- {
- if (debug_lvl_ > 1) {
- if (!(i % 10))
- std::cout << '.';
- }
- for (unsigned int j = int(img_bb.min_y()+0.99); j <= img_bb.max_y(); ++j)
- {
- if (!continue_trace(i - img_i0_ , j - img_j0_)) {
- continue;
- }
- // get direction of vector and enter point - this depends on which camera type we have
- vgl_point_3d<double> ray_origin;
- vgl_vector_3d<double>direction;
- vgl_point_3d<double> enter_pt(0.0,0.0,0.0);
- vgl_point_3d<double> exit_pt;
- // add 0.5 to get center of pixel
- generate_ray((float)i + 0.5f, (float)j + 0.5f, block_bb, ray_origin, direction);
- if (!entry_point(block_bb,ray_origin,direction,enter_pt))
- continue;
- // normalize the entry point to [0,1]
- vgl_point_3d<double> enter_pt_norm((enter_pt.x()-block_bb.min_x())/block_bb.width(),
- (enter_pt.y()-block_bb.min_y())/block_bb.height(),
- (enter_pt.z()-block_bb.min_z())/block_bb.depth());
- boct_loc_code<T_loc> curr_cell_code(enter_pt_norm,tree->root_level());
- boct_tree_cell<T_loc,T_data > * curr_cell=tree->root()->traverse_force(curr_cell_code);
-
- boct_tree_cell<T_loc, boxm_aux_traits<BOXM_AUX_NULL>::sample_datatype> aux_cell_null;
-
- while (continue_trace(i-img_i0_, j-img_j0_))
- {
- boct_tree_cell<T_loc,T_aux > *curr_aux_cell= reinterpret_cast<boct_tree_cell<T_loc,T_aux>*>(&aux_cell_null);
- if (step_functor.is_aux_)
- {
- boct_loc_code<T_loc> cell_code(curr_cell->get_code());
- curr_aux_cell=aux_tree->get_cell(cell_code);
- }
- // get the canonical bounding box
- vgl_box_3d<double> cell_bb = tree->cell_bounding_box(curr_cell);
- // find exit point of cell
-
- double lambda=0;
- boct_face_idx face_id=NONE;
- bool found_exit =boxm_utils::cube_exit_point(cell_bb,enter_pt,direction, exit_pt,lambda,face_id);
- if (!found_exit) {
- std::cerr << "error: could not find cell exit point\n"
- << " enter_pt = [" << enter_pt.x() << ", " << enter_pt.y() << ", " << enter_pt.z() << "]\n"
- << " direction = [" << direction.x() << ", " << direction.y() << ", " << direction.z() << "]\n"
- << " cell_bb = [" << cell_bb.min_x() <<", " << cell_bb.max_x() << "] [" << cell_bb.min_y()
- << ", " << cell_bb.max_y() << "] [" << cell_bb.min_z() << ", " << cell_bb.max_z() <<"]\n";
- assert(found_exit);
- break;
- }
- T_data cell_val=curr_cell->data();
- T_aux aux_val=curr_aux_cell->data();
-
-
- continue_trace(i-img_i0_, j-img_j0_) = step_functor.step_cell(i,j, enter_pt, exit_pt, cell_val,aux_val);
-
- curr_cell->set_data(cell_val);
- if (step_functor.is_aux_)
- curr_aux_cell->set_data(aux_val);
- vgl_point_3d<double> exit_pt_norm((exit_pt.x()-block_bb.min_x())/block_bb.width(),
- (exit_pt.y()-block_bb.min_y())/block_bb.height(),
- (exit_pt.z()-block_bb.min_z())/block_bb.depth());
-
- // obtain the code for the exit point
- boct_loc_code<T_loc> exit_loc_code(exit_pt_norm,tree->root_level(), tree->max_val());
- cell_type *neighborcell=nullptr;
- if (curr_cell->find_neighbor(face_id,neighborcell,tree->root_level()))
- curr_cell=neighborcell->traverse_force(exit_loc_code);
- else
- break;
- enter_pt=exit_pt;
- }
- }
- }
- float compute_time = (float)timer.all() / 1e3f;
- total_compute_time += compute_time;
- timer.mark();
-
- if (!step_functor.scene_read_only_)
- scene_.write_active_block();
- if (step_functor.is_aux_)
- aux_scene_.write_active_block();
-
- float save_time = (float)timer.all() / 1e3f;
- total_save_time += save_time;
- //std::cout << "load: " << load_time << "s compute: " << compute_time << "s save: " << save_time << 's' << std::endl;
- }
- }
- scene_.unload_active_blocks();
- aux_scene_.unload_active_blocks();
-
- //std::cout << "total load: " << total_load_time << "s total compute: " << total_compute_time << "s total save: " << total_save_time << 's' << std::endl;
- return true;
- }
-
- protected:
-
- bool generate_ray_init(vgl_box_3d<double> const& block_bb, vgl_box_2d<double> &img_bb)
- {
- // determine intersection of block bounding box projection and image bounds
- vgl_box_2d<double> img_bounds;
- img_bounds.add(vgl_point_2d<double>(img_i0_,img_j0_));
- img_bounds.add(vgl_point_2d<double>(img_i0_ + img_ni_ - 1, img_j0_ + img_nj_ - 1));
-
- vgl_box_2d<double> block_projection;
- double u,v;
- cam_->project(block_bb.min_x(),block_bb.min_y(),block_bb.min_z(),u,v);
- block_projection.add(vgl_point_2d<double>(u,v));
- cam_->project(block_bb.min_x(),block_bb.min_y(),block_bb.max_z(),u,v);
- block_projection.add(vgl_point_2d<double>(u,v));
- cam_->project(block_bb.min_x(),block_bb.max_y(),block_bb.min_z(),u,v);
- block_projection.add(vgl_point_2d<double>(u,v));
- cam_->project(block_bb.min_x(),block_bb.max_y(),block_bb.max_z(),u,v);
- block_projection.add(vgl_point_2d<double>(u,v));
- cam_->project(block_bb.max_x(),block_bb.min_y(),block_bb.min_z(),u,v);
- block_projection.add(vgl_point_2d<double>(u,v));
- cam_->project(block_bb.max_x(),block_bb.min_y(),block_bb.max_z(),u,v);
- block_projection.add(vgl_point_2d<double>(u,v));
- cam_->project(block_bb.max_x(),block_bb.max_y(),block_bb.min_z(),u,v);
- block_projection.add(vgl_point_2d<double>(u,v));
- cam_->project(block_bb.max_x(),block_bb.max_y(),block_bb.max_z(),u,v);
- block_projection.add(vgl_point_2d<double>(u,v));
-
- img_bb=vgl_intersection(img_bounds,block_projection);
-
- if (img_bb.is_empty())
- return false;
- else
- return true;
- }
-
- void generate_ray(float i, float j, vgl_box_3d<double> const& /*block_bb*/, vgl_point_3d<double> &ray_origin, vgl_vector_3d<double> &norm_direction)
- {
- if (cam_->type_name() == "vpgl_perspective_camera") {
- vpgl_perspective_camera<double> const* pcam =
- static_cast<vpgl_perspective_camera<double> const*>(cam_.ptr());
- // backproject image point to a ray
- ray_origin = pcam->camera_center();
- vgl_line_3d_2_points<double> cam_ray = pcam->backproject(vgl_point_2d<double>((double)i,(double)j));
- norm_direction=cam_ray.direction();
- normalize(norm_direction);
- return;
- }
- if (cam_->type_name() == "vpgl_proj_camera") {
- vpgl_proj_camera<double> const* prcam =
- static_cast<vpgl_proj_camera<double> const*>(cam_.ptr());
- ray_origin = prcam->camera_center();
- vgl_homg_line_3d_2_points<double> cam_ray =
- prcam->backproject(vgl_homg_point_2d<double>((double)i,(double)j));
- vgl_homg_point_3d<double> hp = cam_ray.point_infinite();
- vgl_vector_3d<double> direction(hp.x(), hp.y(), hp.z());
- norm_direction=direction;
- normalize(norm_direction);
- return;
- }
- if (cam_->type_name() == "vpgl_affine_camera") {
- vgl_homg_point_2d<double> ph(i, j);
- vpgl_affine_camera<double> const * afcam =
- static_cast<vpgl_affine_camera<double> const*>(cam_.ptr());
- vgl_homg_line_3d_2_points<double> cam_ray =
- afcam->backproject(ph);
- vgl_homg_point_3d<double> hpinf = cam_ray.point_infinite();
- vgl_homg_point_3d<double> hpfin = cam_ray.point_finite();
- vgl_vector_3d<double> direction(hpinf.x(), hpinf.y(), hpinf.z());
- norm_direction=direction;
- normalize(norm_direction);
- vgl_point_3d<double> temp(hpfin);
- ray_origin = temp;
- return;
- }
- if (cam_->type_name() == "vpgl_local_rational_camera") {
- vpgl_local_rational_camera<double> const* lrcam =
- static_cast<vpgl_local_rational_camera<double> const*>(cam_.ptr());
- vpgl_ray::ray(*lrcam,(double)i, (double)j, ray_origin, norm_direction);
- return;
- }
- else {
- std::cerr << "In boxm_raytrace_function: camera type not handled\n";
- assert(false);
- }
- }
-
- bool entry_point(vgl_box_3d<double> & block_bb, vgl_point_3d<double> &ray_origin,
- vgl_vector_3d<double> &direction, vgl_point_3d<double> & enter_pt)
- {
- double lambda[6];
- std::vector<vgl_point_3d<double> > plane_intersections(6);
-
- lambda[0] = (block_bb.min_x() - ray_origin.x())/direction.x();
- lambda[1] = (block_bb.max_x() - ray_origin.x())/direction.x();
- lambda[2] = (block_bb.min_y() - ray_origin.y())/direction.y();
- lambda[3] = (block_bb.max_y() - ray_origin.y())/direction.y();
- lambda[4] = (block_bb.min_z() - ray_origin.z())/direction.z();
- lambda[5] = (block_bb.max_z() - ray_origin.z())/direction.z();
-
- if (block_bb.contains(ray_origin))
- enter_pt=ray_origin;
- else
- {
- for (unsigned int face=0; face<6; ++face) {
- plane_intersections[face] = ray_origin + (direction * lambda[face]);
- }
-
- // determine which point is the entrance point based on direction
- const double epsilon = 1e-6; // use in place of zero to avoid badly conditioned lambdas
- if ( (plane_intersections[5].x() >= block_bb.min_x()) && (plane_intersections[5].x() <= block_bb.max_x()) &&
- (plane_intersections[5].y() >= block_bb.min_y()) && (plane_intersections[5].y() <= block_bb.max_y()) &&
- (direction.z() < -epsilon) )
- {
- // ray intersects the zmax plane
- // check zmax first since it is probably the most common
- enter_pt = plane_intersections[5];
- }
- else if ( (plane_intersections[0].y() >= block_bb.min_y()) && (plane_intersections[0].y() <= block_bb.max_y()) &&
- (plane_intersections[0].z() >= block_bb.min_z()) && (plane_intersections[0].z() <= block_bb.max_z()) &&
- (direction.x() > epsilon) )
- {
- // ray intersects the xmin plane
- enter_pt = plane_intersections[0];
- }
- else if ( (plane_intersections[1].y() >= block_bb.min_y()) && (plane_intersections[1].y() <= block_bb.max_y()) &&
- (plane_intersections[1].z() >= block_bb.min_z()) && (plane_intersections[1].z() <= block_bb.max_z()) &&
- (direction.x() < -epsilon) )
- {
- // ray intersects the xmax plane
- enter_pt = plane_intersections[1];
- }
- else if ( (plane_intersections[2].x() >= block_bb.min_x()) && (plane_intersections[2].x() <= block_bb.max_x()) &&
- (plane_intersections[2].z() >= block_bb.min_z()) && (plane_intersections[2].z() <= block_bb.max_z()) &&
- (direction.y() > epsilon) )
- {
- // ray intersects the ymin plane
- enter_pt = plane_intersections[2];
- }
- else if ( (plane_intersections[3].x() >= block_bb.min_x()) && (plane_intersections[3].x() <= block_bb.max_x()) &&
- (plane_intersections[3].z() >= block_bb.min_z()) && (plane_intersections[3].z() <= block_bb.max_z()) &&
- (direction.y() < -epsilon) )
- {
- // ray intersects the ymax plane
- enter_pt = plane_intersections[3];
- }
- else if ( (plane_intersections[4].x() >= block_bb.min_x()) && (plane_intersections[4].x() <= block_bb.max_x()) &&
- (plane_intersections[4].y() >= block_bb.min_y()) && (plane_intersections[4].y() <= block_bb.max_y()) &&
- (direction.z() > epsilon) )
- {
- // ray intersects the zmin plane
- enter_pt = plane_intersections[4];
- }
- else {
- // no entry point into this block found
- return false;;
- }
- }
- return true;
- }
-
- boxm_scene<tree_type> &scene_;
- boxm_aux_scene<T_loc, T_data, T_aux> &aux_scene_;
-
- bool reverse_traversal_;
-
- const vpgl_camera_double_sptr cam_;
- unsigned int img_i0_;
- unsigned int img_j0_;
- unsigned int img_ni_;
- unsigned int img_nj_;
-
- unsigned int debug_lvl_;
-};
-
-template<class F, class T_loc, class T_data, class T_aux>
-class boxm_iterate_cells_function
-{
- public:
- typedef boct_tree<T_loc,T_data> tree_type;
- typedef boct_tree<T_loc,T_aux> aux_tree_type;
- typedef boct_tree_cell<T_loc,T_data> cell_type;
- typedef boct_tree_cell<T_loc,T_aux> aux_cell_type;
- //: constructor
- boxm_iterate_cells_function(boxm_scene<tree_type> &scene,
- boxm_aux_scene<T_loc, T_data, T_aux> &aux_scene,
- vpgl_camera_double_sptr cam,
- unsigned int ni, unsigned int nj )
- : scene_(scene), aux_scene_(aux_scene), img_ni_(ni), img_nj_(nj), cam_(cam)
- {}
-
-
- bool run(F& step_functor)
- {
- // code to iterate over the blocks in order of visibility
- boxm_block_vis_graph_iterator<tree_type > block_vis_iter(cam_, &scene_, img_ni_,img_nj_);
- while (block_vis_iter.next())
- {
- std::vector<vgl_point_3d<int> > block_indices = block_vis_iter.frontier_indices();
- for (auto & block_indice : block_indices) // code for each block
- {
- scene_.load_block(block_indice);
- boxm_block<tree_type> * curr_block=scene_.get_active_block();
- boxm_block<aux_tree_type> * curr_aux_block=aux_scene_.get_block(block_indice);
- tree_type * tree=curr_block->get_tree();
- aux_tree_type * aux_tree=curr_aux_block->get_tree();
-
- std::vector<cell_type*> leaves=tree->leaf_cells();
- for (unsigned i=0;i<leaves.size();i++)
- {
- T_data cell_val=leaves[i]->data();
- boct_loc_code<T_loc> cell_code(leaves[i]->get_code());
- aux_cell_type * aux_cell=aux_tree->get_cell(cell_code);
- T_aux aux_val=aux_cell->data();
- step_functor.step_cell(cell_val,aux_val);
- leaves[i]->set_data(cell_val);
- aux_cell->set_data(aux_val);
- }
- scene_.write_active_block();
- aux_scene_.write_active_block();
- }
- }
- return true;
- }
-
- protected:
- boxm_scene<tree_type> &scene_;
- boxm_aux_scene<T_loc, T_data, T_aux> &aux_scene_;
- bool reverse_traversal_;
-
- unsigned img_ni_;
- unsigned img_nj_;
-
- const vpgl_camera_double_sptr cam_;
-};
-
-#endif // boxm_raytrace_function_h_
diff --git a/contrib/brl/bseg/boxm/basic/boxm_seg_length_functor.h b/contrib/brl/bseg/boxm/basic/boxm_seg_length_functor.h
deleted file mode 100644
index ea44cd7eed..0000000000
--- a/contrib/brl/bseg/boxm/basic/boxm_seg_length_functor.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef boxm_seg_length_functor_h
-#define boxm_seg_length_functor_h
-//:
-// \file
-#include <iostream>
-#include <boxm/boxm_apm_traits.h>
-#include "boxm_raytrace_function.h"
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <vil/vil_image_view.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <boxm_apm_type APM, class T_aux>
-class boxm_seg_length_functor
-{
- public:
- boxm_seg_length_functor(vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> &observation,
- unsigned int /*ni*/=0, unsigned /*nj*/=0)
- : obs_(observation)
- {
- scene_read_only_=true;
- is_aux_=true;
- }
-
- inline bool step_cell(unsigned int i, unsigned int j, vgl_point_3d<double> s0, vgl_point_3d<double> s1,
- boxm_sample<APM> & /*cell_value*/, // FIXME: unused...
- T_aux &aux_val)
- {
- const float seg_len = (float)(s1 - s0).length();
- aux_val.obs_ += obs_(i,j) * seg_len;
- aux_val.seg_len_ += seg_len;
- return true;
- }
-
- public:
- bool scene_read_only_;
- bool is_aux_;
-
- private:
- vil_image_view<typename boxm_apm_traits<APM>::obs_datatype> &obs_;
-};
-
-#endif // boxm_seg_length_functor_h
diff --git a/contrib/brl/bseg/boxm/basic/boxm_util_data_types.cxx b/contrib/brl/bseg/boxm/basic/boxm_util_data_types.cxx
deleted file mode 100644
index a6f2af30f1..0000000000
--- a/contrib/brl/bseg/boxm/basic/boxm_util_data_types.cxx
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "boxm_util_data_types.h"
-
-// Binary write boxm_render_probe_manager scene to stream
-// DUMMY IMPLEMENTATION: does nothing!
-void vsl_b_write(vsl_b_ostream &, boxm_array_1d_float const&) {}
-
-// Binary load boxm_render_probe_manager scene from stream.
-// DUMMY IMPLEMENTATION: does nothing!
-void vsl_b_read(vsl_b_istream &, boxm_array_1d_float &) {}
-
-// Binary load boxm_render_probe_manager scene from stream.
-// DUMMY IMPLEMENTATION: does nothing!
-void vsl_b_read(vsl_b_istream&, boxm_array_1d_float*) {}
-
-// Binary write scene pointer to stream
-// DUMMY IMPLEMENTATION: does nothing!
-void vsl_b_write(vsl_b_ostream&, const boxm_array_1d_float* &) {}
diff --git a/contrib/brl/bseg/boxm/basic/boxm_util_data_types.h b/contrib/brl/bseg/boxm/basic/boxm_util_data_types.h
deleted file mode 100644
index 827e172bbc..0000000000
--- a/contrib/brl/bseg/boxm/basic/boxm_util_data_types.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef boxm_util_data_types_h
-#define boxm_util_data_types_h
-//:
-// \file
-#include <vbl/vbl_ref_count.h>
-#include <vbl/vbl_smart_ptr.h>
-#include <vbl/vbl_array_1d.h>
-#include <vsl/vsl_binary_io.h>
-
-class boxm_array_1d_float: public vbl_ref_count
-{
- public:
- boxm_array_1d_float(unsigned n):data_array(n,-1.0f){}
- vbl_array_1d<float> data_array;
-};
-
-typedef vbl_smart_ptr<boxm_array_1d_float> boxm_array_1d_float_sptr;
-
-//: Binary write boxm_render_probe_manager scene to stream
-void vsl_b_write(vsl_b_ostream & os, boxm_array_1d_float const& a);
-
-//: Binary load boxm_render_probe_manager scene from stream.
-void vsl_b_read(vsl_b_istream & is, boxm_array_1d_float &a);
-
-void vsl_b_read(vsl_b_istream& is, boxm_array_1d_float* b);
-
-//: Binary write scene pointer to stream
-void vsl_b_write(vsl_b_ostream& os, const boxm_array_1d_float* &b);
-
-#endif
diff --git a/contrib/brl/bseg/boxm/basic/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/basic/tests/CMakeLists.txt
deleted file mode 100644
index 96c61fe483..0000000000
--- a/contrib/brl/bseg/boxm/basic/tests/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-add_executable( boxm_basic_test_all
- test_driver.cxx
- test_block_vis_graph.cxx
- test_cell_vis_graph.cxx
- )
-
-target_link_libraries( boxm_basic_test_all boxm_basic boxm boxm_util ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vpl ${VXL_LIB_PREFIX}vul)
-
-add_test( NAME boxm_basic_test_block_vis_graph COMMAND $<TARGET_FILE:boxm_basic_test_all> test_block_vis_graph )
-add_test( NAME boxm_basic_test_cell_vis_graph COMMAND $<TARGET_FILE:boxm_basic_test_all> test_cell_vis_graph )
-
-add_executable( boxm_basic_test_include test_include.cxx )
-target_link_libraries( boxm_basic_test_include boxm_basic)
-add_executable( boxm_basic_test_template_include test_template_include.cxx )
-target_link_libraries( boxm_basic_test_template_include boxm_basic)
diff --git a/contrib/brl/bseg/boxm/basic/tests/test_block_vis_graph.cxx b/contrib/brl/bseg/boxm/basic/tests/test_block_vis_graph.cxx
deleted file mode 100644
index 70a87b0476..0000000000
--- a/contrib/brl/bseg/boxm/basic/tests/test_block_vis_graph.cxx
+++ /dev/null
@@ -1,48 +0,0 @@
-
-#include <testlib/testlib_test.h>
-
-#include <boxm/boxm_scene.h>
-#include <boxm/basic/boxm_block_vis_graph_iterator.h>
-#include <boxm/util/boxm_test_util.h>
-#include <vpl/vpl.h>
-#include <vul/vul_file.h>
-
-static void test_block_vis_graph()
-{
- // create scene
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(0,0,0);
- vgl_vector_3d<double> block_dim(10,10,10);
- vgl_vector_3d<unsigned> world_dim(2,2,3);
- boxm_scene<tree_type> scene(lvcs, origin, block_dim, world_dim);
- vul_file::make_directory("boxm_scene");
- scene.set_paths("boxm_scene", "block");
-
-
- vgl_box_3d<double> world;
- world.add(origin);
- world.add(vgl_point_3d<double>(origin.x()+block_dim.x()*world_dim.x(),
- origin.y()+block_dim.y()*world_dim.y(),
- origin.z()+block_dim.z()*world_dim.z()));
- vpgl_camera_double_sptr camera = generate_camera_top(world);
- boxm_block_vis_graph_iterator<tree_type> block_vis_iter(camera, &scene, IMAGE_U, IMAGE_V);
-
- int vis_count = -1;
- std::vector<boxm_block<tree_type>*> blocks;
- int counts[] = {4,4,4};
- while (block_vis_iter.next()) {
- int block_count = 0;
- ++vis_count;
- std::cout << "Frontier\n";
- blocks = block_vis_iter.frontier_blocks();
- for (unsigned i=0; i<blocks.size(); ++i) {
- std::cout << i << "- " << blocks[i]->bounding_box() << std::endl;
- ++block_count;
- }
- TEST("block count", block_count, counts[vis_count]);
- }
- vpl_rmdir("boxm_scene");
- TEST("vis count", ++vis_count, 3);
-}
-
-TESTMAIN(test_block_vis_graph);
diff --git a/contrib/brl/bseg/boxm/basic/tests/test_cell_vis_graph.cxx b/contrib/brl/bseg/boxm/basic/tests/test_cell_vis_graph.cxx
deleted file mode 100644
index d9e2da00f7..0000000000
--- a/contrib/brl/bseg/boxm/basic/tests/test_cell_vis_graph.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <testlib/testlib_test.h>
-
-#include <boxm/boxm_scene.h>
-#include <boxm/basic/boxm_cell_vis_graph_iterator.h>
-#include <boxm/util/boxm_test_util.h>
-#include <vpl/vpl.h>
-#include <vul/vul_file.h>
-
-static void test_cell_vis_graph()
-{
- // create scene
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(10,10,20);
- vgl_vector_3d<double> block_dim(10,10,10);
- vgl_vector_3d<unsigned> world_dim(1,1,1);
- boxm_scene<tree_type> scene(lvcs, origin, block_dim, world_dim);
- scene.set_paths("boxm_scene_cell", "block");
- vul_file::make_directory("boxm_scene_cell");
-
- vgl_box_3d<double> world;
- world.add(origin);
- world.add(vgl_point_3d<double>(origin.x()+block_dim.x()*world_dim.x(),
- origin.y()+block_dim.y()*world_dim.y(),
- origin.z()+block_dim.z()*world_dim.z()));
-
- vpgl_camera_double_sptr camera = generate_camera_top(world);
- boxm_block_iterator<boct_tree<short,vgl_point_3d<double> > > iter(&scene);
-
- while (!iter.end())
- {
- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z());
- boxm_block<boct_tree<short,vgl_point_3d<double> > > * block=scene.get_active_block();
- auto * tree=new boct_tree<short,vgl_point_3d<double> >(3,2);
- block->init_tree(tree);
- boxm_cell_vis_graph_iterator<short,vgl_point_3d<double> > cell_iterator(camera,tree,IMAGE_U, IMAGE_V);
- double cnt=30;
- while (cell_iterator.next()){
- std::cout<<"Frontier\n";
- std::vector<boct_tree_cell<short,vgl_point_3d<double> > *> vis_cells=cell_iterator.frontier();
- for (auto & vis_cell : vis_cells)
- {
- vgl_box_3d<double> box=tree->cell_bounding_box(vis_cell);
- TEST("Returns correct frontier",cnt,box.max_z());
- }
- cnt-=5;
- }
-
- scene.write_active_block();
- iter++;
- }
- vpl_rmdir("boxm_scene_cell");
-}
-
-TESTMAIN(test_cell_vis_graph);
diff --git a/contrib/brl/bseg/boxm/basic/tests/test_driver.cxx b/contrib/brl/bseg/boxm/basic/tests/test_driver.cxx
deleted file mode 100644
index 1e4f60a571..0000000000
--- a/contrib/brl/bseg/boxm/basic/tests/test_driver.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <testlib/testlib_register.h>
-
-DECLARE( test_block_vis_graph );
-DECLARE( test_cell_vis_graph );
-
-void register_tests()
-{
- REGISTER( test_block_vis_graph );
- REGISTER( test_cell_vis_graph );
-}
-
-
-DEFINE_MAIN;
diff --git a/contrib/brl/bseg/boxm/basic/tests/test_include.cxx b/contrib/brl/bseg/boxm/basic/tests/test_include.cxx
deleted file mode 100644
index cbaeca0acc..0000000000
--- a/contrib/brl/bseg/boxm/basic/tests/test_include.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <boxm/basic/boxm_block_vis_graph_iterator.h>
-#include <boxm/basic/boxm_block_vis_graph_node.h>
-#include <boxm/basic/boxm_cell_vis_graph_iterator.h>
-#include <boxm/basic/boxm_num_rays_functor.h>
-#include <boxm/basic/boxm_raytrace_function.h>
-#include <boxm/basic/boxm_seg_length_functor.h>
-#include <boxm/basic/boxm_util_data_types.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm/basic/tests/test_template_include.cxx b/contrib/brl/bseg/boxm/basic/tests/test_template_include.cxx
deleted file mode 100644
index 131baa9347..0000000000
--- a/contrib/brl/bseg/boxm/basic/tests/test_template_include.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/basic/boxm_block_vis_graph_iterator.hxx>
-#include <boxm/basic/boxm_cell_vis_graph_iterator.hxx>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm/boxm_apm_traits.cxx b/contrib/brl/bseg/boxm/boxm_apm_traits.cxx
deleted file mode 100644
index 1d3c646178..0000000000
--- a/contrib/brl/bseg/boxm/boxm_apm_traits.cxx
+++ /dev/null
@@ -1,86 +0,0 @@
-#include "boxm_apm_traits.h"
-
-const char* boxm_apm_types::app_model_strings[] = { "apm_mog_grey",
- "apm_mog_rgb",
- "apm_simple_grey",
- "apm_simple_rgb",
- "apm_mob_grey",
- "float",
- "int",
- "short",
- "char",
- "bool",
- "vnl_double_10",
- "vnl_float_10",
- "vnl_float_3",
- "bsta_mog_f1",
- "bsta_gauss_f1",
- "bvpl_sample_float",
- "bvpl_sample_gauss_f1",
- "bvpl_pca_basis_sample_10",
- "edge_float",
- "edge_line",
- "edge_tangent_line",
- "scalar_float",
- "dbrec3d_part_instance",
- "dbrec3d_pair_composite_instance",
- "apm_na",
- "apm_unknown" };
-
-
-boxm_apm_type boxm_apm_types::str_to_enum(const char* s)
-{
- for (int i=0; i < int(BOXM_APM_UNKNOWN); i++)
- {
- if (std::strcmp(s, boxm_apm_types::app_model_strings[i]) == 0)
- return (boxm_apm_type) i;
- }
- return BOXM_APM_UNKNOWN;
-}
-
-void vsl_b_write(vsl_b_ostream & os, boxm_simple_grey const &sample)
-{
- vsl_b_write(os, sample.version_no());
- vsl_b_write(os, sample.color_);
- vsl_b_write(os, sample.one_over_sigma_);
- //vsl_b_write(os, sample.gauss_weight_);
-}
-
-void vsl_b_write(vsl_b_ostream & os, boxm_simple_grey const * &sample)
-{
- if (sample) {
- vsl_b_write(os, *sample);
- }
-}
-
-void vsl_b_read(vsl_b_istream & is, boxm_simple_grey &sample)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case 1:
- vsl_b_read(is, sample.color_);
- vsl_b_read(is, sample.one_over_sigma_);
- //vsl_b_read(is, sample.gauss_weight_);
- break;
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_sample<T>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- break;
- }
-}
-
-void vsl_b_read(vsl_b_istream & is, boxm_simple_grey *&sample)
-{
- vsl_b_read(is, *sample);
-}
-
-std::ostream& operator<<(std::ostream &os, boxm_simple_grey const& apm)
-{
- os << "color: " << apm.color() << ", one_over_sigma: " << apm.one_over_sigma() << std::endl;
- return os;
-}
diff --git a/contrib/brl/bseg/boxm/boxm_apm_traits.h b/contrib/brl/bseg/boxm/boxm_apm_traits.h
deleted file mode 100644
index 17f80b5a70..0000000000
--- a/contrib/brl/bseg/boxm/boxm_apm_traits.h
+++ /dev/null
@@ -1,206 +0,0 @@
-#ifndef boxm_appearance_model_traits_h_
-#define boxm_appearance_model_traits_h_
-//:
-// \file
-// \brief A class for appearance model traits
-//
-// \author Daniel Crispell
-// \date April 03, 2009
-
-#include <iostream>
-#include <iosfwd>
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_mixture_fixed.h>
-#include <bsta/bsta_gauss_sf1.h>
-#include <bsta/bsta_gauss_if3.h>
-#include <bsta/bsta_beta.h>
-#include <bsta/bsta_beta_f1.h>
-#include <vnl/vnl_vector_fixed.h>
-#include <vil/vil_rgb.h>
-#include <vsl/vsl_binary_io.h>
-#include <boxm/sample/boxm_edge_sample.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include "boxm_export.h"
-
-class boxm_mog_grey_processor;
-class boxm_mog_rgb_processor;
-class boxm_simple_grey_processor;
-class boxm_mob_grey_processor;
-
-enum boxm_apm_type
-{
- BOXM_APM_MOG_GREY = 0,
- BOXM_APM_MOG_RGB,
- BOXM_APM_SIMPLE_GREY,
- BOXM_APM_SIMPLE_RGB,
- BOXM_APM_MOB_GREY,
- BOXM_FLOAT,
- BOXM_INT,
- BOXM_SHORT,
- BOXM_CHAR,
- BOXM_BOOL,
- VNL_DOUBLE_10,
- VNL_FLOAT_10,
- VNL_FLOAT_3,
- BSTA_MOG_F1,
- BSTA_GAUSS_F1,
- BVPL_SAMPLE_FLOAT,
- BVPL_SAMPLE_BSTA_GAUSS_F1,
- BVPL_PCA_BASIS_SAMPLE_10,
- BOXM_EDGE_FLOAT,
- BOXM_EDGE_LINE,
- BOXM_EDGE_TANGENT_LINE,
- BOXM_SCALAR_FLOAT,
- DBREC3D_PART_INSTANCE,
- DBREC3D_PAIR_COMPOSITE_INSTANCE,
- BOXM_APM_NA,
- BOXM_APM_UNKNOWN
-};
-
-class boxm_apm_types
-{
- public:
- static boxm_EXPORT_DATA const char* app_model_strings[];
- static boxm_apm_type str_to_enum(const char* s);
-};
-
-//: Pixel properties for templates.
-template <boxm_apm_type>
-class boxm_apm_traits;
-
-
-//: traits for a mixture of gaussian appearance model of gray-scale images
-template<>
-class boxm_apm_traits<BOXM_APM_MOG_GREY>
-{
- public:
- static const unsigned int n_gaussian_modes_ = 3;
-
- typedef bsta_num_obs<bsta_gauss_sf1> gauss_type_sf1;
- typedef bsta_num_obs<bsta_mixture_fixed<gauss_type_sf1, n_gaussian_modes_> > mix_gauss_sf1_type;
-
- public:
- static const unsigned int obs_dim = 1;
- typedef mix_gauss_sf1_type apm_datatype;
- typedef float obs_datatype;
- typedef float obs_mathtype;
- typedef boxm_mog_grey_processor apm_processor;
-};
-
-
-//: traits for a mixture of gaussian appearance model of rgb images
-template<>
-class boxm_apm_traits<BOXM_APM_MOG_RGB>
-{
- public:
- static const unsigned int n_gaussian_modes_ = 3;
-
- typedef bsta_num_obs<bsta_gauss_if3> gauss_type_if3;
- typedef bsta_num_obs<bsta_mixture_fixed<gauss_type_if3, n_gaussian_modes_> > mix_gauss_if3_type;
-
- public:
- static const unsigned int obs_dim = 3;
- typedef mix_gauss_if3_type apm_datatype;
- typedef vil_rgb<float> obs_datatype;
- typedef float obs_mathtype;
- typedef boxm_mog_rgb_processor apm_processor;
-};
-
-
-//: traits for a simple one-valued appearance model of grey-scale images
-class boxm_simple_grey
-{
- public:
- boxm_simple_grey() : color_(0.5f), one_over_sigma_(1.0f),gauss_weight_(1.0f) {}
- boxm_simple_grey(float colour, float std_dev, float gauss_wght=1.0f) : color_(colour), one_over_sigma_(1/std_dev), gauss_weight_(gauss_wght) { check_vals(); }
- boxm_simple_grey(vnl_vector_fixed<float,3> const& params) : color_(params[0]), one_over_sigma_(1.0f/params[1]) { check_vals(); }
- static short version_no() { return 1; }
- inline float color() const { return color_; }
- inline float sigma() const { return 1.0f/one_over_sigma_; }
- inline float gauss_weight() const { return gauss_weight_; }
- inline float one_over_sigma() const { return one_over_sigma_; }
-
- protected:
- inline void check_vals()
- {
- if (!(color_ > 0.0f))
- color_ = 0.0f;
- if (!(color_ < 1.0f))
- color_ = 1.0f;
- if (!(one_over_sigma_ < 1e4))
- one_over_sigma_ = 1e4f;
- if (!(one_over_sigma_ > 1e-4))
- one_over_sigma_ = 1e-4f;
- }
-
- public:
- float color_;
- float one_over_sigma_;
- float gauss_weight_;
-};
-
-template<>
-class boxm_apm_traits<BOXM_APM_SIMPLE_GREY>
-{
- public:
- static const unsigned int n_gaussian_modes_ = 1;
- static const unsigned int obs_dim = 1;
- static const unsigned int n_params = 3;
- typedef boxm_simple_grey apm_datatype;
- typedef float obs_datatype;
- typedef float obs_mathtype;
- typedef boxm_simple_grey_processor apm_processor;
-};
-
-template<>
-class boxm_apm_traits<BOXM_APM_MOB_GREY>
-{
- public:
- static const unsigned int n_beta_modes_ = 3;
-
- typedef bsta_num_obs<bsta_beta_f1> beta_type;
- typedef bsta_num_obs<bsta_mixture_fixed<beta_type, n_beta_modes_> > mix_beta_type;
-
- public:
- static const unsigned int obs_dim = 1;
- typedef mix_beta_type apm_datatype;
- typedef float obs_datatype;
- typedef float obs_mathtype;
- typedef boxm_mob_grey_processor apm_processor;
-};
-
-template<>
-class boxm_apm_traits<BOXM_EDGE_FLOAT>
-{
- public:
- static const unsigned int obs_dim = 1;
- static const unsigned int n_params = 2;
- typedef boxm_edge_sample<float> apm_datatype;
- typedef float obs_datatype;
- typedef float obs_mathtype;
-#if 0
- typedef boxm_edge_processor apm_processor;
-#endif
-};
-
-template<>
-class boxm_apm_traits<BOXM_EDGE_LINE>
-{
- public:
- static const unsigned int obs_dim = 1;
- static const unsigned int n_params = 2;
- typedef boxm_inf_line_sample<float> apm_datatype;
- typedef float obs_datatype;
- typedef float obs_mathtype;
-};
-
-void vsl_b_write(vsl_b_ostream & os, boxm_simple_grey const &sample);
-void vsl_b_write(vsl_b_ostream & os, boxm_simple_grey const * &sample);
-void vsl_b_read(vsl_b_istream & is, boxm_simple_grey &sample);
-void vsl_b_read(vsl_b_istream & is, boxm_simple_grey *&sample);
-std::ostream& operator << (std::ostream& os, const boxm_simple_grey& sample);
-
-#endif
diff --git a/contrib/brl/bseg/boxm/boxm_aux_scene.h b/contrib/brl/bseg/boxm/boxm_aux_scene.h
deleted file mode 100644
index 40a2a56914..0000000000
--- a/contrib/brl/bseg/boxm/boxm_aux_scene.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef boxm_aux_scene_h_
-#define boxm_aux_scene_h_
-//:
-// \file
-// \brief an auxiliary scene keeps a set of octrees for a given main scene
-//
-// \author Gamze Tunali
-// \date July 31, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <boct/boct_tree.h>
-#include <boct/boct_tree_cell_reader.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_block.h>
-
-#include <vgl/vgl_point_3d.h>
-
-template <class T_loc, class T, class T_AUX>
-class boxm_aux_scene
-{
- public:
- typedef enum {EMPTY=0, CLONE, LOAD, UNDEFINED } tree_creation_type ;
- typedef boct_tree<T_loc, T> tree_type;
- typedef boct_tree<T_loc, T_AUX> aux_tree_type;
- boxm_aux_scene() : aux_scene_(nullptr), aux_storage_dir_("") {}
- boxm_aux_scene(boxm_scene<tree_type>* scene, std::string suffix,
- tree_creation_type type, boxm_apm_type app_model=BOXM_APM_UNKNOWN);
-
- ~boxm_aux_scene(){ /*delete aux_scene_;*/ }
-
- void init_scene(){}
-
-
- boxm_block<boct_tree<T_loc,T_AUX> > * get_block(vgl_point_3d<int> index){
- aux_scene_->load_block(index);
- return aux_scene_->get_active_block();
- }
-
- //: get an incremental reader for a scene block
- boct_tree_cell_reader<T_loc, T_AUX >* get_block_incremental(vgl_point_3d<int> block_idx);
-
- void write_active_block() { aux_scene_->write_active_block(); }
- void unload_active_blocks() { aux_scene_->unload_active_blocks(); }
- void clean_scene();
-
- private:
- boxm_scene<aux_tree_type>* aux_scene_;
- std::string aux_storage_dir_;
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/boxm_aux_scene.hxx b/contrib/brl/bseg/boxm/boxm_aux_scene.hxx
deleted file mode 100644
index d3ceaf9c84..0000000000
--- a/contrib/brl/bseg/boxm/boxm_aux_scene.hxx
+++ /dev/null
@@ -1,121 +0,0 @@
-#ifndef boxm_aux_scene_hxx_
-#define boxm_aux_scene_hxx_
-
-#include "boxm_aux_scene.h"
-#include <boxm/boxm_aux_traits.h>
-
-#include <vpl/vpl.h>
-#include <cassert>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template <class T_loc, class T, class T_AUX>
-boxm_aux_scene<T_loc,T,T_AUX>::boxm_aux_scene(boxm_scene<tree_type>* scene,
- std::string storage_suffix,
- tree_creation_type type,
- boxm_apm_type app_model)
-: aux_scene_(nullptr)
-{
- std::string aux_storage_dir;
- aux_storage_dir_ = scene->path();
- aux_scene_ = new boxm_scene<aux_tree_type >(scene->lvcs(), scene->origin(), scene->block_dim(), scene->world_dim(), scene->load_all_blocks(),scene->save_internal_nodes(), scene->save_platform_independent());
- aux_scene_->set_path(aux_storage_dir_, storage_suffix);
- aux_scene_->set_appearance_model(app_model);
- aux_scene_->set_octree_levels(scene->max_level(),scene->init_level());
- if (type != EMPTY)
- {
- // loop through valid blocks and init same blocks in aux scene
- boxm_block_iterator<tree_type > iter(scene);
- iter.begin();
- while (!iter.end()) {
- if (scene->discover_block(iter.index().x(),iter.index().y(),iter.index().z())) {
- if (type == LOAD) {
- if (aux_scene_->discover_block(iter.index().x(),iter.index().y(),iter.index().z())) {
-#if 0
- // auxiliary block file exist
- aux_scene_->load_block(iter.index());
- boxm_block<boct_tree<T_loc,T_AUX> > * block=aux_scene_->get_active_block();
- assert(block->get_tree() != 0);
-#endif
- }
- }
- else if (type==CLONE) { //clone from the primary block
- scene->load_block(iter.index().x(),iter.index().y(),iter.index().z());
- boxm_block<boct_tree<T_loc,T> > * block=scene->get_active_block();
- boct_tree<T_loc,T>* tree=block->get_tree();
- aux_tree_type *aux_tree = tree->template clone_to_type<T_AUX>();
- boxm_block<aux_tree_type >* aux_block = new boxm_block<aux_tree_type >(block->bounding_box(),aux_tree );
- aux_scene_->set_block(iter.index(), aux_block);
- aux_scene_->write_active_block();
- }
- }
- ++iter;
- }
- aux_scene_->write_scene(storage_suffix+".xml");
- scene->unload_active_blocks();
- aux_scene_->unload_active_blocks();
- }
-}
-
-
-template <class T_loc, class T, class T_AUX>
-boct_tree_cell_reader<T_loc, T_AUX>* boxm_aux_scene<T_loc,T,T_AUX>::get_block_incremental(vgl_point_3d<int> block_idx)
-{
- if (aux_scene_) {
- std::string path=aux_scene_->gen_block_path(block_idx.x(), block_idx.y(), block_idx.z());
- boct_tree_cell_reader<T_loc, T_AUX>* reader = new boct_tree_cell_reader<T_loc, T_AUX>(path);
- reader->begin();
- return reader;
- }
- else {
- return nullptr;
- }
-}
-
-template <class T_loc, class T, class T_AUX>
-void boxm_aux_scene<T_loc,T,T_AUX>::clean_scene()
-{
- std::cout<<"Clean AUX scene "<<std::endl;
- aux_scene_->unload_active_blocks();
- boxm_block_iterator<boct_tree<T_loc, T_AUX> > iter(aux_scene_);
- iter.begin();
- if (!aux_scene_->load_all_blocks())
- {
- while (!iter.end()) {
- if (aux_scene_->discover_block(iter.index().x(),iter.index().y(),iter.index().z())) {
- std::string filename=aux_scene_->gen_block_path(iter.index().x(),iter.index().y(),iter.index().z());
- vpl_unlink(filename.c_str());
- }
- iter++;
- }
- }
- else
- {
- while (!iter.end()) {
- if (iter->get_tree()!=nullptr)
- {
- iter->delete_tree();
- iter->set_tree(nullptr);
- }
- iter++;
- }
- }
-}
-
-#if 0 // commented out
-template <class T_loc, class T, class T_AUX>
-boct_tree_cell_reader<T_loc, T_AUX>* boxm_aux_scene<T_loc,T,T_AUX>::save_scene()
-{
- boxm_block_iterator<boct_tree<T_loc, T_AUX> > iter(&aux_scene);
- iter.begin();
- while (!iter.end()) {
- // body
- }
-}
-#endif // 0
-
-#define BOXM_AUX_SCENE_INSTANTIATE(T1,T2,T3) \
-template class boxm_aux_scene<T1,T2,T3 >
-
-#endif
diff --git a/contrib/brl/bseg/boxm/boxm_aux_traits.h b/contrib/brl/bseg/boxm/boxm_aux_traits.h
deleted file mode 100644
index 4e4c5113da..0000000000
--- a/contrib/brl/bseg/boxm/boxm_aux_traits.h
+++ /dev/null
@@ -1,74 +0,0 @@
-#ifndef boxm_aux_traits_h_
-#define boxm_aux_traits_h_
-//:
-// \file
-
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <boxm/sample/boxm_vis_implicit_sample.h>
-#include <boxm/sample/boxm_update_sample.h>
-
-enum boxm_aux_type
-{
- BOXM_AUX_VIS_IMPLICIT,
- BOXM_AUX_UPDATE,
- BOXM_AUX_OPT_GREY,
- BOXM_AUX_OPT_RT_GREY,
- BOXM_AUX_OPT_RGB,
- BOXM_AUX_OPT_RT_RGB,
- BOXM_AUX_NULL,
- BOXM_AUX_UNKNOWN,
- BOXM_AUX_OPT2_GREY,
- BOXM_AUX_OPT2_RGB,
- BOXM_AUX_OPT3_MOG_GREY,
- BOXM_AUX_OPT3_MOG_RGB,
- BOXM_AUX_SCALAR_SAMPLE
-};
-
-//: sample properties for templates.
-template <boxm_aux_type>
-class boxm_aux_traits;
-
-//: traits for a visibility-based implicit surface sample
-template<>
-class boxm_aux_traits<BOXM_AUX_VIS_IMPLICIT>
-{
- public:
- typedef boxm_vis_implicit_sample sample_datatype;
-
- static std::string storage_subdir() { return "vis_implicit"; }
-};
-
-template<>
-class boxm_aux_traits<BOXM_AUX_UPDATE>
-{
- public:
- typedef boxm_update_sample sample_datatype;
-
- static std::string storage_subdir() { return "update_work";}
-};
-
-//: traits for a null sample
-template<>
-class boxm_aux_traits<BOXM_AUX_NULL>
-{
- public:
- typedef float sample_datatype;
-
- static std::string storage_subdir() { return "null"; }
-};
-template<>
-class boxm_aux_traits<BOXM_AUX_SCALAR_SAMPLE>
-{
- public:
- typedef float sample_datatype;
-
- static std::string storage_subdir() { return "scalar"; }
-};
-
-
-
-#endif // boxm_aux_traits_h_
diff --git a/contrib/brl/bseg/boxm/boxm_block.h b/contrib/brl/bseg/boxm/boxm_block.h
deleted file mode 100644
index 6bda381539..0000000000
--- a/contrib/brl/bseg/boxm/boxm_block.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef boxm_block_h_
-#define boxm_block_h_
-//:
-// \file
-// \brief a block is a smallest area that is going to be processed with an octree
-//
-// \author Gamze Tunali
-// \date Apr 01, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <vgl/vgl_box_3d.h>
-#include <vsl/vsl_binary_io.h>
-
-template <class T>
-class boxm_block
-{
- public:
- //: Default Constructor
- boxm_block(): octree_(nullptr) {}
- //: Destructor
- ~boxm_block() { if (octree_) delete octree_; }
- //: Constructor from boundinf box
- boxm_block(vgl_box_3d<double> bbox): bbox_(bbox), octree_(nullptr) {}
- //: Constructor from bounding box and octree
- boxm_block(vgl_box_3d<double> bbox, T* tree) : bbox_(bbox), octree_(tree) {octree_->set_bbox(bbox_);}
- //: Returns the number of leaf cells in the tree
- unsigned int size();
- //: Initializes octree and bounding-box
- void init_tree(T * octree);
- //: Sets the current octree
- void set_tree(T * octree);
-
- // Accessors
- vgl_box_3d<double> bounding_box() const { return bbox_; }
- T* get_tree() { return octree_; }
-
- //: Releases memory
- void delete_tree() { delete octree_; octree_ = nullptr; }
-
- // IO
- void b_read(vsl_b_istream &s);
- void b_write(vsl_b_ostream &s, const bool save_internal_nodes_, const bool platform_independent = true);
- static short version_no() { return 1; }
-
- bool operator==(boxm_block<T> const& other) const {
- return bbox_ == other.bounding_box()
- && octree_ == other.octree_;
- }
-
- private:
- vgl_box_3d<double> bbox_;
- T* octree_;
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/boxm_block.hxx b/contrib/brl/bseg/boxm/boxm_block.hxx
deleted file mode 100644
index a8f27f2bfe..0000000000
--- a/contrib/brl/bseg/boxm/boxm_block.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-#ifndef boxm_block_hxx_
-#define boxm_block_hxx_
-
-#include <iostream>
-#include "boxm_block.h"
-
-#include <vgl/io/vgl_io_box_3d.h>
-template <class T>
-void boxm_block<T>::init_tree(T * octree)
-{
- if(octree_){
- //release old memory unless the same tree
- if(octree!=octree_)
- delete octree_;
- }
- octree_=octree;
- octree->set_bbox(bbox_);
-}
-
-template <class T>
-void boxm_block<T>::set_tree(T * octree)
-{
- if(octree_) //release old memory
- delete octree_;
- octree_=octree;
-}
-
-template <class T>
-unsigned int boxm_block<T>::size()
-{
- if (octree_) {
- return octree_->size();
- }
- else {
- return 0;
- }
-}
-
-template <class T>
-void boxm_block<T>::b_read(vsl_b_istream &is)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case (1):
- vsl_b_read(is, bbox_);
- // if already allocated, destroy it and read from the file
- if (octree_ != nullptr) {
- delete octree_;
- }
- octree_ = new T();
- octree_->b_read(is);
- break;
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_block<T>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- return;
- }
-}
-
-
-template <class T>
-void boxm_block<T>::b_write(vsl_b_ostream &os, const bool save_internal_nodes, const bool platform_independent)
-{
- vsl_b_write(os, version_no());
- vsl_b_write(os, bbox_);
-#if 0
- std::cout << "Internal Nodes 3: " << save_internal_nodes << std::endl;
-#endif
- octree_->b_write(os, save_internal_nodes, platform_independent);
-}
-
-#define BOXM_BLOCK_INSTANTIATE(T) \
-template class boxm_block<T >
-
-#endif
diff --git a/contrib/brl/bseg/boxm/boxm_export.h b/contrib/brl/bseg/boxm/boxm_export.h
deleted file mode 100644
index 7827178bdf..0000000000
--- a/contrib/brl/bseg/boxm/boxm_export.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef BOXM_EXPORT_H
-#define BOXM_EXPORT_H
-
-#include <vxl_config.h> // get BUILD_SHARED_LIBS
-
-#ifndef BUILD_SHARED_LIBS // if not a shared build
-# define boxm_EXPORT_DATA
-#else // this is a shared build
-# ifdef boxm_EXPORTS // if building this library
-# if defined(_WIN32) || defined(WIN32)
-# define boxm_EXPORT_DATA __declspec(dllexport)
-# else
-# define boxm_EXPORT_DATA
-# endif
-# else // we are using this library and it is built shared
-# if defined(_WIN32) || defined(WIN32)
-# define boxm_EXPORT_DATA __declspec(dllimport)
-# else
-# define boxm_EXPORT_DATA
-# endif
-# endif
-#endif
-#endif
diff --git a/contrib/brl/bseg/boxm/boxm_io_scene_base.cxx b/contrib/brl/bseg/boxm/boxm_io_scene_base.cxx
deleted file mode 100644
index b1415333d6..0000000000
--- a/contrib/brl/bseg/boxm/boxm_io_scene_base.cxx
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "boxm_io_scene_base.h"
-//:
-// \file
-
-
-//: Binary write boxm scene to stream
-void vsl_b_write(vsl_b_ostream& /*os*/, boxm_scene_base const& /*scene_base*/)
-{
-}
-
-
-//: Binary load boxm scene from stream.
-void vsl_b_read(vsl_b_istream& /*is*/, boxm_scene_base& /*scene_base*/)
-{
-}
-
-//: Binary write boxm scene pointer to stream
-void vsl_b_read(vsl_b_istream& /*is*/, boxm_scene_base* /*ph*/)
-{
-}
-
-//: Binary write boxm scene pointer to stream
-void vsl_b_write(vsl_b_ostream& /*os*/, boxm_scene_base* const& /*ph*/)
-{
-}
diff --git a/contrib/brl/bseg/boxm/boxm_io_scene_base.h b/contrib/brl/bseg/boxm/boxm_io_scene_base.h
deleted file mode 100644
index 1abc4fa90c..0000000000
--- a/contrib/brl/bseg/boxm/boxm_io_scene_base.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef boxm_io_scene_base_h_
-#define boxm_io_scene_base_h_
-//:
-// \file
-#include <boxm/boxm_scene_base.h>
-#include <vsl/vsl_binary_io.h>
-
-//: Binary write boxm scene to stream
-void vsl_b_write(vsl_b_ostream & os, boxm_scene_base const& scene_base);
-
-//: Binary load boxm scene from stream.
-void vsl_b_read(vsl_b_istream & is, boxm_scene_base &scene_base);
-
-//: Binary load boxm scene pointer from stream.
-void vsl_b_read(vsl_b_istream& is, boxm_scene_base* p);
-
-//: Binary write boxm scene pointer to stream
-void vsl_b_write(vsl_b_ostream& os, const boxm_scene_base* &p);
-
-
-#endif
diff --git a/contrib/brl/bseg/boxm/boxm_scene.h b/contrib/brl/bseg/boxm/boxm_scene.h
deleted file mode 100644
index 8d1bd207d3..0000000000
--- a/contrib/brl/bseg/boxm/boxm_scene.h
+++ /dev/null
@@ -1,559 +0,0 @@
-#ifndef boxm_scene_h_
-#define boxm_scene_h_
-//:
-// \file
-// \brief The main class to keep the 3D world data. It is a grid of boxm_blocks containing octrees.
-//
-// \author Gamze Tunali
-// \date Apr 03, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <string>
-#include <iostream>
-#include <iosfwd>
-#include <set>
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_block.h>
-#include <boxm/sample/boxm_sample.h>
-#include <bvgl/bvgl_point_3d_cmp.h>
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_vector_3d.h>
-#include <vbl/vbl_array_3d.h>
-#include <vpgl/vpgl_lvcs.h>
-#include <boct/boct_tree.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <cassert>
-
-class boxm_scene_parser;
-template <class T> class boxm_block_iterator;
-template <class T> class boxm_cell_iterator;
-
-template <class T>
-class boxm_scene :public boxm_scene_base
-{
- public:
- typedef typename T::loc_type loc_type;
- typedef typename T::datatype datatype;
-
- //: Default constructor
- boxm_scene() : active_block_(vgl_point_3d<int>(-1,-1,-1)), save_internal_nodes_(false), save_platform_independent_(true) {}
-
- //: Constructor from lvcs, world origin, dimension of the block (in world coordinates) and number of blocks(world_dim)
- boxm_scene(const vpgl_lvcs& lvcs,
- const vgl_point_3d<double>& origin,
- const vgl_vector_3d<double>& block_dim,
- const vgl_vector_3d<unsigned>& world_dim,
- const bool load_all_blocks=false,
- const bool save_internal_nodes_ = false,
- const bool save_platform_independent_ = true);
-
- //: Constructor from lvcs, world origin, dimension of the block, number of blocks and initialization level
- boxm_scene(const vpgl_lvcs& lvcs,
- const vgl_point_3d<double>& origin,
- const vgl_vector_3d<double>& block_dim,
- const vgl_vector_3d<unsigned>& world_dim,
- unsigned max_level, unsigned init_level,
- const bool load_all_blocks=false,
- const bool save_internal_nodes_ = false,
- const bool save_platform_independent_ = true);
-
- //: Constructor when lvcs is not available. World origin, block dimensions and number of blocks
- boxm_scene( const vgl_point_3d<double>& origin,
- const vgl_vector_3d<double>& block_dim,
- const vgl_vector_3d<unsigned>& world_dim,
- const bool load_all_blocks=false,
- const bool save_internal_nodes_ = false,
- const bool save_platform_independent_ = true);
-
- //: Copy constructor
- boxm_scene(const boxm_scene& scene);
-
- //: Constructor from base_scene
- boxm_scene(const boxm_scene_base& scene_base):
- boxm_scene_base(scene_base),active_block_(vgl_point_3d<int>(-1,-1,-1)), save_internal_nodes_(false), save_platform_independent_(true) {}
-
- //: Destructor
- ~boxm_scene() override;
-
- bool discover_block(vgl_point_3d<unsigned> index) { return discover_block(index.x(),index.y(),index.z()); }
-
- bool discover_block(unsigned i, unsigned j, unsigned k);
-
- //: Loads block into memory.
- // Returns true if the block bin file is found on disc, otherwise returns false and creates a new tree for the block
- bool load_block(unsigned i, unsigned j, unsigned k);
-
- // Load block into memory without using global variables
- bool load_block_thread_safe(unsigned i, unsigned j, unsigned k);
-
- //: Loads block into memory.
- bool load_block(vgl_point_3d<int> i) { return load_block(i.x(), i.y(), i.z()); }
-
- //: Loads a block and all its neighboring(adjacent) blocks
- bool load_block_and_neighbors(unsigned i, unsigned j, unsigned k);
-
- //: Loads a block and all its neighboring(adjacent) blocks
- bool load_block_and_neighbors(vgl_point_3d<int> i) { return load_block_and_neighbors(i.x(), i.y(), i.z()); }
-
- //: Reads and loads all blocks into memorty
- bool read_all_blocks();
-
- //: Write the active block to disk
- void write_active_block(bool unload_block=true);
-
- //: Write the active block to disk
- void write_active_block(bool unload_block=false) const;
-
- //: Write the active blocks to disk
- void write_active_blocks(bool unload_block=true);
-
- //: Write the active blocks to disk
- void write_active_blocks(bool unload_block=false) const;
-
- //: Write the specified block to disk without changing global variables
- void write_block_thread_safe(unsigned i, unsigned j, unsigned k);
-
- //: Returns the active block(in memory)
- boxm_block<T>* get_active_block();
-
- //: Returns the index of active block
- vgl_point_3d<int> active_block() const { return active_block_; }
-
- //: Returns the indices of active neighbors;
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> >& active_blocks() { return active_blocks_; }
-
- vpgl_lvcs lvcs() const { return lvcs_; }
-
- vgl_point_3d<double> origin() const { return origin_; }
-
- void set_origin(vgl_point_3d<double> o) { origin_=o; }
-
- vgl_vector_3d<double> block_dim() const { return block_dim_; }
-
- bool save_internal_nodes() const { return save_internal_nodes_; }
-
- bool save_platform_independent() const { return save_platform_independent_; }
-
- bool load_all_blocks() const { return load_all_blocks_; }
-
- void block_num(int &x, int &y, int &z) const {
- x=(int) blocks_.get_row1_count();
- y=(int) blocks_.get_row2_count();
- z=(int) blocks_.get_row3_count();
- }
-
- vgl_vector_3d<unsigned> world_dim() const override {
- unsigned x=(unsigned) blocks_.get_row1_count();
- unsigned y=(unsigned) blocks_.get_row2_count();
- unsigned z=(unsigned) blocks_.get_row3_count();
- return {x,y,z};
- }
-
- std::string path() const { return scene_path_; }
-
- std::string block_prefix() const { return block_pref_; }
-
- void set_path(std::string path, std::string block_prefix) { scene_path_=path; block_pref_= block_prefix; }
-
- void b_read(vsl_b_istream & s);
-
- void b_write(vsl_b_ostream& s) const;
-
- //: Returns the block this point resides in
- boxm_block<T>* get_block(vgl_point_3d<double> const& p) const;
-
- //: Returns the index of the block containing this point
- bool get_block_index(vgl_point_3d<double> const& p, vgl_point_3d<int>& index);
-
- //: Returns a block, assumes block is in memory - if not it returns null
- boxm_block<T>* get_block(unsigned i, unsigned j, unsigned k) const { return blocks_(i,j,k); }
-
- //: Returns a block, assumes block is in memory - if not it returns null
- boxm_block<T>* get_block(const vgl_point_3d<int>& idx) { return blocks_(idx.x(), idx.y(), idx.z()); }
-
- //: Returns a read-only block, assumes block is in memory - if not it returns null
- const boxm_block<T>* get_block_read_only(unsigned i, unsigned j, unsigned k) { return blocks_(i,j,k); }
-
- //: Return all leaf cells in a region
- void leaves_in_region(vgl_box_3d<double>, std::vector<boct_tree_cell<loc_type, datatype>* >& cells);
-
- //: Return the level of the smallest cell entirely containing the 3d region
- short level_region(vgl_box_3d<double> box);
-
- //: Return all leaf_data in a region - data is copied to new memory location
- void leaves_data_in_region(vgl_box_3d<double> box, std::vector<boct_cell_data<loc_type, datatype> > &cell_data);
-
- //: Returns the data of all cells at a given level, that are contained in the specified region
- void cell_data_in_region(vgl_box_3d<double> box, std::vector<boct_cell_data<loc_type, datatype> > &cell_data, unsigned level);
-
- //: Return all leaf cells between an inner box and an outter box
- void leaves_in_hollow_region(vgl_box_3d<double> outer_box, vgl_box_3d<double> inner_box, std::vector<boct_tree_cell<loc_type, datatype>* >& cells);
-
- //: Locates and modifies the value of all cells within a 3d region, which coordinates are given in scene coordinates
- void change_leaves_in_region(vgl_box_3d<double> box, const datatype &cell_data);
- void change_leaves_in_regions(std::vector<vgl_box_3d<double> > boxes, const std::vector<datatype> &all_data);
-
- //: Locate point in scene coordinates. Assumes that the block containing the point is already loaded into memory
- boct_tree_cell<loc_type, datatype>* locate_point_in_memory(vgl_point_3d<double> &p, unsigned level = 0);
-
- void set_block(vgl_point_3d<int> const& idx, boxm_block<T>* block)
- {
- if (blocks_(idx.x(),idx.y(),idx.z())) // release memory
- delete blocks_(idx.x(),idx.y(),idx.z());
-
- blocks_(idx.x(),idx.y(),idx.z()) = block; active_block_=idx;
- }
-
- void set_block(int i, int j, int k , boxm_block<T>* block) { set_block(vgl_point_3d<int>(i,j,k), block); }
-
- //: Write scene xml file at the scenes' path
- void write_scene(std::string filename = "scene.xml");
-
- //: Write scene xml file at the location indicated by path
- void write_scene(std::string path, std::string filename);
-
- void load_scene(std::string filename);
-
- void load_scene(boxm_scene_parser& parser);
-
- void force_write_blocks();
-
- static short version_no() { return 1; }
-
- boxm_block_iterator<T> iterator() { return boxm_block_iterator<T>(this); }
-
- boxm_block_iterator<T> const_iterator() const { return boxm_block_iterator<T>(this); }
-
- boxm_cell_iterator<T> cell_iterator(bool (boxm_scene<T>::*block_loading_func)(unsigned,unsigned, unsigned), bool read_only = false)
- {
- boxm_cell_iterator<T> cell_iter(this->iterator(), block_loading_func, read_only);
- return cell_iter;
- }
-
- boxm_cell_iterator<T> cell_iterator(bool (boxm_scene<T>::*block_loading_func)(unsigned,unsigned, unsigned) const, bool read_only)
- {
- assert (read_only);
- boxm_cell_iterator<T> cell_iter(this->const_iterator(), block_loading_func, read_only);
- return cell_iter;
- }
-
- vgl_box_3d<double> get_world_bbox() const override;
-
- //: Return the dimensions of the scene along each axis - this are equivalent to bbox width, length and depth
- void axes_length(double &x_length,double &y_length, double &z_length) const;
-
- //: Return true if the block index is valid
- bool valid_index(vgl_point_3d<int> const& idx) const { return valid_index(idx.x(), idx.y(), idx.z()); }
-
-
- //: Return true if the block index is valid
- inline bool valid_index(int const& x, int const& y, int const& z) const {
- return x >= (int)0 && x < (int)blocks_.get_row1_count() &&
- y >= (int)0 && y < (int)blocks_.get_row2_count() &&
- z >= (int)0 && z < (int)blocks_.get_row3_count();
- }
-
- void set_pinit(float pinit) { pinit_=pinit; }
-
- float pinit() const { return pinit_; }
-
- vgl_box_3d<double> get_block_bbox(vgl_point_3d<int> const& idx) const { return get_block_bbox(idx.x(), idx.y(), idx.z()); }
-
- vgl_box_3d<double> get_block_bbox(int x, int y, int z) const;
-
- //: generates a name for the block binary file based on the 3D vector index
- std::string gen_block_path(int x, int y, int z) const;
-
- void clean_scene();
-
- //: Returns a scene with the same structure and initialized with given value
- void clone_blocks(boxm_scene<T> &scene_out, datatype data);
-
- //: Returns a scene with the same structure and data
- void clone_blocks(boxm_scene<T> &scene_out);
-
- //: Returns a scene of a different type with the same structure and initialized with given value
- template <class T_out>
- void clone_blocks_to_type(boxm_scene<T_out> &scene_out, typename boxm_scene<T_out>::datatype data )
- {
- std::cout << "Clone blocks to type\n";
- boxm_block_iterator<T> iter(this);
- boxm_block_iterator<T_out> iter_out = scene_out.iterator();
- iter.begin();
- iter_out.begin();
- while (!iter.end())
- {
- load_block(iter.index());
- scene_out.load_block(iter.index());
- T_out *tree_out =(*iter)->get_tree()->template clone_to_type<typename boxm_scene<T_out>::datatype>();
- (*iter_out)->init_tree(tree_out);
- tree_out->init_cells(data);
- scene_out.write_active_block();
- ++iter;
- ++iter_out;
- }
- }
-
- //: Returns a scene of a vector type with the same structure and vector initialized to the the same data
- template <unsigned DIM>
- void clone_blocks_to_vector(boxm_scene<boct_tree<short, vnl_vector_fixed<datatype, DIM> > > &scene_out)
- {
- typedef boct_tree<short, vnl_vector_fixed<datatype, DIM> > type_tree_out;
- std::cout << "Clone blocks to type\n";
- boxm_block_iterator<T> iter(this);
- boxm_block_iterator<type_tree_out> iter_out = scene_out.iterator();
- iter.begin();
- iter_out.begin();
- while (!iter.end())
- {
- load_block(iter.index());
- scene_out.load_block(iter.index());
- type_tree_out *tree_out =(*iter)->get_tree()->template clone_to_vector<DIM>();
- (*iter_out)->init_tree(tree_out);
- scene_out.write_active_block();
- ++iter;
- ++iter_out;
- }
- }
-
- //: Unload active blocks
- void unload_active_blocks() const;
-
- //: Print out the trees in the scene
- void print();
-
- //: Return the finest level in the scene
- short finest_level();
-
- //: Return the length of finest-level cell in the scene
- double finest_cell_length();
-
- //: Return the length of cells at a given level in the scene
- double cell_length(unsigned level);
-
- //: Return the length of finest-level cell in the scene. Iterates through blocks assuming they are all in memory
- double finest_cell_length_in_memory() const;
-
- //: Return the finest level in the scene. Iterates through blocks assuming they are all in memory
- short finest_level_in_memory() const;
-
- //: Return the number of leaf nodes in the scene
- unsigned long size();
-
- vgl_point_3d<double> rpc_origin() const { return rpc_origin_; }
-
- void set_rpc_origin(vgl_point_3d<double>& new_rpc_origin) {
- vgl_point_3d<double> old_origin = origin();
- vgl_point_3d<double> new_origin(
- old_origin.x() + new_rpc_origin.x() - rpc_origin_.x(),
- old_origin.y() + new_rpc_origin.y() - rpc_origin_.y(),
- old_origin.z() + new_rpc_origin.z() - rpc_origin_.z());
- set_origin(new_origin);
- rpc_origin_ = new_rpc_origin;
- }
-
- protected:
- vpgl_lvcs lvcs_;
- vgl_point_3d<double> origin_;
- vgl_point_3d<double> rpc_origin_;
-
- //: World dimensions of a block .e.g 1 meter x 1 meter x 1 meter
- vgl_vector_3d<double> block_dim_;
-
- vbl_array_3d<boxm_block<T>*> blocks_;
-
- //: index of the blocks (3D array) that is active; only one active block at a time
- mutable vgl_point_3d<int> active_block_;
-
- //: if neighbors of the active block are loaded into memory, their indices are stored in this set
- mutable std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> > active_blocks_;
-
- float pinit_;
-
- //: Flag that indicates whether internal nodes of the trees should be saved
- bool save_internal_nodes_;
-
- //: Flag that indicates whether the octree data should be saved in a platform-independent way (slower)
- bool save_platform_independent_;
-
- //: Flag to load all the blocks in the memory
- bool load_all_blocks_;
-
- // ************** private methods *******************
-
- void create_block(unsigned i, unsigned j, unsigned k);
-
- void create_blocks(const vgl_vector_3d<double>& block_dim, const vgl_vector_3d<unsigned>& world_dim);
- bool parse_config(boxm_scene_parser& parser);
-
- bool parse_xml_string(std::string xml, boxm_scene_parser& parser);
-
- //: Load all blocks in between min-max indices. This method is private and the user needs to take care of unloading the blocks
- bool load_blocks(vgl_point_3d<int> min_idx, vgl_point_3d<int> max_idx);
-
- //: Unload all blocks in between min-max indices.
- bool unload_blocks(vgl_point_3d<int> min_idx, vgl_point_3d<int> max_idx);
-
-
- //: A helper function to generate the indices of neighboring blocks
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> > neighboring_blocks(vgl_point_3d<int> idx)
- {
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> > neighbors;
- for (int i = -1; i <= 1; i++)
- {
- int active_i = idx.x() + i;
- if (active_i >= 0 && active_i < int(blocks_.get_row1_count()))
- for (int j = -1; j <= 1; j++)
- {
- int active_j = idx.y() + j;
- if (active_j >= 0 && active_j < int(blocks_.get_row2_count()) )
- for (int k = -1; k <= 1; k++)
- {
- int active_k = idx.z() + k;
- if (active_k >= 0 && active_k < int(blocks_.get_row3_count()))
- neighbors.insert(vgl_point_3d<int>(active_i, active_j, active_k));
- }
- }
- }
- return neighbors;
- }
-};
-
-template <class T>
-class boxm_block_iterator
-{
- friend class boxm_cell_iterator<T>;
-
- public:
- boxm_block_iterator(boxm_scene<T> const* scene): i_(0), j_(0), k_(0), scene_(scene) {}
-
- //: Copy constructor
- boxm_block_iterator(boxm_block_iterator<T> const& other): i_(other.i_), j_(other.j_), k_(other.k_), scene_(other.scene_) {}
-
- ~boxm_block_iterator() = default;
-
- boxm_block_iterator<T>& begin();
-
- bool end();
-
- boxm_block_iterator<T>& operator=(const boxm_block_iterator<T>& that);
-
- bool operator==(const boxm_block_iterator<T>& that);
-
- bool operator!=(const boxm_block_iterator<T>& that);
-
- boxm_block_iterator<T>& operator++(); // pre-inc
-
- boxm_block_iterator<T> operator++(int); // post-inc
-
- boxm_block_iterator<T>& operator--();
-
- boxm_block<T>* operator*();
-
- boxm_block<T>* operator->();
-
- vgl_point_3d<int> index() const { return vgl_point_3d<int>(i_,j_,k_); }
-
- private:
- int i_;
- int j_;
- int k_;
-
- boxm_scene<T> const* scene_;
-};
-
-
-//: A class to iterate through all -or only leaf- cells in a boxm_scene
-template <class T>
-class boxm_cell_iterator
-{
- public:
- typedef bool (boxm_scene<T>::*ptr2func)(unsigned, unsigned, unsigned);
- typedef bool (boxm_scene<T>::*ptr2constfunc)(unsigned, unsigned, unsigned) const;
- typedef typename T::loc_type loc_type;
- typedef typename T::datatype datatype;
-
- //: Copy constructor
- boxm_cell_iterator(boxm_cell_iterator<T> const& other)
- : block_iterator_(other.block_iterator_), cells_(other.cells_),
- block_loading_func_(other.block_loading_func_), read_only_(other.read_only_) {}
-
- //: Constructor from a block iterator and function pointer to loading mechanism i.e load_block() or load_block_and_neighbors()
- boxm_cell_iterator(boxm_block_iterator<T> iter, ptr2func block_loading_func, bool read_only = false, bool use_internal_cells = false)
- : block_iterator_(iter), block_loading_func_((ptr2constfunc)block_loading_func), read_only_(read_only), use_internal_cells_(use_internal_cells) {}
-
- //: "Const" constructor from a block iterator and function pointer to loading mechanism i.e load_block() or load_block_and_neighbors()
- boxm_cell_iterator(boxm_block_iterator<T> iter, ptr2constfunc block_loading_func, bool read_only, bool use_internal_cells = false)
- : block_iterator_(iter), block_loading_func_(block_loading_func), read_only_(read_only), use_internal_cells_(use_internal_cells) { assert(read_only); }
-
- //: Destructor
- ~boxm_cell_iterator() = default;
-
- //: Iterator begin
- boxm_cell_iterator<T>& begin(bool use_internal_cells=false);
-
- //: Iterator end
- bool end();
-
- /*************** Operators ****************/
-
- boxm_cell_iterator<T>& operator=( const boxm_cell_iterator<T>& that);
-
- bool operator==(const boxm_cell_iterator<T>& that);
-
- bool operator!=(const boxm_cell_iterator<T>& that);
-
- //: Prefix increment. When the end of the block is reached, it writes the block to disk and loads the next one
- boxm_cell_iterator<T>& operator++();
-
- //: Increment. When the end of the block is reached, it writes the block to disk and loads the next one
- boxm_cell_iterator<T> operator+=(unsigned const &rhs);
-
- boct_tree_cell<loc_type, datatype>* operator*();
-
- boct_tree_cell<loc_type, datatype>* operator->();
-
- /*************** Data accessor *************/
- //: Return the global origin of the current cell
- vgl_point_3d<double> global_origin();
-
- //: Return the global centroid of the current cell - use only if cells are cubical
- vgl_point_3d<double> global_centroid();
-
- //: Return the global length of this cell
- double length();
-
- private:
-
- boxm_block_iterator<T> block_iterator_;
- std::vector<boct_tree_cell<loc_type ,datatype >* > cells_;
- typename std::vector< boct_tree_cell<loc_type , datatype >* >::const_iterator cells_iterator_;
- ptr2constfunc block_loading_func_;
- bool read_only_;
- bool use_internal_cells_;
-};
-
-
-//: generates an XML file from the member variables
-template <class T>
-void x_write(std::ostream &os, boxm_scene<T>& scene, std::string name="boxm_scene");
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_scene<T> const &scene);
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_scene<T> const * &scene);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_scene<T> &scene);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_scene<T> *&scene);
-
-
-#endif // boxm_scene_h_
diff --git a/contrib/brl/bseg/boxm/boxm_scene.hxx b/contrib/brl/bseg/boxm/boxm_scene.hxx
deleted file mode 100644
index b398bcc2ad..0000000000
--- a/contrib/brl/bseg/boxm/boxm_scene.hxx
+++ /dev/null
@@ -1,1764 +0,0 @@
-#ifndef boxm_scene_hxx_
-#define boxm_scene_hxx_
-//:
-// \file
-#include <cmath>
-#include <cstdio>
-#include <sstream>
-#include <iostream>
-#include <algorithm>
-#include <iterator>
-#include "boxm_scene.h"
-//
-#include "boxm_apm_traits.h"
-#include "boxm_scene_parser.h"
-
-#include <vgl/xio/vgl_xio_point_3d.h>
-#include <vgl/xio/vgl_xio_vector_3d.h>
-#include <vgl/vgl_intersection.h>
-#include <vsl/vsl_basic_xml_element.h>
-#include <vsl/vsl_binary_io.h>
-#include <vpgl/vpgl_lvcs.h>
-#include <vpgl/xio/vpgl_xio_lvcs.h>
-
-#include <vpl/vpl.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <cassert>
-
-template <class T>
-boxm_scene<T>::boxm_scene(const vpgl_lvcs& lvcs,
- const vgl_point_3d<double>& origin,
- const vgl_vector_3d<double>& block_dim,
- const vgl_vector_3d<unsigned>& world_dim,
- const bool load_all_blocks,
- const bool save_internal_nodes,
- const bool save_platform_independent)
-: lvcs_(lvcs),
- origin_(origin),
- block_dim_(block_dim),
- active_block_(vgl_point_3d<int>(-1,-1,-1)),
- save_internal_nodes_(save_internal_nodes),
- save_platform_independent_(save_platform_independent),
- load_all_blocks_(load_all_blocks)
-{
- create_blocks(block_dim, world_dim);
-}
-
-template <class T>
-boxm_scene<T>::boxm_scene( const vgl_point_3d<double>& origin,
- const vgl_vector_3d<double>& block_dim,
- const vgl_vector_3d<unsigned>& world_dim,
- const bool load_all_blocks,
- const bool save_internal_nodes,
- const bool save_platform_independent)
-: origin_(origin),
- block_dim_(block_dim),
- active_block_(vgl_point_3d<int>(-1,-1,-1)),
- save_internal_nodes_(save_internal_nodes),
- save_platform_independent_(save_platform_independent),
- load_all_blocks_(load_all_blocks)
-{
- create_blocks(block_dim, world_dim);
-}
-
-template <class T>
-boxm_scene<T>::boxm_scene(const boxm_scene& scene)
-: boxm_scene_base(scene),
- lvcs_(scene.lvcs()),
- origin_(scene.origin()),
- block_dim_(scene.block_dim()),
- active_block_(vgl_point_3d<int>(-1,-1,-1)),
- save_internal_nodes_(scene.save_internal_nodes()),
- save_platform_independent_(scene.save_platform_independent()),
- load_all_blocks_(scene.load_all_blocks())
-{
- int x,y,z;
- scene.block_num(x,y,z);
- create_blocks(block_dim_, vgl_vector_3d<unsigned>(x,y,z));
-}
-
-
-template <class T>
-void boxm_scene<T>::create_blocks(const vgl_vector_3d<double>& /*block_dim*/,
- const vgl_vector_3d<unsigned>& world_dim)
-{
- // compute the dimensions of 3D array
- unsigned x_dim = world_dim.x(); // = static_cast<int>(std::floor(world_dim.x()/block_dim.x()));
- unsigned y_dim = world_dim.y(); // = static_cast<int>(std::floor(world_dim.y()/block_dim.y()));
- unsigned z_dim = world_dim.z(); // = static_cast<int>(std::floor(world_dim.z()/block_dim.z()));
-
- // pointers are initialized to NULL
- blocks_ = vbl_array_3d<boxm_block<T>*>(x_dim, y_dim, z_dim, (boxm_block<T>*)nullptr);
- for (unsigned i=0; i<x_dim; ++i) {
- for (unsigned j=0; j<y_dim; ++j) {
- for (unsigned k=0; k<z_dim; ++k) {
- create_block(i,j,k);
- }
- }
- }
-}
-
-template <class T>
-boxm_scene<T>::boxm_scene(const vpgl_lvcs& lvcs,
- const vgl_point_3d<double>& origin,
- const vgl_vector_3d<double>& block_dim,
- const vgl_vector_3d<unsigned>& world_dim,
- unsigned max_level, unsigned init_level,
- const bool load_all_blocks,
- const bool save_internal_nodes,
- const bool save_platform_independent)
-: lvcs_(lvcs),
-origin_(origin),
-block_dim_(block_dim),
-active_block_(vgl_point_3d<int>(-1,-1,-1)),
-save_internal_nodes_(save_internal_nodes),
-save_platform_independent_(save_platform_independent),
-load_all_blocks_(load_all_blocks)
-{
- create_blocks(block_dim, world_dim);
- set_octree_levels(max_level, init_level);
-}
-
-template <class T>
-void boxm_scene<T>::create_block(unsigned i, unsigned j, unsigned k)
-{
- if (blocks_(i,j,k) == NULL) {
- vgl_box_3d<double> bbox = get_block_bbox(i,j,k);
- blocks_(i,j,k) = new boxm_block<T>(bbox);
- }
-}
-
-template <class T>
-boxm_scene<T>::~boxm_scene()
-{
- // delete the blocks
- int x_dim, y_dim, z_dim;
- block_num(x_dim, y_dim, z_dim);
- for (int i=0; i<x_dim; i++) {
- for (int j=0; j<y_dim; j++) {
- for (int k=0; k<z_dim; k++) {
- if (blocks_(i,j,k))
- delete blocks_(i,j,k);
- }
- }
- }
-}
-
-//: Returns a scene with the same structure and initialized with given value
-template<class T>
-void boxm_scene<T>::clone_blocks(boxm_scene<T> &scene_out, datatype data)
-{
- boxm_block_iterator<T> iter(this);
- boxm_block_iterator<T> iter_out = scene_out.iterator();
- iter.begin();
- iter_out.begin();
- while (!iter.end())
- {
- load_block(iter.index());
- scene_out.load_block(iter_out.index());
- T *tree_out = (*iter)->get_tree()->clone_all();
- tree_out->init_cells(data);
- (*iter_out)->init_tree(tree_out);
- scene_out.write_active_block();
- ++iter;
- ++iter_out;
- }
-}
-
-//: Returns a scene with the same structure and data
-template<class T>
-void boxm_scene<T>::clone_blocks(boxm_scene<T> &scene_out)
-{
- boxm_block_iterator<T> iter(this);
- boxm_block_iterator<T> iter_out = scene_out.iterator();
- iter.begin();
- iter_out.begin();
- while (!iter.end())
- {
- load_block(iter.index());
- T *tree_out = (*iter)->get_tree()->clone_all();
- (*iter_out)->init_tree(tree_out);
- scene_out.write_active_block();
- ++iter;
- ++iter_out;
- }
-}
-
-template <class T>
-void boxm_scene<T>::write_active_block(bool unload_block)
-{
- if (valid_index(active_block_)&& (!load_all_blocks_))
- {
- int x=active_block_.x(), y=active_block_.y(), z=active_block_.z();
- std::string path = gen_block_path(x,y,z);
- vsl_b_ofstream os(path);
-#ifdef DEBUG
- std::cout << "block path: " << path << '\n'
- << "Load All blocks " << load_all_blocks_ << '\n'
- << "Internal Nodes 2: " << save_internal_nodes_ << " save_platform_independent_ " << save_platform_independent_ << std::endl;
-#endif
- blocks_(x,y,z)->b_write(os, save_internal_nodes_, save_platform_independent_);
-
- // delete the block's data
- if (unload_block)
- {
- boxm_block<T>* block = blocks_(x,y,z);
- block->delete_tree();
- block->set_tree(nullptr);
- active_block_.set(-1,-1,-1);
- }
- os.close();
- }
-}
-
-template <class T>
-void boxm_scene<T>::write_active_block(bool unload_block) const
-{
- assert(!unload_block); // use the "non-const" method ::write_active_block if you want to delete the block's data
-
- if (valid_index(active_block_)&& (!load_all_blocks_))
- {
- int x=active_block_.x(), y=active_block_.y(), z=active_block_.z();
- std::string path = gen_block_path(x,y,z);
- vsl_b_ofstream os(path);
-#ifdef DEBUG
- std::cout << "block path: " << path << '\n'
- << "Load All blocks " << load_all_blocks_ << '\n'
- << "Internal Nodes 2: " << save_internal_nodes_ << " save_platform_independent_ " << save_platform_independent_ << std::endl;
-#endif
- blocks_(x,y,z)->b_write(os, save_internal_nodes_, save_platform_independent_);
- os.close();
- }
-}
-
-
-template <class T>
-void boxm_scene<T>::write_active_blocks(bool unload_block)
-{
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> >::iterator it = active_blocks_.begin();
- for (; it!=active_blocks_.end(); it++)
- {
- vgl_point_3d<int> bidx = *it;
- if (valid_index(bidx)&& (!load_all_blocks_))
- {
- int x=bidx.x(), y=bidx.y(), z=bidx.z();
- std::string path = gen_block_path(x,y,z);
- vsl_b_ofstream os(path);
- #ifdef DEBUG
- std::cout<<"Load All blocks "<<load_all_blocks_<<'\n'
- <<"Internal Nodes 2: " << save_internal_nodes_ << " save_platform_independent_ " << save_platform_independent_ << std::endl;
- #endif
- blocks_(x,y,z)->b_write(os, save_internal_nodes_, save_platform_independent_);
-
- // delete the block's data
- if (unload_block)
- {
- boxm_block<T>* block = blocks_(x,y,z);
- block->delete_tree();
- block->set_tree(nullptr);
- active_block_.set(-1,-1,-1);
- }
- os.close();
- }
- }
-}
-
-template <class T>
-void boxm_scene<T>::write_active_blocks(bool unload_block) const
-{
- assert(!unload_block); // use the "non-const" method ::write_active_blocks if you want to delete the block's data
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> >::iterator it = active_blocks_.begin();
- for (; it!=active_blocks_.end(); it++)
- {
- vgl_point_3d<int> bidx = *it;
- if (valid_index(bidx)&& (!load_all_blocks_))
- {
- int x=bidx.x(), y=bidx.y(), z=bidx.z();
- std::string path = gen_block_path(x,y,z);
- vsl_b_ofstream os(path);
- #ifdef DEBUG
- std::cout<<"Load All blocks "<<load_all_blocks_<<'\n'
- <<"Internal Nodes 2: " << save_internal_nodes_ << " save_platform_independent_ " << save_platform_independent_ << std::endl;
- #endif
- blocks_(x,y,z)->b_write(os, save_internal_nodes_, save_platform_independent_);
- os.close();
- }
- }
-}
-
-//: Writes and unloads the specified block. It doesn't modify global variables
-template <class T>
-void boxm_scene<T>::write_block_thread_safe(unsigned i, unsigned j, unsigned k)
-{
- if (valid_index(i,j,k)&& (!load_all_blocks_))
- {
- std::string path = gen_block_path(i,j,k);
- vsl_b_ofstream os(path);
-
- if (blocks_(i,j,k))
- blocks_(i,j,k)->b_write(os, save_internal_nodes_, save_platform_independent_);
-
- // delete the block's data
- boxm_block<T>* block = blocks_(i,j,k);
- block->delete_tree();
- block->set_tree(nullptr);
-
- os.close();
- }
-}
-
-template <class T>
-void boxm_scene<T>::force_write_blocks()
-{
- boxm_block_iterator<T> iter(this);
- iter.begin();
- while (!iter.end())
- {
- int x=iter.index().x(), y=iter.index().y(), z=iter.index().z();
- if (blocks_(x,y,z)->get_tree()!=nullptr)
- {
- std::cout<<" ? ";
- std::string path = gen_block_path(x,y,z);
- vsl_b_ofstream os(path);
- blocks_(x,y,z)->b_write(os, save_internal_nodes_, save_platform_independent_);
- os.close();
- }
- iter++;
- }
-}
-
-//: Returns the block this point resides in
-template <class T>
-boxm_block<T>* boxm_scene<T>::get_block(vgl_point_3d<double> const& p) const
-{
- vgl_box_3d<double> world(get_world_bbox());
- if (world.contains(p)) {
- // find the block index
- unsigned i = static_cast<unsigned>((p.x()-origin_.x())/block_dim_.x());
- unsigned j = static_cast<unsigned>((p.y()-origin_.y())/block_dim_.y());
- unsigned k = static_cast<unsigned>((p.z()-origin_.z())/block_dim_.z());
- return blocks_(i,j,k);
- }
- else {
-#ifdef DEBUG
- std::cerr << "Point " << p << " is out of world " << world << '\n';
-#endif
- return nullptr;
- }
-}
-
-
-//: Returns the index of the block containing this point
-template <class T>
-bool boxm_scene<T>::get_block_index(vgl_point_3d<double> const& p, vgl_point_3d<int>& index)
-{
- vgl_box_3d<double> world(get_world_bbox());
- if (world.contains(p)) {
- // find the block index
- unsigned i = static_cast<unsigned>((p.x()-origin_.x())/block_dim_.x());
- unsigned j = static_cast<unsigned>((p.y()-origin_.y())/block_dim_.y());
- unsigned k = static_cast<unsigned>((p.z()-origin_.z())/block_dim_.z());
- // boundary case
- double tol = 1e-9;
- if (std::abs(p.x()-world.max_x())<tol)
- i-=1;
- if (std::abs(p.y()-world.max_y())<tol)
- j-=1;
- if (std::abs(p.z()-world.max_z())<tol)
- k-=1;
-
- index=vgl_point_3d<int>(i,j,k);
- return true;
- }
- else {
-#ifdef DEBUG
- std::cerr << "Point " << p << " is out of world " << world << '\n';
-#endif
- return false;
- }
-}
-
-template <class T>
-boxm_block<T>* boxm_scene<T>::get_active_block()
-{
- if (valid_index(active_block_)) {
- boxm_block<T>* block = blocks_(active_block_.x(),active_block_.y(),active_block_.z());
- if (block->get_tree() == nullptr)
- load_block(active_block_.x(),active_block_.y(),active_block_.z());
- return block;
- }
- else {
- std::cerr << "index"<<active_block_<<" is out of world\n";
- return nullptr;
- }
-}
-
-template <class T>
-vgl_box_3d<double> boxm_scene<T>::get_world_bbox() const
-{
- vgl_point_3d<double> min_p(origin_.x(), origin_.y(), origin_.z());
- vgl_point_3d<double> max_p(min_p.x()+block_dim_.x()*blocks_.get_row1_count(),
- min_p.y()+block_dim_.y()*blocks_.get_row2_count(),
- min_p.z()+block_dim_.z()*blocks_.get_row3_count());
-
- vgl_box_3d<double> bbox(min_p, max_p);
- return bbox;
-}
-
-template <class T>
-void boxm_scene<T>::axes_length(double &x_length,double &y_length, double &z_length) const
-{
- x_length = block_dim_.x()*blocks_.get_row1_count();
- y_length = block_dim_.y()*blocks_.get_row2_count();
- z_length = block_dim_.z()*blocks_.get_row3_count();
-}
-
-
-template <class T>
-vgl_box_3d<double> boxm_scene<T>::get_block_bbox(int x, int y, int z) const
-{
- vgl_point_3d<double> min_p(block_dim_.x()*x+origin_.x(), block_dim_.y()*y+origin_.y(), block_dim_.z()*z+origin_.z());
- vgl_point_3d<double> max_p(min_p.x()+block_dim_.x(), min_p.y()+block_dim_.y(), min_p.z()+block_dim_.z());
-
- vgl_box_3d<double> bbox(min_p, max_p);
- return bbox;
-}
-
-template <class T>
-std::string boxm_scene<T>::gen_block_path(int x, int y, int z) const
-{
- std::stringstream strm;
-
- strm << scene_path_ << '/' << block_pref_ << '_' << x << '_' << y << '_' << z << ".bin";
-
- return strm.str();
-}
-
-template <class T>
-bool boxm_scene<T>::discover_block(unsigned i, unsigned j, unsigned k)
-{
- if (!valid_index(vgl_point_3d<int>(i,j,k)))
- return false;
- std::string block_path = gen_block_path(i,j,k);
- vsl_b_ifstream os(block_path);
-
- // if the binary block file is not found, return "false"
- return !os == false;
-}
-
-//: returns true if the block bin file is found on disc, false otherwise.
-// If false, a new tree is create for the block
-template <class T>
-bool boxm_scene<T>::load_block(unsigned i, unsigned j, unsigned k)
-{
- if (!valid_index(vgl_point_3d<int>(i,j,k)))
- return false;
-
- if (!load_all_blocks_)
- {
- // this does not save the active block so make sure to save it first
- if (valid_index(active_block_)) {
- if (!(active_block_ == vgl_point_3d<int>(i,j,k)))
- {
- int x=active_block_.x(), y=active_block_.y(), z=active_block_.z();
- boxm_block<T>* block = blocks_(x,y,z);
- block->delete_tree();
- block->set_tree(nullptr);
- }
- }
- }
-
- active_block_.set(i,j,k);
-
- if (blocks_(i,j,k)->get_tree()==nullptr) // read it from file
- {
- std::string block_path = gen_block_path(i,j,k);
- vsl_b_ifstream os(block_path);
-
- // if the binary block file is not found
- if (!os) {
- if (blocks_(i,j,k)->get_tree()==nullptr) {
- T* tree= new T(max_tree_level_,init_tree_level_);
- blocks_(i,j,k)->init_tree(tree);
- }
- return false;
- }
- blocks_(i,j,k)->b_read(os);
- os.close();
- }
-
- return true;
-}
-
-
-//: Load block into memory - this doesn't use global variables so user is responsible for unloading it
-template <class T>
-bool boxm_scene<T>::load_block_thread_safe(unsigned i, unsigned j, unsigned k)
-{
- if (!valid_index(vgl_point_3d<int>(i,j,k)))
- return false;
-
- if (blocks_(i,j,k)->get_tree()==nullptr) // read it from file
- {
- std::string block_path = gen_block_path(i,j,k);
- vsl_b_ifstream os(block_path);
-
- // if the binary block file is not found
- if (!os) {
- if (blocks_(i,j,k)->get_tree()==nullptr) {
- T* tree= new T(max_tree_level_,init_tree_level_);
- blocks_(i,j,k)->init_tree(tree);
- }
- return false;
- }
- blocks_(i,j,k)->b_read(os);
- os.close();
- }
-
- return true;
-}
-
-//: Reads and loads all blocks into memorty
-template <class T>
-bool boxm_scene<T>::read_all_blocks()
-{
- load_all_blocks_ = true;
- this->unload_active_blocks();
-
- for (unsigned block_i = 0; block_i < blocks_.get_row1_count(); block_i++){
- for (unsigned block_j = 0; block_j < blocks_.get_row2_count(); block_j++){
- for (unsigned block_k = 0; block_k < blocks_.get_row3_count(); block_k++){
- if (blocks_(block_i,block_j,block_k)->get_tree()==nullptr) // read it from file
- {
- std::string block_path = gen_block_path(block_i,block_j,block_k);
- vsl_b_ifstream os(block_path);
-
- // if the binary block file is not found
- if (!os) {
- if (blocks_(block_i,block_j,block_k)->get_tree()==nullptr) {
- T* tree= new T(max_tree_level_,init_tree_level_);
- blocks_(block_i,block_j,block_k)->init_tree(tree);
- }
- }
- else
- blocks_(block_i,block_j,block_k)->b_read(os);
-
- active_blocks_.insert(vgl_point_3d<int>(block_i, block_j, block_k));
- os.close();
- }
- }
- }
- }
-
- return true;
-}
-
-template <class T>
-bool boxm_scene<T>::load_block_and_neighbors(unsigned i, unsigned j, unsigned k)
-{
- if (!valid_index(vgl_point_3d<int>(i,j,k)))
- return false;
-
- active_block_.set(i,j,k);
- // Set unused blocks to null and load new blocks
- // this is to avoid rereading blocks that are already in memory
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> > new_active_blocks = neighboring_blocks(vgl_point_3d<int>(i,j,k));
- new_active_blocks.insert(vgl_point_3d<int>(i,j,k));
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> > blocks_to_unload;
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> > blocks_to_load;
- bvgl_point_3d_cmp<int> cmp;
- std::set_difference(active_blocks_.begin(), active_blocks_.end(),
- new_active_blocks.begin(), new_active_blocks.end(),
- std::insert_iterator<std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> > >(blocks_to_unload, blocks_to_unload.begin()),
- cmp);
-
- std::set_difference(new_active_blocks.begin(), new_active_blocks.end(),
- active_blocks_.begin(), active_blocks_.end(),
- std::insert_iterator<std::set<vgl_point_3d<int> , bvgl_point_3d_cmp<int> > > (blocks_to_load, blocks_to_load.begin()),
- cmp);
-
- active_blocks_.clear();
- active_blocks_ = new_active_blocks;
-
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> >::iterator unload_it = blocks_to_unload.begin();
-
- for (; unload_it!=blocks_to_unload.end(); unload_it++)
- {
- boxm_block<T>* block = blocks_((*unload_it).x(),(*unload_it).y(),(*unload_it).z());
- block->delete_tree();
- block->set_tree(nullptr);
- }
-
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> >::iterator load_it = blocks_to_load.begin();
-
- for (; load_it!=blocks_to_load.end(); load_it++)
- {
- int block_i = (*load_it).x();
- int block_j = (*load_it).y();
- int block_k = (*load_it).z();
-
- if (blocks_(block_i,block_j,block_k)->get_tree() == nullptr)// read it from file
- {
- std::string block_path = gen_block_path(block_i,block_j,block_k);
- vsl_b_ifstream os(block_path);
-
- // if the binary block file is not found
- if (!os) {
- if (blocks_(block_i,block_j,block_k)->get_tree()==nullptr) {
- T* tree= new T(max_tree_level_,init_tree_level_);
- blocks_(block_i,block_j,block_k)->init_tree(tree);
- }
- return false;
- }
- blocks_(block_i,block_j,block_k)->b_read(os);
- assert(blocks_(block_i,block_j,block_k)!=NULL);
- assert(blocks_(block_i,block_j,block_k)->get_tree()!=nullptr);
-
- os.close();
- }
- }
-
- return true;
-}
-
-//: Return the finest level in the scene
-template <class T>
-short boxm_scene<T>::finest_level()
-{
- // iterate through the blocks requesting the finest level
- boxm_block_iterator<T > iter=this->const_iterator();
- iter.begin();
- short finest_level = this->max_tree_level_;
- while (!iter.end()) {
- if (this->load_block(iter.index().x(),iter.index().y(),iter.index().z())) {
- short this_level = get_active_block()->get_tree()->finest_level();
- if (this_level < finest_level)
- finest_level = this_level;
- }
- iter++;
- }
-
- return finest_level;
-}
-
-
-//: Return the finest level in the scene. Iterates through blocks assuming they are all in memory
-template <class T>
-short boxm_scene<T>::finest_level_in_memory() const
-{
- if (!load_all_blocks_)
- return -1;
-
- // iterate through the blocks requesting the finest level
- short finest_level = this->max_tree_level_;
- for (unsigned block_i = 0; block_i < blocks_.get_row1_count(); block_i++){
- for (unsigned block_j = 0; block_j < blocks_.get_row2_count(); block_j++){
- for (unsigned block_k = 0; block_k < blocks_.get_row3_count(); block_k++){
- if (blocks_(block_i,block_j,block_k)) {
- short this_level = blocks_(block_i,block_j,block_k)->get_tree()->finest_level();
- if (this_level < finest_level)
- finest_level = this_level;
- }
- }
- }
- }
-
- return finest_level;
-}
-
-//: Return the length of finest-level cell in the scene
-template <class T>
-double boxm_scene<T>::finest_cell_length()
-{
- double local_cell_length = 1.0/(double)(1<<((this->max_tree_level_ -1) - finest_level()));
-
- if ((std::abs(block_dim_.x() - block_dim_.y()) > 1.0e-7) || (std::abs(block_dim_.x() - block_dim_.z()) > 1.0e-7)){
- std::cerr << "Warning: In boxm_scene::finest_cell_length, cells aren't cubical, returning length along x direction\n"
- << block_dim_.x() <<", " << block_dim_.y()<< ", " << block_dim_.x() << '\n';
- }
-
- return local_cell_length * block_dim_.x();
-}
-
-//: Return the length of cells at a given level in the scene
-template <class T>
-double boxm_scene<T>::cell_length(unsigned level)
-{
- double local_cell_length = 1.0/(double)(1<<((this->max_tree_level_ -1) - level));
-
- if ((std::abs(block_dim_.x() - block_dim_.y()) > 1.0e-7) || (std::abs(block_dim_.x() - block_dim_.z()) > 1.0e-7)){
- std::cerr << "Warning: In boxm_scene::finest_cell_length, cells aren't cubical, returning length along x direction\n"
- << block_dim_.x() <<", " << block_dim_.y()<< ", " << block_dim_.x() << '\n';
- }
-
- return local_cell_length * block_dim_.x();
-}
-
-//: Return the length of finest-level cell in the scene. Iterates through blocks assuming they are all in memory
-template <class T>
-double boxm_scene<T>::finest_cell_length_in_memory() const
-{
- double local_cell_length = 1.0/(double)(1<<((this->max_tree_level_ -1) - finest_level_in_memory()));
-
- if ((std::abs(block_dim_.x() - block_dim_.y()) > 1.0e-7) || (std::abs(block_dim_.x() - block_dim_.z()) > 1.0e-7))
- std::cerr << "Warning: In boxm_scene::finest_cell_length, cells aren't cubical, returning length along x direction\n";
-
- return local_cell_length * block_dim_.x();
-}
-
-//: Return the number of leaf nodes in the scene
-template <class T>
-unsigned long boxm_scene<T>::size()
-{
- // iterate through the blocks requesting the finest level
- boxm_block_iterator<T > iter=this->const_iterator();
- iter.begin();
- unsigned long size = 0;
- while (!iter.end()) {
- if (this->load_block(iter.index().x(),iter.index().y(),iter.index().z()))
- {
- size += get_active_block()->get_tree()->size();
- }
-
- iter++;
- }
-
- return size;
-}
-
-template <class T>
-void boxm_scene<T>::b_read(vsl_b_istream & is)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case 1:
- std::string xml="";
- vsl_b_read(is, xml);
- std::cout << xml << std::endl;
- boxm_scene_parser parser;
- parse_xml_string(xml, parser);
- break;
-#if 0
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_scene<T>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- return;
-#endif
- }
-}
-
-template <class T>
-void boxm_scene<T>::b_write(vsl_b_ostream & s) const
-{
- // create an XML stream for the parameters
- std::stringstream strm;
- boxm_scene<T> scene(this->lvcs(), this->origin(), this->block_dim(), this->world_dim());
- x_write(strm, scene, "scene");
- std::string str(strm.str());
-
- short v = boxm_scene<T>::version_no();
- vsl_b_write(s, v);
- // write the XML as char stream
- vsl_b_write(s, str);
-}
-
-template <class T>
-void boxm_scene<T>::write_scene(std::string filename)
-{
- std::string fullpath=scene_path_+ "/" + filename;
- std::ofstream os(fullpath.c_str());
- x_write(os, *this, "boxm_scene");
- this->filename_ = fullpath;
- os.close();
-}
-
-template <class T>
-void boxm_scene<T>::write_scene(std::string path, std::string filename)
-{
- std::string fullpath= path+ "/" + filename;
- std::ofstream os(fullpath.c_str());
- x_write(os, *this, "boxm_scene");
- this->filename_ = fullpath;
- os.close();
-}
-
-template <class T>
-void boxm_scene<T>::load_scene(std::string filename)
-{
- boxm_scene_parser parser;
- boxm_scene_base::load_scene(filename, parser);
- this->filename_ = filename;
- parse_config(parser);
-}
-
-template <class T>
-void boxm_scene<T>::load_scene(boxm_scene_parser& parser)
-{
- parse_config(parser);
-}
-
-template <class T>
-void x_write(std::ostream &os, boxm_scene<T>& scene, std::string name)
-{
- vsl_basic_xml_element scene_elm(name);
- scene_elm.x_write_open(os);
-
- vsl_basic_xml_element app_model(APP_MODEL_TAG);
- app_model.add_attribute("type", boxm_apm_types::app_model_strings[scene.appearence_model()]);
- app_model.x_write(os);
-
- vsl_basic_xml_element bin(MULTI_BIN_TAG);
- bin.add_attribute("value", scene.multi_bin()? 1 : 0);
- bin.x_write(os);
-
- vsl_basic_xml_element save_nodes(SAVE_INTERNAL_NODES_TAG);
- save_nodes.add_attribute("value", scene.save_internal_nodes()? 1 : 0);
- save_nodes.x_write(os);
-
- vsl_basic_xml_element save_platform_independent(SAVE_PLATFORM_INDEPENDENT_TAG);
- save_platform_independent.add_attribute("value", scene.save_platform_independent()? 1 : 0);
- save_platform_independent.x_write(os);
-
- vsl_basic_xml_element load_all_blocks(LOAD_ALL_BLOCKS_TAG);
- load_all_blocks.add_attribute("value", scene.load_all_blocks()? 1 : 0);
- load_all_blocks.x_write(os);
-
- vpgl_lvcs lvcs=scene.lvcs();
- x_write(os, lvcs, LVCS_TAG);
- x_write(os, scene.origin(), LOCAL_ORIGIN_TAG);
- x_write(os, scene.block_dim(), BLOCK_DIMENSIONS_TAG);
-
- vsl_basic_xml_element blocks(BLOCK_NUM_TAG);
- int x_dim, y_dim, z_dim;
- scene.block_num(x_dim, y_dim, z_dim);
- blocks.add_attribute("x_dimension", x_dim);
- blocks.add_attribute("y_dimension", y_dim);
- blocks.add_attribute("z_dimension", z_dim);
- blocks.x_write(os);
-
- vsl_basic_xml_element paths(SCENE_PATHS_TAG);
- paths.add_attribute("path", scene.path());
- paths.add_attribute("block_prefix", scene.block_prefix());
- paths.x_write(os);
-
- vsl_basic_xml_element tree(OCTREE_LEVELS_TAG);
- tree.add_attribute("max", (int) scene.max_level());
- tree.add_attribute("init", (int) scene.init_level());
- tree.x_write(os);
-
- scene_elm.x_write_close(os);
-}
-
-template <class T>
-bool boxm_scene<T>::parse_config(boxm_scene_parser& parser)
-{
- vpgl_lvcs lvcs;
- parser.lvcs(lvcs);
- vgl_vector_3d<unsigned> dims = parser.block_nums();
-
- lvcs_ = lvcs;
- origin_ = parser.origin();
- block_dim_ = parser.block_dim();
- create_blocks(block_dim_, dims);
-
- parser.paths(scene_path_, block_pref_);
- app_model_ = boxm_apm_types::str_to_enum(parser.app_model().data());
- multi_bin_ = parser.multi_bin();
- save_internal_nodes_ =parser.save_internal_nodes();
- save_platform_independent_ = parser.save_platform_independent();
- load_all_blocks_ = parser.load_all_blocks();
- pinit_=parser.p_init();
-#if 0
- std::cout << "Internal Nodes 1: " << save_internal_nodes_ << std::endl;
-#endif
- parser.levels(max_tree_level_, init_tree_level_);
- return true;
-}
-
-template <class T>
-bool boxm_scene<T>::parse_xml_string(std::string xml, boxm_scene_parser& parser)
-{
- if (xml.size() == 0) {
- std::cerr << "XML string is empty\n";
- return false;
- }
- if (!parser.parseString(xml.data())) {
- std::cerr << XML_ErrorString(parser.XML_GetErrorCode()) << " at line "
- << parser.XML_GetCurrentLineNumber() << '\n';
-
- return false;
- }
-
- vpgl_lvcs lvcs;
- parser.lvcs(lvcs);
- vgl_vector_3d<unsigned> nums = parser.block_nums();
-
- lvcs_ = lvcs;
- origin_ = parser.origin();
- block_dim_ = parser.block_dim();
- create_blocks(block_dim_, nums);
-
- parser.paths(scene_path_, block_pref_);
- app_model_ = boxm_apm_types::str_to_enum(parser.app_model().data());
- multi_bin_ = parser.multi_bin();
- pinit_=parser.p_init();
- load_all_blocks_ = parser.load_all_blocks();
-
- return true;
-}
-
-template <class T>
-void boxm_scene<T>::clean_scene()
-{
- boxm_block_iterator<T > iter=this->iterator();
- iter.begin();
- while (!iter.end()) {
- if (this->discover_block(iter.index().x(),iter.index().y(),iter.index().z())) {
- std::string filename=this->gen_block_path(iter.index().x(),iter.index().y(),iter.index().z());
- vpl_unlink(filename.c_str());
- }
- iter++;
- }
-}
-
-template <class T>
-void boxm_scene<T>::print()
-{
- boxm_block_iterator<T > iter=this->const_iterator();
- iter.begin();
- while (!iter.end()) {
- if (this->load_block(iter.index().x(),iter.index().y(),iter.index().z())) {
- std::cout << "Printing Block : " << iter.index() << std::endl;
- get_active_block()->get_tree()->print();
- }
- ++iter;
- }
-}
-
-//: Load all blocks in between min-max indices.
-template <class T>
-bool boxm_scene<T>::load_blocks(vgl_point_3d<int> min_idx, vgl_point_3d<int> max_idx)
-{
- if (!valid_index(min_idx) || !valid_index(max_idx))
- return false;
-
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> > new_active_blocks;
-
- for (int i = min_idx.x(); i <= max_idx.x(); i++)
- for (int j = min_idx.y(); j <= max_idx.y(); j++)
- for (int k = min_idx.z(); k <= max_idx.z(); k++)
- new_active_blocks.insert(vgl_point_3d<int>(i,j,k));
-
- // Set unused blocks to null and load new blocks
- // this is to avoid rereading blocks that are already in memory
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> > blocks_to_unload;
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> > blocks_to_load;
- bvgl_point_3d_cmp<int> cmp;
- std::set_difference(active_blocks_.begin(), active_blocks_.end(),
- new_active_blocks.begin(), new_active_blocks.end(),
- std::insert_iterator<std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> > >(blocks_to_unload, blocks_to_unload.begin()),
- cmp);
-
- std::set_difference(new_active_blocks.begin(), new_active_blocks.end(),
- active_blocks_.begin(), active_blocks_.end(),
- std::insert_iterator<std::set<vgl_point_3d<int> , bvgl_point_3d_cmp<int> > > (blocks_to_load, blocks_to_load.begin()),
- cmp);
-
- active_blocks_.clear();
- active_blocks_ = new_active_blocks;
-
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> >::iterator unload_it = blocks_to_unload.begin();
-
- for (; unload_it!=blocks_to_unload.end(); unload_it++)
- {
- boxm_block<T>* block = blocks_((*unload_it).x(),(*unload_it).y(),(*unload_it).z());
- block->delete_tree();
- block->set_tree(nullptr);
- }
-
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> >::iterator load_it = blocks_to_load.begin();
-
- for (; load_it!=blocks_to_load.end(); load_it++)
- {
- int block_i = (*load_it).x();
- int block_j = (*load_it).y();
- int block_k = (*load_it).z();
-
- if (blocks_(block_i,block_j,block_k)->get_tree() == nullptr)// read it from file
- {
- std::string block_path = gen_block_path(block_i,block_j,block_k);
- vsl_b_ifstream os(block_path);
-
- // if the binary block file is not found
- if (!os) {
- if (blocks_(block_i,block_j,block_k)->get_tree()==nullptr) {
- T* tree= new T(max_tree_level_,init_tree_level_);
- blocks_(block_i,block_j,block_k)->init_tree(tree);
- }
- return false;
- }
- blocks_(block_i,block_j,block_k)->b_read(os);
- os.close();
- }
- }
-
- return true;
-}
-
-//: Unload all blocks in between min-max indices.
-template <class T>
-bool boxm_scene<T>::unload_blocks(vgl_point_3d<int> min_idx, vgl_point_3d<int> max_idx)
-{
- if (!valid_index(min_idx) || !valid_index(max_idx))
- return false;
-
- for (int i = min_idx.x(); i <= max_idx.x(); i++)
- for (int j = min_idx.y(); j <= max_idx.y(); j++)
- for (int k = min_idx.z(); k <= max_idx.z(); k++)
- {
- boxm_block<T>* block = blocks_(i,j,k);
- block->delete_tree();
- block->set_tree(nullptr);
- }
- return true;
-}
-
-//: Unload active blocks.
-template <class T>
-void boxm_scene<T>::unload_active_blocks() const
-{
- // unload active block
- if (valid_index(active_block_))
- {
- boxm_block<T>* block = blocks_(active_block_.x(), active_block_.y(),active_block_.z());
- block->delete_tree();
- block->set_tree(nullptr);
- active_block_ = vgl_point_3d<int>(-1,-1,-1);
- }
-
- if (active_blocks_.size()==0)
- return;
-
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> >::iterator unload_it = active_blocks_.begin();
-
- for (; unload_it!=active_blocks_.end(); unload_it++)
- {
- boxm_block<T>* block = blocks_((*unload_it).x(),(*unload_it).y(),(*unload_it).z());
- block->delete_tree();
- block->set_tree(nullptr);
- }
- active_blocks_.clear();
-
- return;
-}
-
-
-//: Locate all cells within a 3d region, which coordinates are given in scene coordinates.
-// Use with care --- blocks need to be unloaded by user to not create memory leaks
-template <class T>
-void boxm_scene<T>::leaves_in_region(vgl_box_3d<double> box, std::vector<boct_tree_cell<typename T::loc_type, typename T::datatype>* > &cells)
-{
- vgl_box_3d<double> valid_box = vgl_intersection(get_world_bbox(),box);
- cells.clear();
-
- if (valid_box.is_empty()) {
- std::cout << "Warning in boxm_scene<T>::leaves_in_region: Region does not intersect scene\n";
- return;
- }
-
- vgl_point_3d<double> min_point = valid_box.min_point();
- vgl_point_3d<double> max_point = valid_box.max_point();
-
- // load blocks intersecting the region
- vgl_point_3d<int> min_idx;
- get_block_index(min_point, min_idx);
-
- vgl_point_3d<int> max_idx;
- get_block_index(max_point, max_idx);
-#ifdef DEBUG
- std::cout << "Loading Region beteween blocks: " << max_idx << ", " << min_idx << std::endl;
-#endif
- if (!load_blocks(min_idx, max_idx))
- return;
-
- // traverse blocks. for each block get the cells intersects the portion of the region contained in the block
- for (int k = min_idx.z(); k <= max_idx.z(); k++)
- {
- for (int j = min_idx.y(); j <= max_idx.y(); j++)
- {
- for (int i = min_idx.x(); i <= max_idx.x();i++)
- {
- boxm_block<T>* block = blocks_(i,j,k);
- vgl_box_3d<double> local_box = vgl_intersection(get_block_bbox(i,j,k),box);
-
- // subtract a little from the max point because octree cell are give by a half-closed interval [...).
- // if this is not done, the endpoint may be out of bounds
- vgl_box_3d<double> local_box_exclusive(local_box.min_point().x(), local_box.min_point().y(), local_box.min_point().z(),
- local_box.max_point().x()- 1e-7, local_box.max_point().y()- 1e-7,local_box.max_point().z()- 1e-7);
- T *tree = block->get_tree();
- if (!tree)
- continue;
- std::vector<boct_tree_cell<loc_type, datatype>* > temp_cells;
- temp_cells.clear();
- tree->locate_region_leaves_global(local_box_exclusive, temp_cells);
- cells.insert(cells.end(), temp_cells.begin(), temp_cells.end());
- }
- }
- }
-
- // FIXME: I should unload the blocks
- return;
-}
-
-//: Level of the cell containing a 3d region, which coordinates are given in scene coordinates.
-template <class T>
-short boxm_scene<T>::level_region(vgl_box_3d<double> box)
-{
- vgl_box_3d<double> valid_box = vgl_intersection(get_world_bbox(),box);
-
- if (valid_box.is_empty()) {
- std::cout << "Warning in boxm_scene<T>::level_region: Region does not intersect scene\n";
- return -1;
- }
-
- vgl_point_3d<double> min_point = valid_box.min_point();
- vgl_point_3d<double> max_point = valid_box.max_point();
-
- // load blocks intersecting the region
- vgl_point_3d<int> min_idx;
- get_block_index(min_point, min_idx);
-
- vgl_point_3d<int> max_idx;
- get_block_index(max_point, max_idx);
-//#ifdef DEBUG
- std::cout << "Loading Region beteween blocks: " << max_idx << ", " << min_idx << std::endl;
-//#endif
- if (!load_blocks(min_idx, max_idx))
- return -1;
-
- short level = -1;
-
- // traverse blocks. for each block get the cells intersects the portion of the region contained in the block
- for (int k = min_idx.z(); k <= max_idx.z(); k++)
- {
- for (int j = min_idx.y(); j <= max_idx.y(); j++)
- {
- for (int i = min_idx.x(); i <= max_idx.x();i++)
- {
- boxm_block<T>* block = blocks_(i,j,k);
- vgl_box_3d<double> local_box = vgl_intersection(get_block_bbox(i,j,k),box);
-
- std::cout << ".....In tree with box dimension: " << get_block_bbox(i,j,k).width() << ", " << get_block_bbox(i,j,k).depth() << ", " << get_block_bbox(i,j,k).height()
- << "looking for box with dim: " << box.width() << ", " << box.depth() << ", " <<box.height() <<std::endl;
-
- // subtract a little from the max point because octree cell are give by a half-closed interval [...).
- // if this is not done, the endpoint may be out of bounds
- vgl_box_3d<double> local_box_exclusive(local_box.min_point().x(), local_box.min_point().y(), local_box.min_point().z(),
- local_box.max_point().x()- 1e-7, local_box.max_point().y()- 1e-7,local_box.max_point().z()- 1e-7);
- T *tree = block->get_tree();
- if (!tree)
- continue;
-
- boct_tree_cell<loc_type, datatype>* region_cell = tree->locate_region_global(local_box_exclusive);
- if (region_cell->level() > level)
- level = region_cell->level();
-
- std::cout << "level: " << level << box <<std::endl;
-
- }
- }
- }
- this->unload_active_blocks();
- return level;
-}
-
-
-
-
-//: Return all leaf cells between an inner box and an outter box
-template <class T>
-void boxm_scene<T>::leaves_data_in_region(vgl_box_3d<double> box, std::vector<boct_cell_data<typename T::loc_type, typename T::datatype> > &cell_data)
-{
- vgl_box_3d<double> valid_box = vgl_intersection(get_world_bbox(),box);
- cell_data.clear();
-
- if (valid_box.is_empty()) {
- std::cout << "Warning in boxm_scene<T>::leaves_in_region: Region does not intersect scene\n";
- return;
- }
-
- vgl_point_3d<double> min_point = valid_box.min_point();
- vgl_point_3d<double> max_point = valid_box.max_point();
-
- // load blocks intersecting the region
- vgl_point_3d<int> min_idx;
- get_block_index(min_point, min_idx);
-
- vgl_point_3d<int> max_idx;
- get_block_index(max_point, max_idx);
-#ifdef DEBUG
- std::cout << "Loading Region beteween blocks: " << max_idx << ", " << min_idx << std::endl;
-#endif
- if (!load_blocks(min_idx, max_idx))
- return;
-
- // traverse blocks. for each block get the cells intersects the portion of the region contained in the block
- for (int k = min_idx.z(); k <= max_idx.z(); k++)
- {
- for (int j = min_idx.y(); j <= max_idx.y(); j++)
- {
- for (int i = min_idx.x(); i <= max_idx.x();i++)
- {
- boxm_block<T>* block = blocks_(i,j,k);
- vgl_box_3d<double> local_box = vgl_intersection(get_block_bbox(i,j,k),box);
-
- // subtract a little from the max point because octree cell are give by a half-closed interval [...).
- // if this is not done, the endpoint may be out of bounds
- vgl_box_3d<double> local_box_exclusive(local_box.min_point().x(), local_box.min_point().y(), local_box.min_point().z(),
- local_box.max_point().x()- 1e-7, local_box.max_point().y()- 1e-7,local_box.max_point().z()- 1e-7);
- T *tree = block->get_tree();
- if (!tree)
- continue;
- std::vector<boct_tree_cell<loc_type, datatype>* > temp_cells;
- temp_cells.clear();
- tree->locate_region_leaves_global(local_box_exclusive, temp_cells);
-
- typename std::vector<boct_tree_cell<loc_type, datatype>* >::iterator temp_cell_it = temp_cells.begin();
- for(; temp_cell_it!=temp_cells.end(); temp_cell_it++){
- cell_data.push_back(boct_cell_data<loc_type, datatype>(tree->global_centroid(*temp_cell_it),
- (*temp_cell_it)->level(), (*temp_cell_it)->data()));
- }
- }
- }
- }
- unload_active_blocks();
- return;
-}
-
-//: Returns the data of all cells at a given level, that are contained in the specified region
-template <class T>
-void boxm_scene<T>::cell_data_in_region(vgl_box_3d<double> box, std::vector<boct_cell_data<loc_type, datatype> > &cell_data, unsigned level)
-{
- vgl_box_3d<double> valid_box = vgl_intersection(get_world_bbox(),box);
- cell_data.clear();
-
- if (valid_box.is_empty()) {
- std::cout << "Warning in boxm_scene<T>::leaves_in_region: Region does not intersect scene\n";
- return;
- }
-
- vgl_point_3d<double> min_point = valid_box.min_point();
- vgl_point_3d<double> max_point = valid_box.max_point();
-
- // load blocks intersecting the region
- vgl_point_3d<int> min_idx;
- get_block_index(min_point, min_idx);
-
- vgl_point_3d<int> max_idx;
- get_block_index(max_point, max_idx);
-#ifdef DEBUG
- std::cout << "Loading Region beteween blocks: " << max_idx << ", " << min_idx << std::endl;
-#endif
- if (!load_blocks(min_idx, max_idx))
- return;
-
- // traverse blocks. for each block get the cells intersects the portion of the region contained in the block
- for (int k = min_idx.z(); k <= max_idx.z(); k++)
- {
- for (int j = min_idx.y(); j <= max_idx.y(); j++)
- {
- for (int i = min_idx.x(); i <= max_idx.x();i++)
- {
- boxm_block<T>* block = blocks_(i,j,k);
- vgl_box_3d<double> local_box = vgl_intersection(get_block_bbox(i,j,k),box);
-
- // subtract a little from the max point because octree cell are give by a half-closed interval [...).
- // if this is not done, the endpoint may be out of bounds
- vgl_box_3d<double> local_box_exclusive(local_box.min_point().x(), local_box.min_point().y(), local_box.min_point().z(),
- local_box.max_point().x()- 1e-7, local_box.max_point().y()- 1e-7,local_box.max_point().z()- 1e-7);
- T *tree = block->get_tree();
- if (!tree)
- continue;
- std::vector<boct_tree_cell<loc_type, datatype>* > temp_cells;
- temp_cells.clear();
- tree->locate_region_cells_global(local_box_exclusive, temp_cells, level);
-
- typename std::vector<boct_tree_cell<loc_type, datatype>* >::iterator temp_cell_it = temp_cells.begin();
- for(; temp_cell_it!=temp_cells.end(); temp_cell_it++){
- cell_data.push_back(boct_cell_data<loc_type, datatype>(tree->global_centroid(*temp_cell_it),
- (*temp_cell_it)->level(), (*temp_cell_it)->data()));
- }
- }
- }
- }
- unload_active_blocks();
- return;
-}
-
-//: Return all leaf cells between an inner box and an outter box. Use with care --- blocks need to be unloaded by user
-template <class T>
-void boxm_scene<T>::leaves_in_hollow_region(vgl_box_3d<double> outer_box, vgl_box_3d<double> inner_box, std::vector<boct_tree_cell<loc_type, datatype>* >& cells)
-{
- if (!outer_box.contains(inner_box))
- return;
-
- // load blocks intersecting the region
- vgl_point_3d<double> min_point = outer_box.min_point();
- vgl_point_3d<int> min_idx;
- get_block_index(min_point, min_idx);
-
- vgl_point_3d<double> max_point = outer_box.max_point();
- vgl_point_3d<int> max_idx;
- get_block_index(max_point, max_idx);
-
- if (!load_blocks(min_idx, max_idx))
- return;
-
- // traverse blocks. for each block get the cells intersects the portion of the region contained in the block
- for (int k = min_idx.z(); k <= max_idx.z(); k++)
- {
- for (int j = min_idx.y(); j <= max_idx.y(); j++)
- {
- for (int i = min_idx.x(); i <= max_idx.x();i++)
- {
- boxm_block<T>* block = blocks_(i,j,k);
- vgl_box_3d<double> local_box = vgl_intersection(get_block_bbox(i,j,k),outer_box);
-
- // subtract a little from the max point because octree cell are give by a half-closed interval [...).
- // if this is not done, the endpoint may be out of bounds
- vgl_box_3d<double> local_outer_box_exclusive(local_box.min_point().x(), local_box.min_point().y(), local_box.min_point().z(),
- local_box.max_point().x()- 1e-7, local_box.max_point().y()- 1e-7,local_box.max_point().z()- 1e-7);
-
- vgl_box_3d<double> local_inner_box_exclusive = vgl_intersection(local_outer_box_exclusive,inner_box);
-
- T *tree = block->get_tree();
- if (!tree)
- continue;
- std::vector<boct_tree_cell<loc_type, datatype>* > temp_cells;
- temp_cells.clear();
- tree->locate_leaves_in_hollow_region_global(local_outer_box_exclusive, local_inner_box_exclusive, temp_cells);
- cells.insert(cells.end(), temp_cells.begin(), temp_cells.end());
- }
- }
- }
-
- // FIXME: I should unload the blocks
- return;
-}
-
-//: Locates and modifies the value of all cells within a 3d region, which coordinates are given in scene coordinates
-template <class T>
-void boxm_scene<T>::change_leaves_in_region(vgl_box_3d<double> box, const typename T::datatype &cell_data)
-{
- // load blocks intersecting the region
- vgl_point_3d<double> min_point = box.min_point();
- vgl_point_3d<int> min_idx;
- get_block_index(min_point, min_idx);
-
- vgl_point_3d<double> max_point = box.max_point();
- vgl_point_3d<int> max_idx;
- get_block_index(max_point, max_idx);
-
- if (!load_blocks(min_idx, max_idx))
- return;
-
- // traverse blocks. for each block get the cells intersects the portion of the region contained in the block
- for (int k = min_idx.z(); k <= max_idx.z(); k++)
- {
- for (int j = min_idx.y(); j <= max_idx.y(); j++)
- {
- for (int i = min_idx.x(); i <= max_idx.x();i++)
- {
- boxm_block<T>* block = blocks_(i,j,k);
- vgl_box_3d<double> local_box = vgl_intersection(get_block_bbox(i,j,k),box);
-
- // subtract a little from the max point because octree cell are give by a half-closed interval [...).
- // if this is not done, the endpoint may be out of bounds
- vgl_box_3d<double> local_box_exclusive(local_box.min_point().x(), local_box.min_point().y(), local_box.min_point().z(),
- local_box.max_point().x()- 1e-7, local_box.max_point().y()- 1e-7,local_box.max_point().z()- 1e-7);
- T *tree = block->get_tree();
- if (!tree)
- continue;
-
- tree->change_leaves_in_global_region_leaves_global(local_box_exclusive, cell_data);
-
- std::string path = gen_block_path(i,j,k);
- vsl_b_ofstream os(path);
- block->b_write(os, save_internal_nodes_, save_platform_independent_);
- }
- }
- }
-
- unload_active_blocks();
- return;
-}
-
-//: Locates and modifies the value of all cells within a 3d region, which coordinates are given in scene coordinates
-template <class T>
-void boxm_scene<T>::change_leaves_in_regions(std::vector<vgl_box_3d<double> > boxes, const std::vector<typename T::datatype> &all_data)
-{
- if (boxes.size()!= all_data.size()) {
- std::cerr << "Error in boxm_scene<T>::change_leaves_in_regions --> Input vectors don't have the same size\n";
- return;
- }
-
- for (unsigned bi = 0; bi < boxes.size(); bi++)
- {
- const vgl_box_3d<double> &box = boxes[bi];
- const datatype &cell_data=all_data[bi];
- // load blocks intersecting the region
- vgl_point_3d<double> min_point = box.min_point();
- vgl_point_3d<int> min_idx;
- get_block_index(min_point, min_idx);
-
- vgl_point_3d<double> max_point = box.max_point();
- vgl_point_3d<int> max_idx;
- get_block_index(max_point, max_idx);
-
- if (!load_blocks(min_idx, max_idx))
- return;
-
- // traverse blocks. for each block get the cells intersects the portion of the region contained in the block
- for (int k = min_idx.z(); k <= max_idx.z(); k++)
- {
- for (int j = min_idx.y(); j <= max_idx.y(); j++)
- {
- for (int i = min_idx.x(); i <= max_idx.x();i++)
- {
- boxm_block<T>* block = blocks_(i,j,k);
- vgl_box_3d<double> local_box = vgl_intersection(get_block_bbox(i,j,k),box);
-
- // subtract a little from the max point because octree cell are give by a half-closed interval [...).
- // if this is not done, the endpoint may be out of bounds
- vgl_box_3d<double> local_box_exclusive(local_box.min_point().x(), local_box.min_point().y(), local_box.min_point().z(),
- local_box.max_point().x()- 1e-7, local_box.max_point().y()- 1e-7,local_box.max_point().z()- 1e-7);
- T *tree = block->get_tree();
- if (!tree)
- continue;
-
- tree->change_leaves_in_global_region_leaves_global(local_box_exclusive, cell_data);
-
- std::string path = gen_block_path(i,j,k);
- vsl_b_ofstream os(path);
- block->b_write(os, save_internal_nodes_, save_platform_independent_);
- }
- }
- }
- }
-
- unload_active_blocks();
- return;
-}
-
-
-//: Locate point
-template <class T>
-boct_tree_cell<typename T::loc_type, typename T::datatype>* boxm_scene<T>::locate_point_in_memory(vgl_point_3d<double> &p, unsigned level)
-{
- // get the indices for the block containing this point
- vgl_point_3d<int> block_idx;
- if (!get_block_index(p, block_idx))
- return nullptr;
-
-#ifdef DEBUG
- std::cout << "Requesting blocks : "<< block_idx<< '\n'
- << "Active blocks :" << std::endl;
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> >::iterator it = active_blocks_.begin();
- for (; it!=active_blocks_.end(); it++) {
- std::cout << *it << std::endl;
- boxm_block<T > *block = get_block(*it);
- if (!block)
- std::cerr << " NULL block\n";
- T *tree = block->get_tree();
- if (!tree)
- std::cerr << " NULL tree\n";
- }
-#endif
-
- // get the block, if block is not already in memory, return null
- boxm_block<T>* block = blocks_(block_idx.x(), block_idx.y(), block_idx.z());
- if (!block) {
- std::cerr << "In locate_point_in_memory: NULL block\n";
- return nullptr;
- }
- T *tree = block->get_tree();
- if (!tree) {
- std::cerr << "In locate_point_in_memory: NULL tree\n";
- return nullptr;
- }
- return tree->locate_point_global(p, (short)level);
-}
-
-/************************************************ BOXM_BLOCK_ITERATOR *******************************************/
-
-template <class T>
-boxm_block_iterator<T>& boxm_block_iterator<T>::begin()
-{
- i_=j_=k_=0;
- return *this;
-}
-
-template <class T>
-bool boxm_block_iterator<T>::end()
-{
- int x,y,z;
- scene_->block_num(x,y,z);
-
- // if ((i_==x-1) && (j_==y-1) && (k_==z-1))
- bool end = (k_==z || k_ == -1);
-
- //:If end, release memory
- if (end)
- scene_->unload_active_blocks();
-
- return end;
-}
-
-template <class T>
-boxm_block_iterator<T>& boxm_block_iterator<T>::operator=(const boxm_block_iterator<T>& that)
-{
- this->i_ = that.i_;
- this->j_ = that.j_;
- this->k_ = that.k_;
- return *this;
-}
-
-template <class T>
-bool boxm_block_iterator<T>::operator==(const boxm_block_iterator<T>& that)
-{
- return (this->i_ == that.i_) && (this->j_ == that.j_) && (this->k_ == that.k_) && (this->scene_ == that.scene_);
-}
-
-template <class T>
-bool boxm_block_iterator<T>::operator!=(const boxm_block_iterator<T>& that)
-{
- return (this->i_ != that.i_) || (this->j_ != that.j_) == (this->k_ != that.k_) || (this->scene_ != that.scene_);
-}
-
-template <class T>
-boxm_block_iterator<T>& boxm_block_iterator<T>::operator++()
-{
- int x,y,z;
- scene_->block_num(x,y,z);
-
- if (++i_==x) {
- i_=0;
- if (++j_==y) {
- j_=0;
- ++k_;
- }
- }
- return *this;
-}
-
-template <class T>
-boxm_block_iterator<T> boxm_block_iterator<T>::operator++(int)
-{
- boxm_block_iterator<T> old = *this;
- ++*this;
- return old;
-}
-
-template <class T>
-boxm_block_iterator<T>& boxm_block_iterator<T>::operator--()
-{
- int x,y,z;
-
- scene_->block_num(x,y,z);
- if (--i_==-1) {
- i_=0;
- if (--j_==-1) {
- j_=0;
- k_--;
- }
- }
- return *this;
-}
-
-template <class T>
-boxm_block<T>* boxm_block_iterator<T>::operator*()
-{
- return scene_->get_block(i_,j_,k_);
-}
-
-template <class T>
-boxm_block<T>* boxm_block_iterator<T>::operator->()
-{
- return scene_->get_block(i_,j_,k_);
-}
-
-/************************************************ BOXM_CELL_ITERATOR *******************************************/
-template <class T>
-boxm_cell_iterator<T>& boxm_cell_iterator<T>::begin(bool use_internal_cells)
-{
- use_internal_cells_= use_internal_cells;
-
- // unload all blocks from memory
- block_iterator_.scene_->unload_active_blocks();
- block_iterator_.begin();
-
- // load active block using function pointer, retrieve pointer to all cells
- (block_iterator_.scene_->*block_loading_func_)(block_iterator_.index().x(),block_iterator_.index().y(),block_iterator_.index().z());
- T *tree = (*block_iterator_)->get_tree();
- assert(tree != nullptr);
- if(use_internal_cells_)
- cells_=tree->all_cells();
- else
- cells_ = tree->leaf_cells();
- cells_iterator_ = cells_.begin();
-
- std::cout << "Cell iterator: # of cells: " << cells_.size() << std::endl;
-
- return *this;
-}
-
-template <class T>
-bool boxm_cell_iterator<T>::end()
-{
- bool end = false;
-
- end = cells_.empty() || (block_iterator_.end() && (cells_iterator_ == cells_.end()));
-
- if (end)
- block_iterator_.scene_->unload_active_blocks();
-
- return end;
-}
-
-template <class T>
-boxm_cell_iterator<T>& boxm_cell_iterator<T>::operator=(const boxm_cell_iterator<T>& /*that*/)
-{
- std::cerr << "assignment operator not yet implemented\n";
- return *this;
-}
-
-template <class T>
-bool boxm_cell_iterator<T>::operator==(const boxm_cell_iterator<T>& that)
-{
- return (this->block_iterator_ == that.block_iterator_) && (this->cells_iterator_ == that.cells_iterator_);
-}
-
-template <class T>
-bool boxm_cell_iterator<T>::operator!=(const boxm_cell_iterator<T>& that)
-{
- return (this->block_iterator_ != that.block_iterator_) && (this->cells_iterator_ != that.cells_iterator_);
-}
-
-//: Prefix operator.
-// When the end of the block is reached, it writes the block to disk and loads the next one, unless the read_only flag was set
-template <class T>
-boxm_cell_iterator<T>& boxm_cell_iterator<T>::operator++()
-{
- if (++cells_iterator_ == cells_.end())
- {
- if (!read_only_)
- block_iterator_.scene_->write_active_block(false);
-
- ++block_iterator_;
-
- if (!block_iterator_.end())
- {
- // load active block using function pointer, retrieve pointer to all cells
- (block_iterator_.scene_->*block_loading_func_)(block_iterator_.index().x(),block_iterator_.index().y(),block_iterator_.index().z());
- T *tree = (*block_iterator_)->get_tree();
- assert(tree != nullptr);
-
- if(use_internal_cells_)
- cells_=tree->all_cells();
- else
- cells_ = tree->leaf_cells();
-
- cells_iterator_ = cells_.begin();
- }
- }
- return *this;
-}
-
-template <class T>
-boxm_cell_iterator<T> boxm_cell_iterator<T>::operator+=(unsigned const &rhs)
-{
- // is there a more efficient way to do this whitout messing all the iterator up?
- for (unsigned i =0; i<rhs; ++i)
- ++(*this);
-
- return *this;
-}
-
-
-template <class T>
-boct_tree_cell<typename boxm_cell_iterator<T>::loc_type, typename boxm_cell_iterator<T>::datatype>* boxm_cell_iterator<T>::operator*()
-{
- return *cells_iterator_;
-}
-
-template <class T>
-boct_tree_cell<typename boxm_cell_iterator<T>::loc_type, typename boxm_cell_iterator<T>::datatype>* boxm_cell_iterator<T>::operator->()
-{
- return *cells_iterator_;
-}
-
-template<class T>
-vgl_point_3d<double> boxm_cell_iterator<T>::global_origin()
-{
- return (*block_iterator_)->get_tree()->global_origin(*cells_iterator_);
-}
-
-template<class T>
-vgl_point_3d<double> boxm_cell_iterator<T>::global_centroid()
-{
- return (*block_iterator_)->get_tree()->global_centroid(*cells_iterator_);
-}
-
-//: Return the global length of this cell
-template<class T>
-double boxm_cell_iterator<T>::length()
-{
- return (*block_iterator_)->get_tree()->cell_length(*cells_iterator_)*(*block_iterator_)->bounding_box().width();
-}
-
-/******************************************* I/ O *******************************************************/
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_scene<T> const &scene)
-{
- scene.b_write(os);
-}
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_scene<T> const * &scene)
-{
- scene->b_write(os);
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_scene<T> &scene)
-{
- scene.b_read(is);
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_scene<T> *&scene)
-{
- scene->b_read(is);
-}
-
-#define BOXM_SCENE_INSTANTIATE(T) \
-template class boxm_scene<T >; \
-template void x_write(std::ostream&, boxm_scene<T >&, std::string); \
-template void vsl_b_write(vsl_b_ostream & os, boxm_scene<T > const &scene); \
-template void vsl_b_write(vsl_b_ostream & os, boxm_scene<T > const * &scene); \
-template void vsl_b_read(vsl_b_istream & is, boxm_scene<T > &scene); \
-template void vsl_b_read(vsl_b_istream & is, boxm_scene<T > * &scene)
-
-#define BOXM_BLOCK_ITERATOR_INSTANTIATE(T) \
-template class boxm_block_iterator<T >; \
-template class boxm_cell_iterator<T >
-
-#endif
diff --git a/contrib/brl/bseg/boxm/boxm_scene_base.cxx b/contrib/brl/bseg/boxm/boxm_scene_base.cxx
deleted file mode 100644
index 11fb0faf88..0000000000
--- a/contrib/brl/bseg/boxm/boxm_scene_base.cxx
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <iostream>
-#include <cstdio>
-#include "boxm_scene_base.h"
-#include "boxm_scene_parser.h"
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-bool boxm_scene_base::load_scene(const std::string& filename, boxm_scene_parser& parser)
-{
-
- if (filename.size() > 0) {
- std::FILE* xmlFile = std::fopen(filename.c_str(), "r");
- if (!xmlFile){
- std::cerr << filename.c_str() << " error on opening" << std::endl;
- return false;
- }
- if (!parser.parseFile(xmlFile)) {
- std::cerr << XML_ErrorString(parser.XML_GetErrorCode()) << " at line "
- << parser.XML_GetCurrentLineNumber() << '\n';
- std::fclose(xmlFile);
- return false;
- }
- std::fclose(xmlFile);
- }
- else
- std::cerr << " Filename is empty" << std::endl;
-
- parser.paths(scene_path_, block_pref_);
- app_model_ = boxm_apm_types::str_to_enum(parser.app_model().data());
- multi_bin_ = parser.multi_bin();
- parser.levels(max_tree_level_, init_tree_level_);
- filename_ = filename;
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/boxm_scene_base.h b/contrib/brl/bseg/boxm/boxm_scene_base.h
deleted file mode 100644
index 5e52195ac3..0000000000
--- a/contrib/brl/bseg/boxm/boxm_scene_base.h
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef boxm_scene_base_h_
-#define boxm_scene_base_h_
-//:
-// \file
-// \brief The main class to keep the 3D world data and pieces
-//
-// \author Gamze Tunali
-// \date Apr 14, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <vbl/vbl_ref_count.h>
-#include <vsl/vsl_binary_io.h>
-#include <vbl/vbl_smart_ptr.h>
-#include <vgl/vgl_box_3d.h>
-
-#include <boxm/boxm_apm_traits.h>
-
-class boxm_scene_parser;
-
-class boxm_scene_base : public vbl_ref_count
-{
- public:
- boxm_scene_base()
- : app_model_(BOXM_APM_UNKNOWN), multi_bin_(false), tree_level_set_(false),
- scene_path_(""), filename_(""), block_pref_(""), max_tree_level_(0), init_tree_level_(0) {}
-
- ~boxm_scene_base() override = default;
-
- bool load_scene(const std::string& filename, boxm_scene_parser& parser);
-
- boxm_apm_type appearence_model() { return app_model_; }
-
- void set_appearance_model(boxm_apm_type model) { app_model_ = model; }
-
- void set_bin_option(bool multi_bin) { multi_bin_ = multi_bin; }
-
- void set_octree_levels(unsigned max, unsigned init, bool tree_level_set=true)
- {
- max_tree_level_=max;
- init_tree_level_=init;
- tree_level_set_=tree_level_set;
- }
-
- void set_paths(std::string scene_path, std::string block_prefix)
- {
- scene_path_ = scene_path;
- block_pref_=block_prefix;
- }
-
- bool multi_bin() const { return multi_bin_; }
-
- bool parse_config(std::string xml, boxm_scene_parser& parser, bool filename);
-
- unsigned max_level() const { return max_tree_level_; }
- unsigned init_level() const { return init_tree_level_; }
- std::string filename() const { return filename_; }
-
- virtual vgl_box_3d<double> get_world_bbox() const { return {}; }
- virtual vgl_vector_3d<unsigned> world_dim() const { return {}; }
-
- protected:
- boxm_apm_type app_model_;
-
- bool multi_bin_;
-
- //: it is set to true when max and init tree levels are given
- bool tree_level_set_;
-
- std::string scene_path_;
- std::string filename_;
- std::string block_pref_;
-
- //: maximum octree levels allowed
- unsigned max_tree_level_;
-
- //: number of initial octree levels created at the tree creation step
- unsigned init_tree_level_;
-};
-
-typedef vbl_smart_ptr<boxm_scene_base> boxm_scene_base_sptr;
-
-#endif // boxm_scene_base_h_
diff --git a/contrib/brl/bseg/boxm/boxm_scene_parser.cxx b/contrib/brl/bseg/boxm/boxm_scene_parser.cxx
deleted file mode 100644
index be04cb28ed..0000000000
--- a/contrib/brl/bseg/boxm/boxm_scene_parser.cxx
+++ /dev/null
@@ -1,277 +0,0 @@
-//:
-// \file
-// \brief Parses the configuration file for bwm tool.
-//
-#include <sstream>
-#include <cstring>
-#include <iostream>
-#include <cstdio>
-#include "boxm_scene_parser.h"
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-// --------------
-// --- PARSER ---
-// --------------
-template <typename T>
-void convert(const char* t, T& d)
-{
- std::stringstream strm(t);
- strm >> d;
-}
-
-boxm_scene_parser::boxm_scene_parser()
-{
- init_params();
-}
-
-bool boxm_scene_parser::lvcs(vpgl_lvcs& lvcs) {
- vpgl_lvcs::cs_names cs_name = vpgl_lvcs::str_to_enum(lvcs_cs_name_.data());
- vpgl_lvcs::LenUnits len_unit;
- vpgl_lvcs::AngUnits geo_unit;
- if (std::strcmp(lvcs_XYZ_unit_.data(), "feet")==0) {
- len_unit = vpgl_lvcs::FEET;
- }
- else if (std::strcmp(lvcs_XYZ_unit_.data(), "meters")==0) {
- len_unit = vpgl_lvcs::METERS;
- }
- else {
- std::cout << "LVCS Length Unit " << lvcs_XYZ_unit_ << " is not valid\n";
- return false;
- }
-
- if (std::strcmp(lvcs_geo_angle_unit_.data(), "radians")==0) {
- geo_unit = vpgl_lvcs::RADIANS;
- }
- else if (std::strcmp(lvcs_geo_angle_unit_.data(), "degrees")==0) {
- geo_unit = vpgl_lvcs::DEG;
- }
- else {
- std::cout << "LVCS Geo Angle Unit " << lvcs_geo_angle_unit_ << " is not valid\n";
- return false;
- }
-
- lvcs = vpgl_lvcs(lvcs_origin_lat_,lvcs_origin_lon_,lvcs_origin_elev_, cs_name,
- lvcs_lat_scale_, lvcs_lon_scale_, geo_unit, len_unit,
- lvcs_local_origin_x_, lvcs_local_origin_y_, lvcs_theta_);
- return true;
-}
-
-void boxm_scene_parser::init_params()
-{
- lvcs_cs_name_="";
- lvcs_origin_lon_=0;
- lvcs_origin_lat_=0;
- lvcs_origin_elev_=0;
- lvcs_lon_scale_=0;
- lvcs_lat_scale_=0;
- lvcs_XYZ_unit_="";
- lvcs_geo_angle_unit_="";
- lvcs_local_origin_x_=0;
- lvcs_local_origin_y_=0;
- lvcs_theta_=0;
-
- // world origin
- local_orig_x_=0;
- local_orig_y_=0;
- local_orig_z_=0;
-
- // block dimensions
- block_dim_x_=0;
- block_dim_y_=0;
- block_dim_z_=0;
-
- // block numbers
- block_num_x_=0;
- block_num_y_=0;
- block_num_z_=0;
-
- path_="";
- block_pref_="";
- save_internal_nodes_ = false;
- save_platform_independent_ = true;
- load_all_blocks_=false;
- p_init_=0.01f;
- num_buffers_init_ = 0;
- size_buffer_init_ = 0;
-}
-
-void
-boxm_scene_parser::startElement(const char* name, const char** atts)
-{
-#if 0
- std::cout<< "element=" << name << std::endl;
-#endif
- if (std::strcmp(name, LVCS_TAG) == 0) {
- for (int i=0; atts[i]; i+=2) {
-#if 0
- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl;
-#endif
- if (std::strcmp(atts[i], "cs_name") == 0)
- convert(atts[i+1], lvcs_cs_name_);
- else if (std::strcmp(atts[i], "origin_lon") == 0)
- convert(atts[i+1], lvcs_origin_lon_);
- else if (std::strcmp(atts[i], "origin_lat") == 0)
- convert(atts[i+1], lvcs_origin_lat_);
- else if (std::strcmp(atts[i], "origin_elev") == 0)
- convert(atts[i+1], lvcs_origin_elev_);
- else if (std::strcmp(atts[i], "lon_scale") == 0)
- convert(atts[i+1], lvcs_lon_scale_);
- else if (std::strcmp(atts[i], "lat_scale") == 0)
- convert(atts[i+1], lvcs_lat_scale_);
- else if (std::strcmp(atts[i], "local_XYZ_unit") == 0)
- convert(atts[i+1], lvcs_XYZ_unit_);
- else if (std::strcmp(atts[i], "geo_angle_unit") == 0)
- convert(atts[i+1], lvcs_geo_angle_unit_);
- else if (std::strcmp(atts[i], "local_origin_x") == 0)
- convert(atts[i+1], lvcs_local_origin_x_);
- else if (std::strcmp(atts[i], "local_origin_y") == 0)
- convert(atts[i+1], lvcs_local_origin_y_);
- else if (std::strcmp(atts[i], "theta_") == 0)
- convert(atts[i+1], lvcs_theta_);
- }
- }
- else if (std::strcmp(name,LOCAL_ORIGIN_TAG)== 0) {
- for (int i=0; atts[i]; i+=2) {
-#if 0
- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl;
-#endif
- if (std::strcmp(atts[i], "x") == 0)
- convert(atts[i+1], local_orig_x_);
- else if (std::strcmp(atts[i], "y") == 0)
- convert(atts[i+1], local_orig_y_);
- else if (std::strcmp(atts[i], "z") == 0)
- convert(atts[i+1], local_orig_z_);
- }
- }
- else if (std::strcmp(name,BLOCK_DIMENSIONS_TAG)== 0) {
- for (int i=0; atts[i]; i+=2) {
-#if 0
- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl;
-#endif
- if (std::strcmp(atts[i], "x") == 0)
- convert(atts[i+1], block_dim_x_);
- else if (std::strcmp(atts[i], "y") == 0)
- convert(atts[i+1], block_dim_y_);
- else if (std::strcmp(atts[i], "z") == 0)
- convert(atts[i+1], block_dim_z_);
- }
- }
- else if (std::strcmp(name,BLOCK_NUM_TAG)== 0) {
- for (int i=0; atts[i]; i+=2) {
-#if 0
- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl;
-#endif
- if (std::strcmp(atts[i], "x_dimension") == 0)
- convert(atts[i+1], block_num_x_);
- else if (std::strcmp(atts[i], "y_dimension") == 0)
- convert(atts[i+1], block_num_y_);
- else if (std::strcmp(atts[i], "z_dimension") == 0)
- convert(atts[i+1], block_num_z_);
- }
- }
- else if (std::strcmp(name,SCENE_PATHS_TAG)== 0) {
- for (int i=0; atts[i]; i+=2) {
-#if 0
- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl;
-#endif
- if (std::strcmp(atts[i], "path") == 0)
- convert(atts[i+1], path_);
- else if (std::strcmp(atts[i], "block_prefix") == 0)
- convert(atts[i+1], block_pref_);
- }
- }
- else if (std::strcmp(name,APP_MODEL_TAG)== 0) {
- for (int i=0; atts[i]; i+=2) {
-#if 0
- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl;
-#endif
- if (std::strcmp(atts[i], "type") == 0)
- convert(atts[i+1], app_model_);
- }
- }
- else if (std::strcmp(name,MULTI_BIN_TAG)== 0) {
- for (int i=0; atts[i]; i+=2) {
-#if 0
- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl;
-#endif
- if (std::strcmp(atts[i], "value") == 0)
- convert(atts[i+1], multi_bin_);
- }
- }
- else if (std::strcmp(name,SAVE_INTERNAL_NODES_TAG)== 0) {
- for (int i=0; atts[i]; i+=2) {
-#if 0
- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl;
-#endif
- if (std::strcmp(atts[i], "value") == 0)
- convert(atts[i+1], save_internal_nodes_);
- }
- }
- else if (std::strcmp(name,SAVE_PLATFORM_INDEPENDENT_TAG)== 0) {
- for (int i=0; atts[i]; i+=2) {
-#if 0
- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl;
-#endif
- if (std::strcmp(atts[i], "value") == 0)
- convert(atts[i+1], save_platform_independent_);
- }
- //std::cout << "parser: save_platform_independent_ = " << save_platform_independent_ << std::endl;
- }
- else if (std::strcmp(name,LOAD_ALL_BLOCKS_TAG)== 0) {
- for (int i=0; atts[i]; i+=2) {
-#if 0
- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl;
-#endif
- if (std::strcmp(atts[i], "value") == 0)
- convert(atts[i+1], load_all_blocks_);
- }
- //std::cout << "parser: load_all_blocks_ = " << load_all_blocks_ << std::endl;
- }
-
- else if (std::strcmp(name, "octree_level")==0) {
- for (int i=0; atts[i]; i+=2) {
-#if 0
- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl;
-#endif
- if (std::strcmp(atts[i], "max") == 0)
- convert(atts[i+1], max_tree_level_);
- else if (std::strcmp(atts[i], "init") == 0)
- convert(atts[i+1], init_tree_level_);
- }
- }
- else if (std::strcmp(name, "p_init")==0) {
- for (int i=0; atts[i]; i+=2) {
-#if 0
- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl;
-#endif
- if (std::strcmp(atts[i], "val") == 0)
- convert(atts[i+1], p_init_);
- }
- }
-
- else if (std::strcmp(name, "tree_init") == 0) {
- for (int i=0; atts[i]; i+=2) {
-#if 0
- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl;
-#endif
- if (std::strcmp(atts[i], "num_buffers")==0)
- convert(atts[i+1], num_buffers_init_);
- if (std::strcmp(atts[i], "buff_size")==0)
- convert(atts[i+1], size_buffer_init_);
- }
- }
-
- else if (std::strcmp(name, "max_mb") == 0) {
- for (int i=0; atts[i]; i+=2) {
-#if 0
- std::cout << " Attr=" << atts[i] << "->" << atts[i+1] << std::endl;
-#endif
- if (std::strcmp(atts[i], "mb") == 0)
- convert(atts[i+1], max_mb_);
- }
- }
-
-}
diff --git a/contrib/brl/bseg/boxm/boxm_scene_parser.h b/contrib/brl/bseg/boxm/boxm_scene_parser.h
deleted file mode 100644
index cbda358d2d..0000000000
--- a/contrib/brl/bseg/boxm/boxm_scene_parser.h
+++ /dev/null
@@ -1,108 +0,0 @@
-#ifndef boxm_scene_parser_h_
-#define boxm_scene_parser_h_
-
-#include <iostream>
-#include <string>
-#include <boxm/boxm_scene.h>
-
-#ifdef WIN32
- #define _LIB
-#endif
-#include <expatpp.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <vpgl/vpgl_lvcs.h>
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_vector_3d.h>
-
-#define LVCS_TAG "lvcs"
-#define LOCAL_ORIGIN_TAG "local_origin"
-#define BLOCK_DIMENSIONS_TAG "block_dimensions"
-#define BLOCK_NUM_TAG "blocks"
-#define SCENE_PATHS_TAG "scene_paths"
-#define APP_MODEL_TAG "appearence_model"
-#define MULTI_BIN_TAG "multi_bin"
-#define SAVE_INTERNAL_NODES_TAG "save_internal_nodes"
-#define SAVE_PLATFORM_INDEPENDENT_TAG "save_platform_independent"
-#define LOAD_ALL_BLOCKS_TAG "load_all_blocks"
-#define OCTREE_LEVELS_TAG "octree_level"
-#define P_INIT_TAG "p_init"
-#define TREE_INIT_TAG "tree_init"
-#define MAX_MB_TAG "max_mb"
-
-class boxm_scene_parser : public expatpp
-{
- public:
- boxm_scene_parser();
-
- ~boxm_scene_parser(void) override = default;
-
- bool lvcs(vpgl_lvcs& lvcs);
- vgl_point_3d<double> origin() const { return {local_orig_x_,local_orig_y_,local_orig_z_}; }
- vgl_vector_3d<double> block_dim() const { return {block_dim_x_,block_dim_y_,block_dim_z_}; }
- vgl_vector_3d<unsigned> block_nums() const { return {block_num_x_,block_num_y_,block_num_z_}; }
- void paths(std::string& scene_path, std::string& block_pref) { scene_path=path_; block_pref=block_pref_; }
- std::string app_model() const { return app_model_; }
- bool multi_bin() const { return multi_bin_; }
- void levels(unsigned& max, unsigned& init) { max = max_tree_level_; init=init_tree_level_; }
- bool save_internal_nodes() const { return save_internal_nodes_; }
- bool save_platform_independent() const { return save_platform_independent_; }
- bool load_all_blocks() const { return load_all_blocks_; }
- void tree_buffer_shape(int &num_buffers, int &buff_size) { num_buffers = num_buffers_init_; buff_size = size_buffer_init_; }
- int max_mb() const { return max_mb_; }
-
- float p_init() const { return p_init_; }
-
- private:
- void startElement(const XML_Char* name, const XML_Char** atts) override;
- void endElement(const XML_Char* /*name*/) override {}
- void charData(const XML_Char* /*s*/, int /*len*/) override {}
-
- void init_params();
-
- // temporary values
- //lvcs
- std::string lvcs_cs_name_;
- double lvcs_origin_lon_;
- double lvcs_origin_lat_;
- double lvcs_origin_elev_;
- double lvcs_lon_scale_;
- double lvcs_lat_scale_;
- std::string lvcs_XYZ_unit_;
- std::string lvcs_geo_angle_unit_;
- double lvcs_local_origin_x_;
- double lvcs_local_origin_y_;
- double lvcs_theta_;
-
- // world origin
- double local_orig_x_;
- double local_orig_y_;
- double local_orig_z_;
-
- // block dimensions
- double block_dim_x_;
- double block_dim_y_;
- double block_dim_z_;
-
- // block numbers
- unsigned block_num_x_;
- unsigned block_num_y_;
- unsigned block_num_z_;
-
- std::string path_;
- std::string block_pref_;
- std::string app_model_;
- bool multi_bin_;
- unsigned max_tree_level_;
- unsigned init_tree_level_;
- bool save_internal_nodes_;
- bool save_platform_independent_;
- bool load_all_blocks_;
- float p_init_;
- int num_buffers_init_, size_buffer_init_;
- int max_mb_;
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/pro/CMakeLists.txt b/contrib/brl/bseg/boxm/pro/CMakeLists.txt
deleted file mode 100644
index 4c0cd29038..0000000000
--- a/contrib/brl/bseg/boxm/pro/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# boxm's Process Library
-
-# bprb depends on expat and bvxm_prodepends on bprb primarily
-FIND_PACKAGE(EXPAT REQUIRED)
-FIND_PACKAGE(EXPATPP REQUIRED)
-if(EXPAT_FOUND)
- include_directories( ${BRL_INCLUDE_DIR}/bpro )
- include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb )
- include_directories( ${BRL_INCLUDE_DIR}/bseg )
- include_directories( ${GEL_INCLUDE_DIR}/mrc/vpgl )
- include_directories( ${GEL_INCLUDE_DIR}/mrc )
-
- set(boxm_pro_sources
- boxm_processes.h
- boxm_register.h boxm_register.cxx
- )
-
- aux_source_directory(Templates boxm_pro_sources)
- aux_source_directory(processes boxm_pro_sources)
-
- vxl_add_library(LIBRARY_NAME boxm_pro LIBRARY_SOURCES ${boxm_pro_sources})
-
- target_link_libraries(boxm_pro boxm boxm_util boxm_sample_algo boxm_sample vpgl_pro imesh bprb brdb brip vsol bsta bsta_pro ${VXL_LIB_PREFIX}vnl_io ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vbl_io ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl)
-
- if( BUILD_TESTING )
- add_subdirectory(tests)
- endif()
-
-endif()
diff --git a/contrib/brl/bseg/boxm/pro/Templates/boct_tree+short.vnl_vector_fixed+float.3--.cxx b/contrib/brl/bseg/boxm/pro/Templates/boct_tree+short.vnl_vector_fixed+float.3--.cxx
deleted file mode 100644
index fb055c2df5..0000000000
--- a/contrib/brl/bseg/boxm/pro/Templates/boct_tree+short.vnl_vector_fixed+float.3--.cxx
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <boct/boct_tree.hxx>
-#include <boct/boct_tree_cell.hxx>
-#include <vnl/vnl_vector_fixed.h>
-#include <vnl/io/vnl_io_vector_fixed.h>
-
-typedef vnl_vector_fixed<float,3> vector;
-
-
-BOCT_TREE_INSTANTIATE(short, vector );
-BOCT_TREE_CELL_INSTANTIATE(short, vector);
diff --git a/contrib/brl/bseg/boxm/pro/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.3---.cxx b/contrib/brl/bseg/boxm/pro/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.3---.cxx
deleted file mode 100644
index ac40b5ec2d..0000000000
--- a/contrib/brl/bseg/boxm/pro/Templates/boxm_block+boct_tree+short.vnl_vector_fixed+float.3---.cxx
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <iostream>
-#include <string>
-#include <boct/boct_tree.h>
-#include <boxm/boxm_block.hxx>
-#include <boxm/boxm_scene.hxx>
-#include <vnl/vnl_vector_fixed.h>
-#include <vbl/vbl_array_3d.hxx>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-typedef boct_tree<short, vnl_vector_fixed<float,3> > tree_type;
-
-BOXM_BLOCK_INSTANTIATE(tree_type);
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
-BOXM_SCENE_INSTANTIATE(tree_type);
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type> *);
diff --git a/contrib/brl/bseg/boxm/pro/Templates/boxm_scene+boct_tree+short.vnl_vector_fixed+float.3---.cxx b/contrib/brl/bseg/boxm/pro/Templates/boxm_scene+boct_tree+short.vnl_vector_fixed+float.3---.cxx
deleted file mode 100644
index 24334a0ce4..0000000000
--- a/contrib/brl/bseg/boxm/pro/Templates/boxm_scene+boct_tree+short.vnl_vector_fixed+float.3---.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-#include <vnl/vnl_vector_fixed.h>
-
-typedef boct_tree<short,vnl_vector_fixed<float,3> > tree;
-BOXM_SCENE_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/pro/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx b/contrib/brl/bseg/boxm/pro/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx
deleted file mode 100644
index 5de38b0662..0000000000
--- a/contrib/brl/bseg/boxm/pro/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <brdb/brdb_value.hxx>
-#include <boxm/boxm_scene_base.h>
-#include <vbl/io/vbl_io_smart_ptr.h>
-BRDB_VALUE_INSTANTIATE(boxm_scene_base_sptr, "boxm_scene_base_sptr");
diff --git a/contrib/brl/bseg/boxm/pro/Templates/vbl_array_3d+boxm_block+boct_tree+short.vnl_vector_fixed+float.3---~-.cxx b/contrib/brl/bseg/boxm/pro/Templates/vbl_array_3d+boxm_block+boct_tree+short.vnl_vector_fixed+float.3---~-.cxx
deleted file mode 100644
index d1cce77af7..0000000000
--- a/contrib/brl/bseg/boxm/pro/Templates/vbl_array_3d+boxm_block+boct_tree+short.vnl_vector_fixed+float.3---~-.cxx
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <boxm/boxm_block.h>
-#include <boct/boct_tree.h>
-#include <vnl/vnl_vector_fixed.h>
-
-typedef boct_tree<short,vnl_vector_fixed<float,3> > tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type>*);
diff --git a/contrib/brl/bseg/boxm/pro/boxm_processes.h b/contrib/brl/bseg/boxm/pro/boxm_processes.h
deleted file mode 100644
index 4466447bb1..0000000000
--- a/contrib/brl/bseg/boxm/pro/boxm_processes.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef boxm_processes_h_
-#define boxm_processes_h_
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_macros.h>
-
-//the init functions
-DECLARE_FUNC_CONS(boxm_load_scene_process);
-DECLARE_FUNC_CONS(boxm_create_scene_process);
-DECLARE_FUNC_CONS(boxm_construct_scene_from_image_process);
-DECLARE_FUNC_CONS(boxm_proj_local_cam_process);
-DECLARE_FUNC_CONS(boxm_camera_viewing_scene_process);
-DECLARE_FUNC_CONS(boxm_upload_mesh_process);
-DECLARE_FUNC_CONS(boxm_clean_scene_process);
-DECLARE_FUNC_CONS(boxm_force_write_blocks_process);
-#endif
diff --git a/contrib/brl/bseg/boxm/pro/boxm_register.cxx b/contrib/brl/bseg/boxm/pro/boxm_register.cxx
deleted file mode 100644
index 631b5beadc..0000000000
--- a/contrib/brl/bseg/boxm/pro/boxm_register.cxx
+++ /dev/null
@@ -1,27 +0,0 @@
-#include "boxm_register.h"
-
-#include <bprb/bprb_macros.h>
-#include <bprb/bprb_batch_process_manager.h>
-#include <bprb/bprb_func_process.h>
-
-#include <boxm/boxm_scene_base.h>
-
-#include "boxm_processes.h"
-
-void boxm_register::register_datatype()
-{
- REGISTER_DATATYPE( boxm_scene_base_sptr );
-}
-
-void boxm_register::register_process()
-{
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_load_scene_process, "boxmLoadSceneProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_create_scene_process, "boxmCreateSceneProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_proj_local_cam_process,"boxmProjLocalCamProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_camera_viewing_scene_process,"boxmCameraViewingSceneProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_construct_scene_from_image_process, "boxmConstructSceneFromImageProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_upload_mesh_process,"boxmUploadMeshProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_clean_scene_process,"boxmCleanSceneProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_force_write_blocks_process,"boxmForceWriteBlocksProcess");
-
-}
diff --git a/contrib/brl/bseg/boxm/pro/boxm_register.h b/contrib/brl/bseg/boxm/pro/boxm_register.h
deleted file mode 100644
index 784df08bde..0000000000
--- a/contrib/brl/bseg/boxm/pro/boxm_register.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef boxm_register_h_
-#define boxm_register_h_
-
-class boxm_register
-{
- public:
- static void register_datatype();
- static void register_process();
-};
-
-#endif // boxm_register_h_
diff --git a/contrib/brl/bseg/boxm/pro/processes/boxm_camera_viewing_scene_process.cxx b/contrib/brl/bseg/boxm/pro/processes/boxm_camera_viewing_scene_process.cxx
deleted file mode 100644
index 799958429f..0000000000
--- a/contrib/brl/bseg/boxm/pro/processes/boxm_camera_viewing_scene_process.cxx
+++ /dev/null
@@ -1,131 +0,0 @@
-//This is brl/bseg/boxm/pro/processes/boxm_camera_viewing_scene_process.cxx
-#include <string>
-#include <iostream>
-#include <cmath>
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-//:
-// \file
-// \brief A process for generating cameras that view a scene
-//
-// \author J.L. Mundy
-// \date January 23, 2010
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <vpgl/vpgl_perspective_camera.h>
-#include <bpgl/algo/bpgl_project.h>
-#include <vnl/vnl_math.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-//:global variables
-namespace boxm_camera_viewing_scene_process_globals
-{
- //this process takes no inputs
- constexpr unsigned n_inputs_ = 7;
- constexpr unsigned n_outputs_ = 1;
-}
-
-//:sets input and output types
-bool boxm_camera_viewing_scene_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_camera_viewing_scene_process_globals;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";// the scene
- input_types_[1] = "vcl_string";//the camera type, e.g. perspective
- input_types_[2] = "double";//camera elevation degrees
- input_types_[3] = "double";//camera azimuth degrees
- input_types_[4] = "double";//radius
-
- input_types_[5] = "unsigned";//image ni
- input_types_[6] = "unsigned";//image nj
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "vpgl_camera_double_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-//:creates a scene from parameters
-bool boxm_camera_viewing_scene_process(bprb_func_process& pro)
-{
- if ( !pro.verify_inputs()) {
- std::cout << pro.name() << "boxm_camera_viewing_scene_process: invalid inputs" << std::endl;
- return false;
- }
- using namespace boxm_camera_viewing_scene_process_globals;
- boxm_scene_base_sptr scene_ptr = pro.get_input<boxm_scene_base_sptr>(0);
- std::cout<<"h";
- if (!scene_ptr) return false;
- std::cout<<"hi";
- vgl_box_3d<double> bb = scene_ptr->get_world_bbox();
-
- std::string cam_type = pro.get_input<std::string>(1);
- if (cam_type!="vpgl_perspective_camera")
- return false; //later other camera types
- auto elevation = pro.get_input<double>(2);
- auto azimuth = pro.get_input<double>(3);
- auto radius = pro.get_input<double>(4);
-
- auto ni = pro.get_input<unsigned>(5);
- auto nj = pro.get_input<unsigned>(6);
- auto dni = static_cast<double>(ni), dnj = static_cast<double>(nj);
- //
- //find a camera that will project the scene bounding box
- //entirely inside the image
- //
- // 1) determine the stare point (center of bounding box)
- vgl_point_3d<double> cn = bb.centroid();
- vgl_homg_point_3d<double> stpt(cn.x(), cn.y(), cn.z());
-
- // 2) determine camera center
- // the viewsphere radius is set to 10x the bounding box diameter
- //double w = bb.width(), h = bb.height(), d = bb.depth();
- double r = radius;//std::sqrt(w*w + h*h + d*d);
- //r *=10;
- double deg_to_rad = vnl_math::pi_over_180;
- double el = elevation*deg_to_rad, az = azimuth*deg_to_rad;
- double cx = r*std::sin(el)*std::cos(az);
- double cy = r*std::sin(el)*std::sin(az);
- double cz = r*std::cos(el);
- vgl_point_3d<double> cent(cx+cn.x(), cy+cn.y(), cz);
-
- // 3) start with a unit focal length and position the camera
- vpgl_calibration_matrix<double> K(1.0, vgl_point_2d<double>(ni/2, nj/2));
- vgl_rotation_3d<double> R;
- auto* cam =
- new vpgl_perspective_camera<double>(K, cent, R);
-
- //stare at the center of the scene
- vgl_vector_3d<double> up(0.0, 1.0, 0.0);
- if (std::fabs(el)<1.0e-3)
- cam->look_at(stpt, up);
- else
- cam->look_at(stpt);
-
- //4) Adjust the focal length so that the box projects into the image
- // project the bounding box
- vgl_box_2d<double> image_bb = bpgl_project::project_bounding_box(*cam, bb);
- // get 2-d box diameter and image diameter
- double bw = image_bb.width(), bh = image_bb.height();
- double bd = std::sqrt(bw*bw + bh*bh);
- double id = std::sqrt(dni*dni + dnj*dnj);
- //find the adjusted focal length
- double f = id/bd;
- K.set_focal_length(f);
- cam->set_calibration(K);
-
- std::cout<<"Camera :" <<*cam<<std::endl;
- pro.set_output_val<vpgl_camera_double_sptr>(0, cam);
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/pro/processes/boxm_clean_scene_process.cxx b/contrib/brl/bseg/boxm/pro/processes/boxm_clean_scene_process.cxx
deleted file mode 100644
index 82051affab..0000000000
--- a/contrib/brl/bseg/boxm/pro/processes/boxm_clean_scene_process.cxx
+++ /dev/null
@@ -1,102 +0,0 @@
-//This is brl/bseg/boxm/pro/processes/boxm_clean_scene_process.cxx
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-//:
-// \file
-// \brief A process for removing any previously created scene data from disk
-//
-// \author Daniel Crispell
-// \date Feb 18, 2010
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <boxm/boxm_scene_parser.h>
-
-//:global variables
-namespace boxm_clean_scene_process_globals
-{
- //this process takes no inputs
- constexpr unsigned int n_inputs_ = 1;
- constexpr unsigned int n_outputs_ = 0;
-}
-
-//:sets input and output types
-bool boxm_clean_scene_process_cons(bprb_func_process& pro)
-{
- //set output types
- using namespace boxm_clean_scene_process_globals;
- //process takes 1 input
- //input[0]: The scene
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- if (!pro.set_input_types(input_types_))
- return false;
-
- return true;
-}
-
-//: removes data previously associated with scene
-bool boxm_clean_scene_process(bprb_func_process& pro)
-{
- using namespace boxm_clean_scene_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << "boxm_clean_scene_process: The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get inputs:
- unsigned i = 0;
- boxm_scene_base_sptr scene = pro.get_input<boxm_scene_base_sptr>(i++);
-
- // check the input validity
- if (scene == nullptr) {
- std::cout << "boxm_clean_scene_process: scene is null, cannot run" << std::endl;
- return false;
- }
-
- switch (scene->appearence_model())
- {
- case BOXM_APM_MOG_GREY:
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- s->clean_scene();
- break;
- }
- case BOXM_APM_SIMPLE_GREY:
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- s->clean_scene();
- break;
- }
- case BOXM_APM_MOB_GREY:
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOB_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- s->clean_scene();
- break;
- }
- default:
- std::cout << "boxm_clean_scene_process: undefined APM type" << std::endl;
- return false;
- }
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/pro/processes/boxm_construct_scene_from_image_process.cxx b/contrib/brl/bseg/boxm/pro/processes/boxm_construct_scene_from_image_process.cxx
deleted file mode 100644
index 0129877c53..0000000000
--- a/contrib/brl/bseg/boxm/pro/processes/boxm_construct_scene_from_image_process.cxx
+++ /dev/null
@@ -1,219 +0,0 @@
-// This is brl/bseg/boxm/pro/processes/boxm_construct_scene_from_image_process.cxx
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief Process to construct an ideal scene for testing
-//
-// \author J.L. Mundy
-// \date January 23, 2010
-// \verbatim
-// Modifications
-// \endverbatim
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <boxm/sample/boxm_sample.h>
-#include <vil/vil_convert.h>
-#include <vil/vil_image_view_base.h>
-#include <vil/vil_image_view.h>
-#include <vgl/vgl_box_3d.h>
-
-namespace boxm_construct_scene_from_image_process_globals
-{
- // The image area should be a multiple of area unit, e.g. 64.
- // This granularity is useful for parallel implementation
- template <class T>
- void tree_from_image(vil_image_view<float> const& image,
- unsigned area_unit,
- unsigned& base_ni, unsigned& base_nj,
- boct_tree<short, T >*& tree)
- {
- tree = nullptr;
- unsigned ni = image.ni(), nj = image.nj();
- // find a square arrangement consistent with area unit
- auto gsize = static_cast<double>(area_unit);
- auto gwidth = static_cast<unsigned>(std::sqrt(gsize));
- unsigned gheight = area_unit/gwidth;
- if (gwidth*gheight!=gsize)
- return;//maybe fixup later to handle all situations
- unsigned mni = (ni/gwidth)*gwidth, mnj = (nj/gheight)*gheight;
- double min_dim = mni;
- if (mnj<min_dim)
- min_dim = mnj;
- double dlev = std::log(min_dim)/std::log(2.0);
- auto n_levels = static_cast<unsigned>(dlev+1.0);
-
- //note that tree is being constructed in local coordinates
- float rni = 1.0f/static_cast<float>(mni), rnj =1.0f/static_cast<float>(mnj);
- base_ni = mni; base_nj = mnj;
- std::vector<boct_loc_code<short> > leaf_codes;
- std::vector<float> image_int;
- float upper_v=float(mnj-1)*rnj;
- for (unsigned j=0; j<mnj; ++j)
- for (unsigned i=0; i<mni; ++i)
- {
- float u = static_cast<float>(i)*rni;
- float v = upper_v-static_cast<float>(j)*rnj;
- vgl_point_3d<double> p(u, v, 0.0f);
- boct_loc_code<short> loc(p, n_levels-1);
- leaf_codes.push_back(loc);
- image_int.push_back(image(i,j));
- }
- //construct leaves
- std::vector<boct_tree_cell<short, T > > leaves;
- for (auto & leaf_code : leaf_codes) {
- boct_tree_cell<short, T > leaf(leaf_code);
- leaves.push_back(leaf);
- }
-
- //construct tree from leaves
- auto *init_tree =
- new boct_tree<short, T >(n_levels, 0);
- boct_tree_cell<short, T > *root =
- init_tree->construct_tree(leaves, init_tree->number_levels());
-
- // construct full tree with leaves and root
- //set the global bounding box, assuming a box with depth ni
- vgl_box_3d<double> box;
- vgl_point_3d<double> p0(0,0,0);
- vgl_point_3d<double> p1(mni, mnj, mni);
- box.add(p0); box.add(p1);
- tree = new boct_tree<short, T >(root, init_tree->number_levels());
- tree->set_bbox(box);
- delete init_tree;
-
- // fill the leaves with data
- std::vector<boct_tree_cell<short, T >* > tleaves;
- tleaves = tree->leaf_cells();
- std::size_t i = 0;
- auto lit =
- tleaves.begin();
- for (; lit!= tleaves.end(); ++lit, ++i)
- {
- boct_loc_code<short> code = (*lit)->get_code();
- bool found = false;
- unsigned found_k = 0;
- for (unsigned k = 0; k<leaf_codes.size()&&!found; ++k)
- if (code == leaf_codes[k]) {
- found = true;
- found_k = k;
- }
- if (auto * cell_grey_ptr = reinterpret_cast<boct_tree_cell<short, boxm_sample<BOXM_APM_SIMPLE_GREY> >* >(*lit))
- {
- if (found) {
- boxm_sample<BOXM_APM_SIMPLE_GREY> data(1.0f,boxm_sample<BOXM_APM_SIMPLE_GREY>::apm_datatype(image_int[found_k],0.0008f));
- cell_grey_ptr->set_data(data);
- }
- else {
- boxm_sample<BOXM_APM_SIMPLE_GREY> data(0.0f,boxm_sample<BOXM_APM_SIMPLE_GREY>::apm_datatype(0.0f,0.0008f));
- cell_grey_ptr->set_data(data);
- }
- }
- else if (auto * cell_mog_grey_ptr = reinterpret_cast<boct_tree_cell<short, boxm_sample<BOXM_APM_MOG_GREY> >* >(*lit))
- {
- if (found) {
- boxm_sample<BOXM_APM_MOG_GREY> data(1.0f);
- typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_processor aproc;
- aproc::update(data.appearance(),image_int[found_k],1.0);
- cell_mog_grey_ptr->set_data(data);
- }
- else {
- boxm_sample<BOXM_APM_MOG_GREY> data(0.0f);
- cell_mog_grey_ptr->set_data(data);
- }
- }
- else if (auto * cell_float_ptr
- =reinterpret_cast<boct_tree_cell<short, float >* >(*lit))
- {
- if (found) {
- float data(1.0f);
- cell_float_ptr->set_data(data);
- }
- }
- }
- }
- constexpr unsigned n_inputs_ = 4;
- constexpr unsigned n_outputs_ = 1;
-}
-
-bool boxm_construct_scene_from_image_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_construct_scene_from_image_process_globals;
-
- //input[0]: The image view
- //input[1]: appearance model type
- //input[2]: scene directory
- //input[3]: scene xml path
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vil_image_view_base_sptr";
- input_types_[1] = "vcl_string";
- input_types_[2] = "vcl_string";
- input_types_[3] = "vcl_string";
-
- //output[0]: The scene
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0]= "boxm_scene_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_construct_scene_from_image_process(bprb_func_process& pro)
-{
- using namespace boxm_construct_scene_from_image_process_globals;
-
- if ( !pro.verify_inputs()){
- std::cerr << pro.name() << "boxm_construct_scene_from_image_process: invalid inputs\n";
- return false;
- }
-
- //get inputs:
- unsigned i = 0;
- vil_image_view_base_sptr image = pro.get_input<vil_image_view_base_sptr>(i++);
- std::string app_type = pro.get_input<std::string>(i++);
- std::string scene_dir = pro.get_input<std::string>(i++);
- std::string xml_path = pro.get_input<std::string>(i++);
- if (image == nullptr) {
- std::cerr << "boxm_construct_scene_from_image_process: null image value, cannot run\n";
- return false;
- }
-
- vil_image_view<float> img = *vil_convert_cast(float(), image);
- if (image->pixel_format() == VIL_PIXEL_FORMAT_BYTE)
- vil_math_scale_values(img,1.0/255.0);
-
- unsigned base_ni =0, base_nj=0;
- std::string block_prefix = "ideal";
- boxm_scene_base_sptr scene_base = nullptr;
- if (app_type == "simple_grey")
- {
- typedef boxm_sample<BOXM_APM_SIMPLE_GREY> data_type;
- boct_tree<short, data_type>* tree = nullptr;
- tree_from_image<data_type>(img, 16, base_ni, base_nj,tree);
- if (tree == nullptr) return false;
- boxm_block<boct_tree<short, data_type> >* blk =
- new boxm_block<boct_tree<short, data_type> >(tree->bounding_box(), tree);
- vgl_box_3d<double> bb = blk->bounding_box();
- vgl_point_3d<double> origin(0,0,0);
- vgl_vector_3d<double> block_dim(bb.width(),bb.height(),bb.depth());
- vgl_vector_3d<unsigned> world_dim(1,1,1);
- auto* scene
- = new boxm_scene<boct_tree<short, data_type> >(origin, block_dim, world_dim);
- scene->set_appearance_model(BOXM_APM_SIMPLE_GREY);
- scene->set_block(vgl_point_3d<int>(0,0,0), blk);
- scene->set_path(scene_dir, block_prefix);
- scene->write_scene(xml_path);
- scene->write_active_block();
- scene_base = scene;
- }
- pro.set_output_val<boxm_scene_base_sptr>(0, scene_base);
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/pro/processes/boxm_create_scene_process.cxx b/contrib/brl/bseg/boxm/pro/processes/boxm_create_scene_process.cxx
deleted file mode 100644
index d2abb94b67..0000000000
--- a/contrib/brl/bseg/boxm/pro/processes/boxm_create_scene_process.cxx
+++ /dev/null
@@ -1,218 +0,0 @@
-//This is brl/bseg/boxm/pro/processes/boxm_create_scene_process.cxx
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-//:
-// \file
-// \brief A process for creating a new boxm_scene when there is not a saved one.
-// It receives the parameters from a parameter file in XML
-//
-// \author Gamze Tunali
-// \date Apr 21, 2009
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_scene_parser.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-#include <boxm/sample/boxm_scalar_sample.h>
-
-//:global variables
-namespace boxm_create_scene_process_globals
-{
- //this process takes no inputs
- constexpr unsigned n_inputs_ = 1;
- constexpr unsigned n_outputs_ = 1;
-}
-
-//:sets input and output types
-bool boxm_create_scene_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_create_scene_process_globals;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vcl_string";
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-//:creates a scene from parameters
-bool boxm_create_scene_process(bprb_func_process& pro)
-{
- using namespace boxm_create_scene_process_globals;
- std::string fname = pro.get_input<std::string>(0);
-
- boxm_scene_parser parser;
-
- boxm_scene_base_sptr scene_ptr=new boxm_scene_base();
- scene_ptr->load_scene(fname, parser);
- std::cout << "Scene path: " << scene_ptr->filename()<< '\n'
- << "Scene appearance: " <<scene_ptr->appearence_model()<< std::endl;
-
- if (scene_ptr->appearence_model() == BOXM_APM_MOG_GREY) {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(parser);
- scene_ptr = scene;
- }
- else {
- typedef boct_tree<short,boxm_sample_multi_bin<BOXM_APM_MOG_GREY> > tree_type;
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(parser);
- std::cout<<"Multi Bin set"<<std::endl;
- scene_ptr = scene;
- }
- }
- else if (scene_ptr->appearence_model() == BOXM_APM_MOB_GREY) {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short,boxm_sample<BOXM_APM_MOB_GREY> > tree_type;
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(parser);
- scene_ptr = scene;
- }
- else {
- std::cout<<"Multi Bin for BOXM_APM_MOB_GREY is not defined yet"<<std::endl;
- }
- }
- else if (scene_ptr->appearence_model() == BOXM_APM_SIMPLE_GREY) {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short,boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(parser);
- scene_ptr = scene;
- }
-#if 0
- else {
- typedef boct_tree<short,boxm_sample_multi_bin<BOXM_APM_SIMPLE_GREY> > tree_type;
- boxm_scene<tree_type>* scene = new boxm_scene<tree_type>();
- scene->load_scene(fname);
- std::cout<<"Multi Bin set"<<std::endl;
- scene_ptr = scene;
- }
-#endif
- }
- else if (scene_ptr->appearence_model() == BOXM_FLOAT) {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short,float> tree_type;
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(fname);
- scene_ptr = scene;
- std::cout << "Scene path: " << scene->filename()<< std::endl;
- }
- }
- else if (scene_ptr->appearence_model() == VNL_FLOAT_3) {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short,vnl_vector_fixed<float, 3> > tree_type;
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(fname);
- scene_ptr = scene;
- std::cout << "Loading scene of type vnl_float_3" << '\n'
- << "Scene path: " << scene->filename()<< std::endl;
- }
- }
- else if (scene_ptr->appearence_model() == VNL_FLOAT_10) {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short,vnl_vector_fixed<float, 10> > tree_type;
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(fname);
- scene_ptr = scene;
- std::cout << "Loading scene of type vnl_float_10" << '\n'
- << "Scene path: " << scene->filename()<< std::endl;
- }
- }
- else if (scene_ptr->appearence_model() == BOXM_BOOL) {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short,bool> tree_type;
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(fname);
- scene_ptr = scene;
- std::cout << "Scene path: " << scene->filename()<< std::endl;
- }
- }
- else if (scene_ptr->appearence_model() == BSTA_MOG_F1) {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short,boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype > tree_type;
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(parser);
- scene_ptr = scene;
- }
- }
- else if (scene_ptr->appearence_model() == BSTA_GAUSS_F1) {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short,bsta_num_obs<bsta_gauss_sf1> > tree_type;
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(parser);
- scene_ptr = scene;
- }
- }
- else if (scene_ptr->appearence_model() == BOXM_EDGE_FLOAT) {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short,boxm_edge_sample<float> > tree_type;
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(parser);
- scene_ptr = scene;
- }
- }
- else if (scene_ptr->appearence_model() == BOXM_EDGE_LINE) {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short,boxm_inf_line_sample<float> > tree_type;
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(parser);
- scene_ptr = scene;
- }
- }
- else if (scene_ptr->appearence_model() == BOXM_EDGE_TANGENT_LINE) {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short,boxm_edge_tangent_sample<float> > tree_type;
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(parser);
- scene_ptr = scene;
- }
- }
- else if (scene_ptr->appearence_model() == BOXM_SCALAR_FLOAT) {
- typedef boct_tree<short, boxm_scalar_sample<float> > tree_type;
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(parser);
- scene_ptr = scene;
- }
- else {
- std::cerr << "boxm_create_scene_process: undefined APM type\n";
- return false;
- }
-
- //store output
- pro.set_output_val<boxm_scene_base_sptr>(0, scene_ptr);
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/pro/processes/boxm_force_write_blocks_process.cxx b/contrib/brl/bseg/boxm/pro/processes/boxm_force_write_blocks_process.cxx
deleted file mode 100644
index dba8e9687e..0000000000
--- a/contrib/brl/bseg/boxm/pro/processes/boxm_force_write_blocks_process.cxx
+++ /dev/null
@@ -1,102 +0,0 @@
-//This is brl/bseg/boxm/pro/processes/boxm_force_write_blocks_process.cxx
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-//:
-// \file
-// \brief A process for removing any previously created scene data from disk
-//
-// \author Daniel Crispell
-// \date Feb 18, 2010
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <boxm/boxm_scene_parser.h>
-
-//:global variables
-namespace boxm_force_write_blocks_process_globals
-{
- //this process takes no inputs
- constexpr unsigned int n_inputs_ = 1;
- constexpr unsigned int n_outputs_ = 0;
-}
-
-//:sets input and output types
-bool boxm_force_write_blocks_process_cons(bprb_func_process& pro)
-{
- //set output types
- using namespace boxm_force_write_blocks_process_globals;
- //process takes 1 input
- //input[0]: The scene
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- if (!pro.set_input_types(input_types_))
- return false;
-
- return true;
-}
-
-//: removes data previously associated with scene
-bool boxm_force_write_blocks_process(bprb_func_process& pro)
-{
- using namespace boxm_force_write_blocks_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << "boxm_force_write_blocks_process: The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get inputs:
- unsigned i = 0;
- boxm_scene_base_sptr scene = pro.get_input<boxm_scene_base_sptr>(i++);
-
- // check the input validity
- if (scene == nullptr) {
- std::cout << "boxm_force_write_blocks_process: scene is null, cannot run" << std::endl;
- return false;
- }
-
- switch (scene->appearence_model())
- {
- case BOXM_APM_MOG_GREY:
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- s->force_write_blocks();
- break;
- }
- case BOXM_APM_SIMPLE_GREY:
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- s->force_write_blocks();
- break;
- }
- case BOXM_APM_MOB_GREY:
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOB_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- s->force_write_blocks();
- break;
- }
- default:
- std::cout << "boxm_force_write_blocks_process: undefined APM type" << std::endl;
- return false;
- }
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/pro/processes/boxm_load_scene_process.cxx b/contrib/brl/bseg/boxm/pro/processes/boxm_load_scene_process.cxx
deleted file mode 100644
index 59808debc7..0000000000
--- a/contrib/brl/bseg/boxm/pro/processes/boxm_load_scene_process.cxx
+++ /dev/null
@@ -1,73 +0,0 @@
-// This is brl/bseg/boxm/pro/processes/boxm_load_scene_process.cxx
-//:
-// \file
-// \brief A class for obtaining roc curve from change detection results.
-//
-// \author Gamze Tunali
-// \date April 14, 2009
-
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_scene_parser.h>
-
-namespace boxm_load_scene_process_globals
-{
- constexpr unsigned n_inputs_ = 1;
- constexpr unsigned n_outputs_ = 1;
-}
-
-bool boxm_load_scene_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_load_scene_process_globals;
-
- //process takes 1 input
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vcl_string";
-
- // process has 1 output:
- // output[0]: scene sptr
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_load_scene_process(bprb_func_process& pro)
-{
- using namespace boxm_load_scene_process_globals;
-
- if ( pro.n_inputs() < n_inputs_ ){
- std::cout << pro.name() << ": The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- //get the inputs
- unsigned i = 0;
- std::string scene_file = pro.get_input<std::string>(i++);
-
- boxm_scene_base_sptr scene= new boxm_scene_base();
- boxm_scene_parser parser;
- scene->load_scene(scene_file, parser);
- if (scene->appearence_model() == BOXM_APM_MOG_GREY) {
- typedef boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto *s = new boxm_scene<tree_type>();
- s->load_scene(parser);
- // scene.unref(scene);
- scene = s;
- } else {
- std::cout << "boxm_load_scene_process: undefined APM type" << std::endl;
- return false;
- }
-
- unsigned j = 0;
- // store scene smaprt pointer
- pro.set_output_val<boxm_scene_base_sptr>(j++, scene);
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/pro/processes/boxm_proj_local_cam_process.cxx b/contrib/brl/bseg/boxm/pro/processes/boxm_proj_local_cam_process.cxx
deleted file mode 100644
index b250a33a61..0000000000
--- a/contrib/brl/bseg/boxm/pro/processes/boxm_proj_local_cam_process.cxx
+++ /dev/null
@@ -1,103 +0,0 @@
-// This is brl/bseg/boxm/pro/processes/boxm_proj_local_cam_process.cxx
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A class for clipping and image based on a 3D bounding box.
-// - Input:
-// - Image path (string)
-// - boxm_voxel_world_sptr
-//
-// - Output:
-// - modified rational camera "vpgl_camera_double_sptr"
-// - clipped image area (NITF) "vil_image_view_base_sptr"
-//
-// - Params:
-// -geographic uncertainty (error) in meters
-//
-// \author Gamze D. Tunali
-// \date Feb 19, 2008
-// \verbatim
-// Modifications
-// Brandon Mayer - Jan 28, 2009 - converted process-class to function to conform with new boxm_process architecture.
-// \endverbatim
-
-
-#include <brip/brip_roi.h>
-
-//#include <vil/file_formats/vil_nitf2_image.h> // unused?
-//#include <vil/vil_image_view_base.h> // unused?
-#include <vpgl/vpgl_local_rational_camera.h>
-
-#include <bprb/bprb_parameters.h>
-
-//: globals variables and functions
-namespace boxm_proj_local_cam_process_globals
-{
- constexpr unsigned n_inputs_ = 4;
- constexpr unsigned n_outputs_ = 2;
-}
-
-//: set input and output types
-// this process takes 4 inputs:
-// the camera and the (x,y,z) input coordinates
-// this process takes 2 outputs:
-// the (u,v) output coordinates
-bool boxm_proj_local_cam_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_proj_local_cam_process_globals;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i=0;
- input_types_[i++] = "vpgl_camera_double_sptr"; // rational camera
- input_types_[i++] = "float"; // x
- input_types_[i++] = "float"; // y
- input_types_[i++] = "float"; // z
-
- std::vector<std::string> output_types_(n_outputs_);
- unsigned j=0;
- output_types_[j++] = "float"; // u
- output_types_[j++] = "float"; // v
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-bool boxm_proj_local_cam_process(bprb_func_process& pro)
-{
- using namespace boxm_proj_local_cam_process_globals;
- //static const parameters
- static const std::string error = "error";
-
- if ( pro.n_inputs() < n_inputs_ ) {
- std::cout << pro.name() << " The input number should be " << n_inputs_<< std::endl;
- return false;
- }
-
- // get the inputs:
- unsigned i = 0;
- // camera
- vpgl_camera_double_sptr camera = pro.get_input<vpgl_camera_double_sptr>(i++);
- float X=0.0,Y=0.0,Z=0.0;
- //voxel_world
- X = pro.get_input<float>(i++);
- Y = pro.get_input<float>(i++);
- Z = pro.get_input<float>(i++);
-
- auto* rat_camera =
- dynamic_cast<vpgl_local_rational_camera<double>*> (camera.as_pointer());
- if (!rat_camera) {
- std::cerr << "The camera input is not a rational camera\n";
- return false;
- }
-
- double u=0,v=0;
- rat_camera->project((double)X,(double)Y,(double)Z,u,v);
- //Store outputs
- unsigned j = 0;
- // update the camera and store
- pro.set_output_val<float>(j++, float(u));
- pro.set_output_val<float>(j++, float(v));
-
- std::cout<<"(u,v):"<<u<<','<<v<<std::endl;
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/pro/processes/boxm_upload_mesh_process.cxx b/contrib/brl/bseg/boxm/pro/processes/boxm_upload_mesh_process.cxx
deleted file mode 100644
index 0488a2cbdb..0000000000
--- a/contrib/brl/bseg/boxm/pro/processes/boxm_upload_mesh_process.cxx
+++ /dev/null
@@ -1,148 +0,0 @@
-//This is brl/bseg/boxm/pro/processes/boxm_upload_mesh_process.cxx
-#include <string>
-#include <iostream>
-#include <sstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A process for populating the octree with meshes.
-// Meshes are in ply format and the grid will be filled with 0's at the faces
-// of the meshes.
-// \author Gamze D. Tunali
-// \date July 14, 2009
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bprb/bprb_parameters.h>
-
-#include <boxm/boxm_apm_traits.h>
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/algo/boxm_upload_mesh.h>
-#include <boxm/algo/boxm_fill_in_mesh.h>
-#include <boxm/util/boxm_utils.h>
-#include <boxm/boxm_scene.h>
-#include <boct/boct_tree.h>
-#include <vul/vul_file_iterator.h>
-#include <vul/vul_file.h>
-#include <vul/vul_string.h>
-
-#include <imesh/imesh_mesh.h>
-#include <imesh/imesh_fileio.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-namespace boxm_upload_mesh_process_globals
-{
- constexpr unsigned n_inputs_ = 4;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//: set input and output types
-bool boxm_upload_mesh_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_upload_mesh_process_globals;
-
- // process takes 4 inputs and no output
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i=0;
- input_types_[i++]="vcl_string"; //the directory for ply files
- input_types_[i++]="boxm_scene_base_sptr"; //scene to be uploaded
- input_types_[i++]="bool"; //true, if mesh vertices are in geo coordinates
- input_types_[i++]="vcl_string"; //true, if mesh vertices are in geo coordinates
-
- std::vector<std::string> output_types_(n_outputs_);
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//: Execute the process
-bool boxm_upload_mesh_process(bprb_func_process& pro)
-{
- using namespace boxm_upload_mesh_process_globals;
- // check number of inputs
- if (pro.input_types().size() != n_inputs_)
- {
- std::cout << pro.name() << "The number of inputs should be " << n_inputs_ << std::endl;
- return false;
- }
-
- unsigned i=0;
- std::string input_path = pro.get_input<std::string>(i++);
- boxm_scene_base_sptr scene = pro.get_input<boxm_scene_base_sptr>(i++);
- bool use_lvcs = pro.get_input<bool>(i++);
- std::string draw_or_fill = pro.get_input<std::string>(i++);
-
- if (!vul_file::is_directory(input_path)) {
- std::cerr << "In boxm_upload_mesh_process -- input path " << input_path<< "is not valid!\n";
- return false;
- }
-
- // get all the files in the directory
- std::stringstream glob;
- glob << input_path << "/*.ply*";
-
- std::vector<imesh_mesh> meshes;
- for (vul_file_iterator file_it = glob.str().c_str(); file_it; ++file_it)
- {
- std::string file(file_it());
- std::string file_format = vul_file::extension(file);
- vul_string_upcase(file_format);
-
-
- std::cout << "format = " << file_format << '\n'
- << "file = " << file << '\n';
- // call appropriate load functions to load the M
- imesh_mesh mesh;
- if (file_format == ".PLY")
- imesh_read(file, mesh);
- else if (file_format == ".PLY2")
- imesh_read_ply2(file, mesh);
-
- meshes.push_back(mesh);
- }
- if (scene->appearence_model() == BOXM_APM_MOG_GREY) {
- if (!scene->multi_bin())
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
-
- boxm_sample<BOXM_APM_MOG_GREY> val(0,boxm_utils::obtain_mog_grey_unit_mode());
- if (draw_or_fill=="draw")
- std::cout<<"Not yet";
- //boxm_upload_mesh_into_scene<short, boxm_sample<BOXM_APM_MOG_GREY> >(*s, mesh, use_lvcs, val);
- else if (draw_or_fill=="fill")
- boxm_fill_in_mesh_into_scene<short, boxm_sample<BOXM_APM_MOG_GREY> >(*s, meshes, use_lvcs, val);
- }
- else
- std::cout << "boxm_upload_mesh_process: multi bin is not implemented yet" << std::endl;
- }
- if (scene->appearence_model() == BOXM_APM_SIMPLE_GREY) {
- if (!scene->multi_bin())
- {
- typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
- auto *s = static_cast<boxm_scene<tree_type>*> (scene.as_pointer());
- boxm_simple_grey simplegrey(1.0f,0.1f,1.0f);
- boxm_sample<BOXM_APM_SIMPLE_GREY> val(1,simplegrey);
- if (draw_or_fill=="draw")
- std::cout<<"Not yet";
- //boxm_upload_mesh_into_scene<short, boxm_sample<BOXM_APM_MOG_GREY> >(*s, mesh, use_lvcs, val);
- else if (draw_or_fill=="fill")
- boxm_fill_in_mesh_into_scene<short, boxm_sample<BOXM_APM_SIMPLE_GREY> >(*s, meshes, use_lvcs, val);
- }
- else
- std::cout << "boxm_upload_mesh_process: multi bin is not implemented yet" << std::endl;
- }
- else {
- std::cout << "boxm_upload_mesh_process: undefined APM type" << std::endl;
- return false;
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/pro/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/pro/tests/CMakeLists.txt
deleted file mode 100644
index f37ad237ce..0000000000
--- a/contrib/brl/bseg/boxm/pro/tests/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-add_executable( boxm_pro_test_include test_include.cxx )
-target_link_libraries( boxm_pro_test_include boxm_pro)
diff --git a/contrib/brl/bseg/boxm/pro/tests/test_include.cxx b/contrib/brl/bseg/boxm/pro/tests/test_include.cxx
deleted file mode 100644
index 7a3d47df60..0000000000
--- a/contrib/brl/bseg/boxm/pro/tests/test_include.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/pro/boxm_processes.h>
-#include <boxm/pro/boxm_register.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm/sample/CMakeLists.txt b/contrib/brl/bseg/boxm/sample/CMakeLists.txt
deleted file mode 100644
index 42618cc7ca..0000000000
--- a/contrib/brl/bseg/boxm/sample/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# brl/bseg/boxm/sample/CMakeLists.txt
-include_directories( ${MUL_INCLUDE_DIR} )
-set(boxm_sample_sources
- boxm_edge_sample.h boxm_edge_sample.hxx
- boxm_edge_tangent_sample.h boxm_edge_tangent_sample.hxx
- boxm_inf_line_sample.h boxm_inf_line_sample.hxx
- boxm_opt2_sample.h boxm_opt2_sample.hxx
- boxm_opt3_sample.h boxm_opt3_sample.hxx
- boxm_plane_obs.h boxm_plane_obs.hxx
- boxm_rt_sample.h boxm_rt_sample.hxx
- boxm_sample.h boxm_sample.hxx
- boxm_sample_multi_bin.h boxm_sample_multi_bin.hxx
- boxm_scalar_sample.h boxm_scalar_sample.hxx
- boxm_vis_implicit_sample.h
- boxm_update_sample.h
- dummy.cxx
- )
-
-aux_source_directory(Templates boxm_sample_sources)
-
-vxl_add_library(LIBRARY_NAME boxm_sample LIBRARY_SOURCES ${boxm_sample_sources})
-target_link_libraries(boxm_sample boxm ${VXL_LIB_PREFIX}vgl_io bsta ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vsl ${VXL_LIB_PREFIX}vcl)
-
-if( BUILD_TESTING )
- add_subdirectory(tests)
-endif()
-
-#processors for the samples
-add_subdirectory(algo)
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_edge_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_edge_sample+float--.cxx
deleted file mode 100644
index a08cc93e31..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_edge_sample+float--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_edge_sample.h>
-
-BOCT_TREE_INSTANTIATE(short,boxm_edge_sample<float>);
-BOCT_TREE_INSTANTIATE(short,boxm_aux_edge_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_edge_tangent_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_edge_tangent_sample+float--.cxx
deleted file mode 100644
index 130866a26d..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_edge_tangent_sample+float--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-
-BOCT_TREE_INSTANTIATE(short,boxm_edge_tangent_sample<float>);
-BOCT_TREE_INSTANTIATE(short,boxm_inf_line_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_opt2_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_opt2_sample+float--.cxx
deleted file mode 100644
index 8d3ee3d65a..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_opt2_sample+float--.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_opt2_sample.h>
-
-BOCT_TREE_INSTANTIATE(short,boxm_opt2_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_rt_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_rt_sample+float--.cxx
deleted file mode 100644
index ca506845c1..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_rt_sample+float--.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_rt_sample.h>
-
-BOCT_TREE_INSTANTIATE(short,boxm_rt_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx
deleted file mode 100644
index c1d7480b1c..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boct/boct_tree.hxx>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.h>
-
-BOCT_TREE_INSTANTIATE(short, boxm_sample<BOXM_APM_MOB_GREY>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx
deleted file mode 100644
index 5eaa3da056..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <boct/boct_tree.hxx>
-#include <bsta/io/bsta_io_mixture_fixed.h>
-#include <bsta/io/bsta_io_gaussian_sphere.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.h>
-
-// tree with alpha and appearance combined
-BOCT_TREE_INSTANTIATE(short, boxm_sample<BOXM_APM_MOG_GREY>);
-
-// tree with appearance
-typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype apm_datatype;
-BOCT_TREE_INSTANTIATE(short, apm_datatype);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx
deleted file mode 100644
index ef07d67c7a..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <boct/boct_tree.hxx>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.h>
-
-BOCT_TREE_INSTANTIATE(short, boxm_sample<BOXM_APM_SIMPLE_GREY>);
-
-// tree with appearance
-typedef boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype apm_datatype;
-BOCT_TREE_INSTANTIATE(short, apm_datatype);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx
deleted file mode 100644
index b45fc2a401..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boct/boct_tree.hxx>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-
-BOCT_TREE_INSTANTIATE(short, boxm_sample_multi_bin<BOXM_APM_MOG_GREY>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_scalar_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_scalar_sample+float--.cxx
deleted file mode 100644
index 7c93436b6a..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree+short.boxm_scalar_sample+float--.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_scalar_sample.h>
-
-BOCT_TREE_INSTANTIATE(short,boxm_scalar_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_edge_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_edge_sample+float--.cxx
deleted file mode 100644
index 8c4d0a0f82..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_edge_sample+float--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boct/boct_tree_cell.hxx>
-#include <boxm/sample/boxm_edge_sample.h>
-
-BOCT_TREE_CELL_INSTANTIATE(short,boxm_edge_sample<float>);
-BOCT_TREE_CELL_INSTANTIATE(short,boxm_aux_edge_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_edge_tangent_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_edge_tangent_sample+float--.cxx
deleted file mode 100644
index 55b487a7aa..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_edge_tangent_sample+float--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boct/boct_tree_cell.hxx>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-
-BOCT_TREE_CELL_INSTANTIATE(short,boxm_edge_tangent_sample<float>);
-BOCT_TREE_CELL_INSTANTIATE(short,boxm_inf_line_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_opt2_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_opt2_sample+float--.cxx
deleted file mode 100644
index 39216280e0..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_opt2_sample+float--.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boct/boct_tree_cell.hxx>
-#include <boxm/sample/boxm_opt2_sample.h>
-
-BOCT_TREE_CELL_INSTANTIATE(short,boxm_opt2_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_rt_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_rt_sample+float--.cxx
deleted file mode 100644
index 3d0b6e71a5..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_rt_sample+float--.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boct/boct_tree_cell.hxx>
-#include <boxm/sample/boxm_rt_sample.h>
-
-BOCT_TREE_CELL_INSTANTIATE(short,boxm_rt_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx
deleted file mode 100644
index 9a5432b934..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boct/boct_tree_cell.hxx>
-#include "boxm/boxm_apm_traits.h"
-#include "boxm/sample/boxm_sample.h"
-
-typedef boxm_sample<BOXM_APM_MOB_GREY> boxm_sample_mob_grey;
-BOCT_TREE_CELL_INSTANTIATE(short,boxm_sample_mob_grey );
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx
deleted file mode 100644
index 58cc1cfacf..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <bsta/io/bsta_io_mixture_fixed.h>
-#include <bsta/io/bsta_io_gaussian_sphere.h>
-#include <boct/boct_tree_cell.hxx>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.h>
-
-typedef boxm_sample<BOXM_APM_MOG_GREY> boxm_sample_mog_grey;
-BOCT_TREE_CELL_INSTANTIATE(short,boxm_sample_mog_grey );
-
-typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype apm_datatype;
-BOCT_TREE_CELL_INSTANTIATE(short,apm_datatype );
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx
deleted file mode 100644
index 28198f869f..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample+BOXM_APM_SIMPLE_GREY--.cxx
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <boct/boct_tree_cell.hxx>
-#include "boxm/boxm_apm_traits.h"
-#include "boxm/sample/boxm_sample.h"
-
-typedef boxm_sample<BOXM_APM_SIMPLE_GREY> boxm_sample_simple_grey;
-BOCT_TREE_CELL_INSTANTIATE(short,boxm_sample_simple_grey );
-
-// tree with appearance
-typedef boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype apm_datatype;
-BOCT_TREE_CELL_INSTANTIATE(short, apm_datatype);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx
deleted file mode 100644
index 1b9ee1e0de..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boct/boct_tree_cell.hxx>
-#include "boxm/boxm_apm_traits.h"
-#include "boxm/sample/boxm_sample_multi_bin.h"
-
-typedef boxm_sample_multi_bin<BOXM_APM_MOG_GREY> boxm_sample_mog_grey;
-BOCT_TREE_CELL_INSTANTIATE(short,boxm_sample_mog_grey );
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_scalar_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_scalar_sample+float--.cxx
deleted file mode 100644
index 78c61bf35e..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell+short.boxm_scalar_sample+float--.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boct/boct_tree_cell.hxx>
-#include <boxm/sample/boxm_scalar_sample.h>
-
-BOCT_TREE_CELL_INSTANTIATE(short,boxm_scalar_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_edge_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_edge_sample+float--.cxx
deleted file mode 100644
index 13ae4934e9..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_edge_sample+float--.cxx
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <boct/boct_tree_cell_reader.hxx>
-#include <boxm/sample/boxm_edge_sample.h>
-
-typedef boxm_edge_sample<float> sample;
-BOCT_TREE_CELL_READER_INSTANTIATE(short,sample);
-
-typedef boxm_aux_edge_sample<float> aux_sample;
-BOCT_TREE_CELL_READER_INSTANTIATE(short,aux_sample);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_edge_tangent_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_edge_tangent_sample+float--.cxx
deleted file mode 100644
index 3744b8ee6f..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_edge_tangent_sample+float--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boct/boct_tree_cell_reader.hxx>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-
-typedef boxm_edge_tangent_sample<float> aux_sample;
-BOCT_TREE_CELL_READER_INSTANTIATE(short,aux_sample);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_inf_line_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_inf_line_sample+float--.cxx
deleted file mode 100644
index 08ad36f2ea..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_inf_line_sample+float--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boct/boct_tree_cell_reader.hxx>
-#include <boxm/sample/boxm_inf_line_sample.h>
-
-typedef boxm_inf_line_sample<float> sample;
-BOCT_TREE_CELL_READER_INSTANTIATE(short,sample);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_opt2_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_opt2_sample+float--.cxx
deleted file mode 100644
index 18262443a5..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_opt2_sample+float--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boct/boct_tree_cell_reader.hxx>
-#include <boxm/sample/boxm_opt2_sample.h>
-
-typedef boxm_opt2_sample<float> sample;
-BOCT_TREE_CELL_READER_INSTANTIATE(short,sample);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_rt_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_rt_sample+float--.cxx
deleted file mode 100644
index 1784facefe..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_rt_sample+float--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boct/boct_tree_cell_reader.hxx>
-#include <boxm/sample/boxm_rt_sample.h>
-
-typedef boxm_rt_sample<float> sample;
-BOCT_TREE_CELL_READER_INSTANTIATE(short,sample);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx
deleted file mode 100644
index 83cf840aa8..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_sample+BOXM_APM_MOB_GREY--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boct/boct_tree_cell_reader.hxx>
-#include "boxm/boxm_apm_traits.h"
-#include "boxm/sample/boxm_sample.h"
-
-typedef boxm_sample<BOXM_APM_MOB_GREY> boxm_sample_mob_grey;
-BOCT_TREE_CELL_READER_INSTANTIATE(short,boxm_sample_mob_grey);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx
deleted file mode 100644
index 68c063579f..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_sample+BOXM_APM_MOG_GREY--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boct/boct_tree_cell_reader.hxx>
-#include "boxm/boxm_apm_traits.h"
-#include "boxm/sample/boxm_sample.h"
-
-typedef boxm_sample<BOXM_APM_MOG_GREY> boxm_sample_mog_grey;
-BOCT_TREE_CELL_READER_INSTANTIATE(short,boxm_sample_mog_grey);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_scalar_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_scalar_sample+float--.cxx
deleted file mode 100644
index 81c19507f9..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boct_tree_cell_reader+short.boxm_scalar_sample+float--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boct/boct_tree_cell_reader.hxx>
-#include <boxm/sample/boxm_scalar_sample.h>
-
-typedef boxm_scalar_sample<float> sample;
-BOCT_TREE_CELL_READER_INSTANTIATE(short,sample);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_edge_sample+float-.boxm_aux_edge_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_edge_sample+float-.boxm_aux_edge_sample+float--.cxx
deleted file mode 100644
index 5e771c97e2..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_edge_sample+float-.boxm_aux_edge_sample+float--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_edge_sample.h>
-#include <boxm/boxm_aux_scene.hxx>
-
-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_edge_sample<float>,boxm_aux_edge_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_inf_line_sample+float-.boxm_edge_tangent_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_inf_line_sample+float-.boxm_edge_tangent_sample+float--.cxx
deleted file mode 100644
index a73d09d6f5..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_inf_line_sample+float-.boxm_edge_tangent_sample+float--.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_edge_sample.h>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-#include <boxm/boxm_aux_scene.hxx>
-
-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_inf_line_sample<float>,boxm_edge_tangent_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOB_GREY-.boxm_rt_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOB_GREY-.boxm_rt_sample+float--.cxx
deleted file mode 100644
index c134345620..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOB_GREY-.boxm_rt_sample+float--.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_aux_scene.hxx>
-
-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample<BOXM_APM_MOB_GREY>,boxm_rt_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_opt2_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_opt2_sample+float--.cxx
deleted file mode 100644
index b8aa7777ee..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_opt2_sample+float--.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/sample/boxm_opt2_sample.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_aux_scene.hxx>
-
-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample<BOXM_APM_MOG_GREY>,boxm_opt2_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_rt_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_rt_sample+float--.cxx
deleted file mode 100644
index 918a3be765..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_rt_sample+float--.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_aux_scene.hxx>
-
-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample<BOXM_APM_MOG_GREY>,boxm_rt_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.float-.cxx
deleted file mode 100644
index 70bf413567..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.float-.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_aux_scene.hxx>
-
-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample<BOXM_APM_MOG_GREY>,float);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_opt2_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_opt2_sample+float--.cxx
deleted file mode 100644
index 6a0f7d745c..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_opt2_sample+float--.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/sample/boxm_opt2_sample.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_aux_scene.hxx>
-
-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample<BOXM_APM_SIMPLE_GREY>,boxm_opt2_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_rt_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_rt_sample+float--.cxx
deleted file mode 100644
index 03014e67ab..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_rt_sample+float--.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_aux_scene.hxx>
-
-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample<BOXM_APM_SIMPLE_GREY>,boxm_rt_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_scalar_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_scalar_sample+float--.cxx
deleted file mode 100644
index 1b75036c3b..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_scalar_sample+float--.cxx
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/sample/boxm_scalar_sample.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_aux_scene.hxx>
-
-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample<BOXM_APM_SIMPLE_GREY>,boxm_scalar_sample<float>);
-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample<BOXM_APM_MOG_GREY>,boxm_scalar_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.float-.cxx
deleted file mode 100644
index a27805ad73..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.float-.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_aux_scene.hxx>
-
-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample<BOXM_APM_SIMPLE_GREY>,float);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.float.boxm_edge_tangent_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.float.boxm_edge_tangent_sample+float--.cxx
deleted file mode 100644
index dc6a48e38b..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_aux_scene+short.float.boxm_edge_tangent_sample+float--.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_edge_sample.h>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-#include <boxm/boxm_aux_scene.hxx>
-
-BOXM_AUX_SCENE_INSTANTIATE(short,float,boxm_edge_tangent_sample<float>);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_edge_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_edge_sample+float---.cxx
deleted file mode 100644
index c814f6a8fe..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_edge_sample+float---.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_edge_sample.h>
-
-typedef boct_tree<short,boxm_edge_sample<float> > tree;
-BOXM_BLOCK_INSTANTIATE(tree);
-
-typedef boct_tree<short,boxm_aux_edge_sample<float> > aux_tree;
-BOXM_BLOCK_INSTANTIATE(aux_tree);
-
-#include <boxm/boxm_scene.hxx>
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree);
-BOXM_BLOCK_ITERATOR_INSTANTIATE(aux_tree);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_edge_tangent_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_edge_tangent_sample+float---.cxx
deleted file mode 100644
index 802a8ca615..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_edge_tangent_sample+float---.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-
-typedef boct_tree<short,boxm_edge_tangent_sample<float> > tree;
-BOXM_BLOCK_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_inf_line_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_inf_line_sample+float---.cxx
deleted file mode 100644
index 9ef6e210dd..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_inf_line_sample+float---.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-
-typedef boct_tree<short,boxm_inf_line_sample<float> > tree;
-BOXM_BLOCK_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_opt2_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_opt2_sample+float---.cxx
deleted file mode 100644
index dc6e57af68..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_opt2_sample+float---.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_opt2_sample.h>
-
-typedef boct_tree<short,boxm_opt2_sample<float> > tree;
-BOXM_BLOCK_INSTANTIATE(tree);
-
-#include <boxm/boxm_scene.hxx>
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_rt_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_rt_sample+float---.cxx
deleted file mode 100644
index ef11cd85a7..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_rt_sample+float---.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_rt_sample.h>
-
-typedef boct_tree<short,boxm_rt_sample<float> > tree;
-BOXM_BLOCK_INSTANTIATE(tree);
-
-#include <boxm/boxm_scene.hxx>
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx
deleted file mode 100644
index 647e553d5e..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_block.hxx>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,boxm_sample<BOXM_APM_MOB_GREY> > tree_type;
-BOXM_BLOCK_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx
deleted file mode 100644
index b5e4f8cce0..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <boxm/boxm_block.hxx>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
-BOXM_BLOCK_INSTANTIATE(tree_type);
-
-typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype apm_datatype;
-typedef boct_tree<short,apm_datatype > apm_tree_type;
-
-BOXM_BLOCK_INSTANTIATE(apm_tree_type);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx
deleted file mode 100644
index 5a2482adbc..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <boxm/boxm_block.hxx>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
-BOXM_BLOCK_INSTANTIATE(tree_type);
-
-// block with appearance
-typedef boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype apm_datatype;
-typedef boct_tree<short,apm_datatype > apm_tree_type;
-BOXM_BLOCK_INSTANTIATE(apm_tree_type);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx
deleted file mode 100644
index 6e13f9977a..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_block.hxx>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,boxm_sample_multi_bin<BOXM_APM_MOG_GREY> > tree_type;
-BOXM_BLOCK_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_scalar_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_scalar_sample+float---.cxx
deleted file mode 100644
index 0348b21996..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block+boct_tree+short.boxm_scalar_sample+float---.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_scalar_sample.h>
-
-typedef boct_tree<short,boxm_scalar_sample<float> > tree;
-BOXM_BLOCK_INSTANTIATE(tree);
-
-#include <boxm/boxm_scene.hxx>
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_edge_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_edge_sample+float---.cxx
deleted file mode 100644
index 0b79668c5f..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_edge_sample+float---.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boxm/sample/boxm_edge_sample.h>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,boxm_edge_sample<float> > tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
-
-typedef boct_tree<short,boxm_aux_edge_sample<float> > aux_tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(aux_tree_type);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_edge_tangent_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_edge_tangent_sample+float---.cxx
deleted file mode 100644
index ea335e591d..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_edge_tangent_sample+float---.cxx
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,boxm_edge_tangent_sample<float> > aux_tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(aux_tree_type);
-
-typedef boct_tree<short,boxm_inf_line_sample<float> > tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx
deleted file mode 100644
index 7c96bfeeee..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,boxm_sample<BOXM_APM_MOB_GREY> > tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx
deleted file mode 100644
index 052fa82c04..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
-
-typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype apm_datatype;
-typedef boct_tree<short,apm_datatype > apm_tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(apm_tree_type);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx
deleted file mode 100644
index a9d55be913..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
-
-// block iterator with appearance
-typedef boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype apm_datatype;
-typedef boct_tree<short,apm_datatype > apm_tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(apm_tree_type);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx
deleted file mode 100644
index 25f9ca6e61..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_block_iterator+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short,boxm_sample_multi_bin<BOXM_APM_MOG_GREY> > tree_type;
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_edge_sample+float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_edge_sample+float-.cxx
deleted file mode 100644
index d68f374c40..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_edge_sample+float-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/sample/boxm_edge_sample.hxx>
-
-BOXM_EDGE_SAMPLE_INSTANTIATE(float);
-BOXM_AUX_EDGE_SAMPLE_INSTANTIATE(float);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_edge_tangent_sample+float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_edge_tangent_sample+float-.cxx
deleted file mode 100644
index a00d2268b5..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_edge_tangent_sample+float-.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <boxm/sample/boxm_edge_tangent_sample.hxx>
-
-BOXM_EDGE_TANGENT_SAMPLE_INSTANTIATE(float);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_inf_line_sample+float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_inf_line_sample+float-.cxx
deleted file mode 100644
index f957308804..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_inf_line_sample+float-.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <boxm/sample/boxm_inf_line_sample.hxx>
-
-BOXM_INF_LINE_SAMPLE_INSTANTIATE(float);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_opt2_sample+float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_opt2_sample+float-.cxx
deleted file mode 100644
index 66ceeacd2d..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_opt2_sample+float-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/sample/boxm_opt2_sample.hxx>
-#include <boxm/boxm_apm_traits.h>
-
-BOXM_OPT2_SAMPLE_INSTANTIATE(float);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_plane_obs+float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_plane_obs+float-.cxx
deleted file mode 100644
index c6e45bdcca..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_plane_obs+float-.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <boxm/sample/boxm_plane_obs.hxx>
-
-BOXM_PLANE_OBS_INSTANTIATE(float);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_rt_sample+float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_rt_sample+float-.cxx
deleted file mode 100644
index 1fc6db3c56..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_rt_sample+float-.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <boxm/sample/boxm_rt_sample.hxx>
-
-BOXM_RT_SAMPLE_INSTANTIATE(float);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_MOB_GREY-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_MOB_GREY-.cxx
deleted file mode 100644
index 4ee2f52816..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_MOB_GREY-.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.hxx>
-#include <bsta/io/bsta_io_mixture_fixed.h>
-#include <bsta/io/bsta_io_attributes.h>
-#include <bsta/io/bsta_io_beta.h>
-
-BOXM_SAMPLE_INSTANTIATE(BOXM_APM_MOB_GREY);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_MOG_GREY-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_MOG_GREY-.cxx
deleted file mode 100644
index d1054422d9..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_MOG_GREY-.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.hxx>
-#include <bsta/io/bsta_io_mixture_fixed.h>
-#include <bsta/io/bsta_io_gaussian_sphere.h>
-#include <bsta/io/bsta_io_mixture.h>
-#include <bsta/io/bsta_io_attributes.h>
-#include <bsta/bsta_mixture_fixed.h>
-
-BOXM_SAMPLE_INSTANTIATE(BOXM_APM_MOG_GREY);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_SIMPLE_GREY-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_SIMPLE_GREY-.cxx
deleted file mode 100644
index e3c225ae4d..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_sample+BOXM_APM_SIMPLE_GREY-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.hxx>
-
-BOXM_SAMPLE_INSTANTIATE(BOXM_APM_SIMPLE_GREY);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_sample_multi_bin+BOXM_APM_MOG_GREY-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_sample_multi_bin+BOXM_APM_MOG_GREY-.cxx
deleted file mode 100644
index 4e2b56c696..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_sample_multi_bin+BOXM_APM_MOG_GREY-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample_multi_bin.hxx>
-
-BOXM_SAMPLE_MULTI_BIN_INSTANTIATE(BOXM_APM_MOG_GREY);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scalar_sample+float-.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scalar_sample+float-.cxx
deleted file mode 100644
index a9552e4b00..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scalar_sample+float-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm/sample/boxm_scalar_sample.hxx>
-#include <boxm/boxm_apm_traits.h>
-
-BOXM_SCALAR_SAMPLE_INSTANTIATE(float);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_edge_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_edge_sample+float---.cxx
deleted file mode 100644
index 4fd83d2d66..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_edge_sample+float---.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_edge_sample.h>
-
-typedef boct_tree<short,boxm_edge_sample<float> > tree;
-BOXM_SCENE_INSTANTIATE(tree);
-
-typedef boct_tree<short,boxm_aux_edge_sample<float> > aux_tree;
-BOXM_SCENE_INSTANTIATE(aux_tree);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_edge_tangent_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_edge_tangent_sample+float---.cxx
deleted file mode 100644
index 882f421e87..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_edge_tangent_sample+float---.cxx
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-
-typedef boct_tree<short,boxm_edge_tangent_sample<float> > aux_tree;
-BOXM_SCENE_INSTANTIATE(aux_tree);
-
-typedef boct_tree<short,boxm_inf_line_sample<float> > tree;
-BOXM_SCENE_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_opt2_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_opt2_sample+float---.cxx
deleted file mode 100644
index dfec334150..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_opt2_sample+float---.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_opt2_sample.h>
-
-typedef boct_tree<short,boxm_opt2_sample<float> > tree;
-BOXM_SCENE_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_rt_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_rt_sample+float---.cxx
deleted file mode 100644
index cd3c475545..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_rt_sample+float---.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_rt_sample.h>
-
-typedef boct_tree<short,boxm_rt_sample<float> > tree;
-BOXM_SCENE_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx
deleted file mode 100644
index db72e7c8ea..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_sample.h>
-
-typedef boct_tree<short, boxm_sample<BOXM_APM_MOB_GREY> > tree_type;
-BOXM_SCENE_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx
deleted file mode 100644
index 6d21678187..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---.cxx
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_sample.h>
-
-typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
-BOXM_SCENE_INSTANTIATE(tree_type);
-
-typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype apm_datatype;
-typedef boct_tree<short,apm_datatype > apm_tree_type;
-BOXM_SCENE_INSTANTIATE(apm_tree_type);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx
deleted file mode 100644
index 52e5afb01c..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---.cxx
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_sample.h>
-
-typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
-BOXM_SCENE_INSTANTIATE(tree_type);
-
-// scene with appearance
-typedef boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype apm_datatype;
-typedef boct_tree<short,apm_datatype > apm_tree_type;
-BOXM_SCENE_INSTANTIATE(apm_tree_type);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx
deleted file mode 100644
index 262d6e4f89..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-
-typedef boct_tree<short, boxm_sample_multi_bin<BOXM_APM_MOG_GREY> > tree_type;
-BOXM_SCENE_INSTANTIATE(tree_type);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_scalar_sample+float---.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_scalar_sample+float---.cxx
deleted file mode 100644
index 4a2c0c7437..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.boxm_scalar_sample+float---.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_scalar_sample.h>
-
-typedef boct_tree<short,boxm_scalar_sample<float> > tree;
-BOXM_SCENE_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.int--.cxx b/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.int--.cxx
deleted file mode 100644
index b727cb7d12..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/boxm_scene+boct_tree+short.int--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.hxx>
-
-typedef boct_tree<short,int > tree;
-BOXM_SCENE_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_edge_sample+float---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_edge_sample+float---~-.cxx
deleted file mode 100644
index fc06a01419..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_edge_sample+float---~-.cxx
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-#include <boxm/boxm_block.hxx>
-#include <boxm/sample/boxm_edge_sample.h>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short, boxm_edge_sample<float> > tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type>*);
-
-typedef boct_tree<short, boxm_aux_edge_sample<float> > aux_tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<aux_tree_type>*);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_edge_tangent_sample+float---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_edge_tangent_sample+float---~-.cxx
deleted file mode 100644
index 0b4f55a413..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_edge_tangent_sample+float---~-.cxx
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-#include <boxm/boxm_block.hxx>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short, boxm_edge_tangent_sample<float> > aux_tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<aux_tree_type>*);
-
-typedef boct_tree<short, boxm_inf_line_sample<float> > tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type>*);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_opt2_sample+float---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_opt2_sample+float---~-.cxx
deleted file mode 100644
index 1372664c8c..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_opt2_sample+float---~-.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-#include <boxm/boxm_block.hxx>
-#include <boxm/sample/boxm_opt2_sample.h>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short, boxm_opt2_sample<float> > tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type>*);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_rt_sample+float---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_rt_sample+float---~-.cxx
deleted file mode 100644
index 5409ed1d26..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_rt_sample+float---~-.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-#include <boxm/boxm_block.hxx>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short, boxm_rt_sample<float> > tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type>*);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---~-.cxx
deleted file mode 100644
index 3508b23e74..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOB_GREY---~-.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_sample.h>
-
-typedef boct_tree<short, boxm_sample<BOXM_APM_MOB_GREY> > tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type>*);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---~-.cxx
deleted file mode 100644
index 9676fc11a4..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_MOG_GREY---~-.cxx
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_sample.h>
-
-typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type>*);
-
-typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype apm_datatype;
-typedef boct_tree<short,apm_datatype > apm_tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<apm_tree_type>*);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---~-.cxx
deleted file mode 100644
index e8c9902c7e..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample+BOXM_APM_SIMPLE_GREY---~-.cxx
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_sample.h>
-
-typedef boct_tree<short, boxm_sample<BOXM_APM_SIMPLE_GREY> > tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type>*);
-
-// scene with appearance
-typedef boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype apm_datatype;
-typedef boct_tree<short,apm_datatype > apm_tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<apm_tree_type>*);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---~-.cxx
deleted file mode 100644
index 4cadf24760..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_sample_multi_bin+BOXM_APM_MOG_GREY---~-.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-
-typedef boct_tree<short, boxm_sample_multi_bin<BOXM_APM_MOG_GREY> > tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type>*);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_scalar_sample+float---~-.cxx b/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_scalar_sample+float---~-.cxx
deleted file mode 100644
index f013383f50..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_scalar_sample+float---~-.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-#include <boxm/boxm_block.hxx>
-#include <boxm/sample/boxm_scalar_sample.h>
-#include <boct/boct_tree.h>
-
-typedef boct_tree<short, boxm_scalar_sample<float> > tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type>*);
diff --git a/contrib/brl/bseg/boxm/sample/Templates/vil_image_view+boxm_inf_line_sample+float--.cxx b/contrib/brl/bseg/boxm/sample/Templates/vil_image_view+boxm_inf_line_sample+float--.cxx
deleted file mode 100644
index 116b748109..0000000000
--- a/contrib/brl/bseg/boxm/sample/Templates/vil_image_view+boxm_inf_line_sample+float--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <vil/vil_image_view.hxx>
-#include <boxm/sample/boxm_inf_line_sample.h>
-
-typedef boxm_inf_line_sample<float> sample;
-VIL_IMAGE_VIEW_INSTANTIATE(sample);
diff --git a/contrib/brl/bseg/boxm/sample/algo/CMakeLists.txt b/contrib/brl/bseg/boxm/sample/algo/CMakeLists.txt
deleted file mode 100644
index c758e9f2a4..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-# brl/bseg/boxm/util/CMakeLists.txt
-include_directories( ${MUL_INCLUDE_DIR} )
-set(boxm_sample_algo_sources
- boxm_mob_grey_processor.h boxm_mob_grey_processor.cxx
- boxm_mog_grey_processor.h boxm_mog_grey_processor.cxx
- boxm_simple_grey_processor.h boxm_simple_grey_processor.cxx
- boxm_sigma_normalizer.h boxm_sigma_normalizer.cxx
- )
-
-aux_source_directory(Templates boxm_sample_algo_sources)
-
-vxl_add_library(LIBRARY_NAME boxm_sample_algo LIBRARY_SOURCES ${boxm_sample_algo_sources})
-
-target_link_libraries(boxm_sample_algo boxm_sample boxm boxm_util bsta bsta_algo ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl_io ${VXL_LIB_PREFIX}vbl)
-
-if( BUILD_TESTING )
- add_subdirectory(tests)
-endif()
diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx
deleted file mode 100644
index 994d8628d9..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boct/boct_tree.hxx>
-#include <boxm/sample/boxm_opt3_sample.h>
-#include <boxm/boxm_apm_traits.h>
-
-BOCT_TREE_INSTANTIATE(short,boxm_opt3_sample<BOXM_APM_MOG_GREY>);
diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree_cell+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree_cell+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx
deleted file mode 100644
index 10fc203f38..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree_cell+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boct/boct_tree_cell.hxx>
-#include <boxm/sample/boxm_opt3_sample.h>
-#include <boxm/boxm_apm_traits.h>
-
-BOCT_TREE_CELL_INSTANTIATE(short,boxm_opt3_sample<BOXM_APM_MOG_GREY>);
diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree_cell_reader+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree_cell_reader+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx
deleted file mode 100644
index b5be45d2b1..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/Templates/boct_tree_cell_reader+short.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boct/boct_tree_cell_reader.hxx>
-#include <boxm/sample/boxm_opt3_sample.h>
-#include <boxm/boxm_apm_traits.h>
-
-typedef boxm_opt3_sample<BOXM_APM_MOG_GREY> sample;
-BOCT_TREE_CELL_READER_INSTANTIATE(short,sample);
diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx
deleted file mode 100644
index 0772000b0d..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_MOG_GREY-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/sample/boxm_opt3_sample.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_aux_scene.hxx>
-
-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample<BOXM_APM_MOG_GREY>,boxm_opt3_sample<BOXM_APM_MOG_GREY>);
diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx
deleted file mode 100644
index 00af986d6d..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_aux_scene+short.boxm_sample+BOXM_APM_SIMPLE_GREY-.boxm_opt3_sample+BOXM_APM_MOG_GREY--.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/sample/boxm_opt3_sample.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/boxm_aux_scene.hxx>
-
-BOXM_AUX_SCENE_INSTANTIATE(short,boxm_sample<BOXM_APM_SIMPLE_GREY>,boxm_opt3_sample<BOXM_APM_MOG_GREY>);
diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_block+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_block+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx
deleted file mode 100644
index b4aef87f19..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_block+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_opt3_sample.h>
-#include <boxm/boxm_apm_traits.h>
-
-typedef boct_tree<short,boxm_opt3_sample<BOXM_APM_MOG_GREY> > tree;
-BOXM_BLOCK_INSTANTIATE(tree);
-
-#include <boxm/boxm_scene.hxx>
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_opt3_sample+BOXM_APM_MOG_GREY-.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_opt3_sample+BOXM_APM_MOG_GREY-.cxx
deleted file mode 100644
index c67fd5c479..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_opt3_sample+BOXM_APM_MOG_GREY-.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <boxm/sample/boxm_opt3_sample.hxx>
-
-BOXM_OPT3_SAMPLE_INSTANTIATE(BOXM_APM_MOG_GREY);
diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_scene+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_scene+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx
deleted file mode 100644
index e0c8931986..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/Templates/boxm_scene+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <boxm/boxm_scene.hxx>
-#include <boct/boct_tree.h>
-#include <boxm/sample/boxm_opt3_sample.h>
-#include <boxm/boxm_apm_traits.h>
-
-typedef boct_tree<short,boxm_opt3_sample<BOXM_APM_MOG_GREY> > tree;
-BOXM_SCENE_INSTANTIATE(tree);
diff --git a/contrib/brl/bseg/boxm/sample/algo/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---~-.cxx b/contrib/brl/bseg/boxm/sample/algo/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---~-.cxx
deleted file mode 100644
index 0bf4864b81..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/Templates/vbl_array_3d+boxm_block+boct_tree+short.boxm_opt3_sample+BOXM_APM_MOG_GREY---~-.cxx
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <iostream>
-#include <string>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vbl/vbl_array_3d.hxx>
-#include <vgl/io/vgl_io_point_3d.h>
-#include <boxm/boxm_block.hxx>
-#include <boxm/sample/boxm_opt3_sample.h>
-#include <boct/boct_tree.h>
-#include <boxm/boxm_apm_traits.h>
-
-typedef boct_tree<short, boxm_opt3_sample<BOXM_APM_MOG_GREY> > tree_type;
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type>*);
diff --git a/contrib/brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.cxx b/contrib/brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.cxx
deleted file mode 100644
index e93ea9b17a..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.cxx
+++ /dev/null
@@ -1,83 +0,0 @@
-#include "boxm_mob_grey_processor.h"
-//:
-// \file
-#include <bsta/algo/bsta_beta_updater.h>
-#include <bsta/bsta_distribution.h>
-#include <bsta/bsta_beta.h>
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_mixture_fixed.h>
-#include <bsta/bsta_beta_f1.h>
-
-#include <cassert>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-//: Expected value
-boxm_apm_traits<BOXM_APM_MOB_GREY>::obs_datatype
-boxm_mob_grey_processor::expected_color(boxm_apm_traits<BOXM_APM_MOB_GREY>::apm_datatype const& appear)
-{
- float total_weight= 0;
- obs_datatype c = 0;
- obs_datatype expected = 0;
-
- //should be components used
- for (unsigned i = 0; i< appear.num_components(); ++i)
- {
- total_weight += appear.weight(i);
- c += appear.distribution(i).mean() * appear.weight(i);
- }
- if (total_weight > 0.0f) {
- expected = c/total_weight;
- }
-
- return expected;
-}
-//: Return probability density of observing pixel values
-float boxm_mob_grey_processor::prob_density(apm_datatype const& appear, obs_datatype const& obs)
-{
- if (appear.num_components() ==0) {
- return 1.00f;
- }
- else {
- return appear.prob_density(obs);
- }
-}
-
-//: Update with a new sample image
-bool boxm_mob_grey_processor::update( apm_datatype &appear,
- obs_datatype const& obs,
- float const& weight)
-{
- // the model
- float init_variance = 0.008f;
- float g_thresh = 0.025f; // number of std devs from mean sample must be
-
- //float t_l_u = float(std::sqrt(1-4*init_variance)*0.5);
- //float lower = 0.5f-t_l_u;
- //float upper = 0.5f+t_l_u;
-
- obs_datatype val = obs;
- //if (obs < lower)
- // val = lower+0.000001f;
- //else if (obs > upper)
- // val = upper-0.000001f;
-
- float alpha, beta;
- bsta_beta<float>::bsta_beta_from_moments(val, init_variance,alpha,beta);
- bsta_beta_f1 this_beta(alpha,beta);
-
- const unsigned int nmodes = boxm_apm_traits<BOXM_APM_MOB_GREY>::n_beta_modes_;
-
- typedef bsta_num_obs<bsta_beta_f1> beta_type;
- typedef bsta_mixture_fixed<beta_type, nmodes> mix_beta;
-
- // the updater
- bsta_mix_beta_updater<mix_beta> updater(this_beta, g_thresh, init_variance, nmodes );
-
- if (weight > 0) {
- updater(appear, obs);
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.h b/contrib/brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.h
deleted file mode 100644
index 8c6c4b46d8..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// This is brl/bseg/boxm/sample/algo/boxm_mob_grey_processor.h
-#ifndef boxm_mob_grey_processor_h_
-#define boxm_mob_grey_processor_h_
-//:
-// \file
-// \brief A class for a grey-scale-mixture-of-beta processor
-//
-// \author Gamze Tunali
-// \date Nov 24, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bsta/bsta_distribution.h>
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_mixture_fixed.h>
-#include <boxm/boxm_apm_traits.h>
-
-
-class boxm_mob_grey_processor
-{
- protected:
- // convenience typedefs
- typedef boxm_apm_traits<BOXM_APM_MOB_GREY>::apm_datatype apm_datatype;
- typedef boxm_apm_traits<BOXM_APM_MOB_GREY>::obs_datatype obs_datatype;
- typedef boxm_apm_traits<BOXM_APM_MOB_GREY>::obs_mathtype obs_mathtype;
-
- public:
- static obs_datatype expected_color(apm_datatype const& appear);
- static float prob_density(apm_datatype const& appear, obs_datatype const& obs);
- static bool update( apm_datatype &appear, obs_datatype const& obs, float const& weight);
-};
-
-#endif // boxm_mob_grey_processor_h_
diff --git a/contrib/brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.cxx b/contrib/brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.cxx
deleted file mode 100644
index 7c7e011b07..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.cxx
+++ /dev/null
@@ -1,286 +0,0 @@
-#include "boxm_mog_grey_processor.h"
-//:
-// \file
-#include <bsta/algo/bsta_adaptive_updater.h>
-#include <bsta/bsta_distribution.h>
-#include <bsta/bsta_gauss_sf1.h>
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_mixture_fixed.h>
-#include <bsta/bsta_gaussian_indep.h>
-#include <bsta/algo/bsta_fit_gaussian.h>
-
-#include <vnl/vnl_random.h>
-
-#include "boxm_sigma_normalizer.h"
-
-#include <cassert>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-//: Expected value
-boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype
-boxm_mog_grey_processor::expected_color(boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype const& appear)
-{
- float total_weight= 0;
- obs_datatype c = 0;
- obs_datatype expected = 0;
-
- //should be components used
- for (unsigned i = 0; i< appear.num_components(); ++i)
- {
- total_weight += appear.weight(i);
- c += appear.distribution(i).mean() * appear.weight(i);
- }
- if (total_weight > 0.0f) {
- expected = c/total_weight;
- }
-
- return expected;
-}
-
-//: Return a random sample from the appearance distribution
-boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype
-boxm_mog_grey_processor::sample(boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype const& appear, vnl_random &rand_gen)
-{
- return appear.sample(rand_gen);
-}
-
-
-//: Return probability density of observing pixel values
-float boxm_mog_grey_processor::prob_density(apm_datatype const& appear, obs_datatype const& obs)
-{
- if (appear.num_components() ==0) {
- return 1.00f;
- }
- else {
- return appear.prob_density(obs);
- }
-}
-
-//: Update with a new sample image
-bool boxm_mog_grey_processor::update( apm_datatype &appear, obs_datatype const& obs, float const& weight)
-{
- // the model
- float init_variance = 0.008f;
- float min_stddev = 0.030f; //TO UNDERSTAND: changed from 0.02 for dinoRing dataset -dec
- float g_thresh = 2.5; // number of std devs from mean sample must be
- bsta_gauss_sf1 this_gauss(0.0f, init_variance);
-
- const unsigned int nmodes = boxm_apm_traits<BOXM_APM_MOG_GREY>::n_gaussian_modes_;
-
- typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
- typedef bsta_mixture_fixed<gauss_type, nmodes> mix_gauss;
-
- // the updater
- bsta_mg_grimson_weighted_updater<mix_gauss> updater(this_gauss, nmodes ,g_thresh,min_stddev);
-
- if (weight > 0) {
- updater(appear, obs, weight);
- }
-
- return true;
-}
-
-void boxm_mog_grey_processor::update_appearance(std::vector<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> const& obs, std::vector<float> const& obs_weights, boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype &model, float min_sigma)
-{
- std::vector<float> pre(obs.size(),0.0f);
- compute_appearance(obs,pre,obs_weights,model,min_sigma);
- return;
-}
-
-void boxm_mog_grey_processor::compute_appearance(std::vector<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> const& obs, std::vector<float> const& obs_weights, boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype &model, float min_sigma)
-{
- std::vector<float> pre(obs.size(),0.0f);
- compute_appearance(obs,pre,obs_weights,model,min_sigma);
- return;
-}
-
-void boxm_mog_grey_processor::finalize_appearance(std::vector<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> const& obs,
- std::vector<float> const& /*obs_weights*/, // FIXME - unused
- boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype &model,
- float min_sigma)
-{
- static const unsigned int nmodes = boxm_apm_traits<BOXM_APM_MOG_GREY>::n_gaussian_modes_;
- const auto nobs = (unsigned int)obs.size();
- const float min_var = min_sigma*min_sigma;
- const auto big_sigma = (float)vnl_math::sqrt1_2; // maximum possible std. dev for set of samples drawn from [0 1]
- const float big_var = big_sigma * big_sigma;
-
- static boxm_sigma_normalizer sigma_norm(0.1f);
- for (unsigned int m=0; m<nmodes; ++m) {
- //float unbias_factor = sigma_norm.normalization_factor(mode_weight_sum[m]);
- float unbias_factor = sigma_norm.normalization_factor(model.weight(m) * nobs);
-
- //float unbias_factor = sigma_norm.normalization_factor_int(nobs);
- float mode_var = model.distribution(m).var();
- mode_var *= (unbias_factor*unbias_factor);
-
- // make sure variance does not get too big
- if (!(mode_var < big_var)) {
- mode_var = big_var;
- }
- // or too small
- if (!(mode_var > min_var)) {
- mode_var = min_var;
- }
- model.distribution(m).set_var(mode_var);
- }
- return;
-}
-
-void boxm_mog_grey_processor::compute_appearance(std::vector<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> const& obs, std::vector<float> const& pre, std::vector<float> const& vis, boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype &model, float min_sigma)
-{
- static const unsigned int max_nmodes = boxm_apm_traits<BOXM_APM_MOG_GREY>::n_gaussian_modes_;
- const float min_var = min_sigma*min_sigma;
- const auto big_sigma = (float)vnl_math::sqrt1_2; // maximum possible std. dev for set of samples drawn from [0 1]
- const float big_var = big_sigma * big_sigma;
-
- auto nobs = (unsigned int)obs.size();
- if (nobs == 0) {
- // nothing to do.
- return;
- }
- if (nobs == 1) {
- model = bsta_num_obs<bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, max_nmodes> >();
- bsta_gauss_sf1 mode(obs[0], big_sigma*big_sigma);
- model.insert(bsta_num_obs<bsta_gauss_sf1>(mode), 1.0f);
- return;
- }
-
- unsigned int nmodes = model.num_components();
-
- if (nmodes == 0) {
- // if initial model is "blank", create an arbitrary starting point for the optimization with max number of modes
- model = bsta_num_obs<bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, max_nmodes> >();
- nmodes = max_nmodes;
- // no need for model to have more modes than observations
- if (nobs < nmodes) {
- nmodes = nobs;
- }
- // initialize parameters
- for (unsigned int m=0; m<nmodes; ++m) {
- float mean = (float(m) + 0.5f) / float(nmodes);
- float sigma = 0.3f;
- float mode_weight = 1.0f / float(nmodes);
- bsta_gauss_sf1 mode(mean, sigma*sigma);
- model.insert(bsta_num_obs<bsta_gauss_sf1>(mode), mode_weight);
- }
- }
-
- std::vector<std::vector<float> > mode_probs(nobs);
- for (unsigned int n=0; n<nobs; ++n) {
- for (unsigned int m=0; m<nmodes; ++m) {
- mode_probs[n].push_back(0.0f);
- }
- }
- std::vector<float> mode_weight_sum(nmodes,0.0f);
-
- // run EM algorithm to maximize expected probability of observations
- constexpr unsigned int max_its = 50;
- const float max_converged_weight_change = 1e-3f;
-
- for (unsigned int i=0; i<max_its; ++i) {
- float max_weight_change = 0.0f;
- // EXPECTATION
- for (unsigned int n=0; n<nobs; ++n) {
- // for each observation, assign probabilities to each mode of appearance model (and to a "previous cell")
- float total_prob = 0.0f;
- std::vector<float> new_mode_probs(nmodes);
- for (unsigned int m=0; m<nmodes; ++m) {
- // compute probability that nth data point was produced by mth mode
- const float new_mode_prob = vis[n] * model.distribution(m).prob_density(obs[n]) * model.weight(m);
- new_mode_probs[m] = new_mode_prob;
- total_prob += new_mode_prob;
- }
- // compute the probability the observation came from an occluding cell
- const float prev_prob = pre[n];
- total_prob += prev_prob;
- if (total_prob > 1e-6) {
- for (unsigned int m=0; m<nmodes; ++m) {
- new_mode_probs[m] /= total_prob;
- const float weight_change = std::fabs(new_mode_probs[m] - mode_probs[n][m]);
- if (weight_change > max_weight_change) {
- max_weight_change = weight_change;
- }
- mode_probs[n][m] = new_mode_probs[m];
- }
- }
- }
- // check for convergence
- if (max_weight_change < max_converged_weight_change) {
- break;
- }
- // MAXIMIZATION
- // computed the weighted means and variances for each mode based on the probabilities
- float total_weight_sum = 0.0f;
-
- // update the mode parameters
- for (unsigned int m=0; m<nmodes; ++m) {
- mode_weight_sum[m] = 0.0f;
- std::vector<float> obs_weights(nobs);
- for (unsigned int n=0; n<nobs; ++n) {
- obs_weights[n] = mode_probs[n][m];
- mode_weight_sum[m] += obs_weights[n];
- }
- total_weight_sum += mode_weight_sum[m];
- float mode_mean(0.5f);
- float mode_var(1.0f);
- bsta_gauss_sf1 single_gauss(mode_mean,mode_var);
- bsta_fit_gaussian(obs, obs_weights, single_gauss);
- mode_mean = single_gauss.mean();
- mode_var = single_gauss.var();
-
- // unbias variance based on number of observations
- //float unbias_factor = sigma_norm_factor(mode_weight_sum[m]);
- // mode_var *= (unbias_factor*unbias_factor);
-
- // make sure variance does not get too big
- if (!(mode_var < big_var)) {
- mode_var = big_var;
- }
- // or too small
- if (!(mode_var > min_var)) {
- mode_var = min_var;
- }
-
- // update mode parameters
- model.distribution(m).set_mean(mode_mean);
- model.distribution(m).set_var(mode_var);
- }
- // update mode probabilities
- if (total_weight_sum > 1e-6) {
- for (unsigned int m=0; m<nmodes; ++m) {
- const float mode_weight = mode_weight_sum[m] / total_weight_sum;
- // update mode weight
- model.set_weight(m, mode_weight);
- }
- }
- }
-
- // unbias variance based on number of observations
- static const boxm_sigma_normalizer sigma_norm(0.20f);
- for (unsigned int m=0; m<nmodes; ++m) {
- float unbias_factor = sigma_norm.normalization_factor(mode_weight_sum[m]);
- //float unbias_factor = sigma_norm.normalization_factor(model.weight(m) * nobs);
- //float unbias_factor = sigma_norm.normalization_factor_int(nobs);
-
- float mode_var = model.distribution(m).var();
- mode_var *= (unbias_factor*unbias_factor);
-
- // make sure variance does not get too big
- if (!(mode_var < big_var)) {
- mode_var = big_var;
- }
- // or too small
- if (!(mode_var > min_var)) {
- mode_var = min_var;
- }
- model.distribution(m).set_var(mode_var);
- }
-
- // sort the modes based on weight
- model.sort();
-
- return;
-}
diff --git a/contrib/brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.h b/contrib/brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.h
deleted file mode 100644
index b4d64bc6ad..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// This is brl/bseg/boxm/sample/algo/boxm_mog_grey_processor.h
-#ifndef boxm_mog_grey_processor_h_
-#define boxm_mog_grey_processor_h_
-//:
-// \file
-// \brief A class for a grey-scale-mixture-of-gaussian processor
-//
-// \author Gamze Tunali
-// \date Apr 03, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bsta/algo/bsta_adaptive_updater.h>
-#include <bsta/bsta_distribution.h>
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_mixture_fixed.h>
-#include <bsta/bsta_gaussian_indep.h>
-
-#include <vnl/vnl_random.h>
-
-#include <boxm/boxm_apm_traits.h>
-
-
-class boxm_mog_grey_processor
-{
- protected:
- // convienance typedefs
- typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype apm_datatype;
- typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype obs_datatype;
- typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_mathtype obs_mathtype;
-
- public:
- static obs_datatype expected_color(apm_datatype const& appear);
-
- static obs_datatype sample(apm_datatype const& appear, vnl_random &rand_gen);
-
- static float prob_density(apm_datatype const& appear, obs_datatype const& obs);
-
- static bool update( apm_datatype &appear, obs_datatype const& obs, float const& weight);
-
- static void compute_appearance(std::vector<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> const& obs, std::vector<float> const& obs_weights, boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype &model, float min_sigma = 0.01f);
- static void update_appearance(std::vector<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> const& obs, std::vector<float> const& obs_weights, boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype &model, float min_sigma = 0.01f);
- static void finalize_appearance(std::vector<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> const& obs, std::vector<float> const& obs_weights, boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype &model, float min_sigma = 0.01f);
-
- static void compute_appearance(std::vector<boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype> const& obs, std::vector<float> const& pre, std::vector<float> const& vis, boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype &model, float min_sigma = 0.01f);
-};
-
-#endif // boxm_mog_grey_processor_h_
diff --git a/contrib/brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.cxx b/contrib/brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.cxx
deleted file mode 100644
index b88fd5c03d..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.cxx
+++ /dev/null
@@ -1,104 +0,0 @@
-#include <iostream>
-#include "boxm_sigma_normalizer.h"
-//:
-// \file
-// \brief A class for adjusting sample standard deviation values such that the probability of underestimation of the true std. dev. is fixed.
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <vnl/vnl_vector_fixed.h>
-#include <vnl/vnl_gamma.h>
-#include <vnl/vnl_least_squares_function.h>
-#include <vnl/algo/vnl_levenberg_marquardt.h>
-
-boxm_sigma_normalizer::boxm_sigma_normalizer(float under_estimation_probability) : unbias_const_(N_PRECOMPUTED_+1, 0.0f)
-{
- class gammainc_error_fn : public vnl_least_squares_function
- {
- public:
- gammainc_error_fn(unsigned int ndof, float under_estimation_prob) : vnl_least_squares_function(1,1,no_gradient), ndof_(ndof), p_(under_estimation_prob) {}
-
- void f(vnl_vector<double> const& x, vnl_vector<double>& fx) override
- {
- // don't allow x to become negative
- if (x[0] < 0.0f) {
- fx[0] = x[0] - p_; // so error function is c0 continuous at x=0
- return;
- }
- double cdf_prob = vnl_cum_prob_chi2(ndof_, x[0]);
- fx[0] = cdf_prob - p_;
- return;
- }
- private:
- unsigned int ndof_;
- float p_;
- };
-
- // sanity check on probability
- if (under_estimation_probability < 1e-4) {
- std::cout << "error : boxm_sigma_normalizer : under_estimation_probability " << under_estimation_probability << " too low" << std::endl;
- return;
- }
- if (under_estimation_probability > (1 - 1e-4)) {
- std::cout << "error : boxm_sigma_normalizer : under_estimation_probability " << under_estimation_probability << " too high" << std::endl;
- return;
- }
-
- // populate array of normalization factors for easy lookup
- vnl_vector_fixed<double,1> x(1.0);
-
- for (unsigned int n=2; n<= N_PRECOMPUTED_; ++n) {
- gammainc_error_fn f(n-1, under_estimation_probability);
- vnl_levenberg_marquardt minimizer(f);
- minimizer.set_f_tolerance(1e-8);
- minimizer.set_x_tolerance(1e-8);
-
- minimizer.minimize(x);
- //minimizer.diagnose_outcome();
- double end_error = minimizer.get_end_error();
- if (end_error > 1e-3) {
- std::cerr << "error: boxm_sigma_normalizer: levenberg_marquardt final error = " << end_error << '\n';
- }
- auto unbias_constant = (float)std::sqrt((float)(n-1) / x[0]);
-
- unbias_const_[n] = unbias_constant;
- }
- // sigma is undefined for samples sizes of 0 and 1, but we can linearly interpolate to get values anyway
- unbias_const_[1] = unbias_const_[2] - (unbias_const_[3] - unbias_const_[2]);
- unbias_const_[0] = unbias_const_[1] - (unbias_const_[2] - unbias_const_[1]);
-}
-
-
-float boxm_sigma_normalizer::normalization_factor(float number_of_observations) const
-{
- if (number_of_observations <= 1.0f) {
- return normalization_factor_int((unsigned int)1);
- }
-
- // linearly interpolate between integer values
- float nobs_floor = std::floor(number_of_observations);
- float nobs_ceil = std::ceil(number_of_observations);
- float floor_weight = nobs_ceil - number_of_observations;
- float norm_factor = (normalization_factor_int((unsigned int)nobs_floor) * floor_weight) + (normalization_factor_int((unsigned int)nobs_ceil) * (1.0f - floor_weight));
-
- return norm_factor;
-}
-
-
-float boxm_sigma_normalizer::normalization_factor_int(unsigned int number_of_observations) const
-{
- if (number_of_observations < 2) {
- return unbias_const_[1];
- }
-
- if (number_of_observations <= N_PRECOMPUTED_) {
- return unbias_const_[number_of_observations];
- }
- // else nobs >= N_PRECOMPUTED_
- // approximate for big n with function a = m /nobs + b
- static const float m = (unbias_const_[N_PRECOMPUTED_] - unbias_const_[N_PRECOMPUTED_ - 5])/(1.0f/N_PRECOMPUTED_ - 1.0f/(N_PRECOMPUTED_ - 5));
- static const float b = unbias_const_[N_PRECOMPUTED_] - m*(1.0f/N_PRECOMPUTED_);
- return m/number_of_observations + b;
-}
diff --git a/contrib/brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.h b/contrib/brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.h
deleted file mode 100644
index aafb71a2c2..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// this is brl/bseg/boxm/sample/algo/boxm_sigma_normalizer.h
-#ifndef boxm_sigma_normalizer_h_
-#define boxm_sigma_normalizer_h_
-//:
-// \file
-// \brief A class for adjusting sample standard deviation values such that the probability of underestimation of the true std. dev. is fixed.
-//
-// \author Daniel Crispell
-// \date Feb. 18, 2010
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <vector>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-class boxm_sigma_normalizer
-{
- public:
- //: create a sigma_normalizer object.
- boxm_sigma_normalizer(float under_estimation_probability);
-
- //: compute the normalization factor for a sample distribution computing with N observations
- // \a sigma_norm = sample_sigma * normalization_factor(N);
- float normalization_factor(float number_of_observations) const;
-
- //: compute the normalization factor for a sample distribution computed with N observations
- // \a sigma_norm = sample_sigma * normalization_factor(N);
- float normalization_factor_int(unsigned int number_of_observations) const;
-
- private:
- // do not allow default constructor - under-estimation param is necessary
- boxm_sigma_normalizer()= default;
-
- static const unsigned int N_PRECOMPUTED_ = 40;
- std::vector<float> unbias_const_;
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/sample/algo/boxm_simple_grey_processor.cxx b/contrib/brl/bseg/boxm/sample/algo/boxm_simple_grey_processor.cxx
deleted file mode 100644
index b1d9e4639b..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/boxm_simple_grey_processor.cxx
+++ /dev/null
@@ -1,437 +0,0 @@
-#include "boxm_simple_grey_processor.h"
-//:
-// \file
-
-#include <vnl/vnl_erf.h>
-#include <bsta/bsta_gauss_sf1.h>
-#include <bsta/algo/bsta_fit_gaussian.h>
-
-#include "boxm_sigma_normalizer.h"
-
-//const float boxm_simple_grey_processor::one_over_sigma_ = 25.0f;
-const static bool USE_UNIFORM_COMPONENT = false;
-
-//: Return probability density of observing pixel values
-float boxm_simple_grey_processor::prob_density(apm_datatype const& appear, obs_datatype const& obs)
-{
- const auto norm = float(appear.one_over_sigma() * vnl_math::one_over_sqrt2pi);
- const float diff = obs - appear.color();
- const float p = norm * std::exp(-(diff*diff)*appear.one_over_sigma()*appear.one_over_sigma()*0.5f);
- // normalize by area of distribution between 0 and 1
- //return p / total_prob(appear);
- return p * appear.gauss_weight() + (1.0f - appear.gauss_weight());
-}
-
-//: Return probabilities that pixels are in range [min,max]
-float boxm_simple_grey_processor::prob_range(apm_datatype const& appear, obs_datatype const& obs_min, obs_datatype const& obs_max)
-{
- // make sure obs_min and obs_max are within bounds
- const float obs_min_n = obs_min >= 0 ? obs_min : 0.0f;
- const float obs_max_n = obs_max <= 1.0? obs_max : 1.0f;
-
- const float diff_low = obs_min_n - appear.color();
- const float diff_high = obs_max_n - appear.color();
- const auto norm = float(appear.one_over_sigma()*vnl_math::sqrt1_2);
-
- const auto double_cdf_low_minus_1 = (float)vnl_erf(diff_low*norm);
- const auto double_cdf_high_minus_1 = (float)vnl_erf(diff_high*norm);
- const float P = (0.5f * (double_cdf_high_minus_1 - double_cdf_low_minus_1));
- //return P / total_prob(appear);
- return P * appear.gauss_weight() + (1.0f - appear.gauss_weight())*(obs_max - obs_min);
-}
-
-//: Return probabilities that pixels are in range [0,1] - used for normalizing
-float boxm_simple_grey_processor::total_prob(apm_datatype const& appear)
-{
- const float diff_low = -appear.color();
- const float diff_high = 1.0f - appear.color();
- const auto norm = float(appear.one_over_sigma()*vnl_math::sqrt1_2);
- const auto double_cdf_low_minus_1 = (float)vnl_erf(diff_low*norm);
- const auto double_cdf_high_minus_1 = (float)vnl_erf(diff_high*norm);
- return 0.5f * (double_cdf_high_minus_1 - double_cdf_low_minus_1);
-}
-
-
-//: Update with a new sample image
-bool boxm_simple_grey_processor::update( apm_datatype &appear, obs_datatype const& obs, float const& /*weight*/)
-{
- appear = boxm_simple_grey(vnl_vector_fixed<float,3>(obs, appear.sigma(), appear.gauss_weight()));
- return true;
-}
-
-
-//: Expected value
-boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype boxm_simple_grey_processor::expected_color(boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype const& appear)
-{
- return appear.color() * appear.gauss_weight() + 0.5f * (1.0f - appear.gauss_weight());
-}
-
-//: color of the most probable mode in the mixtures in the slab
-boxm_simple_grey_processor::obs_datatype boxm_simple_grey_processor::most_probable_color(apm_datatype const& appear)
-{
- return appear.color();
-}
-
-void boxm_simple_grey_processor::compute_appearance(std::vector<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> const& obs, std::vector<float> const& pre, std::vector<float> const& vis, boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype &model, float min_sigma)
-{
- bsta_gauss_sf1 model_bsta(model.color(),model.sigma()*model.sigma());
- const auto big_sigma = (float)vnl_math::sqrt1_2; // maximum possible std. dev for set of samples drawn from [0 1]
- auto nobs = (unsigned int)obs.size();
- // check for some simple cases first
- if (nobs == 0) {
- // zero observations. nothing to do here.
- model = boxm_simple_grey(0.5f, big_sigma);
- return;
- }
- if (nobs == 1) {
- // one observation: Just return the value as the mean, and a big sigma.
- model = boxm_simple_grey(obs[0], big_sigma);
- return;
- }
- //std::cout << "nobs = " << obs.size() << std::endl;
- //for (unsigned int i=0; i<obs.size(); ++i) {
- // std::cout << "obs=" << obs[i] << " vis=" << vis[i] << "pre=" << pre[i] << std::endl;
- //}
- const float min_var_EM = 1.5e-5f; // to prevent degenerate solution (corresponds roughly to sigma = 1/255)
- bsta_fit_gaussian(obs,vis,pre,model_bsta,min_var_EM);
- // compute expected number of observations
- float expected_nobs = 0.0f;
- for (float vi : vis) {
- expected_nobs += vi;
- }
- // normalize sigma
- static const boxm_sigma_normalizer sigma_norm(0.20f);
- const float norm_factor = sigma_norm.normalization_factor(expected_nobs);
- //const float norm_factor = 1.0f;
- float sigma = std::sqrt(model_bsta.var()) * norm_factor;
-
- // bounds check on std. deviation value
- if (sigma < min_sigma) {
- sigma = min_sigma;
- }
- if (sigma > big_sigma) {
- sigma = big_sigma;
- }
- if (!(sigma < big_sigma) && !(sigma > min_sigma)) {
- std::cerr << "error: sigma = " << sigma << " model_bsta.var() = " << model_bsta.var() << std::endl;
- sigma = big_sigma;
- }
- // convert back to a boxm_simple_grey model
- model = boxm_simple_grey(model_bsta.mean(),sigma);
- return;
-}
-
-void boxm_simple_grey_processor::compute_appearance(std::vector<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> const& obs, std::vector<float> const& weights, boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype &model, float min_sigma)
-{
- const auto big_sigma = (float)vnl_math::sqrt1_2; // maximum possible std. dev for set of samples drawn from [0 1]
-
- const auto nobs = (unsigned int)obs.size();
- if (nobs == 0) {
- // zero observations. nothing to do here.
- model = boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype(0.5f, 1.0f, 0.0f);
- return;
- }
- if (nobs == 1) {
- // one observation: Just return the value as the mean, and a big sigma.
- model = boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype(obs[0], big_sigma, weights[0]);
- return;
- }
- else {
- // compute estimate of gaussian parameters
- // Initialize the estimates
- boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype mean_est(0);
- float sigma_est = 0.0f;
-
- compute_gaussian_params(obs, weights, mean_est, sigma_est);
- boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype gauss_model(mean_est, sigma_est, 1.0f);
-
- sigma_est *= sigma_norm_factor(nobs);
-
- // make sure standard deviation is not too small
- if (sigma_est < min_sigma) {
- sigma_est = min_sigma;
- }
- // or too big
- if (sigma_est > big_sigma) {
- sigma_est = big_sigma;
- }
-
- // compute estimate of gaussian weight by summing probabilities
- float gauss_weight = 0.0f;
- if (USE_UNIFORM_COMPONENT) {
- float weight_sum = 0.0f;
- for (unsigned int n=0; n<nobs; ++n) {
- const float p_gauss = boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_processor::prob_density(gauss_model,obs[n]);
- const float p_uniform = 1.0f;
- gauss_weight += weights[n] * p_gauss / (p_gauss + p_uniform);
- weight_sum += weights[n];
- }
- if (weight_sum > 0.0f) {
- gauss_weight /= weight_sum;
- }
- }
- else {
- gauss_weight = 1.0f;
- }
-
- model = boxm_simple_grey(mean_est, sigma_est, gauss_weight);
- }
-}
-
-
-void boxm_simple_grey_processor::update_appearance(std::vector<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> const& obs, std::vector<float> const& weights, boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype &model, float min_sigma)
-{
- const auto big_sigma = (float)vnl_math::sqrt1_2; // maximum possible std. dev for set of samples drawn from [0 1]
-
- const auto nobs = (unsigned int)obs.size();
- if (nobs == 0) {
- // zero observations. nothing to do here.
- return;
- }
- if (nobs == 1) {
- // one observation: Just return the value as the mean, and a big sigma.
- model = boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype(obs[0], big_sigma);
- return;
- }
- else {
- // compute estimate of gaussian weight by summing probabilities
- std::vector<float> obs_gauss_weights = weights;
- float gauss_weight = 0.0f;
- float expected_nobs = 0.0f;
- if (USE_UNIFORM_COMPONENT) {
- float weight_sum = 0.0f;
-
- for (unsigned int n=0; n<nobs; ++n) {
- const float p_total = boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_processor::prob_density(model,obs[n]);
- const float p_uniform = 1.0f - model.gauss_weight();
- const float p_gauss = p_total - p_uniform;
- if (p_total > 0.0f) {
- obs_gauss_weights[n] = weights[n] * p_gauss / p_total;
- }
- else {
- obs_gauss_weights[n] = 0.0f;
- }
- gauss_weight += obs_gauss_weights[n];
- weight_sum += weights[n];
- }
- if (weight_sum > 0.0f) {
- gauss_weight /= weight_sum;
- }
- expected_nobs = weight_sum;
- }
- else {
- auto wit = weights.begin();
- for (; wit != weights.end(); ++wit) {
- expected_nobs += *wit;
- }
- gauss_weight = 1.0f;
- }
- // Initialize the estimates
- boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype mean_est(0);
- float sigma_est = 0.0f;
-
- compute_gaussian_params(obs, obs_gauss_weights, mean_est, sigma_est);
-
- //sigma_est *= sigma_norm_factor(nobs);
-
- // make sure standard deviation is not too small
- if (sigma_est < min_sigma) {
- sigma_est = min_sigma;
- }
- // or too big
- if (sigma_est > big_sigma) {
- sigma_est = big_sigma;
- }
-
- model = boxm_simple_grey(mean_est, sigma_est, gauss_weight);
- }
- return;
-}
-
-void boxm_simple_grey_processor::finalize_appearance(std::vector<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> const& obs,
- std::vector<float> const& weights,
- boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype &model)
-{
- const auto big_sigma = (float)vnl_math::sqrt1_2; // maximum possible std. dev for set of samples drawn from [0 1]
-
- float expected_nobs = 0.0f;
- const auto nobs = (unsigned int)obs.size();
-
- auto wit = weights.begin();
- for (; wit != weights.end(); ++wit) {
- expected_nobs += *wit;
- }
-
- //float unbiased_sigma = model.sigma() * sigma_norm_factor(expected_nobs);
- float unbiased_sigma = model.sigma() * sigma_norm_factor(nobs);
- if (unbiased_sigma > big_sigma) {
- unbiased_sigma = big_sigma;
- }
-
-
- model = boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype(model.color(), unbiased_sigma, model.gauss_weight());
-}
-
-
-void boxm_simple_grey_processor::compute_gaussian_params(std::vector<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> obs, std::vector<float> weights, boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype &mean, float &sigma)
-{
- const auto nobs = (unsigned int)obs.size();
- double w_sum = 0.0;
- double w2_sum = 0.0;
- double obs_sum = 0.0;
-
- for (unsigned int i=0; i<nobs; ++i) {
- w_sum += weights[i];
- w2_sum += weights[i]*weights[i];
- obs_sum += obs[i] * weights[i];
- }
- double mean_obs = 0.5f;
- if (w_sum > 0) {
- mean_obs = obs_sum / w_sum;
- }
-
- double var_sum = 0.0;
- for (unsigned int i=0; i<nobs; ++i) {
- const double diff = obs[i] - mean_obs;
- var_sum += diff*diff*weights[i];
- }
- double var = 1.0f;
- if (w_sum > 0) {
- var = var_sum / (w_sum - (w2_sum/w_sum));
- }
-
- mean = (float)mean_obs;
- sigma = (float)std::sqrt(var);
-}
-
-float boxm_simple_grey_processor::sigma_norm_factor(float nobs)
-{
- if (nobs <= 1.0f) {
- return sigma_norm_factor((unsigned int)1);
- }
-
- // linearly interpolate between integer values
- float nobs_floor = std::floor(nobs);
- float nobs_ceil = std::ceil(nobs);
- float floor_weight = nobs_ceil - nobs;
- float norm_factor = (sigma_norm_factor((unsigned int)nobs_floor) * floor_weight) + (sigma_norm_factor((unsigned int)nobs_ceil) * (1.0f - floor_weight));
-
- return norm_factor;
-}
-
-float boxm_simple_grey_processor::sigma_norm_factor(unsigned int nobs)
-{
- static const float unbias_const[] = {0, 1e3f, 7.9057f, 3.0787f, 2.2646f, 1.9389f, 1.7617f, 1.6496f, 1.5716f, 1.5140f, 1.4693f, 1.4336f, 1.4043f, 1.3797f, 1.3587f, 1.3406f, 1.3248f, 1.3107f, 1.2983f, 1.2871f, 1.2770f, 1.2678f, 1.2594f, 1.2517f, 1.2446f, 1.2380f, 1.2319f, 1.2262f, 1.2209f, 1.2159f, 1.2112f, 1.2068f, 1.2026f, 1.1987f, 1.1949f, 1.1914f };
-
- if (nobs < 2) {
- return unbias_const[1];
- }
-
- if (nobs < 36) {
- return unbias_const[nobs];
- }
- // else nobs >= 36
- // approximate for big n with function a = m /nobs + b
- static const float m = (unbias_const[35] - unbias_const[30])/(1.0f/35.0f - 1.0f/30.0f);
- static const float b = unbias_const[35] - m*(1.0f/35.0f);
- return m/nobs + b;
-}
-
-void boxm_simple_grey_processor::
-boxm_compute_shadow_appearance(std::vector<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> const& obs,
- std::vector<float> const& pre,
- std::vector<float> const& vis,
- boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype &model,
- float min_app_sigma,
- float shadow_prior,
- float shadow_mean,
- float shadow_sigma,
- bool verbose )
-{
- std::vector<float> obs_weights(vis.size(), 0.0f);
- std::vector<float> sh_density(vis.size(), 0.0f);
- //assume that the initial appearance distribution is uniform on [0 1]
- //thus a reasonable initialization for weights is
- //
- // vis(1-Psh)/( (1-Psh) + Psh psh(obs) )
- //
- //, where Psh is shadow_prior and psh(x) is the shadow density function,
- // sh_density. vis is the visibilty probability
- //
- boxm_simple_grey shadow_dist(shadow_mean, shadow_sigma);
- for (unsigned n = 0; n<obs.size(); ++n)
- {
- //2.0 x density since centered on zero
- sh_density[n] =
- 2.0f*boxm_simple_grey_processor::prob_density(shadow_dist, obs[n]);
- float neu = vis[n]*(1-shadow_prior);
- float weight =
- neu/(neu + sh_density[n]*shadow_prior);
- obs_weights[n]=weight;
- }
- std::vector<float> initial_weights = obs_weights;
- // initial estimate for the illuminated appearance model
- boxm_simple_grey_processor::compute_appearance(obs,obs_weights,model,min_app_sigma);
- double initial_mean = model.color();
- double initial_sigma = model.sigma();
-
- // use EM to refine estimate until convergence.
- auto nobs = (unsigned int)obs.size();
- if (nobs == 0) {
- // nothing to do.
- return;
- }
- const float epsilon = 1e-4f;
- constexpr unsigned int max_its = 100;
- const float min_weight_change = 1e-5f;
- unsigned int i=0;
- for (; i<max_its; ++i) {
- float max_weight_change = 0.0f;
- // EXPECTATION - determine the weights
- for (unsigned int n=0; n<nobs; ++n) {
- float PI = vis[n] * boxm_simple_grey_processor::prob_density(model,obs[n]);
- float neu = PI*(1-shadow_prior);
- float den = (PI + pre[n])*(1-shadow_prior) + shadow_prior*sh_density[n];
- float new_obs_weight = 0;
- if (den > epsilon) {
- new_obs_weight = neu / den;
- }
- // compute delta weight for convergence check
- float weight_delta = std::fabs(obs_weights[n] - new_obs_weight);
- if (weight_delta > max_weight_change) {
- max_weight_change = weight_delta;
- }
- obs_weights[n] = new_obs_weight;
- }
- // check for convergence
- if (max_weight_change < min_weight_change)
- break;
- // MAXIMIZATION - determine the parameters of the appearance distribution
- boxm_simple_grey_processor::update_appearance(obs,obs_weights,model,min_app_sigma);
- }
- if (verbose) {
- bool print = false;
- for (unsigned n = 0; n<obs.size(); ++n) {
- if (obs[n]>0) print = true;
- if (i<max_its&&print) {
- std::cout << "converged after " << i << " iterations.\n"
- << " initial mean = " << initial_mean << " final mean = "
- << model.color() << '\n'
- << " initial sigma = " << initial_sigma << " final sigma = "
- << model.sigma() << '\n';
- }
- else { std::cout << "failed to converge\n"; }
-
- std::cout << "Initial (Observations, Weights):\n";
- for (unsigned n=0; n<obs.size(); ++n)
- std::cout << '('<< obs[n] << ' ' << initial_weights[n] << ") ";
- std::cout << "\nFinal (Observations, Weights):\n";
- for (unsigned n=0; n<obs.size(); ++n)
- std::cout << '('<< obs[n] << ' ' << obs_weights[n] << ") ";
- std::cout << '\n';
- }
- }
-
- // adjust model to account for small sample sizes.
- boxm_simple_grey_processor::finalize_appearance(obs,obs_weights,model);
-}
diff --git a/contrib/brl/bseg/boxm/sample/algo/boxm_simple_grey_processor.h b/contrib/brl/bseg/boxm/sample/algo/boxm_simple_grey_processor.h
deleted file mode 100644
index 076213bd46..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/boxm_simple_grey_processor.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// This is brl/bseg/boxm/sample/algo/boxm_simple_grey_processor.h
-#ifndef boxm_simple_grey_processor_h_
-#define boxm_simple_grey_processor_h_
-//:
-// \file
-// \brief A class for processing simple, single valued grey-scale appearance models.
-// The represented distribution can be thought of as a delta function centered on the value.
-//
-// \author Daniel Crispell
-// \date Sept 29, 2008
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <iosfwd>
-#include <boxm/boxm_apm_traits.h>
-#if 0 // operator<< in commented-out section
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#endif
-
-class boxm_simple_grey_processor
-{
- protected:
- // convienance typedefs
- typedef boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype apm_datatype;
- typedef boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype obs_datatype;
- typedef boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_mathtype obs_mathtype;
-
- // all methods are static - no constructor needed
- private:
- boxm_simple_grey_processor() = default;
-
-#if 0 // one_over_sigma is now a member of apm_datatype
- static const float one_over_sigma_;
-#endif
-
- public:
-
- static float prob_density(apm_datatype const& appear, obs_datatype const& obs);
-
- static float prob_range(apm_datatype const& appear, obs_datatype const& obs_min, obs_datatype const& obs_max);
-
- static float total_prob(apm_datatype const& appear);
-
- static bool update( apm_datatype &appear, obs_datatype const& obs, float const& weight);
-
- static boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype expected_color(boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype const& appear);
-
- static boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_mathtype most_probable_color(boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype const& appear);
-
- static void compute_appearance(std::vector<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> const& obs, std::vector<float> const& weights, boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype &model, float min_sigma = 0.01f);
- static void compute_appearance(std::vector<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> const& obs, std::vector<float> const& pre, std::vector<float> const& vis, boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype &model, float min_sigma=0.01f);
-
- static void update_appearance(std::vector<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> const& obs, std::vector<float> const& weights, boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype &model, float min_sigma = 0.01f);
-
- static void finalize_appearance(std::vector<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> const& obs, std::vector<float> const& weights, boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype &model);
-
- //: includes a shadow density component to the single gaussian scalar appearance model, defined by a fixed shadow mean and sigma.
- // The shadow prior defines the probability that an observation is in shadow.
- // The function updates the "model" mean and sigma.
- static void boxm_compute_shadow_appearance(std::vector<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> const& obs,
- std::vector<float> const& pre,
- std::vector<float> const& vis,
- boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::apm_datatype &model,
- float min_app_sigma,
- float shadow_prior,
- float shadow_mean,
- float shadow_sigma,
- bool verbose = false);
- private:
- static void compute_gaussian_params(std::vector<boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype> obs, std::vector<float> weights, boxm_apm_traits<BOXM_APM_SIMPLE_GREY>::obs_datatype &mean, float &sigma);
-
- static float sigma_norm_factor(unsigned int nobs);
-
- static float sigma_norm_factor(float nobs);
-};
-
-#if 0
-std::ostream& operator<<(std::ostream &os, boxm_simple_grey const& apm);
-#endif
-
-#endif // boxm_simple_grey_processor_h_
diff --git a/contrib/brl/bseg/boxm/sample/algo/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/sample/algo/tests/CMakeLists.txt
deleted file mode 100644
index 4390b597bc..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/tests/CMakeLists.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-add_executable( boxm_sample_algo_test_all
- test_driver.cxx
- test_sigma_normalizer.cxx
- )
-
-target_link_libraries( boxm_sample_algo_test_all boxm_sample_algo boxm_sample boxm ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vcl ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vnl_algo ${VXL_LIB_PREFIX}vbl bsta bsta_algo)
-
-add_test( NAME boxm_sample_test_sigma_normalizer COMMAND $<TARGET_FILE:boxm_sample_algo_test_all> test_sigma_normalizer )
-
-add_executable( boxm_sample_algo_test_include test_include.cxx )
-target_link_libraries( boxm_sample_algo_test_include boxm_sample_algo)
diff --git a/contrib/brl/bseg/boxm/sample/algo/tests/test_driver.cxx b/contrib/brl/bseg/boxm/sample/algo/tests/test_driver.cxx
deleted file mode 100644
index 1258c5dc63..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/tests/test_driver.cxx
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <testlib/testlib_register.h>
-
-DECLARE( test_sigma_normalizer );
-
-void register_tests()
-{
- REGISTER( test_sigma_normalizer );
-}
-
-
-DEFINE_MAIN;
diff --git a/contrib/brl/bseg/boxm/sample/algo/tests/test_include.cxx b/contrib/brl/bseg/boxm/sample/algo/tests/test_include.cxx
deleted file mode 100644
index 3c7fc60db6..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/tests/test_include.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boxm/sample/algo/boxm_mob_grey_processor.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-#include <boxm/sample/algo/boxm_simple_grey_processor.h>
-#include <boxm/sample/algo/boxm_sigma_normalizer.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm/sample/algo/tests/test_sigma_normalizer.cxx b/contrib/brl/bseg/boxm/sample/algo/tests/test_sigma_normalizer.cxx
deleted file mode 100644
index 7231ca0b24..0000000000
--- a/contrib/brl/bseg/boxm/sample/algo/tests/test_sigma_normalizer.cxx
+++ /dev/null
@@ -1,59 +0,0 @@
-
-#include <testlib/testlib_test.h>
-#include <vnl/vnl_random.h>
-#include <boxm/sample/algo/boxm_sigma_normalizer.h>
-#include <bsta/bsta_gauss_sf1.h>
-#include <bsta/algo/bsta_fit_gaussian.h>
-
-
-static void test_sigma_normalizer()
-{
- START("boxm_sigma_normalizer test");
-
- // generate random sets of samples from a normal distribution and compare sigma estimate to true value
- {
- vnl_random rand_gen;
- unsigned int n_trials = 5000;
-
- unsigned int n_observations = 6;
- float true_sigma = 0.5f;
- float true_mean = 2.5f;
- float under_estimation_prob = 0.4f;
- unsigned int under_estimates = 0;
-
- boxm_sigma_normalizer normalizer(under_estimation_prob);
-
- for (unsigned int t=0; t<n_trials; ++t) {
- std::vector<float> samples;
- std::vector<float> weights;
- for (unsigned int n=0; n<n_observations; ++n) {
- float sample = true_mean + true_sigma*(float)rand_gen.normal();
- samples.push_back(sample);
- weights.push_back(1.0f);
- }
- // compute the sample mean and variance
- bsta_gauss_sf1 gauss_model;
- bsta_fit_gaussian(samples, weights, gauss_model);
- float normalized_sigma = std::sqrt(gauss_model.var()) * normalizer.normalization_factor_int(n_observations);
- if (normalized_sigma < true_sigma) {
- ++under_estimates;
- }
- }
- float under_estimate_ratio = (float)under_estimates / n_trials;
-
- TEST_NEAR("correct ratio of sigma under-estimates", under_estimate_ratio, under_estimation_prob, 0.05);
- }
-
- // make sure normalization factor approaches 1 for large sample sizes
- {
- boxm_sigma_normalizer sigma_norm(0.10f);
- float norm_factor_f = sigma_norm.normalization_factor(10000.0f);
- float norm_factor_i = sigma_norm.normalization_factor_int(10000);
-
- TEST_NEAR("normalization factor (float) approaches 1 for large N",norm_factor_f, 1.0, 0.1);
- TEST_NEAR("normalization factor (int) approaches 1 for large N",norm_factor_i, 1.0, 0.1);
- }
- return;
-}
-
-TESTMAIN(test_sigma_normalizer);
diff --git a/contrib/brl/bseg/boxm/sample/boxm_edge_sample.h b/contrib/brl/bseg/boxm/sample/boxm_edge_sample.h
deleted file mode 100644
index ae46c03fd6..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_edge_sample.h
+++ /dev/null
@@ -1,97 +0,0 @@
-#ifndef boxm_edge_sample_h_
-#define boxm_edge_sample_h_
-//:
-// \file
-
-#include <iostream>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vil/vil_rgb.h>
-#include <vsl/vsl_binary_io.h>
-#include <boxm/boxm_aux_traits.h>
-
-template<class OBS_T>
-class boxm_edge_sample
-{
- public:
- boxm_edge_sample(): edge_prob_(0), num_obs_(0.0f) {}
- ~boxm_edge_sample() = default;
- static short version_no() { return 1; }
- void print(std::ostream& os) const;
-
- //: returns a basic value that represents this sample (mostly for raw file creation purposes)
- float basic_val() const { return edge_prob_; }
- OBS_T edge_prob_;
- float num_obs_;
-};
-
-template<class OBS_T>
-class boxm_aux_edge_sample
-{
- public:
- boxm_aux_edge_sample(): obs_(0), seg_len_(0.0f) { }
- ~boxm_aux_edge_sample() = default;
- static short version_no() { return 1; }
- void print(std::ostream& os) const;
-
- OBS_T obs_;
- float seg_len_;
-};
-
-#if 0 // two classes commented out
-
-//: traits for a grey optimization sample
-template<>
-class boxm_aux_traits<BOXM_AUX_OPT_RT_GREY>
-{
- public:
- typedef boxm_edge_sample<float> sample_datatype;
-
- static std::string storage_subdir() { return "opt_rt_grey_work"; }
-};
-
-//: traits for an rgb optimization sample
-template<>
-class boxm_aux_traits<BOXM_AUX_OPT_RT_RGB>
-{
- public:
- typedef boxm_edge_sample<vil_rgb<float> > sample_datatype;
-
- static std::string storage_subdir() { return "opt_rt_rgb_work"; }
-};
-
-#endif // 0
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_edge_sample<T> const &sample);
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_edge_sample<T> const * &sample);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_edge_sample<T> &sample);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_edge_sample<T> *&sample);
-
-template <class T>
-std::ostream& operator << (std::ostream& os, const boxm_edge_sample<T>& sample);
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_aux_edge_sample<T> const &sample);
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_aux_edge_sample<T> const * &sample);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_aux_edge_sample<T> &sample);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_aux_edge_sample<T> *&sample);
-
-template <class T>
-std::ostream& operator << (std::ostream& os, const boxm_aux_edge_sample<T>& sample);
-
-
-#endif // boxm_edge_sample_h_
diff --git a/contrib/brl/bseg/boxm/sample/boxm_edge_sample.hxx b/contrib/brl/bseg/boxm/sample/boxm_edge_sample.hxx
deleted file mode 100644
index d2e60dc175..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_edge_sample.hxx
+++ /dev/null
@@ -1,137 +0,0 @@
-#ifndef boxm_edge_sample_hxx_
-#define boxm_edge_sample_hxx_
-
-#include "boxm_edge_sample.h"
-
-
-// Edge Sample Methods
-template <class OBS_T>
-void boxm_edge_sample<OBS_T>::print(std::ostream& os) const
-{
- os << "(edge_prob=" << edge_prob_ << " num_obs=" << num_obs_ << ')';
-}
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_edge_sample<T> const &sample)
-{
- vsl_b_write(os, sample.version_no());
- vsl_b_write(os, sample.edge_prob_);
- vsl_b_write(os, sample.num_obs_);
-}
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_edge_sample<T> const * &sample)
-{
- if (sample) {
- vsl_b_write(os, *sample);
- }
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_edge_sample<T> &sample)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case 1:
- vsl_b_read(is, sample.edge_prob_);
- vsl_b_read(is, sample.num_obs_);
- break;
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_edge_sample<T>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- break;
- }
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_edge_sample<T> *&sample)
-{
- vsl_b_read(is, *sample);
-}
-
-template <class T>
-std::ostream& operator << (std::ostream& os, const boxm_edge_sample<T>& sample)
-{
- sample.print(os);
- return os;
-}
-
-// Auxiliary Edge Sample Methods
-template <class OBS_T>
-void boxm_aux_edge_sample<OBS_T>::print(std::ostream& os) const
-{
- os << "(obs=" << obs_ << " seg_len=" << seg_len_ << ')';
-}
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_aux_edge_sample<T> const &sample)
-{
- vsl_b_write(os, sample.version_no());
- vsl_b_write(os, sample.obs_);
- vsl_b_write(os, sample.seg_len_);
-}
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_aux_edge_sample<T> const * &sample)
-{
- if (sample) {
- vsl_b_write(os, *sample);
- }
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_aux_edge_sample<T> &sample)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case 1:
- vsl_b_read(is, sample.obs_);
- vsl_b_read(is, sample.seg_len_);
- break;
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_aux_edge_sample<T>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- break;
- }
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_aux_edge_sample<T> *&sample)
-{
- vsl_b_read(is, *sample);
-}
-
-template <class T>
-std::ostream& operator << (std::ostream& os, const boxm_aux_edge_sample<T>& sample)
-{
- sample.print(os);
- return os;
-}
-
-#define BOXM_EDGE_SAMPLE_INSTANTIATE(T) \
-template class boxm_edge_sample<T >; \
-template void vsl_b_write(vsl_b_ostream &, boxm_edge_sample<T > const &); \
-template void vsl_b_write(vsl_b_ostream &, boxm_edge_sample<T > const *&); \
-template void vsl_b_read(vsl_b_istream &, boxm_edge_sample<T > &); \
-template void vsl_b_read(vsl_b_istream &, boxm_edge_sample<T > *&); \
-template std::ostream& operator << (std::ostream&, const boxm_edge_sample<T >&)
-
-#define BOXM_AUX_EDGE_SAMPLE_INSTANTIATE(T) \
-template class boxm_aux_edge_sample<T >; \
-template void vsl_b_write(vsl_b_ostream &, boxm_aux_edge_sample<T > const &); \
-template void vsl_b_write(vsl_b_ostream &, boxm_aux_edge_sample<T > const *&); \
-template void vsl_b_read(vsl_b_istream &, boxm_aux_edge_sample<T > &); \
-template void vsl_b_read(vsl_b_istream &, boxm_aux_edge_sample<T > *&); \
-template std::ostream& operator << (std::ostream&, const boxm_aux_edge_sample<T >&)
-
-#endif
diff --git a/contrib/brl/bseg/boxm/sample/boxm_edge_tangent_sample.h b/contrib/brl/bseg/boxm/sample/boxm_edge_tangent_sample.h
deleted file mode 100644
index a92ae0e38e..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_edge_tangent_sample.h
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef boxm_edge_tangent_sample_h_
-#define boxm_edge_tangent_sample_h_
-//:
-// \file
-
-#include <iostream>
-#include <vector>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vsl/vsl_binary_io.h>
-#include "boxm_plane_obs.h"
-#include <boxm/boxm_aux_traits.h>
-
-
-template <class T>
-class boxm_edge_tangent_sample
-{
- public:
- boxm_edge_tangent_sample() = default;
- ~boxm_edge_tangent_sample() = default;
- static short version_no() { return 1; }
- void print(std::ostream& os) const;
-
- //: adds observations
- void insert(boxm_plane_obs<T> const& obs) { obs_.push_back(obs); }
-
- //: insert a lis of observations
- void insert(std::vector<boxm_plane_obs<T> > const& obs) {obs_.insert(obs_.end(),obs.begin(),obs.end()); }
-
- //: returns the number of observations
- unsigned num_obs() const { return obs_.size(); }
-
- boxm_plane_obs<T> obs(unsigned int i) const {
- if (i < obs_.size()) return obs_[i];
- std::cerr << "boxm_edge_tangent_sample: " << i << " is out of index - size is " << obs_.size() << std::endl;
- return boxm_plane_obs<T>();
- }
-
- //: returns a basic value that represents this sample (mostly for raw file creation purposes)
- float basic_val(unsigned int i) {
- if (i < obs_.size()) return obs_[i].seg_len_;
- std::cerr << "boxm_edge_tangent_sample: " << i << "is out of index - size is " << obs_.size() << std::endl;
- return -1.0f;
- }
-
- std::vector<boxm_plane_obs<T> > obs_list() { return obs_; }
-
- private:
- std::vector<boxm_plane_obs<T> > obs_;
-};
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_edge_tangent_sample<T> const &sample);
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_edge_tangent_sample<T> const * &sample);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_edge_tangent_sample<T> &sample);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_edge_tangent_sample<T> *&sample);
-
-template <class T>
-std::ostream&operator << (std::ostream& os, boxm_edge_tangent_sample<T>& sample);
-
-
-#endif // boxm_edge_tangent_sample_h_
diff --git a/contrib/brl/bseg/boxm/sample/boxm_edge_tangent_sample.hxx b/contrib/brl/bseg/boxm/sample/boxm_edge_tangent_sample.hxx
deleted file mode 100644
index bb96baa1e0..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_edge_tangent_sample.hxx
+++ /dev/null
@@ -1,79 +0,0 @@
-#ifndef boxm_edge_tangent_sample_hxx_
-#define boxm_edge_tangent_sample_hxx_
-
-#include "boxm_edge_tangent_sample.h"
-#include "boxm_plane_obs.h"
-
-template <class OBS_T>
-void boxm_edge_tangent_sample<OBS_T>::print(std::ostream& os) const
-{
- os << " num_obs=" << this->num_obs() << std::endl;
- for (unsigned i=0; i<obs_.size(); i++)
- os << " " << i << "- (obs=" << this->obs(i) << ")\n" ;
-}
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_edge_tangent_sample<T> const & sample)
-{
- vsl_b_write(os, sample.version_no());
- vsl_b_write(os, sample.num_obs());
- for (unsigned i=0; i<sample.num_obs(); i++)
- vsl_b_write(os, sample.obs(i));
-}
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_edge_tangent_sample<T> const * &sample)
-{
- if (sample) {
- vsl_b_write(os, *sample);
- }
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_edge_tangent_sample<T> &sample)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case 1:
- { unsigned num;
- vsl_b_read(is, num);
- boxm_plane_obs<T> o;
- for (unsigned i=0; i<num; i++) {
- vsl_b_read(is, o);
- sample.insert(o);
- }}
- break;
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_edge_tangent_sample<T>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- break;
- }
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_edge_tangent_sample<T> *&sample)
-{
- vsl_b_read(is, *sample);
-}
-
-template <class T>
-std::ostream& operator << (std::ostream& os, boxm_edge_tangent_sample<T> &sample)
-{
- sample.print(os);
- return os;
-}
-
-#define BOXM_EDGE_TANGENT_SAMPLE_INSTANTIATE(T) \
-template class boxm_edge_tangent_sample<T >; \
-template void vsl_b_write(vsl_b_ostream &, boxm_edge_tangent_sample<T > const &); \
-template void vsl_b_write(vsl_b_ostream &, boxm_edge_tangent_sample<T > const *&); \
-template void vsl_b_read(vsl_b_istream &, boxm_edge_tangent_sample<T > &); \
-template void vsl_b_read(vsl_b_istream &, boxm_edge_tangent_sample<T > *&); \
-template std::ostream& operator << (std::ostream&, boxm_edge_tangent_sample<T >&)
-
-#endif
diff --git a/contrib/brl/bseg/boxm/sample/boxm_inf_line_sample.h b/contrib/brl/bseg/boxm/sample/boxm_inf_line_sample.h
deleted file mode 100644
index 953c9f286f..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_inf_line_sample.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef boxm_inf_line_sample_h_
-#define boxm_inf_line_sample_h_
-//:
-// \file
-
-#include <iostream>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vsl/vsl_binary_io.h>
-#include <vgl/vgl_infinite_line_3d.h>
-#include <vgl/vgl_line_3d_2_points.h>
-
-#include <boxm/boxm_aux_traits.h>
-#include <bsta/bsta_kent.h>
-
-template<class T>
-class boxm_inf_line_sample
-{
- public:
- //: initially the residual is very big, it means the solution to this inf line is not found yet
- boxm_inf_line_sample() :
- residual_(1e6), line_(vgl_infinite_line_3d<T>(vgl_vector_2d<T>(0,0),
- vgl_vector_3d<T>(10,10,10))), num_obs_(0){}
-
- boxm_inf_line_sample(vgl_infinite_line_3d<T> line,unsigned num_obs=0) : residual_(1e6),line_(line),num_obs_(num_obs) {}
- ~boxm_inf_line_sample() = default;
- static short version_no() { return 1; }
- void print(std::ostream& os) { os << "(line=" << line_ << ')'; }
- bool operator==(const boxm_inf_line_sample &rhs) const;
- typedef boxm_inf_line_sample<T> value_type;
- // public members
- T residual_;
- vgl_infinite_line_3d<T> line_;
- vgl_line_3d_2_points<T> line_clipped_;
- unsigned num_obs_;
-};
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_inf_line_sample<T> const &sample);
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_inf_line_sample<T> const * &sample);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_inf_line_sample<T> &sample);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_inf_line_sample<T> *&sample);
-
-template <class T>
-std::ostream& operator << (std::ostream& os, boxm_inf_line_sample<T>& sample);
-
-
-#endif // boxm_inf_line_sample_h_
diff --git a/contrib/brl/bseg/boxm/sample/boxm_inf_line_sample.hxx b/contrib/brl/bseg/boxm/sample/boxm_inf_line_sample.hxx
deleted file mode 100644
index 1206b4a5f3..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_inf_line_sample.hxx
+++ /dev/null
@@ -1,79 +0,0 @@
-#ifndef boxm_inf_line_sample_hxx_
-#define boxm_inf_line_sample_hxx_
-
-#include "boxm_inf_line_sample.h"
-#include <vgl/io/vgl_io_infinite_line_3d.h> // for vsl_b_write(os, sample.line_);
-#include <vgl/io/vgl_io_line_3d_2_points.h> // for vsl_b_write(os, sample.line_clipped_);
-
-template <class T>
-bool boxm_inf_line_sample<T>::operator==(const boxm_inf_line_sample<T> &rhs) const
-{
- if ((this==&rhs) || (line_==rhs.line_ && line_clipped_==rhs.line_clipped_ && num_obs_==rhs.num_obs_))
- return true;
- else
- return false;
-}
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_inf_line_sample<T> const &sample)
-{
- vsl_b_write(os, sample.version_no());
- vsl_b_write(os, sample.num_obs_);
- vsl_b_write(os, sample.residual_);
- vsl_b_write(os, sample.line_);
- vsl_b_write(os, sample.line_clipped_);
-}
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_inf_line_sample<T> const * &sample)
-{
- if (sample) {
- vsl_b_write(os, *sample);
- }
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_inf_line_sample<T> &sample)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case 1:
- vsl_b_read(is, sample.num_obs_);
- vsl_b_read(is, sample.residual_);
- vsl_b_read(is, sample.line_);
- vsl_b_read(is, sample.line_clipped_);
- break;
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_inf_line_sample<T>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- break;
- }
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_inf_line_sample<T> *&sample)
-{
- vsl_b_read(is, *sample);
-}
-
-template <class T>
-std::ostream& operator << (std::ostream& os, boxm_inf_line_sample<T>& sample)
-{
- sample.print(os);
- return os;
-}
-
-#define BOXM_INF_LINE_SAMPLE_INSTANTIATE(T) \
-template class boxm_inf_line_sample<T >; \
-template void vsl_b_write(vsl_b_ostream &, boxm_inf_line_sample<T > const &); \
-template void vsl_b_write(vsl_b_ostream &, boxm_inf_line_sample<T > const *&); \
-template void vsl_b_read(vsl_b_istream &, boxm_inf_line_sample<T > &); \
-template void vsl_b_read(vsl_b_istream &, boxm_inf_line_sample<T > *&);\
-template std::ostream& operator << (std::ostream&, boxm_inf_line_sample<T >&)
-
-#endif
diff --git a/contrib/brl/bseg/boxm/sample/boxm_opt2_sample.h b/contrib/brl/bseg/boxm/sample/boxm_opt2_sample.h
deleted file mode 100644
index 56ac1825d9..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_opt2_sample.h
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifndef boxm_opt2_sample_h_
-#define boxm_opt2_sample_h_
-//:
-// \file
-
-#include <iostream>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vil/vil_rgb.h>
-#include <vsl/vsl_binary_io.h>
-#include <boxm/boxm_aux_traits.h>
-
-
-template <class OBS_T>
-class boxm_opt2_sample
-{
- public:
- boxm_opt2_sample()
- : obs_(0), pre_(0.0f), vis_(0.0f), PI_(0.0f), seg_len_(0.0f), log_pass_prob_sum_(0.0f), weighted_seg_len_sum_(0.0f)
- {}
-
- ~boxm_opt2_sample() = default;
- static short version_no() { return 1; }
- void print(std::ostream& os) const;
-
- OBS_T obs_;
- float pre_;
- float vis_;
- float PI_;
- float seg_len_;
-
- float log_pass_prob_sum_;
- float weighted_seg_len_sum_;
-};
-
-//:traits for a grey optimization sample
-template <>
-class boxm_aux_traits<BOXM_AUX_OPT2_GREY>
-{
- public:
- typedef boxm_opt2_sample<float> sample_datatype;
-
- static std::string storage_subdir() { return "opt2_grey_work"; }
-};
-
-//:traits for an rgb optimization sample
-template <>
-class boxm_aux_traits<BOXM_AUX_OPT2_RGB>
-{
- public:
- typedef boxm_opt2_sample<vil_rgb<float> > sample_datatype;
-
- static std::string storage_subdir() { return "opt2_rgb_work"; }
-};
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_opt2_sample<T> const &sample);
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_opt2_sample<T> const * &sample);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_opt2_sample<T> &sample);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_opt2_sample<T> *&sample);
-
-template <class T>
-std::ostream& operator<< (std::ostream& os, const boxm_opt2_sample<T>& sample);
-
-#endif // boxm_opt2_sample_h_
diff --git a/contrib/brl/bseg/boxm/sample/boxm_opt2_sample.hxx b/contrib/brl/bseg/boxm/sample/boxm_opt2_sample.hxx
deleted file mode 100644
index 44300e3bf7..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_opt2_sample.hxx
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef boxm_opt2_sample_hxx_
-#define boxm_opt2_sample_hxx_
-
-#include "boxm_opt2_sample.h"
-
-
-template <class OBS_T>
-void boxm_opt2_sample<OBS_T>::print(std::ostream& os) const
-{
- os << "(obs=" << obs_ << " pre=" << pre_ << " vis=" << vis_ << " PI=" << PI_
- << " seg_len=" << seg_len_ << " log_pass_prob_sum=" << log_pass_prob_sum_
- << " weighted_seg_len_sum=" << weighted_seg_len_sum_ << ')';
-}
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_opt2_sample<T> const &sample)
-{
- vsl_b_write(os, sample.version_no());
- vsl_b_write(os, sample.obs_);
- vsl_b_write(os, sample.pre_);
- vsl_b_write(os, sample.vis_);
- vsl_b_write(os, sample.PI_);
- vsl_b_write(os, sample.seg_len_);
- vsl_b_write(os, sample.log_pass_prob_sum_);
- vsl_b_write(os, sample.weighted_seg_len_sum_);
-}
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_opt2_sample<T> const * &sample)
-{
- if (sample) {
- vsl_b_write(os, *sample);
- }
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_opt2_sample<T> &sample)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case 1:
- vsl_b_read(is, sample.obs_);
- vsl_b_read(is, sample.pre_);
- vsl_b_read(is, sample.vis_);
- vsl_b_read(is, sample.PI_);
- vsl_b_read(is, sample.seg_len_);
- vsl_b_read(is, sample.log_pass_prob_sum_);
- vsl_b_read(is, sample.weighted_seg_len_sum_);
- break;
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_opt2_sample<T>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- break;
- }
-}
-
-template<class T>
-void vsl_b_read(vsl_b_istream & is, boxm_opt2_sample<T> *&sample)
-{
- vsl_b_read(is, *sample);
-}
-
-template <class T>
-std::ostream& operator << (std::ostream& os, const boxm_opt2_sample<T>& sample)
-{
- sample.print(os);
- return os;
-}
-
-#define BOXM_OPT2_SAMPLE_INSTANTIATE(T) \
-template class boxm_opt2_sample<T >; \
-template void vsl_b_write(vsl_b_ostream &, boxm_opt2_sample<T > const &); \
-template void vsl_b_write(vsl_b_ostream &, boxm_opt2_sample<T > const *&); \
-template void vsl_b_read(vsl_b_istream &, boxm_opt2_sample<T > &); \
-template void vsl_b_read(vsl_b_istream &, boxm_opt2_sample<T > *&); \
-template std::ostream& operator << (std::ostream&, const boxm_opt2_sample<T >&)
-
-#endif
diff --git a/contrib/brl/bseg/boxm/sample/boxm_opt3_sample.h b/contrib/brl/bseg/boxm/sample/boxm_opt3_sample.h
deleted file mode 100644
index 3b8d162774..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_opt3_sample.h
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifndef boxm_opt3_sample_h_
-#define boxm_opt3_sample_h_
-//:
-// \file
-
-#include <vector>
-#include <iostream>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vsl/vsl_binary_io.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_traits.h>
-
-//: class for holding auxiliary information for opt3 process.
-// Note that APM is not necessarily appearance model type of world,
-// but observation types of the two models should be the same.
-template<boxm_apm_type APM>
-class boxm_opt3_sample
-{
- public:
- typedef typename boxm_apm_traits<APM>::obs_datatype obs_datatype;
- typedef typename boxm_apm_traits<APM>::apm_datatype apm_datatype;
-
- boxm_opt3_sample()
- : weighted_vis_sum_(0.0f), seg_len_sum_(0.0f), log_pass_prob_sum_(0.0f) { }
- ~boxm_opt3_sample() = default;
- static short version_no() { return 1; }
- void print(std::ostream& os) const;
-
- void update_obs_dist(obs_datatype obs, float obs_prob);
-
- apm_datatype obs_dist_; // distribution of samples from this observation
- float weighted_vis_sum_; // sum of visibility probabilities * corresponding seg_lens
- float seg_len_sum_; // sum of sample segment lengths
- float log_pass_prob_sum_; // sum of log of updated (1 - PQ)
-};
-
-//: traits for a grey optimization sample
-template<>
-class boxm_aux_traits<BOXM_AUX_OPT3_MOG_GREY>
-{
- public:
- typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::obs_datatype sample_datatype;
- static const boxm_apm_type APM_TYPE = BOXM_APM_MOG_GREY;
-
- static std::string storage_subdir() { return "opt3_mog_grey"; }
-};
-
-//: traits for an rgb optimization sample
-template<>
-class boxm_aux_traits<BOXM_AUX_OPT3_MOG_RGB>
-{
- public:
- typedef boxm_apm_traits<BOXM_APM_MOG_RGB>::obs_datatype sample_datatype;
- static const boxm_apm_type APM_TYPE = BOXM_APM_MOG_RGB;
-
- static std::string storage_subdir() { return "opt3_mog_rgb"; }
-};
-
-template <boxm_apm_type APM>
-void vsl_b_write(vsl_b_ostream & os, boxm_opt3_sample<APM> const &sample);
-
-template <boxm_apm_type APM>
-void vsl_b_write(vsl_b_ostream & os, boxm_opt3_sample<APM> const * &sample);
-
-template <boxm_apm_type APM>
-void vsl_b_read(vsl_b_istream & is, boxm_opt3_sample<APM> &sample);
-
-template <boxm_apm_type APM>
-void vsl_b_read(vsl_b_istream & is, boxm_opt3_sample<APM> *&sample);
-
-template <boxm_apm_type APM>
-std::ostream& operator << (std::ostream& os, const boxm_opt3_sample<APM>& sample);
-
-#endif // boxm_opt3_sample_h_
diff --git a/contrib/brl/bseg/boxm/sample/boxm_opt3_sample.hxx b/contrib/brl/bseg/boxm/sample/boxm_opt3_sample.hxx
deleted file mode 100644
index 85f2e954dc..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_opt3_sample.hxx
+++ /dev/null
@@ -1,92 +0,0 @@
-#ifndef boxm_opt3_sample_hxx_
-#define boxm_opt3_sample_hxx_
-
-#include "boxm_opt3_sample.h"
-
-#include <vsl/vsl_vector_io.h>
-#include <vsl/vsl_binary_io.h>
-#include <bsta/bsta_attributes.h>
-#include <bsta/io/bsta_io_attributes.h>
-#include <bsta/io/bsta_io_mixture_fixed.h> // for binary io functions
-#include <bsta/io/bsta_io_gaussian_indep.h>
-#include <bsta/io/bsta_io_gaussian_sphere.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/algo/boxm_mog_grey_processor.h>
-//#include <boxm/boxm_mog_rgb_processor.h>
-
-template <boxm_apm_type APM>
-void boxm_opt3_sample<APM>::print(std::ostream& os) const
-{
- os << "(log_pass_prob_sum=" << log_pass_prob_sum_ << " seg_len_sum_=" << seg_len_sum_
- << "weighted_vis_sum_=" << weighted_vis_sum_ << " obs_dist=" << obs_dist_ << ')';
-}
-
-template <boxm_apm_type APM>
-void boxm_opt3_sample<APM>::update_obs_dist(typename boxm_opt3_sample<APM>::obs_datatype obs, float obs_prob)
-{
- boxm_apm_traits<APM>::apm_processor::update(obs_dist_, obs, obs_prob);
-}
-
-template <boxm_apm_type APM>
-void vsl_b_write(vsl_b_ostream & os, boxm_opt3_sample<APM> const &sample)
-{
- vsl_b_write(os, sample.version_no());
- vsl_b_write(os, sample.log_pass_prob_sum_);
- vsl_b_write(os, sample.seg_len_sum_);
- vsl_b_write(os, sample.weighted_vis_sum_);
- vsl_b_write(os, sample.obs_dist_);
-}
-
-template <boxm_apm_type APM>
-void vsl_b_write(vsl_b_ostream & os, boxm_opt3_sample<APM> const * &sample)
-{
- if (sample) {
- vsl_b_write(os, *sample);
- }
-}
-
-template <boxm_apm_type APM>
-void vsl_b_read(vsl_b_istream & is, boxm_opt3_sample<APM> &sample)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case 1:
- vsl_b_read(is, sample.log_pass_prob_sum_);
- vsl_b_read(is, sample.seg_len_sum_);
- vsl_b_read(is, sample.weighted_vis_sum_);
- vsl_b_read(is, sample.obs_dist_);
- break;
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_opt3_sample<APM>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- break;
- }
-}
-
-template <boxm_apm_type APM>
-void vsl_b_read(vsl_b_istream & is, boxm_opt3_sample<APM> *&sample)
-{
- vsl_b_read(is, *sample);
-}
-
-template <boxm_apm_type APM>
-std::ostream& operator << (std::ostream& os, const boxm_opt3_sample<APM>& sample)
-{
- sample.print(os);
- return os;
-}
-
-#define BOXM_OPT3_SAMPLE_INSTANTIATE(T) \
-template class boxm_opt3_sample<T >; \
-template void vsl_b_write(vsl_b_ostream &, boxm_opt3_sample<T > const &); \
-template void vsl_b_write(vsl_b_ostream &, boxm_opt3_sample<T > const *&); \
-template void vsl_b_read(vsl_b_istream &, boxm_opt3_sample<T > &); \
-template void vsl_b_read(vsl_b_istream &, boxm_opt3_sample<T > *&); \
-template std::ostream& operator << (std::ostream&, const boxm_opt3_sample<T >&)
-
-#endif
diff --git a/contrib/brl/bseg/boxm/sample/boxm_plane_obs.h b/contrib/brl/bseg/boxm/sample/boxm_plane_obs.h
deleted file mode 100644
index 417c0ccc98..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_plane_obs.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef boxm_plane_obs_h_
-#define boxm_plane_obs_h_
-//:
-// \file
-
-#include <iostream>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vsl/vsl_binary_io.h>
-#include <vgl/vgl_homg_plane_3d.h>
-#include <boxm/boxm_aux_traits.h>
-
-template<class T>
-class boxm_plane_obs
-{
- public:
- boxm_plane_obs() : seg_len_(0.0f), plane_(vgl_homg_plane_3d<T>()) {}
- boxm_plane_obs(vgl_homg_plane_3d<T> plane, float seg_len) : seg_len_(seg_len), plane_(plane) {}
- ~boxm_plane_obs() = default;
- static short version_no() { return 1; }
- void print(std::ostream& os) const { os << "(plane=" << plane_ << " seg_len=" << seg_len_ << ')'; }
-
- // public members
- float seg_len_;
- vgl_homg_plane_3d<T> plane_;
-};
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_plane_obs<T> const &sample);
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_plane_obs<T> const * &sample);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_plane_obs<T> &sample);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_plane_obs<T> *&sample);
-
-template <class T>
-std::ostream& operator << (std::ostream& os, const boxm_plane_obs<T>& sample);
-
-
-#endif // boxm_plane_obs_h_
diff --git a/contrib/brl/bseg/boxm/sample/boxm_plane_obs.hxx b/contrib/brl/bseg/boxm/sample/boxm_plane_obs.hxx
deleted file mode 100644
index 5d2d8b4535..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_plane_obs.hxx
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef boxm_plane_obs_hxx_
-#define boxm_plane_obs_hxx_
-
-#include "boxm_plane_obs.h"
-
-#include "boxm_edge_tangent_sample.h"
-#include "boxm_inf_line_sample.h"
-
-#include <vgl/io/vgl_io_homg_plane_3d.h> // for vsl_b_write(os, sample.plane_);
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_plane_obs<T> const &sample)
-{
- vsl_b_write(os, sample.version_no());
- vsl_b_write(os, sample.seg_len_);
- vsl_b_write(os, sample.plane_);
-}
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_plane_obs<T> const * &sample)
-{
- if (sample) {
- vsl_b_write(os, *sample);
- }
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_plane_obs<T> &sample)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case 1:
- vsl_b_read(is, sample.seg_len_);
- vsl_b_read(is, sample.plane_);
- break;
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_edge_tangent_sample<T>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- break;
- }
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_plane_obs<T> *&sample)
-{
- vsl_b_read(is, *sample);
-}
-
-template <class T>
-std::ostream& operator<< (std::ostream& os, boxm_plane_obs<T> const& sample)
-{
- sample.print(os);
- return os;
-}
-
-#define BOXM_PLANE_OBS_INSTANTIATE(T) \
-template class boxm_plane_obs<T >; \
-template void vsl_b_write(vsl_b_ostream &, boxm_plane_obs<T > const &); \
-template void vsl_b_write(vsl_b_ostream &, boxm_plane_obs<T > const *&); \
-template void vsl_b_read(vsl_b_istream &, boxm_plane_obs<T > &); \
-template void vsl_b_read(vsl_b_istream &, boxm_plane_obs<T > *&);\
-template std::ostream& operator << (std::ostream&, boxm_plane_obs<T > const&)
-
-#endif
diff --git a/contrib/brl/bseg/boxm/sample/boxm_rt_sample.h b/contrib/brl/bseg/boxm/sample/boxm_rt_sample.h
deleted file mode 100644
index e51d415ce8..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_rt_sample.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef boxm_rt_sample_h_
-#define boxm_rt_sample_h_
-//:
-// \file
-
-#include <iostream>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vil/vil_rgb.h>
-#include <vsl/vsl_binary_io.h>
-#include <boxm/boxm_aux_traits.h>
-
-template<class OBS_T>
-class boxm_rt_sample
-{
- public:
- boxm_rt_sample()
- : obs_(0), pre_(0.0f), vis_(0.0f), PI_(0.0f), seg_len_(0.0f), Beta_(0.0f),
- updatefactor_(0.0f), log_sum_(0.0f) {}
- ~boxm_rt_sample() = default;
- static short version_no() { return 1; }
- void print(std::ostream& os) const;
-
- OBS_T obs_;
- float pre_;
- float vis_;
- float PI_;
- float seg_len_;
- float Beta_;
- float updatefactor_;
- float log_sum_;
-};
-
-
-//: traits for a grey optimization sample
-template<>
-class boxm_aux_traits<BOXM_AUX_OPT_RT_GREY>
-{
- public:
- typedef boxm_rt_sample<float> sample_datatype;
-
- static std::string storage_subdir() { return "opt_rt_grey_work"; }
-};
-
-//: traits for an rgb optimization sample
-template<>
-class boxm_aux_traits<BOXM_AUX_OPT_RT_RGB>
-{
- public:
- typedef boxm_rt_sample<vil_rgb<float> > sample_datatype;
-
- static std::string storage_subdir() { return "opt_rt_rgb_work"; }
-};
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_rt_sample<T> const &sample);
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_rt_sample<T> const * &sample);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_rt_sample<T> &sample);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_rt_sample<T> *&sample);
-
-template <class T>
-std::ostream& operator << (std::ostream& os, const boxm_rt_sample<T>& sample);
-
-#endif // boxm_rt_sample_h_
diff --git a/contrib/brl/bseg/boxm/sample/boxm_rt_sample.hxx b/contrib/brl/bseg/boxm/sample/boxm_rt_sample.hxx
deleted file mode 100644
index 4202653363..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_rt_sample.hxx
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef boxm_rt_sample_hxx_
-#define boxm_rt_sample_hxx_
-
-#include "boxm_rt_sample.h"
-
-
-template <class OBS_T>
-void boxm_rt_sample<OBS_T>::print(std::ostream& os) const
-{
- os << "(obs=" << obs_ << " pre=" << pre_ << " vis=" << vis_ << " PI=" << PI_ << " seg_len=" << seg_len_ << " Beta=" << Beta_ << ')';
-}
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_rt_sample<T> const &sample)
-{
- vsl_b_write(os, sample.version_no());
- vsl_b_write(os, sample.obs_);
- vsl_b_write(os, sample.pre_);
- vsl_b_write(os, sample.vis_);
- vsl_b_write(os, sample.PI_);
- vsl_b_write(os, sample.seg_len_);
- vsl_b_write(os, sample.updatefactor_);
- vsl_b_write(os, sample.Beta_);
-}
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_rt_sample<T> const * &sample)
-{
- if (sample) {
- vsl_b_write(os, *sample);
- }
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_rt_sample<T> &sample)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case 1:
- vsl_b_read(is, sample.obs_);
- vsl_b_read(is, sample.pre_);
- vsl_b_read(is, sample.vis_);
- vsl_b_read(is, sample.PI_);
- vsl_b_read(is, sample.seg_len_);
- vsl_b_read(is, sample.updatefactor_);
- vsl_b_read(is, sample.Beta_);
- break;
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_rt_sample<T>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- break;
- }
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_rt_sample<T> *&sample)
-{
- vsl_b_read(is, *sample);
-}
-
-template <class T>
-std::ostream &operator << (std::ostream& os, const boxm_rt_sample<T>& sample)
-{
- sample.print(os);
- return os;
-}
-
-#define BOXM_RT_SAMPLE_INSTANTIATE(T) \
-template class boxm_rt_sample<T >; \
-template void vsl_b_write(vsl_b_ostream &, boxm_rt_sample<T > const &); \
-template void vsl_b_write(vsl_b_ostream &, boxm_rt_sample<T > const *&); \
-template void vsl_b_read(vsl_b_istream &, boxm_rt_sample<T > &); \
-template void vsl_b_read(vsl_b_istream &, boxm_rt_sample<T > *&); \
-template std::ostream& operator << (std::ostream&, const boxm_rt_sample<T >&)
-
-#endif
diff --git a/contrib/brl/bseg/boxm/sample/boxm_sample.h b/contrib/brl/bseg/boxm/sample/boxm_sample.h
deleted file mode 100644
index 4d2312ae98..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_sample.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef boxm_sample_h_
-#define boxm_sample_h_
-//:
-// \file
-#include <iostream>
-#include <utility>
-#include <boxm/boxm_apm_traits.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vsl/vsl_binary_io.h>
-#include <bsta/io/bsta_io_attributes.h>
-
-template <boxm_apm_type APM_MODEL>
-class boxm_sample
-{
- public:
- static const boxm_apm_type apm_type = APM_MODEL;
- typedef typename boxm_apm_traits<APM_MODEL>::apm_datatype apm_datatype;
- typedef typename boxm_apm_traits<APM_MODEL>::obs_datatype obs_datatype;
- typedef typename boxm_apm_traits<APM_MODEL>::obs_mathtype obs_mathtype;
- typedef typename boxm_apm_traits<APM_MODEL>::apm_processor apm_processor;
- static const unsigned int obs_dim = boxm_apm_traits<APM_MODEL>::obs_dim;
-
- //: default constructor: alpha is set to 0.0015.
- boxm_sample() : alpha(0.0015f), appearance_() {}
-
- boxm_sample(float alpha_val): alpha(alpha_val), appearance_() {}
- //: constructor
- boxm_sample(float alpha_val, apm_datatype apm_val): alpha(alpha_val), appearance_(std::move(apm_val)) {}
-
- virtual ~boxm_sample() = default;
-
- static short version_no() { return 1; }
-
- //: bin is to imitate the bin number of multiple_bin case
- apm_datatype & appearance(int /*bin*/=-1) { return appearance_; }
-
- void set_appearance(apm_datatype app,int /*bin*/=-1) { appearance_=app; }
-
- //: returns a basic value that represents this sample (mostly for raw file creation purposes)
- float basic_val() const { return alpha; }
-
- //: the occlusion density at the sample point
- float alpha;
-
- //: the appearance model at the sample point
- typename boxm_apm_traits<APM_MODEL>::apm_datatype appearance_;
-
- void print(std::ostream& os) const;
-};
-
-template <boxm_apm_type APM_MODEL>
-void vsl_b_write(vsl_b_ostream & os, boxm_sample<APM_MODEL> const &sample);
-
-template <boxm_apm_type APM_MODEL>
-void vsl_b_write(vsl_b_ostream & os, boxm_sample<APM_MODEL> const * &sample);
-
-template <boxm_apm_type APM_MODEL>
-void vsl_b_read(vsl_b_istream & is, boxm_sample<APM_MODEL> &sample);
-
-template <boxm_apm_type APM_MODEL>
-void vsl_b_read(vsl_b_istream & is, boxm_sample<APM_MODEL> *&sample);
-
-template <boxm_apm_type APM_MODEL>
-std::ostream& operator << (std::ostream& os, const boxm_sample<APM_MODEL>& sample);
-
-#endif
diff --git a/contrib/brl/bseg/boxm/sample/boxm_sample.hxx b/contrib/brl/bseg/boxm/sample/boxm_sample.hxx
deleted file mode 100644
index e644739f43..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_sample.hxx
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef boxm_sample_hxx_
-#define boxm_sample_hxx_
-
-#include "boxm_sample.h"
-#include <bsta/bsta_mixture_fixed.h>
-
-template <boxm_apm_type APM_MODEL>
-void boxm_sample<APM_MODEL>::print(std::ostream& os) const
-{
- os << "(alpha=" << alpha << " appearence=" << appearance_ << ')';
-}
-
-template <boxm_apm_type APM_MODEL>
-void vsl_b_write(vsl_b_ostream & os, boxm_sample<APM_MODEL> const &sample)
-{
- vsl_b_write(os, sample.version_no());
- vsl_b_write(os, sample.alpha);
- vsl_b_write(os, sample.appearance_);
-}
-
-template <boxm_apm_type APM_MODEL>
-void vsl_b_write(vsl_b_ostream & os, boxm_sample<APM_MODEL> const * &sample)
-{
- if (sample) {
- vsl_b_write(os, *sample);
- }
-}
-
-template <boxm_apm_type APM_MODEL>
-void vsl_b_read(vsl_b_istream & is, boxm_sample<APM_MODEL> &sample)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case 1:
- vsl_b_read(is, sample.alpha);
- vsl_b_read(is, sample.appearance_);
- break;
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_sample<T>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- break;
- }
-}
-
-template <boxm_apm_type APM_MODEL>
-void vsl_b_read(vsl_b_istream & is, boxm_sample<APM_MODEL> *&sample)
-{
- vsl_b_read(is, *sample);
-}
-
-template <boxm_apm_type APM_MODEL>
-std::ostream& operator << (std::ostream& os, const boxm_sample<APM_MODEL>& sample)
-{
- sample.print(os);
- return os;
-}
-
-#define BOXM_SAMPLE_INSTANTIATE(T) \
-template class boxm_sample<T >; \
-template void vsl_b_write(vsl_b_ostream &, boxm_sample<T > const &); \
-template void vsl_b_write(vsl_b_ostream &, boxm_sample<T > const *&); \
-template void vsl_b_read(vsl_b_istream &, boxm_sample<T > &); \
-template void vsl_b_read(vsl_b_istream &, boxm_sample<T > *&); \
-template std::ostream& operator << (std::ostream&, const boxm_sample<T >&)
-
-#endif
diff --git a/contrib/brl/bseg/boxm/sample/boxm_sample_multi_bin.h b/contrib/brl/bseg/boxm/sample/boxm_sample_multi_bin.h
deleted file mode 100644
index 838637e49f..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_sample_multi_bin.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef boxm_sample_multi_bin_h_
-#define boxm_sample_multi_bin_h_
-//:
-// \file
-#include <iostream>
-#include <utility>
-#include <boxm/boxm_apm_traits.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vsl/vsl_binary_io.h>
-#include <bsta/bsta_attributes.h>
-
-template <boxm_apm_type APM_MODEL>
-class boxm_sample_multi_bin
-{
- public:
- static const boxm_apm_type apm_type = APM_MODEL;
- typedef typename boxm_apm_traits<APM_MODEL>::apm_datatype apm_datatype;
- typedef typename boxm_apm_traits<APM_MODEL>::obs_datatype obs_datatype;
- typedef typename boxm_apm_traits<APM_MODEL>::obs_mathtype obs_mathtype;
- typedef typename boxm_apm_traits<APM_MODEL>::apm_processor apm_processor;
-
- //: default constructor
- boxm_sample_multi_bin() : alpha(0.001f) {}
- //: constructor
- boxm_sample_multi_bin(float alpha_val,std::map<int,apm_datatype> apm_val): alpha(alpha_val), appearance_(std::move(apm_val)) {}
-
- static short version_no() { return 1; }
-
- //: returns a basic value that represents this sample (mostly for raw file creation purposes)
- float basic_val() const { return alpha; }
-
- //: the occlusion density at the sample point
- float alpha;
- apm_datatype & appearance(int bin=0);
-
- void set_appearance(apm_datatype app,int bin=0);
-
- std::map<int,apm_datatype> appearance_;
-
- void print(std::ostream& os) const;
- private:
- //: the appearance model at the sample point
-};
-
-template <boxm_apm_type APM_MODEL>
-void vsl_b_write(vsl_b_ostream & os, boxm_sample_multi_bin<APM_MODEL> const &sample);
-
-template <boxm_apm_type APM_MODEL>
-void vsl_b_write(vsl_b_ostream & os, boxm_sample_multi_bin<APM_MODEL> const * &sample);
-
-template <boxm_apm_type APM_MODEL>
-void vsl_b_read(vsl_b_istream & is, boxm_sample_multi_bin<APM_MODEL> &sample);
-
-template <boxm_apm_type APM_MODEL>
-void vsl_b_read(vsl_b_istream & is, boxm_sample_multi_bin<APM_MODEL> *&sample);
-
-template <boxm_apm_type APM_MODEL>
-std::ostream& operator << (std::ostream& os, const boxm_sample_multi_bin<APM_MODEL>& sample);
-
-
-#endif
diff --git a/contrib/brl/bseg/boxm/sample/boxm_sample_multi_bin.hxx b/contrib/brl/bseg/boxm/sample/boxm_sample_multi_bin.hxx
deleted file mode 100644
index 714b493eec..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_sample_multi_bin.hxx
+++ /dev/null
@@ -1,98 +0,0 @@
-#ifndef boxm_sample_multi_bin_hxx_
-#define boxm_sample_multi_bin_hxx_
-
-#include "boxm_sample_multi_bin.h"
-#include <bsta/bsta_mixture_fixed.h>
-#include <vsl/vsl_map_io.hxx>
-#include <bsta/io/bsta_io_mixture_fixed.h>
-#include <bsta/io/bsta_io_gaussian_sphere.h>
-#include <bsta/io/bsta_io_mixture.h>
-#include <bsta/io/bsta_io_attributes.h>
-#include <bsta/io/bsta_io_gaussian_indep.h>
-
-template <boxm_apm_type APM_MODEL>
-typename boxm_sample_multi_bin<APM_MODEL>::apm_datatype & boxm_sample_multi_bin<APM_MODEL>::appearance(int bin)
-{
- if (appearance_.find(bin)==appearance_.end())
- {
- appearance_[bin]=apm_datatype();
- return appearance_[bin];
- }
- else
- return appearance_[bin];
-}
-
-template <boxm_apm_type APM_MODEL>
-void boxm_sample_multi_bin<APM_MODEL>::set_appearance(apm_datatype app,int bin)
-{
- appearance_[bin]=app;
-}
-
-template <boxm_apm_type APM_MODEL>
-void boxm_sample_multi_bin<APM_MODEL>::print(std::ostream& os) const
-{
- os << "(alpha=" << alpha << " appearence=" ;
- for (typename std::map<int,apm_datatype>::const_iterator iter=appearance_.begin();
- iter!=appearance_.end(); ++iter)
- os << "bin#= " << iter->first << ' ' << iter->second;
-}
-
-template <boxm_apm_type APM_MODEL>
-void vsl_b_write(vsl_b_ostream & os, boxm_sample_multi_bin<APM_MODEL> const &sample)
-{
- vsl_b_write(os, sample.version_no());
- vsl_b_write(os, sample.alpha);
- vsl_b_write(os, sample.appearance_);
-}
-
-template <boxm_apm_type APM_MODEL>
-void vsl_b_write(vsl_b_ostream & os, boxm_sample_multi_bin<APM_MODEL> const * &sample)
-{
- if (sample) {
- vsl_b_write(os, *sample);
- }
-}
-
-template <boxm_apm_type APM_MODEL>
-void vsl_b_read(vsl_b_istream & is, boxm_sample_multi_bin<APM_MODEL> &sample)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case 1:
- vsl_b_read(is, sample.alpha);
- vsl_b_read(is, sample.appearance_);
- break;
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_sample_multi_bin<T>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- break;
- }
-}
-
-template <boxm_apm_type APM_MODEL>
-void vsl_b_read(vsl_b_istream & is, boxm_sample_multi_bin<APM_MODEL> *&sample)
-{
- vsl_b_read(is, *sample);
-}
-
-template <boxm_apm_type APM_MODEL>
-std::ostream& operator << (std::ostream& os, const boxm_sample_multi_bin<APM_MODEL>& sample)
-{
- sample.print(os);
- return os;
-}
-
-#define BOXM_SAMPLE_MULTI_BIN_INSTANTIATE(T) \
-template class boxm_sample_multi_bin<T >; \
-template void vsl_b_write(vsl_b_ostream &, boxm_sample_multi_bin<T > const &); \
-template void vsl_b_write(vsl_b_ostream &, boxm_sample_multi_bin<T > const *&); \
-template void vsl_b_read(vsl_b_istream &, boxm_sample_multi_bin<T > &); \
-template void vsl_b_read(vsl_b_istream &, boxm_sample_multi_bin<T > *&); \
-template std::ostream& operator << (std::ostream&, const boxm_sample_multi_bin<T >&)
-
-#endif
diff --git a/contrib/brl/bseg/boxm/sample/boxm_scalar_sample.h b/contrib/brl/bseg/boxm/sample/boxm_scalar_sample.h
deleted file mode 100644
index ba4cd770ad..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_scalar_sample.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef boxm_scalar_sample_h_
-#define boxm_scalar_sample_h_
-//:
-// \file
-
-#include <iostream>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vsl/vsl_binary_io.h>
-#include <boxm/boxm_apm_traits.h>
-
-
-template <class T>
-class boxm_scalar_sample
-{
- public:
- boxm_scalar_sample() : scalar_sum_(0), seg_len_(0.0f) { }
-
- ~boxm_scalar_sample() = default;
- T basic_val() { if (seg_len_>0) return scalar_sum_/seg_len_; else return (T)0; }
- static short version_no() { return 1; }
- void print(std::ostream& os) const;
-
- T scalar_sum_;
- float seg_len_;
-};
-
-//: traits for a scalar sample
-template <>
-class boxm_apm_traits<BOXM_SCALAR_FLOAT>
-{
- public:
- typedef boxm_scalar_sample<float> sample_datatype;
-
- static std::string storage_subdir() { return "scalar_subdir"; }
-};
-
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_scalar_sample<T> const &sample);
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_scalar_sample<T> const* &sample);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_scalar_sample<T> &sample);
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_scalar_sample<T>* &sample);
-
-template <class T>
-std::ostream& operator << (std::ostream& os, const boxm_scalar_sample<T>& sample);
-
-#endif // boxm_scalar_sample_h_
diff --git a/contrib/brl/bseg/boxm/sample/boxm_scalar_sample.hxx b/contrib/brl/bseg/boxm/sample/boxm_scalar_sample.hxx
deleted file mode 100644
index 6eb0d37aef..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_scalar_sample.hxx
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef boxm_scalar_sample_hxx_
-#define boxm_scalar_sample_hxx_
-
-#include "boxm_scalar_sample.h"
-
-template <class OBS_T>
-void boxm_scalar_sample<OBS_T>::print(std::ostream& os) const
-{
- os << "(scalar=" << scalar_sum_ << " seg_len=" << seg_len_ << ")\n";
-}
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_scalar_sample<T> const &sample)
-{
- vsl_b_write(os, sample.version_no());
- vsl_b_write(os, sample.scalar_sum_);
- vsl_b_write(os, sample.seg_len_);
-}
-
-template <class T>
-void vsl_b_write(vsl_b_ostream & os, boxm_scalar_sample<T> const * &sample)
-{
- if (sample) {
- vsl_b_write(os, *sample);
- }
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_scalar_sample<T> &sample)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case 1:
- vsl_b_read(is, sample.scalar_sum_);
- vsl_b_read(is, sample.seg_len_);
- break;
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_scalar_sample<T>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- break;
- }
-}
-
-template <class T>
-void vsl_b_read(vsl_b_istream & is, boxm_scalar_sample<T> *&sample)
-{
- vsl_b_read(is, *sample);
-}
-
-template <class T>
-std::ostream& operator << (std::ostream& os, const boxm_scalar_sample<T>& sample)
-{
- sample.print(os);
- return os;
-}
-
-#define BOXM_SCALAR_SAMPLE_INSTANTIATE(T) \
- template class boxm_scalar_sample<T >; \
- template void vsl_b_write(vsl_b_ostream &, boxm_scalar_sample<T > const &); \
- template void vsl_b_write(vsl_b_ostream &, boxm_scalar_sample<T > const *&); \
- template void vsl_b_read(vsl_b_istream &, boxm_scalar_sample<T > &); \
- template void vsl_b_read(vsl_b_istream &, boxm_scalar_sample<T > *&); \
- template std::ostream& operator << (std::ostream&, const boxm_scalar_sample<T >&)
-
-#endif
diff --git a/contrib/brl/bseg/boxm/sample/boxm_update_sample.h b/contrib/brl/bseg/boxm/sample/boxm_update_sample.h
deleted file mode 100644
index 666c4a3ac5..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_update_sample.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef boxm_update_sample_h_
-#define boxm_update_sample_h_
-//:
-// \file
-
-class boxm_update_sample
-{
- public:
- //: default constructor
- boxm_update_sample() : update_multiplier(0.0f), do_update(false) {}
-
- //: the (unnormalized) update multiplier
- float update_multiplier;
- bool do_update;
-};
-
-#endif // boxm_update_sample_h_
diff --git a/contrib/brl/bseg/boxm/sample/boxm_vis_implicit_sample.h b/contrib/brl/bseg/boxm/sample/boxm_vis_implicit_sample.h
deleted file mode 100644
index 3ff4ed3ad5..0000000000
--- a/contrib/brl/bseg/boxm/sample/boxm_vis_implicit_sample.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef boxm_vis_implicit_sample_h_
-#define boxm_vis_implicit_sample_h_
-//:
-// \file
-
-class boxm_vis_implicit_sample
-{
- public:
- //: default constructor
- boxm_vis_implicit_sample() : max_vis(0.0f), n_obs(0) {}
-
- float max_vis;
- unsigned int n_obs;
-};
-
-#endif // boxm_vis_implicit_sample_h_
diff --git a/contrib/brl/bseg/boxm/sample/dummy.cxx b/contrib/brl/bseg/boxm/sample/dummy.cxx
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/contrib/brl/bseg/boxm/sample/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/sample/tests/CMakeLists.txt
deleted file mode 100644
index ed11dfb489..0000000000
--- a/contrib/brl/bseg/boxm/sample/tests/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-add_executable( boxm_sample_test_include test_include.cxx )
-target_link_libraries( boxm_sample_test_include boxm_sample)
-add_executable( boxm_sample_test_template_include test_template_include.cxx )
-target_link_libraries( boxm_sample_test_template_include boxm_sample)
diff --git a/contrib/brl/bseg/boxm/sample/tests/test_include.cxx b/contrib/brl/bseg/boxm/sample/tests/test_include.cxx
deleted file mode 100644
index 17e8b789dd..0000000000
--- a/contrib/brl/bseg/boxm/sample/tests/test_include.cxx
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <boxm/sample/boxm_edge_sample.h>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-#include <boxm/sample/boxm_inf_line_sample.h>
-#include <boxm/sample/boxm_opt2_sample.h>
-#include <boxm/sample/boxm_opt3_sample.h>
-#include <boxm/sample/boxm_plane_obs.h>
-#include <boxm/sample/boxm_rt_sample.h>
-#include <boxm/sample/boxm_sample.h>
-#include <boxm/sample/boxm_sample_multi_bin.h>
-#include <boxm/sample/boxm_scalar_sample.h>
-#include <boxm/sample/boxm_update_sample.h>
-#include <boxm/sample/boxm_vis_implicit_sample.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm/sample/tests/test_template_include.cxx b/contrib/brl/bseg/boxm/sample/tests/test_template_include.cxx
deleted file mode 100644
index d1f741b32f..0000000000
--- a/contrib/brl/bseg/boxm/sample/tests/test_template_include.cxx
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <boxm/sample/boxm_edge_sample.hxx>
-#include <boxm/sample/boxm_edge_tangent_sample.hxx>
-#include <boxm/sample/boxm_inf_line_sample.hxx>
-#include <boxm/sample/boxm_opt2_sample.hxx>
-#include <boxm/sample/boxm_opt3_sample.hxx>
-#include <boxm/sample/boxm_plane_obs.hxx>
-#include <boxm/sample/boxm_rt_sample.hxx>
-#include <boxm/sample/boxm_sample.hxx>
-#include <boxm/sample/boxm_sample_multi_bin.hxx>
-#include <boxm/sample/boxm_scalar_sample.hxx>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/tests/CMakeLists.txt
deleted file mode 100644
index eb0d974b9f..0000000000
--- a/contrib/brl/bseg/boxm/tests/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-add_executable( boxm_test_all
- test_driver.cxx
- test_binary_io.cxx
- test_block_iter.cxx
-# FAILS on DASHBOARD FIX_ME
-# test_region_finder.cxx
- test_cell_iterator.cxx
- test_load_neighboring_blocks.cxx
- )
-
-set(boxm_test_all_sources
- test_utils.h test_utils.cxx
- )
-
-vxl_add_library(LIBRARY_NAME boxm_tests LIBRARY_SOURCES ${boxm_test_all_sources})
-target_link_libraries(boxm_tests boxm boct ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vgl_xio ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vpl ${VXL_LIB_PREFIX}vul)
-
-target_link_libraries( boxm_test_all boxm_tests boxm boct ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vgl_xio ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vpl ${VXL_LIB_PREFIX}vul)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/camera0.txt ${CMAKE_CURRENT_BINARY_DIR}/camera0.txt COPYONLY )
-
-add_test( NAME boxm_test_binary_io COMMAND $<TARGET_FILE:boxm_test_all> test_binary_io )
-add_test( NAME boxm_test_block_iter COMMAND $<TARGET_FILE:boxm_test_all> test_block_iter )
-#add_test( NAME boxm_test_region_finder COMMAND $<TARGET_FILE:boxm_test_all> test_region_finder )
-if( VXL_RUN_FAILING_TESTS ) ## SEGFAULT when testing with ctest -j16 (perhaps files are shared between tests)
-add_test( NAME boxm_test_cell_iterator COMMAND $<TARGET_FILE:boxm_test_all> test_cell_iterator )
-endif()
-add_test( NAME boxm_test_load_neighboring_blocks COMMAND $<TARGET_FILE:boxm_test_all> test_load_neighboring_blocks )
-
-add_executable( boxm_test_include test_include.cxx )
-target_link_libraries( boxm_test_include boxm)
-add_executable( boxm_test_template_include test_template_include.cxx )
-target_link_libraries( boxm_test_template_include boxm)
diff --git a/contrib/brl/bseg/boxm/tests/camera0.txt b/contrib/brl/bseg/boxm/tests/camera0.txt
deleted file mode 100644
index cf11c57707..0000000000
--- a/contrib/brl/bseg/boxm/tests/camera0.txt
+++ /dev/null
@@ -1,104 +0,0 @@
-satId = "????";
-bandId = "RGB";
-SpecId = "RPC00B";
-BEGIN_GROUP = IMAGE
-
-
- lineOffset = 0.0
- sampOffset = 0.0
- latOffset = 0.0
- longOffset = 0.0
- heightOffset = 0.0
- lineScale = 1.0
- sampScale = 1.0
- latScale = 1.0
- longScale = 1.0
- heightScale = 1.0
- lineNumCoef = (
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1);
- lineDenCoef = (
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1);
- sampNumCoef = (
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1);
- sampDenCoef = (
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1);
-END_GROUP = IMAGE
-END;
-lvcs
-47.550493 35.395931 664.186757
diff --git a/contrib/brl/bseg/boxm/tests/frame_00000.txt b/contrib/brl/bseg/boxm/tests/frame_00000.txt
deleted file mode 100644
index a66e2014bd..0000000000
--- a/contrib/brl/bseg/boxm/tests/frame_00000.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-1 0 0
-0 1 0
-0 0 1
-1 0 0
-0 1 0
-0 0 1
-0 0 0
diff --git a/contrib/brl/bseg/boxm/tests/test_binary_io.cxx b/contrib/brl/bseg/boxm/tests/test_binary_io.cxx
deleted file mode 100644
index 7dc2da196e..0000000000
--- a/contrib/brl/bseg/boxm/tests/test_binary_io.cxx
+++ /dev/null
@@ -1,75 +0,0 @@
-
-#include <testlib/testlib_test.h>
-
-#include <boxm/boxm_scene.h>
-#include <boct/boct_tree.h>
-#include <vpl/vpl.h>
-#include <vul/vul_file.h>
-
-static void test_binary_io()
-{
-#ifdef DEBUG
- short nlevels=5;
- typedef vgl_point_3d<double> point_type;
- boct_tree<short,point_type > * block = new boct_tree<short,point_type >(nlevels);
- TEST("No of Max levels of tree",nlevels, block->num_levels());
-
- block->split(); //block->print();
-
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(10,10,20);
- vgl_vector_3d<double> block_dim(10,10,10);
- vgl_vector_3d<double> world_dim(30,30,30);
- boxm_scene<boct_tree<short,point_type > > scene(lvcs, origin, block_dim, world_dim);
- scene.set_paths("./boxm_scene", "block");
- x_write(std::cout, scene, "scene");
-
- vsl_b_ofstream os("scene.bin");
- scene.b_write(os);
- os.close();
- vul_file::make_directory("./boxm_scene");
-
- boxm_scene<boct_tree<short,vgl_point_3d<double> > > scene_out;
- vsl_b_ifstream is("scene.bin", std::ios::binary);
- scene_out.b_read(is);
- vpl_rmdir("./boxm_scene");
- vpl_unlink("./scene.bin");
-
- // writing the binary file for a scene with grey MOG
- vgl_point_3d<double> mog_origin(0,0,0);
- vgl_vector_3d<double> mog_block_dim(1,1,1);
- vgl_vector_3d<double> mog_world_dim(3,3,1);
-
- boxm_scene<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > mog_scene( mog_origin, mog_block_dim, mog_world_dim);
- mog_scene.set_paths("./boxm_scene", "block");
- vul_file::make_directory("./boxm_scene");
- boxm_block_iterator<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > iter(&mog_scene);
-
- while (!iter.end())
- {
- mog_scene.load_block(iter.index().x(),iter.index().y(),iter.index().z());
- boxm_block<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > * block=mog_scene.get_active_block();
- boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > * tree=new boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> >(10,6);
- block->init_tree(tree);
- mog_scene.write_active_block();
- iter++;
- }
- mog_scene.write_scene();
- // writing the binary file for a scene with grey MOG
- boxm_scene<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > read_mog_scene;
- read_mog_scene.load_scene("./boxm_scene/scene.xml");
-
- boxm_block_iterator<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > read_iter(&read_mog_scene);
- while (!read_iter.end())
- {
- read_mog_scene.load_block(read_iter.index().x(),read_iter.index().y(),read_iter.index().z());
- boxm_block<boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > > * block=read_mog_scene.get_active_block();
- boct_tree<short,boxm_sample<BOXM_APM_MOG_GREY> > * tree=block->get_tree();
- read_iter++;
- }
- vpl_rmdir("./boxm_scene");
- vpl_unlink("./scene.bin");
-#endif // DEBUG
-}
-
-TESTMAIN(test_binary_io);
diff --git a/contrib/brl/bseg/boxm/tests/test_block_iter.cxx b/contrib/brl/bseg/boxm/tests/test_block_iter.cxx
deleted file mode 100644
index 376ee2d9b4..0000000000
--- a/contrib/brl/bseg/boxm/tests/test_block_iter.cxx
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <testlib/testlib_test.h>
-
-#include <boxm/boxm_scene.h>
-#include <boct/boct_tree.h>
-
-#include "test_utils.h"
-
-typedef boct_tree<short,vgl_point_3d<double> > tree_type;
-
-static void test_block_iter()
-{
- clean_up();
- short nlevels=5;
- auto * block = new tree_type(nlevels);
- TEST("No of Max levels of tree",nlevels, block->number_levels());
-
- block->split();
- block->print();
- delete block;
-
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(10,10,20);
- vgl_vector_3d<double> block_dim(10,10,10);
- vgl_vector_3d<unsigned> world_dim(3,3,3);
- boxm_scene<tree_type> scene(lvcs, origin, block_dim, world_dim);
- scene.set_paths("./boxm_scene", "block");
-
- boxm_block_iterator<tree_type> iter = scene.iterator();
- int num_blocks=0;
- for (; !iter.end(); ++iter) {
- scene.load_block(iter.index());
- boxm_block<tree_type> *block = scene.get_active_block();
- block->set_tree(new tree_type(5,3));
- std::cout << block->bounding_box() << std::endl;
- ++num_blocks;
- scene.write_active_block();
- }
- int x,y,z;
- scene.block_num(x,y,z);
- TEST("Number of blocks iterator visits", num_blocks, x*y*z);
-#ifdef DEBUG_LEAKS
- std::cerr << "Leaks in test_block_iter: " << boct_tree_cell<short,vgl_point_3d<double> >::nleaks() << '\n';
-#endif
- clean_up();
-}
-
-TESTMAIN(test_block_iter);
diff --git a/contrib/brl/bseg/boxm/tests/test_cell_iterator.cxx b/contrib/brl/bseg/boxm/tests/test_cell_iterator.cxx
deleted file mode 100644
index f65529a973..0000000000
--- a/contrib/brl/bseg/boxm/tests/test_cell_iterator.cxx
+++ /dev/null
@@ -1,51 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 13-Aug-2010
-
-#include <testlib/testlib_test.h>
-#include "test_utils.h"
-
-void test_cell_iterator()
-{
-
- clean_up();
- //create scene
- boxm_scene<boct_tree<short, float> > *scene = create_scene();
-
- //get the iterator
- boxm_cell_iterator<boct_tree<short, float > > iterator = scene->cell_iterator(&boxm_scene<boct_tree<short, float> >::load_block_and_neighbors);
- iterator.begin();
-
- boct_tree_cell<short,float> *cell = *iterator;
- unsigned num_cells = 0;
- bool result = true;
-
- while (!iterator.end()) {
-
- if( (std::abs(cell->data() - 0.8) > 1e-7) && (std::abs(cell->data() - 0.5) > 1e-7) ){
- result = false;
- std::cerr << " Wrong data: " << cell->data() << std::endl;
- }
- ++iterator;
- num_cells ++;
- if(!iterator.end()){
- cell = *iterator;
- }
- }
-
- if(num_cells!=120){
- result = false;
- std::cerr << "Wrong number of cells: " << num_cells << std::endl;
- }
-
- TEST("Valid Test", result, true);
-#ifdef DEBUG_LEAKS
- std::cerr << "Leaks at test_cell_iterator " << boct_tree_cell<short, float >::nleaks() << std::endl;
-#endif
- clean_up();
-
-}
-
-
-TESTMAIN(test_cell_iterator);
diff --git a/contrib/brl/bseg/boxm/tests/test_driver.cxx b/contrib/brl/bseg/boxm/tests/test_driver.cxx
deleted file mode 100644
index 3e55d5a0ea..0000000000
--- a/contrib/brl/bseg/boxm/tests/test_driver.cxx
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <testlib/testlib_register.h>
-
-DECLARE( test_binary_io );
-DECLARE( test_block_iter );
-//FAILS ON DASHBOARD FIX_ME
-//DECLARE( test_region_finder );
-DECLARE( test_cell_iterator );
-DECLARE( test_load_neighboring_blocks );
-
-void register_tests()
-{
- REGISTER( test_binary_io );
- REGISTER( test_block_iter );
-//FAILS ON DASHBOARD FIX_ME
-// REGISTER( test_region_finder );
- REGISTER( test_cell_iterator );
- REGISTER( test_load_neighboring_blocks );
-}
-
-
-DEFINE_MAIN;
diff --git a/contrib/brl/bseg/boxm/tests/test_include.cxx b/contrib/brl/bseg/boxm/tests/test_include.cxx
deleted file mode 100644
index ae4ae05a88..0000000000
--- a/contrib/brl/bseg/boxm/tests/test_include.cxx
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/boxm_aux_scene.h>
-#include <boxm/boxm_aux_traits.h>
-#include <boxm/boxm_block.h>
-#include <boxm/boxm_io_scene_base.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene_parser.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm/tests/test_load_neighboring_blocks.cxx b/contrib/brl/bseg/boxm/tests/test_load_neighboring_blocks.cxx
deleted file mode 100644
index 1f8fe346ca..0000000000
--- a/contrib/brl/bseg/boxm/tests/test_load_neighboring_blocks.cxx
+++ /dev/null
@@ -1,89 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 17-Aug-2010
-
-#include <testlib/testlib_test.h>
-
-#include "test_utils.h"
-
-void test_load_neighboring_blocks()
-{
- clean_up();
- //create scene
- boxm_scene<boct_tree<short, float> > *scene = create_scene(4,4,4);
- std::cout << "Scene Created" << std::endl;
-
- //iterate through blocks, loading blocks and eighbors
- boxm_block_iterator<boct_tree<short, float> > iter=scene->iterator();
- iter.begin();
- bool result = true;
- while (!iter.end()) {
- if (scene->load_block_and_neighbors(iter.index().x(),iter.index().y(),iter.index().z())) {
- //std::cout << "Center blocks : " << iter.index()<< std::endl;
- std::set<vgl_point_3d<int>, bvgl_point_3d_cmp<int> > active_blocks = scene->active_blocks();
-
- //iterate through the active blocks and check that their trees are in memory
- auto it = active_blocks.begin();
-
- for (; it!=active_blocks.end(); it++){
- boxm_block<boct_tree<short, float> > *block = scene->get_block(*it);
- if(!block)
- result = false;
- boct_tree<short, float> *tree = block->get_tree();
- if(!tree)
- result =false;
- }
-
-
- unsigned sum =0;
- if (iter.index().x()>0 && iter.index().x()<3) sum++;
- if (iter.index().y()>0 && iter.index().y()<3) sum++;
- if (iter.index().z()>0 && iter.index().z()<3) sum++;
- if(sum == 0)
- if(active_blocks.size()!=8){
- result = false;
- std::cout << sum << ' ' << active_blocks.size() << std::endl;
- }
- if(sum == 1)
- if(active_blocks.size()!=12){
- result = false;
- std::cout << sum << ' ' << active_blocks.size() << std::endl;
- }
- if(sum == 2)
- if(active_blocks.size()!=18){
- result = false;
- std::cout << sum << ' ' << active_blocks.size() << std::endl;
- }
- if(sum == 3)
- if(active_blocks.size()!=27){
- result=false;
- std::cout << sum << ' ' << active_blocks.size() << std::endl;
- }
-#if 0
- std::cout << "Active blocks : " << std::endl;
- std::set<vgl_point_3d<int> >::iterator it = active_blocks.begin();
- for (; it!=active_blocks.end(); it++)
- std::cout << *it << std::endl;
-#endif
- }
- iter++;
-
- }
-
- scene->unload_active_blocks();
- if(scene->active_blocks().size()!=0){
- result = false;
- std::cout << "Failed to unload active blocks" << std::endl;
- }
-
-#ifdef DEBUG_LEAKS
- std::cerr << "Leaks test_load_neighboring_blocks: " << boct_tree_cell<short, float >::nleaks() << std::endl;
-#endif
-
- TEST("Valid Test", result, true);
- clean_up();
-}
-
-
-TESTMAIN(test_load_neighboring_blocks);
diff --git a/contrib/brl/bseg/boxm/tests/test_region_finder.cxx b/contrib/brl/bseg/boxm/tests/test_region_finder.cxx
deleted file mode 100644
index 47d5fd903b..0000000000
--- a/contrib/brl/bseg/boxm/tests/test_region_finder.cxx
+++ /dev/null
@@ -1,80 +0,0 @@
-//:
-// \file
-// \brief A test to verify that findind cells within a region is correct
-// \author Isabel Restrepo
-// \date 13-Aug-2010
-
-#include <testlib/testlib_test.h>
-
-#include "test_utils.h"
-
-void test_region_finder()
-{
- clean_up();
- //create scene
- boxm_scene<boct_tree<short, float> > *scene = create_scene();
-
- bool result = true;
-
- if(!scene) result=false;
-
- //find a region
-
- {
- vgl_point_3d<double> max_point(14.0, 14.0, 14.0);
- vgl_point_3d<double> min_point(6.0, 6.0, 6.0);
- vgl_box_3d<double> roi(min_point, max_point);
-
- std::vector<boct_tree_cell<short, float>* > cells;
- scene->leaves_in_region(roi,cells);
-
-
- if(cells.size()!=64){
- result=false;
- std::cerr << "Number of cells in the region: " << cells.size() <<std::endl;
- }
-
- for(unsigned i =0; i<cells.size(); i++)
- if(std::abs(cells[i]->data()- 0.8f)>1.0e-7)
- {
- result = false;
- std::cerr << cells[i]->data()<<std::endl;
- }
-
- cells.clear();
- scene->unload_active_blocks();
-
- }
-#ifdef DEBUG_LEAKS
- std::cerr << "Leaks Region1: " << boct_tree_cell<short, float >::nleaks() << std::endl;
-#endif
-
- //find another region
- {
- vgl_point_3d<double> max_point(19.0, 19.0, 19.0);
- vgl_point_3d<double> min_point(6.0, 6.0, 6.0);
- vgl_box_3d<double> roi(min_point, max_point);
-
- std::vector<boct_tree_cell<short, float>* > cells;
- scene->leaves_in_region(roi,cells);
-
- if(cells.size()!=83){
- result=false;
- std::cerr << "Number of cells in the region: " << cells.size() <<std::endl;
- }
-
- cells.clear();
- scene->unload_active_blocks();
- }
-#ifdef DEBUG_LEAKS
- std::cerr << "Leaks Region2: " << boct_tree_cell<short, float >::nleaks() << std::endl;
-#endif
-
- if(!scene) result=false;
-
- TEST("Correct region found", result, true);
- clean_up();
-}
-
-
-TESTMAIN(test_region_finder);
diff --git a/contrib/brl/bseg/boxm/tests/test_template_include.cxx b/contrib/brl/bseg/boxm/tests/test_template_include.cxx
deleted file mode 100644
index edd7156927..0000000000
--- a/contrib/brl/bseg/boxm/tests/test_template_include.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <boxm/boxm_aux_scene.hxx>
-#include <boxm/boxm_block.hxx>
-#include <boxm/boxm_scene.hxx>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm/tests/test_utils.cxx b/contrib/brl/bseg/boxm/tests/test_utils.cxx
deleted file mode 100644
index 58b40215a5..0000000000
--- a/contrib/brl/bseg/boxm/tests/test_utils.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-#include "test_utils.h"
-//:
-// \file
-// \author Isabel Restrepo
-// \date 15-Aug-2010
-
-#include <vul/vul_file.h>
-#include <vul/vul_file_iterator.h>
-#include <vpl/vpl.h>
-
-void init_tree(boct_tree<short,float> *tree, unsigned i)
-{
- tree-> split(); //now we have 8 cells
- std::vector<boct_tree_cell<short,float>*> leaves = tree->leaf_cells();
- leaves[i]->set_data(0.8f);
- leaves[i]->split();
-}
-
-boxm_scene<boct_tree<short, float> >* create_scene(unsigned world_dimx,unsigned world_dimy,unsigned world_dimz)
-{
- //crete the input scene
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(0,0,0);
-
- vgl_vector_3d<double> block_dim(10, 10, 10); //world coordinate dimensions of a block
-
- vgl_vector_3d<unsigned> world_dim(world_dimx,world_dimy,world_dimz); //number of blocks in a scene
-
- auto *scene = new boxm_scene<boct_tree<short, float> >(lvcs, origin, block_dim, world_dim);
- std::string scene_path("./");
- scene->set_paths(scene_path, "test_scene");
- #ifdef DEBUG
- std::cerr << "Leaks Created - scene constructor: " << boct_tree_cell<short,float>::nleaks() << '\n';
-#endif
- unsigned cell_index = 7;
- boxm_block_iterator<boct_tree<short, float> > iter=scene->iterator();
- iter.begin();
- while (!iter.end())
- {
- //std::cout << "Loading block " << iter.index() << std::endl;
- scene->load_block(iter.index());
- boxm_block<boct_tree<short, float> > *block = scene->get_active_block();
- // Construct an empty tree with 3 maximum levels 1 levele initialized to 0.0
- auto *tree = new boct_tree<short,float>(0.5f, 3, 1);
- //tree->print();
- init_tree(tree, cell_index);
- //tree->print();
- block->init_tree(tree);
- scene->write_active_block();
- if (cell_index == 0) cell_index = 7;
- cell_index--;
- ++iter;
- }
- //scene->unload_active_blocks();
-
-#ifdef DEBUG_LEAKS
- std::cerr << "Leaks Created by create_scene() : " << boct_tree_cell<short,float>::nleaks() << '\n';
-#endif
-
- return scene;
-}
-
-void clean_up()
-{
- //clean temporary files
- vul_file_iterator file_it("./*.bin");
- for (; file_it; ++file_it)
- {
- vpl_unlink(file_it());
- //vul_file::delete_file_glob(file_it());// already deleted ?? FIX_ME
- }
-}
diff --git a/contrib/brl/bseg/boxm/tests/test_utils.h b/contrib/brl/bseg/boxm/tests/test_utils.h
deleted file mode 100644
index 43f864a0da..0000000000
--- a/contrib/brl/bseg/boxm/tests/test_utils.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef boxm_test_utils_h_
-#define boxm_test_utils_h_
-//:
-// \file
-// \brief A file containing utility functions for other tests
-// \author Isabel Restrepo
-// \date 13-Aug-2010
-
-#include <boxm/boxm_scene.h>
-
-void init_tree(boct_tree<short,float> *tree, unsigned i);
-
-boxm_scene<boct_tree<short, float> >* create_scene(unsigned world_dimx = 2,unsigned world_dimy = 2,unsigned world_dimz = 2);
-
-void clean_up();
-
-#endif
diff --git a/contrib/brl/bseg/boxm/util/CMakeLists.txt b/contrib/brl/bseg/boxm/util/CMakeLists.txt
deleted file mode 100644
index 10f3b5fd49..0000000000
--- a/contrib/brl/bseg/boxm/util/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-# brl/bseg/boxm/util/CMakeLists.txt
-include_directories( ${MUL_INCLUDE_DIR} )
-set(boxm_util_sources
- boxm_cell_data_traits.h boxm_cell_data_traits.cxx
- boxm_plane_ransac.h
- boxm_quad_scan_iterator.h boxm_quad_scan_iterator.cxx
- boxm_rational_camera_utils.h boxm_rational_camera_utils.cxx
- boxm_raytrace_operations.h boxm_raytrace_operations.cxx
- boxm_triangle_interpolation_iterator.h boxm_triangle_interpolation_iterator.hxx
- boxm_triangle_scan_iterator.h boxm_triangle_scan_iterator.cxx
- boxm_utils.h boxm_utils.cxx
- boxm_vrml_util.h
- boxm_test_util.h boxm_test_util.cxx
- )
-
-aux_source_directory(Templates boxm_util_sources)
-
-vxl_add_library(LIBRARY_NAME boxm_util LIBRARY_SOURCES ${boxm_util_sources})
-target_link_libraries(boxm_util boxm boxm_sample bvrml boct bsta ${VXL_LIB_PREFIX}vpgl_algo ${VXL_LIB_PREFIX}vnl_algo ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vnl_io ${VXL_LIB_PREFIX}vil ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vcl)
-
-if( BUILD_TESTING )
- add_subdirectory(tests)
-endif()
diff --git a/contrib/brl/bseg/boxm/util/Templates/boxm_triangle_interpolation_iterator+float-.cxx b/contrib/brl/bseg/boxm/util/Templates/boxm_triangle_interpolation_iterator+float-.cxx
deleted file mode 100644
index 3a276cc3b2..0000000000
--- a/contrib/brl/bseg/boxm/util/Templates/boxm_triangle_interpolation_iterator+float-.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <boxm/util/boxm_triangle_interpolation_iterator.hxx>
-
-BOXM_TRIANGLE_INTERPOLATION_ITERATOR_INSTANTIATE(float);
diff --git a/contrib/brl/bseg/boxm/util/boxm_cell_data_traits.cxx b/contrib/brl/bseg/boxm/util/boxm_cell_data_traits.cxx
deleted file mode 100644
index b4bf234941..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_cell_data_traits.cxx
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "boxm_cell_data_traits.h"
-//:
-// \file
-
-
-//: Template specialization of zero_val for floating point case
-template <>
-float boxm_zero_val<short, float>()
-{
- return 0.0f;
-}
-
-
-//: Template specialization of zero_val for unimodal gaussian
-template <>
-bsta_num_obs<bsta_gauss_sf1> boxm_zero_val<short, bsta_num_obs<bsta_gauss_sf1> >()
-{
- return {};
-}
-
-template <>
-mix_gauss_sf1_type boxm_zero_val<short, mix_gauss_sf1_type>()
-{
- return {};
-}
diff --git a/contrib/brl/bseg/boxm/util/boxm_cell_data_traits.h b/contrib/brl/bseg/boxm/util/boxm_cell_data_traits.h
deleted file mode 100644
index c96599e730..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_cell_data_traits.h
+++ /dev/null
@@ -1,89 +0,0 @@
-// This is brl/bseg/boxm/util/boxm_cell_data_traits.h
-#ifndef boxm_cell_data_traits_h_
-#define boxm_cell_data_traits_h_
-//:
-// \file
-// \brief Set of accessors of cell's data, taking care of different datatypes
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date December 9, 2009
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <boct/boct_tree_cell.h>
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_gauss_sf1.h>
-#include <boxm/sample/boxm_scalar_sample.h>
-
-//: Float to float
-template <class T_loc>
-float boxm_cell_to_float(boct_tree_cell<T_loc, float >* cell, double /*step_len*/)
-{
- //return 1.0 - std::exp(-cell->data()*step_len);
- return cell->data();
-}
-
-//: Float to float
-template <class T_loc>
-float boxm_cell_to_float(boct_tree_cell<T_loc, short >* cell, double /*step_len*/)
-{
- return (float)cell->data();
-}
-
-//: bool to float
-template <class T_loc>
-float boxm_cell_to_float(boct_tree_cell<T_loc, bool >* cell, double /*step_len*/)
-{
- return (float)cell->data();
-}
-
-//: Mixture of gaussians to float; return the mean
-template <class T_loc>
-float boxm_cell_to_float(boct_tree_cell<T_loc, bsta_num_obs<bsta_gauss_sf1> >* cell, double /*step_len*/)
-{
- return cell->data().mean();
-}
-
-//: Mixture of gaussians to float; return the mean
-template <class T_loc>
-float boxm_cell_to_float(boct_tree_cell<T_loc, boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype >* cell, double /*step_len*/)
-{
- return cell->data().expected_value();
-}
-
-//: boxm_sample to float. Return the probability values
-template <class T_loc, class T_data>
-float boxm_cell_to_float(boct_tree_cell<T_loc, T_data >* cell, double step_len)
-{
- return 1.f - float(std::exp(-cell->data().basic_val()*step_len));
-}
-
-
-template <class T_loc, class T_data>
-T_data boxm_zero_val()
-{
- return T_data(0);
-}
-
-static const unsigned int n_gaussian_modes_ = 3;
-typedef bsta_num_obs<bsta_gauss_sf1> gauss_type_sf1;
-typedef bsta_num_obs<bsta_mixture_fixed<gauss_type_sf1, n_gaussian_modes_> > mix_gauss_sf1_type;
-template <>
-mix_gauss_sf1_type boxm_zero_val<short, mix_gauss_sf1_type>();
-
-template <>
-bsta_num_obs<bsta_gauss_sf1> boxm_zero_val<short, bsta_num_obs<bsta_gauss_sf1> >();
-
-template <>
-float boxm_zero_val<short, float >();
-
-//: boxm_scalar_sample to float. Return the normalized scalar value
-template <class T_loc>
-float boxm_cell_to_float(boct_tree_cell<T_loc, boxm_scalar_sample<float> >* cell, double /*step_len*/)
-{
- return cell->data().basic_val();
-}
-
-#endif
diff --git a/contrib/brl/bseg/boxm/util/boxm_plane_ransac.h b/contrib/brl/bseg/boxm/util/boxm_plane_ransac.h
deleted file mode 100644
index 07d10348a6..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_plane_ransac.h
+++ /dev/null
@@ -1,126 +0,0 @@
-#ifndef boxm_plane_ransac_h_
-#define boxm_plane_ransac_h_
-//:
-// \file
-// \brief class to find the optimal intersecting 3D line of a set of 3D planes.
-//
-// \author G. Tunali
-//
-// \verbatim
-// Modifications
-// Ozge C. Ozcanli July 7, 2010 : made some internal hard-coded defaults into parameters
-// \endverbatim
-
-#include <iostream>
-#include <cstdlib>
-#include <list>
-#include <vgl/vgl_infinite_line_3d.h>
-#include <vgl/vgl_intersection.h>
-#include <vgl/algo/vgl_intersection.h>
-#include <vgl/vgl_plane_3d.h>
-#include <vgl/vgl_distance.h>
-#include <vgl/vgl_vector_3d.h>
-#include <vgl/vgl_closest_point.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#define ITER_MAX 100
-
-template <class T>
-bool boxm_plane_ransac(std::vector<boxm_edge_tangent_sample<T> > aux_samples,
- std::vector<T> /*weights*/,
- vgl_infinite_line_3d<T>& line,
- T &min_res, vgl_box_3d<double> cell_global_box,
- unsigned int threshold, float ortho_thres = 0.01f, float volume_ratio = 128.0f)
-{
- unsigned int num_imgs = aux_samples.size();
-
- vgl_point_3d<T> local_origin((T)cell_global_box.centroid_x(),(T)cell_global_box.centroid_y(),(T)cell_global_box.centroid_z());
- std::list<vgl_plane_3d<T> > fit_planes;
- min_res=T(1e10);
- line=vgl_infinite_line_3d<T>(vgl_vector_2d<T>(-10000,-10000),vgl_vector_3d<T>(0,0,1));
- std::vector<T> ws;
- bool set=false;
- // this threshold is to check participation from number of images
- if (num_imgs<=threshold)
- return set;
-
- for (unsigned iter=0; iter<ITER_MAX; iter++)
- {
- fit_planes.clear();
- ws.clear();
- // select two imgs randomly
- int index1 = std::rand() % num_imgs;
- int index2 = index1;
- while (index2==index1)
- index2=std::rand() % num_imgs;
-
- int index1_1 =std::rand() % aux_samples[index1].num_obs();
- int index2_1 =std::rand() % aux_samples[index2].num_obs();
-
- vgl_plane_3d<T> plane1 = aux_samples[index1].obs(index1_1).plane_;
- vgl_plane_3d<T> plane2 = aux_samples[index2].obs(index2_1).plane_;
-
- vgl_infinite_line_3d<T> inters_line;
- // form a hypothesis
- if (vgl_intersection(plane1, plane2, inters_line))
- {
- vgl_vector_3d<T> line_dir = inters_line.direction();
- vgl_point_3d<T> p=vgl_closest_point<T>(inters_line,local_origin);
- int cnt_imgs=0;
- // only if the hypothesis is close to the cell in consideration
- // can be made more tighter.
- if (vgl_distance<T>(p,local_origin)<0.67*cell_global_box.width())
- {
- for (unsigned i=0; i<aux_samples.size(); ++i) {
- bool flag=false;
- for (unsigned j=0;j<aux_samples[i].num_obs();j++)
- {
- vgl_plane_3d<T> plane = aux_samples[i].obs(j).plane_;
- vgl_vector_3d<T> normal = plane.normal();
- // see if the line direction and plane normal is perpendicular
- T res = dot_product(normal,line_dir);
- if (std::fabs(res) < T(ortho_thres)) { // ortho_thres, used to be hard-coded to 0.05, then made a param with default 0.01 (stricter)
- // check to see if the line is close to the plane
- if (plane.contains(p,T(cell_global_box.width())/T(volume_ratio))) // volume_ratio, used to be hard-coded to 8, then made a param with default 128 (stricter)
- {
- fit_planes.push_back(plane);
- //ws.push_back(weights[i]);
- ws.push_back(aux_samples[i].obs(j).seg_len_);
- flag=true;
- }
- }
- }
- if (flag)
- cnt_imgs++;
- }
- }
-
- // intersect the selected planes
- if (cnt_imgs > (int)threshold ) {
- T res=0;
- vgl_infinite_line_3d<T> l;
- bool good = vgl_intersection(fit_planes, ws, l, res);
- vgl_point_3d<double> p0,p1;
- vgl_vector_2d<double> x0(l.x0().x(), l.x0().y());
- vgl_vector_3d<double> dir(l.direction().x(), l.direction().y(), l.direction().z());
-
- if (good&&vgl_intersection<double>(cell_global_box, vgl_infinite_line_3d<double>(x0,dir), p0, p1)) {
- if (res<min_res) {
- min_res=res;
- line=l;
- set=true;
- }
- }
- }
- }
- }
-
- return set;
-}
-
-
-#endif
diff --git a/contrib/brl/bseg/boxm/util/boxm_quad_scan_iterator.cxx b/contrib/brl/bseg/boxm/util/boxm_quad_scan_iterator.cxx
deleted file mode 100644
index c1e220a294..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_quad_scan_iterator.cxx
+++ /dev/null
@@ -1,188 +0,0 @@
-#include <vector>
-#include <cmath>
-#include <iostream>
-#include <algorithm>
-#include "boxm_quad_scan_iterator.h"
-//:
-// \file
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-//: constructor
-boxm_quad_scan_iterator::boxm_quad_scan_iterator(double *verts_x, double *verts_y,
- unsigned int v0, unsigned int v1,
- unsigned int v2, unsigned int v3):poly_()
-{
- poly_.new_sheet();
-
- poly_.push_back(verts_x[v0] * supersample_ratio_ - 0.5,
- verts_y[v0] * supersample_ratio_ - 0.5);
- poly_.push_back(verts_x[v1] * supersample_ratio_ - 0.5,
- verts_y[v1] * supersample_ratio_ - 0.5);
- poly_.push_back(verts_x[v2] * supersample_ratio_ - 0.5,
- verts_y[v2] * supersample_ratio_ - 0.5);
- poly_.push_back(verts_x[v3] * supersample_ratio_ - 0.5,
- verts_y[v3] * supersample_ratio_ - 0.5);
-
- super_it_= new vgl_polygon_scan_iterator<double>(poly_,false);
-
- poly_bb_.update(verts_x[v0], verts_y[v0]);
- poly_bb_.update(verts_x[v1], verts_y[v1]);
- poly_bb_.update(verts_x[v2], verts_y[v2]);
- poly_bb_.update(verts_x[v3], verts_y[v3]);
-
- int poly_xmin = (int)std::floor(poly_bb_.xmin());
- int poly_xmax = (int)std::floor(poly_bb_.xmax()) + 1;
- poly_diameter_x_ = (poly_xmax - poly_xmin) + 1;
- aa_vals_ = new float[poly_diameter_x_];
- aa_vals_offset_ = -poly_xmin;
- next_return_ = false;
-}
-
-
-//: Resets the scan iterator to before the first scan line
-// After calling this function, next() needs to be called before
-// startx() and endx() form a valid scan line.
-void boxm_quad_scan_iterator::reset()
-{
- super_it_->reset();
- next_return_ = super_it_->next();
- while (next_return_ && super_it_->scany() < 0) {
- next_return_ = super_it_->next();
- }
-}
-
-//: Tries to move to the next scan line.
-// Returns false if there are no more scan lines.
-bool boxm_quad_scan_iterator::next()
-{
- if (!next_return_) {
- return false;
- }
- int super_scany = super_it_->scany();
- scany_ = super_scany / supersample_ratio_; // super_scany should always be >= 0
-
- // initialize startx_ and endx_
- startx_ = int(poly_bb_.xmax()) + 1;
- endx_ = int(poly_bb_.xmin()) - 1;
-
- // compute antialiasing values for each pixel in scanline
- //std::fill(aa_vals_.begin(), aa_vals_.end(), 0.0f);
- for (unsigned int i=0; i<poly_diameter_x_; i++)
- aa_vals_[i] = 0.0f;
-
- int super_scany_end = (scany_ + 1)*supersample_ratio_;
- static const float increment = 1.0f / (supersample_ratio_*supersample_ratio_);
- static const float full_increment = 1.0f / (supersample_ratio_);
-
- while ( (super_scany < super_scany_end) && next_return_ ) {
- int super_startx = super_it_->startx();
- int super_endx = super_it_->endx() + 1;
-
- super_startx = std::max(0, super_startx);
- super_endx = std::max(0, super_endx);
- // make sure super_startx < super_endx
- if (super_endx > super_startx) {
- int scanline_startx = super_startx / supersample_ratio_;
- int scanline_endx = ((super_endx - 1)/ supersample_ratio_) + 1;
- // update startx and endx
- if (scanline_startx < startx_) {
- startx_ = scanline_startx;
- }
- if (scanline_endx > endx_) {
- endx_ = scanline_endx;
- }
- // case 1: run covers 1 superpixel only
- if (scanline_startx + 1 == scanline_endx) {
- aa_vals_[aa_vals_offset_ + scanline_startx] += increment*(super_endx - super_startx);
- }
- // case 2: startx is less than endx by more than 1
- else {
- // partial coverage at the beginning of scanline
- aa_vals_[aa_vals_offset_ + scanline_startx] += increment*(supersample_ratio_ - (super_startx % supersample_ratio_));
-
- // full coverage in middle of scanline
- for (int x = scanline_startx + 1; x < scanline_endx-1; ++x) {
- aa_vals_[aa_vals_offset_ + x] += full_increment;
- }
- // partial coverage at end of scanline
- aa_vals_[aa_vals_offset_ + scanline_endx - 1] += increment*((super_endx - 1)% supersample_ratio_ + 1);
- }
- }
- next_return_ = super_it_->next();
- super_scany = super_it_->scany();
- }
- return true;
-}
-
-//: y-coordinate of the current scan line.
-int boxm_quad_scan_iterator::scany() const
-{
- return scany_;
-}
-
-//: Returns starting x-value of the current scan line.
-// startx() should be smaller than endx(), unless the scan line is empty
-int boxm_quad_scan_iterator::startx() const
-{
- return startx_;
-}
-
-//: Returns ending x-value of the current scan line.
-// endx() should be larger than startx(), unless the scan line is empty
-int boxm_quad_scan_iterator::endx() const
-{
- return endx_;
-}
-
-//: returns the amount of pixel at location x in the current scanline covered by the triangle
-float boxm_quad_scan_iterator::pix_coverage(int x)
-{
- return aa_vals_[aa_vals_offset_ + x];
-}
-
-bool
-boxm_quad_scan_iterator:: x_start_end_val(const double * vals,double & start_val,double & end_val)
-{
- int * chainnum=nullptr;
- int * vertnum=nullptr;
- int numcrossedges=0;
- super_it_->get_crossedge_vertices(chainnum,vertnum,numcrossedges);
- if (numcrossedges==2)
- {
- for (int i=0;i<numcrossedges;++i)
- {
- vgl_point_2d<double> p1=poly_[chainnum[i]][vertnum[i]];
- double val1=vals[vertnum[i]];
- double val2=0;
- vgl_point_2d<double> p2;
- if (vertnum[i]==3)
- {
- val2=vals[0];
- p2=poly_[chainnum[i]][0];
- }
- else
- {
- val2=vals[vertnum[i]+1];
- p2=poly_[chainnum[i]][vertnum[i]+1];
- }
- if (i==0)
- start_val=val1+(val2-val1)*(super_it_->scany()-p1.y())/(p2.y()-p1.y());
- else
- end_val=val1+(val2-val1)*(super_it_->scany()-p1.y())/(p2.y()-p1.y());
- }
- delete [] vertnum;
- delete [] chainnum;
- return true;
- }
- else
- return false;
-}
-
-
-boxm_quad_scan_iterator::~boxm_quad_scan_iterator()
-{
- delete super_it_;
- delete[] aa_vals_;
-}
diff --git a/contrib/brl/bseg/boxm/util/boxm_quad_scan_iterator.h b/contrib/brl/bseg/boxm/util/boxm_quad_scan_iterator.h
deleted file mode 100644
index 86c7bd0565..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_quad_scan_iterator.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef boxm_quad_scan_iterator_h_
-#define boxm_quad_scan_iterator_h_
-//:
-// \file
-#include <iostream>
-#include <vector>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <vgl/vgl_region_scan_iterator.h>
-#include <vgl/vgl_polygon_scan_iterator.h>
-
-#include <vbl/vbl_bounding_box.h>
-
-class boxm_quad_scan_iterator : public vgl_region_scan_iterator
-{
- public:
- //: constructor
- boxm_quad_scan_iterator(double *verts_x, double *verts_y, unsigned int v0 = 0, unsigned int v1 = 1, unsigned int v2 = 2, unsigned int v3 = 3);
- ~boxm_quad_scan_iterator() override;
-
- //: Resets the scan iterator to before the first scan line
- // After calling this function, next() needs to be called before
- // startx() and endx() form a valid scan line.
- void reset() override;
-
- //: Tries to move to the next scan line.
- // Returns false if there are no more scan lines.
- bool next() override;
-
- //: y-coordinate of the current scan line.
- int scany() const override;
-
- //: Returns starting x-value of the current scan line.
- // startx() should be smaller than endx(), unless the scan line is empty
- int startx() const override;
-
- //: Returns ending x-value of the current scan line.
- // endx() should be larger than startx(), unless the scan line is empty
- int endx() const override;
-
- //: returns the amount of pixel at location x in the current scanline covered by the triangle
- float pix_coverage(int x);
-
- bool x_start_end_val(const double * vals,double & start_val,double & end_val);
-
-
- protected:
- static const unsigned int supersample_ratio_ = 1;
- vgl_polygon_scan_iterator<double> * super_it_;
- vgl_polygon<double> poly_;
-
- int startx_;
- int endx_;
- int scany_;
- bool next_return_;
-
- unsigned int poly_diameter_x_;
- float* aa_vals_;
- int aa_vals_offset_;
-
- vbl_bounding_box<double,2> poly_bb_;
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/util/boxm_rational_camera_utils.cxx b/contrib/brl/bseg/boxm/util/boxm_rational_camera_utils.cxx
deleted file mode 100644
index 4ffdd47b22..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_rational_camera_utils.cxx
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "boxm_rational_camera_utils.h"
-#include <vgl/vgl_point_2d.h>
-
-vgl_plane_3d<double>
-boxm_rational_camera_utils::boxm_find_parallel_image_plane(vpgl_rational_camera<double> * rcam,
- vgl_plane_3d<double> top,
- vgl_plane_3d<double> bottom,
- unsigned ni, unsigned nj)
-{
- vgl_point_3d<double> top_guess(0,0,-top.d()/top.c());
- vgl_point_3d<double> bottom_guess(0,0,-bottom.d()/bottom.c());
- vpgl_backproject::bproj_plane(*rcam,vgl_point_2d<double>(ni/2,nj/2),top,top_guess,top_guess);
- vpgl_backproject::bproj_plane(*rcam,vgl_point_2d<double>(ni/2,nj/2),bottom,bottom_guess,bottom_guess);
-
- vgl_plane_3d<double> parallelplane(bottom_guess-top_guess,top_guess);
-
- return parallelplane;
-}
-
-void
-boxm_rational_camera_utils::project_corners_rational_camera(std::vector<vgl_point_3d<double> > const& corners,
- vpgl_rational_camera<double> * rcam,vgl_plane_3d<double> plane,
- double* xverts, double* yverts,
- float* vertdist)
-{
- double a=plane.a();
- double b=plane.b();
- double c=plane.c();
- double d=plane.d();
- double denom=std::sqrt(a*a+b*b+c*c);
- for (unsigned i=0; i<corners.size(); ++i)
- {
- rcam->project(corners[i].x(), corners[i].y(), corners[i].z(), xverts[i], yverts[i]);
- vertdist[i]=float((corners[i].x()*a+corners[i].y()*b+corners[i].z()*c+d)/denom);
- }
-}
diff --git a/contrib/brl/bseg/boxm/util/boxm_rational_camera_utils.h b/contrib/brl/bseg/boxm/util/boxm_rational_camera_utils.h
deleted file mode 100644
index 61c9252276..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_rational_camera_utils.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef boxm_rational_camera_utils_h
-#define boxm_rational_camera_utils_h
-
-#include <vgl/vgl_plane_3d.h>
-#include <vgl/vgl_point_3d.h>
-#include <vpgl/vpgl_rational_camera.h>
-#include <vpgl/algo/vpgl_backproject.h>
-
-class boxm_rational_camera_utils
-{
- public:
- static vgl_plane_3d<double> boxm_find_parallel_image_plane(vpgl_rational_camera<double> * rcam,
- vgl_plane_3d<double> top,
- vgl_plane_3d<double> bottom,
- unsigned ni, unsigned nj);
- static void project_corners_rational_camera(std::vector<vgl_point_3d<double> > const& corners,
- vpgl_rational_camera<double> * rcam,vgl_plane_3d<double> plane,
- double* xverts, double* yverts,
- float* vertdist);
-};
-
-class abs_functor
-{
- public:
- abs_functor()= default;
-
- float operator()(float x) const { return std::fabs(x); }
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/util/boxm_raytrace_operations.cxx b/contrib/brl/bseg/boxm/util/boxm_raytrace_operations.cxx
deleted file mode 100644
index 1b1a95623b..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_raytrace_operations.cxx
+++ /dev/null
@@ -1,232 +0,0 @@
-#include "boxm_raytrace_operations.h"
-
-bool boxm_alpha_seg_len(double *xverts_2d, double* yverts_2d, float* vert_distances, boct_face_idx visible_faces, float alpha, vil_image_view<float> &alpha_distance)
-{
- // multiply each vertex distance by alpha
- float vert_alpha_distances[8];
- float *vert_dist_ptr = vert_distances;
- float *vert_alpha_dist_ptr = vert_alpha_distances;
- for (unsigned int i=0; i<8; ++i) {
- *vert_alpha_dist_ptr++ = *vert_dist_ptr++ * alpha;
- }
-
- // for each face, create two triangle iterators and fill in pixel data
- // X_LOW
- // tri 0
- boxm_triangle_interpolation_iterator<float> tri_it(xverts_2d, yverts_2d, vert_alpha_distances, 0, 4, 3);
- if (visible_faces & X_LOW)
- tri_interpolate_values(tri_it, alpha_distance, true);
- else
- tri_interpolate_values(tri_it, alpha_distance, false);
-
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_alpha_distances, 4, 7, 3);
- if (visible_faces & X_LOW)
- tri_interpolate_values(tri_it, alpha_distance, true);
- else
- tri_interpolate_values(tri_it, alpha_distance, false);
-
-
- // X_HIGH
- // tri 0
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_alpha_distances, 1, 2, 5);
- if (visible_faces & X_HIGH)
- tri_interpolate_values(tri_it, alpha_distance, true);
- else
- tri_interpolate_values(tri_it, alpha_distance, false);
-
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_alpha_distances, 2, 6, 5);
- if (visible_faces & X_HIGH)
- tri_interpolate_values(tri_it, alpha_distance, true);
- else
- tri_interpolate_values(tri_it, alpha_distance, false);
-
-
- // Y_LOW
- // tri 0
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_alpha_distances, 0, 1, 5);
- if (visible_faces & Y_LOW)
- tri_interpolate_values(tri_it, alpha_distance, true);
- else
- tri_interpolate_values(tri_it, alpha_distance, false);
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_alpha_distances, 0, 5, 4);
- if (visible_faces & Y_LOW)
- tri_interpolate_values(tri_it, alpha_distance, true);
- else
- tri_interpolate_values(tri_it, alpha_distance, false);
-
- // Y_HIGH
- // tri 0
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_alpha_distances, 3, 2, 6);
- if (visible_faces & Y_HIGH)
- tri_interpolate_values(tri_it, alpha_distance, true);
- else
- tri_interpolate_values(tri_it, alpha_distance, false);
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_alpha_distances, 3, 6, 7);
- if (visible_faces & Y_HIGH)
- tri_interpolate_values(tri_it, alpha_distance, true);
- else
- tri_interpolate_values(tri_it, alpha_distance, false);
-
- // Z_LOW
- // tri 0
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_alpha_distances, 0, 1, 2);
- if (visible_faces & Z_LOW)
- tri_interpolate_values(tri_it, alpha_distance, true);
- else
- tri_interpolate_values(tri_it, alpha_distance, false);
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_alpha_distances, 0, 2, 3);
- if (visible_faces & Z_LOW)
- tri_interpolate_values(tri_it, alpha_distance, true);
- else
- tri_interpolate_values(tri_it, alpha_distance, false);
-
- // Z_HIGH
- // tri 0
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_alpha_distances, 4, 5, 6);
- if (visible_faces & Z_HIGH)
- tri_interpolate_values(tri_it, alpha_distance, true);
- else
- tri_interpolate_values(tri_it, alpha_distance, false);
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_alpha_distances, 4, 7, 6);
- if (visible_faces & Z_HIGH)
- tri_interpolate_values(tri_it, alpha_distance, true);
- else
- tri_interpolate_values(tri_it, alpha_distance, false);
-
- return true;
-}
-
-
-bool boxm_depth_fill(double *xverts_2d, double* yverts_2d,
- float* vert_distances, boct_face_idx visible_faces,
- vil_image_view<float> &depth_image)
-{
- // for each face, create two triangle iterators and fill in pixel data
- // X_LOW
- // tri 0
- boxm_triangle_interpolation_iterator<float> tri_it(xverts_2d, yverts_2d, vert_distances, 0, 4, 3);
- if (visible_faces & X_LOW)
- tri_interpolate_values(tri_it, depth_image, true);
-
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_distances, 4, 7, 3);
- if (visible_faces & X_LOW)
- tri_interpolate_values(tri_it, depth_image, true);
-
-
- // X_HIGH
- // tri 0
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_distances, 1, 2, 5);
- if (visible_faces & X_HIGH)
- tri_interpolate_values(tri_it, depth_image, true);
-
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_distances, 2, 6, 5);
- if (visible_faces & X_HIGH)
- tri_interpolate_values(tri_it, depth_image, true);
-
-
- // Y_LOW
- // tri 0
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_distances, 0, 1, 5);
- if (visible_faces & Y_LOW)
- tri_interpolate_values(tri_it, depth_image, true);
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_distances, 0, 5, 4);
- if (visible_faces & Y_LOW)
- tri_interpolate_values(tri_it, depth_image, true);
-
- // Y_HIGH
- // tri 0
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_distances, 3, 2, 6);
- if (visible_faces & Y_HIGH)
- tri_interpolate_values(tri_it, depth_image, true);
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_distances, 3, 6, 7);
- if (visible_faces & Y_HIGH)
- tri_interpolate_values(tri_it, depth_image, true);
-
- // Z_LOW
- // tri 0
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_distances, 0, 1, 2);
- if (visible_faces & Z_LOW)
- tri_interpolate_values(tri_it, depth_image, true);
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_distances, 0, 2, 3);
- if (visible_faces & Z_LOW)
- tri_interpolate_values(tri_it, depth_image, true);
-
- // Z_HIGH
- // tri 0
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_distances, 4, 5, 6);
- if (visible_faces & Z_HIGH)
- tri_interpolate_values(tri_it, depth_image, true);
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_distances, 4, 7, 6);
- if (visible_faces & Z_HIGH)
- tri_interpolate_values(tri_it, depth_image, true);
-
- return true;
-}
-
-
-bool cube_fill_value(double* xverts_2d, double* yverts_2d, boct_face_idx visible_faces, vil_image_view<float> &img, float const& val)
-{
- // for each face, create two triangle iterators and fill in pixel data
- boxm_triangle_scan_iterator tri_it(xverts_2d, yverts_2d, 0,4,3);
- if (visible_faces & X_LOW) {
- // tri 0
- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 0, 4, 3);
- tri_fill_value(tri_it, img, val);
- // tri 1
- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 4, 7, 3);
- tri_fill_value(tri_it, img, val);
- }
- if (visible_faces & X_HIGH) {
- // tri 0
- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 1, 2, 5);
- tri_fill_value(tri_it, img, val);
- // tri 1
- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 2, 6, 5);
- tri_fill_value(tri_it, img, val);
- }
- if (visible_faces & Y_LOW) {
- // tri 0
- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 0, 1, 5);
- tri_fill_value(tri_it, img, val);
- // tri 1
- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 0, 5, 4);
- tri_fill_value(tri_it, img, val);
- }
- if (visible_faces & Y_HIGH) {
- // tri 0
- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 3, 2, 6);
- tri_fill_value(tri_it, img, val);
- // tri 1
- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 3, 6, 7);
- tri_fill_value(tri_it, img, val);
- }
- if (visible_faces & Z_LOW) {
- // tri 0
- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 0, 1, 2);
- tri_fill_value(tri_it, img, val);
- // tri 1
- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 0, 2, 3);
- tri_fill_value(tri_it, img, val);
- }
- if (visible_faces & Z_HIGH) {
- // tri 0
- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 4, 5, 6);
- tri_fill_value(tri_it, img, val);
- // tri 1
- tri_it = boxm_triangle_scan_iterator(xverts_2d, yverts_2d, 4, 7, 6);
- tri_fill_value(tri_it, img, val);
- }
- return true;
-}
diff --git a/contrib/brl/bseg/boxm/util/boxm_raytrace_operations.h b/contrib/brl/bseg/boxm/util/boxm_raytrace_operations.h
deleted file mode 100644
index ee6147127b..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_raytrace_operations.h
+++ /dev/null
@@ -1,452 +0,0 @@
-#ifndef boxm_raytrace_operations_h_
-#define boxm_raytrace_operations_h_
-//:
-// \file
-
-#include <iostream>
-#include "boxm_triangle_interpolation_iterator.h"
-#include "boxm_triangle_scan_iterator.h"
-#include <boxm/boxm_apm_traits.h>
-
-#include <vnl/algo/vnl_determinant.h>
-#include <vgl/vgl_triangle_scan_iterator.h>
-#include <boct/boct_tree.h>
-#include <vil/vil_image_view.h>
-
-#if 0
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#endif
-
-bool cube_fill_value(double* xverts_2d, double* yverts_2d, boct_face_idx visible_faces, vil_image_view<float> &img, float const& val);
-
-bool boxm_alpha_seg_len(double *xverts_2d, double* yverts_2d, float* vert_distances, boct_face_idx visible_faces, float alpha, vil_image_view<float> &alpha_distance);
-bool boxm_depth_fill(double *xverts_2d, double* yverts_2d,
- float* vert_distances, boct_face_idx visible_faces,
- vil_image_view<float> &depth_image);
-template<class T, class tri_int_it_t>
-bool tri_interpolated_weighted_sum(tri_int_it_t &tri_it, vil_image_view<T> const& values, T &val_sum, float &weight_sum, bool subtract)
-{
- tri_it.reset();
- while (tri_it.next()) {
- int y = tri_it.scany();
- if (y < 0) {
- // not inside of image bounds yet. go to next scanline.
- continue;
- }
- unsigned int yu = (unsigned int)y;
- if (yu >= values.nj() ) {
- // we have left the image bounds. no need to continue.
- break;
- }
- if ( (tri_it.startx() >= (int)values.ni()) || (tri_it.endx() <= 0) ) {
- // no part of this scanline is within the image bounds. go to next scanline.
- continue;
- }
- unsigned int startx = (unsigned int)std::max((int)0,tri_it.startx());
- unsigned int endx = (unsigned int)std::min((int)values.ni(),tri_it.endx());
-
- if (subtract) {
- for (unsigned int x = startx; x < endx; ++x) {
- float point_dist = tri_it.value_at(x);
- val_sum -= values(x,yu) * point_dist;
- weight_sum -= point_dist;
- }
- }
- else {
- for (unsigned int x = startx; x < endx; ++x) {
- float point_dist = tri_it.value_at(x);
- val_sum += values(x,yu) * point_dist;
- weight_sum += point_dist;
- }
- }
- }
- return true;
-}
-
-//: returns the sum of the weights
-template<class T1, class T2, class tri_it_t>
-bool tri_interpolated_weighted_sum(tri_it_t &tri_it, vil_image_view<T1> const& weights, vil_image_view<T2> const& values, T2 &val_sum, T1 &weight_sum, bool subtract=false)
-{
- tri_it.reset();
- while (tri_it.next()) {
- int y = tri_it.scany();
- if (y < 0) {
- // not inside of image bounds yet. go to next scanline.
- continue;
- }
- unsigned int yu = (unsigned int)y;
- if (yu >= values.nj() ) {
- // we have left the image bounds. no need to continue.
- break;
- }
- if ( (tri_it.startx() >= (int)values.ni()) || (tri_it.endx() <= 0) ) {
- // no part of this scanline is within the image bounds. go to next scanline.
- continue;
- }
- unsigned int startx = (unsigned int)std::max((int)0,tri_it.startx());
- unsigned int endx = (unsigned int)std::min((int)values.ni(),tri_it.endx());
-
- if (subtract) {
- for (unsigned int x = startx; x < endx; ++x) {
- T1 weight = tri_it.value_at(x)*weights(x,yu);
- val_sum -= weight * values(x,yu);
- weight_sum -= weight;
- }
- }
- else {
- for (unsigned int x = startx; x < endx; ++x) {
- T1 weight = tri_it.value_at(x)*weights(x,yu);
- val_sum += weight * values(x,yu);
- weight_sum += weight;
- }
- }
- }
- return true;
-}
-
-
-template<class T, class tri_it_t>
-void tri_interpolate_values(tri_it_t &tri_it, vil_image_view<T> &img, bool subtract = false)
-{
- tri_it.reset();
- while (tri_it.next()) {
- int y = tri_it.scany();
- if (y < 0) {
- // not inside of image bounds yet. go to next scanline.
- continue;
- }
- unsigned int yu = (unsigned int)y;
- if (yu >= img.nj() ) {
- // we have left the image bounds. no need to continue.
- break;
- }
- if ( (tri_it.startx() >= (int)img.ni()) || (tri_it.endx() <= 0) ) {
- // no part of this scanline is within the image bounds. go to next scanline.
- continue;
- }
- unsigned int startx = (unsigned int)std::max((int)0,tri_it.startx());
- unsigned int endx = (unsigned int)std::min((int)img.ni(),tri_it.endx());
-
- if (subtract) {
- for (unsigned int x = startx; x < endx; ++x) {
- img(x,yu) -= tri_it.value_at(x);
- }
- }
- else {
- for (unsigned int x = startx; x < endx; ++x) {
- img(x,yu) += tri_it.value_at(x);
- }
- }
- }
- return;
-}
-
-
-#if 0
-template<class T, class tri_it_T>
-void tri_interpolate_values(tri_it_T &tri_it, double* xvals, double* yvals, T* vals, vil_image_view<T> &img, vil_image_view<float> &pix_coverage, unsigned int v0=0, unsigned int v1=1, unsigned int v2=2)
-{
- // first compute s0, s1, s2 such that val = s0*x + s1*y + s2 for any point within the triangle
- // (no need to compute barycentric coordinates at each step)
- // subtract 0.5 from xvals and yvals, so that interpolated value at pixel x,y evaluates to coordinates x+0.5, y+0.5 (center of pixel)
- double Acol0[] = {xvals[v0]-0.5, xvals[v1]-0.5, xvals[v2]-0.5};
- double Acol1[] = {yvals[v0]-0.5, yvals[v1]-0.5, yvals[v2]-0.5};
- double Acol2[] = {1.0, 1.0, 1.0};
-
- double Z[] = {vals[v0], vals[v1], vals[v2]};
-
- double detA = vnl_determinant(Acol0, Acol1, Acol2);
- double s0 = vnl_determinant(Z, Acol1, Acol2) / detA;
- double s1 = vnl_determinant(Acol0, Z, Acol2) / detA;
- double s2 = vnl_determinant(Acol0, Acol1, Z) / detA;
-
- tri_it.reset();
- while (tri_it.next()) {
- int y = tri_it.scany();
- if (y < 0) {
- // not inside of image bounds yet. go to next scanline.
- continue;
- }
- unsigned int yu = (unsigned int)y;
- if (yu > img.nj() ) {
- // we have left the image bounds. no need to continue.
- break;
- }
- if ( (tri_it.startx() >= (int)img.ni()) || (tri_it.endx() <= 0) ) {
- // no part of this scanline is within the image bounds. go to next scanline.
- continue;
- }
- unsigned int startx = (unsigned int)std::max((int)0,tri_it.startx());
- unsigned int endx = (unsigned int)std::min((int)img.ni(),tri_it.endx());
-
- for (unsigned int x = startx; x < endx; ++x) {
- T interp_val = (T)(s0*x + s1*y + s2);
- if ( (min_img(x,yu) == 0) || (min_img(x,yu) > interp_val) ) {
- min_img(x,yu) = interp_val;
- }
- if (max_img(x,yu) < interp_val) {
- max_img(x,yu) = interp_val;
- }
- }
- }
- return;
-}
-#endif
-
-template<class T, class tri_it_T>
-void tri_interpolate_min_max(tri_it_T &tri_it, double* xvals, double* yvals, T* vals, vil_image_view<T> &min_img, vil_image_view<T> &max_img, unsigned int v0=0, unsigned int v1=1, unsigned int v2=2)
-{
- // first compute s0, s1, s2 such that val = s0*x + s1*y + s2 for any point within the triangle
- // (no need to compute barycentric coordinates at each step)
- // subtract 0.5 from xvals and yvals, so that interpolated value at pixel x,y evaluates to coordinates x+0.5, y+0.5 (center of pixel)
- double Acol0[] = {xvals[v0]-0.5, xvals[v1]-0.5, xvals[v2]-0.5};
- double Acol1[] = {yvals[v0]-0.5, yvals[v1]-0.5, yvals[v2]-0.5};
- double Acol2[] = {1.0, 1.0, 1.0};
-
- double Z[] = {vals[v0], vals[v1], vals[v2]};
-
- double detA = vnl_determinant(Acol0, Acol1, Acol2);
- double s0 = vnl_determinant(Z, Acol1, Acol2) / detA;
- double s1 = vnl_determinant(Acol0, Z, Acol2) / detA;
- double s2 = vnl_determinant(Acol0, Acol1, Z) / detA;
-
- tri_it.reset();
- while (tri_it.next()) {
- int y = tri_it.scany();
- if (y < 0) {
- // not inside of image bounds yet. go to next scanline.
- continue;
- }
- unsigned int yu = (unsigned int)y;
- if (yu >= max_img.nj() ) {
- // we have left the image bounds. no need to continue.
- break;
- }
- if ( (tri_it.startx() >= (int)max_img.ni()) || (tri_it.endx() <= 0) ) {
- // no part of this scanline is within the image bounds. go to next scanline.
- continue;
- }
- unsigned int startx = (unsigned int)std::max((int)0,tri_it.startx());
- unsigned int endx = (unsigned int)std::min((int)max_img.ni(),tri_it.endx());
-
- for (unsigned int x = startx; x < endx; ++x) {
- T interp_val = (T)(s0*x + s1*y + s2);
- if ( (min_img(x,yu) == 0) || (min_img(x,yu) > interp_val) ) {
- min_img(x,yu) = interp_val;
- }
- if (max_img(x,yu) < interp_val) {
- max_img(x,yu) = interp_val;
- }
- }
- }
- return;
-}
-
-template<class T1, class T2>
-void tri_weighted_sum(vgl_triangle_scan_iterator<double> &tri_it, vil_image_view<T1> &img, vil_image_view<T2> &weights, T1 &val_sum, T2 &weight_sum)
-{
- tri_it.reset();
- while (tri_it.next()) {
- int y = tri_it.scany();
- if (y < 0) {
- // not inside of image bounds yet. go to next scanline.
- continue;
- }
- unsigned int yu = (unsigned int)y;
- if (yu >= img.nj() ) {
- // we have left the image bounds. no need to continue.
- break;
- }
- if ( (tri_it.startx() >= (int)img.ni()) || (tri_it.endx() <= 0) ) {
- // no part of this scanline is within the image bounds. go to next scanline.
- continue;
- }
- unsigned int startx = (unsigned int)std::max((int)0,tri_it.startx());
- unsigned int endx = (unsigned int)std::min((int)img.ni(),tri_it.endx());
-
- for (unsigned int x = startx; x < endx; ++x) {
- val_sum += img(x,yu)*weights(x,yu);
- weight_sum += weights(x,yu);
- }
- }
- return;
-}
-
-template<class T, class tri_it_T>
-void tri_fill_value(tri_it_T &tri_it, vil_image_view<T> &img, T val)
-{
- tri_it.reset();
- while (tri_it.next()) {
- int y = tri_it.scany();
- if (y < 0) {
- // not inside of image bounds yet. go to next scanline.
- continue;
- }
- unsigned int yu = (unsigned int)y;
- if (yu >= img.nj() ) {
- // we have left the image bounds. no need to continue.
- break;
- }
- if ( (tri_it.startx() >= (int)img.ni()) || (tri_it.endx() <= 0) ) {
- // no part of this scanline is within the image bounds. go to next scanline.
- continue;
- }
- unsigned int startx = (unsigned int)std::max((int)0,tri_it.startx());
- unsigned int endx = (unsigned int)std::min((int)img.ni(),tri_it.endx());
-
- for (unsigned int x = startx; x < endx; ++x) {
- img(x,yu) = val;
- }
- }
- return;
-}
-
-#if 0 // this function commented out
-template <class T>
-void tri_fill_value_aa(boxm_triangle_scan_iterator_aa &tri_it, vil_image_view<T> &img, vil_image_view<float> &aa_weights, T val)
-{
- tri_it.reset();
- while (tri_it.next())
- {
- int y = tri_it.scany();
- if (y < 0) {
- // not inside of image bounds yet. go to next scanline.
- continue;
- }
- unsigned int yu = (unsigned int)y;
- if (yu >= img.nj() ) {
- // we have left the image bounds. no need to continue.
- break;
- }
- if ( (tri_it.startx() >= (int)img.ni()) || (tri_it.endx() <= 0) ) {
- // no part of this scanline is within the image bounds. go to next scanline.
- continue;
- }
- unsigned int startx = (unsigned int)std::max((int)0,tri_it.startx());
- unsigned int endx = (unsigned int)std::min((int)img.ni(),tri_it.endx());
-
- for (unsigned int x = startx; x < endx; ++x) {
- float pix_cov = tri_it.pix_coverage(x);
- if ((pix_cov < 0.0f) || (pix_cov > 1.0f)) {
- std::cerr << " error: pix_cov = " << pix_cov << std::endl;
- }
- aa_weights(x,yu) += tri_it.pix_coverage(x);
- img(x,yu) += val * pix_cov;
- }
- }
- return;
-}
-#endif // 0
-
-template<class T>
-bool cube_mean(double* xverts_2d, double* yverts_2d, float* vert_dists, boct_face_idx visible_faces, vil_image_view<T> const& values, T &mean)
-{
- // for each face, create two triangle iterators to interpolate distances
- T value_sum(0);
- float weight_sum(0);
- // X_LOW
- // tri 0
- boxm_triangle_interpolation_iterator<float> tri_it(xverts_2d, yverts_2d, vert_dists, 0, 3, 4);
- if (visible_faces & X_LOW)
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true);
- else
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false);
-
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_dists, 3, 4, 7);
- if (visible_faces & X_LOW)
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true);
- else
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false);
-
- // X_HIGH
- // tri 0
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_dists, 1, 2, 5);
- if (visible_faces & X_HIGH)
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true);
- else
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false);
-
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_dists, 2, 5, 6);
- if (visible_faces & X_HIGH)
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true);
- else
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false);
-
- // Y_LOW
- // tri 0
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_dists, 0, 1, 5);
- if (visible_faces & Y_LOW)
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true);
- else
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false);
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_dists, 4, 0, 5);
- if (visible_faces & Y_LOW)
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true);
- else
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false);
-
- // Y_HIGH
- // tri 0
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_dists, 7, 3, 2);
- if (visible_faces & Y_HIGH)
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true);
- else
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false);
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_dists, 2, 6, 7);
- if (visible_faces & Y_HIGH)
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true);
- else
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false);
-
- // Z_LOW
- // tri 0
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_dists, 0, 2, 1);
- if (visible_faces & Z_LOW)
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true);
- else
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false);
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_dists, 0, 2, 3);
- if (visible_faces & Z_LOW)
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true);
- else
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false);
-
- // Z_HIGH
- // tri 0
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_dists, 4, 5, 6);
- if (visible_faces & Z_HIGH)
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true);
- else
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false);
- // tri 1
- tri_it = boxm_triangle_interpolation_iterator<float>(xverts_2d, yverts_2d, vert_dists, 4, 7, 6);
- if (visible_faces & Z_HIGH)
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, true);
- else
- tri_interpolated_weighted_sum(tri_it, values, value_sum, weight_sum, false);
-
- if (std::fabs(weight_sum) > 1e-6) {
- mean = value_sum / weight_sum;
- }
- else {
- mean = T(0);
- return false;
- }
- return true;
-}
-
-inline void init_triangle_scan_iterator(vgl_triangle_scan_iterator<double> &tri_it, const double* xverts, const double* yverts, unsigned int v0=0, unsigned int v1=1, unsigned int v2=2)
-{
- // subtract 0.5 to follow convention that the center of pixel i,j is located at coordinates i+0.5, j+0.5
- tri_it.a.x = xverts[v0] - 0.5; tri_it.a.y = yverts[v0] - 0.5;
- tri_it.b.x = xverts[v1] - 0.5; tri_it.b.y = yverts[v1] - 0.5;
- tri_it.c.x = xverts[v2] - 0.5; tri_it.c.y = yverts[v2] - 0.5;
-}
-#endif
diff --git a/contrib/brl/bseg/boxm/util/boxm_test_util.cxx b/contrib/brl/bseg/boxm/util/boxm_test_util.cxx
deleted file mode 100644
index 1586ba9fcd..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_test_util.cxx
+++ /dev/null
@@ -1,141 +0,0 @@
-#include "boxm_test_util.h"
-#include <vgl/vgl_line_3d_2_points.h>
-#include <vnl/io/vnl_io_matrix_fixed.h>
-#include <vgl/algo/vgl_rotation_3d.h>
-
-void generate_persp_camera(double focal_length,
- vgl_point_2d<double>& pp, //principal point
- double x_scale, double y_scale,
- vgl_point_3d<double>& camera_center,
- vpgl_perspective_camera<double>& cam)
-{
- vpgl_calibration_matrix<double> K(focal_length,pp, x_scale, y_scale);
- cam.set_calibration(K);
- cam.set_camera_center(camera_center);
-}
-
-vpgl_rational_camera<double>
-perspective_to_rational(vpgl_perspective_camera<double>& cam_pers)
-{
- vnl_matrix_fixed<double,3,4> cam_pers_matrix = cam_pers.get_matrix();
- std::vector<double> neu_u,den_u,neu_v,den_v;
- double x_scale = 1.0, x_off = 0.0,
- y_scale = 1.0, y_off = 0.0,
- z_scale = 1.0, z_off = 0.0,
- u_scale = 1.0, u_off = 0.0,
- v_scale = 1.0, v_off = 0.0;
-
- for (int i=0; i<20; i++) {
- neu_u.push_back(0.0);
- neu_v.push_back(0.0);
- den_u.push_back(0.0);
- den_v.push_back(0.0);
- }
-
- int vector_map[] = {9,15,18,19};
-
- for (int i=0; i<4; i++) {
- neu_u[vector_map[i]] = cam_pers_matrix(0,i);
- neu_v[vector_map[i]] = cam_pers_matrix(1,i);
- den_u[vector_map[i]] = cam_pers_matrix(2,i);
- den_v[vector_map[i]] = cam_pers_matrix(2,i);
- }
-
- vpgl_rational_camera<double> cam_rat(neu_u,den_u,neu_v,den_v,
- x_scale,x_off,y_scale,y_off,z_scale,z_off,
- u_scale,u_off,v_scale,v_off);
- return cam_rat;
-}
-
-vpgl_camera_double_sptr generate_camera_top(vgl_box_3d<double>& world)
-{
- vgl_point_2d<double> principal_point(IMAGE_U*0.5, IMAGE_V*0.5);
-
- vgl_point_3d<double> centroid = world.centroid();
- vgl_point_3d<double> camera_center(centroid.x(), centroid.y(), centroid.z()+boxm_camera_dist);
-
- std::vector<vpgl_camera_double_sptr> rat_cameras;
-
- vpgl_perspective_camera<double> persp_cam;
- generate_persp_camera(boxm_focal_length,principal_point, boxm_x_scale, boxm_y_scale, camera_center, persp_cam);
- double r[] = { 1, 0, 0,
- 0, -1, 0,
- 0, 0, -1 };
-
- vnl_matrix_fixed<double,3,3> R(r);
- persp_cam.set_rotation(vgl_rotation_3d<double>(R));
-
- //persp_cam.look_at(vgl_homg_point_3d<double>(centroid));
- vpgl_rational_camera<double>* rat_cam = new vpgl_rational_camera<double>(perspective_to_rational(persp_cam));
- return rat_cam;
-}
-
-vpgl_camera_double_sptr generate_camera_top_persp(vgl_box_3d<double>& world)
-{
- vgl_point_2d<double> principal_point(IMAGE_U*0.5, IMAGE_V*0.5);
-
- vgl_point_3d<double> centroid = world.centroid();
- vgl_point_3d<double> camera_center(centroid.x(), centroid.y(), centroid.z()+boxm_camera_dist);
-
- std::vector<vpgl_camera_double_sptr> rat_cameras;
-
- auto * persp_cam= new vpgl_perspective_camera<double>();
- generate_persp_camera(boxm_focal_length,principal_point, boxm_x_scale, boxm_y_scale, camera_center, *persp_cam);
- persp_cam->look_at(vgl_homg_point_3d<double>(centroid));
- return persp_cam;
-}
-
-std::vector<vpgl_camera_double_sptr> generate_cameras_diagonal(vgl_box_3d<double>& world)
-{
- vgl_point_2d<double> principal_point(IMAGE_U/2., IMAGE_V/2.);
-
- vgl_line_3d_2_points<double> diag(world.min_point(), world.max_point());
-
- std::vector<vgl_point_3d<double> > centers;
- unsigned i=0;
- for (double t=0; t<=1.0; t+=0.1) {
- vgl_point_3d<double> centroid = diag.point_t(1-t);
- centers.push_back(centroid);
- std::cout << centers[i++] << std::endl;
- }
-
- std::vector<vpgl_camera_double_sptr> cameras;
- for (auto camera_center : centers)
- {
- vpgl_perspective_camera<double> persp_cam;
- generate_persp_camera(boxm_focal_length, principal_point, boxm_x_scale, boxm_y_scale, camera_center, persp_cam);
- persp_cam.look_at(vgl_homg_point_3d<double>(0,0,0)); //camera_center.x()+10, camera_center.y()+10, camera_center.z()));
- cameras.push_back(new vpgl_perspective_camera<double>(persp_cam));
- }
- return cameras;
-}
-
-std::vector<vpgl_camera_double_sptr> generate_cameras_circular(vgl_box_3d<double>& world)
-{
- vgl_point_2d<double> principal_point(IMAGE_U/2., IMAGE_V/2.);
-
- vgl_line_3d_2_points<double> diag(world.min_point(), world.max_point());
-
- std::vector<vgl_point_3d<double> > centers;
- vgl_point_3d<double> centroid(0,0,0);
- double x,y;
- double alpha = 0;
- double delta_alpha = vnl_math::pi/9.;
- for (unsigned i=0; i<11; i++) {
- x = boxm_camera_dist*std::cos(alpha);
- y = boxm_camera_dist*std::sin(alpha);
- centers.emplace_back(centroid.x()+x, centroid.y()+y, centroid.z());
- std::cout << centers[i] << std::endl;
- alpha += delta_alpha;
- }
-
- std::vector<vpgl_camera_double_sptr> cameras;
- for (auto camera_center : centers)
- {
- vpgl_perspective_camera<double> persp_cam;
- generate_persp_camera(boxm_focal_length, principal_point, boxm_x_scale, boxm_y_scale, camera_center, persp_cam);
- persp_cam.look_at(vgl_homg_point_3d<double>(0,0,0)); //camera_center.x()+10, camera_center.y()+10, camera_center.z()));
- cameras.push_back(new vpgl_perspective_camera<double>(persp_cam));
- }
- return cameras;
-}
diff --git a/contrib/brl/bseg/boxm/util/boxm_test_util.h b/contrib/brl/bseg/boxm/util/boxm_test_util.h
deleted file mode 100644
index b960b6d3c7..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_test_util.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef boxm_test_util_h
-#define boxm_test_util_h
-//:
-// \file
-#include <boct/boct_tree.h>
-#include <vpgl/vpgl_perspective_camera.h>
-#include <vpgl/vpgl_rational_camera.h>
-
-typedef boct_tree<short,vgl_point_3d<double> > tree_type;
-
-constexpr int IMAGE_U = 800;
-constexpr int IMAGE_V = 500;
-constexpr int boxm_x_scale = 500;
-constexpr int boxm_y_scale = 500;
-constexpr double boxm_focal_length = 1.0;
-constexpr double boxm_camera_dist = 300;
-constexpr unsigned num_train_images = 20;
-constexpr bool verbose = true;
-
-void generate_persp_camera(double focal_length,
- vgl_point_2d<double>& pp, //principal point
- double x_scale, double y_scale,
- vgl_point_3d<double>& camera_center,
- vpgl_perspective_camera<double>& cam);
-
-vpgl_rational_camera<double>
-perspective_to_rational(vpgl_perspective_camera<double>& cam_pers);
-
-vpgl_camera_double_sptr generate_camera_top(vgl_box_3d<double>& world);
-
-vpgl_camera_double_sptr generate_camera_top_persp(vgl_box_3d<double>& world);
-
-//: create a trajectory of perspective cameras at the diagonal of world (inside)
-std::vector<vpgl_camera_double_sptr> generate_cameras_diagonal(vgl_box_3d<double>& world);
-
-std::vector<vpgl_camera_double_sptr> generate_cameras_circular(vgl_box_3d<double>& world);
-#endif // boxm_test_util_h
diff --git a/contrib/brl/bseg/boxm/util/boxm_triangle_interpolation_iterator.h b/contrib/brl/bseg/boxm/util/boxm_triangle_interpolation_iterator.h
deleted file mode 100644
index e3561eb3b5..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_triangle_interpolation_iterator.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef boxm_triangle_interpolation_iterator_h_
-#define boxm_triangle_interpolation_iterator_h_
-//:
-// \file
-#include <iostream>
-#include <vector>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <vgl/vgl_region_scan_iterator.h>
-#include <vgl/vgl_triangle_scan_iterator.h>
-
-template<class T>
-class boxm_triangle_interpolation_iterator : public vgl_region_scan_iterator
-{
- public:
- //: constructor
- boxm_triangle_interpolation_iterator(double *verts_x, double *verts_y, T *values, unsigned int v0 = 0, unsigned int v1 = 1, unsigned int v2 = 2);
-
- //: Resets the scan iterator to before the first scan line
- // After calling this function, next() needs to be called before
- // startx() and endx() form a valid scan line.
- void reset() override;
-
- //: Tries to move to the next scan line.
- // Returns false if there are no more scan lines.
- bool next() override;
-
- //: y-coordinate of the current scan line.
- int scany() const override;
-
- //: Returns starting x-value of the current scan line.
- // startx() should be smaller than endx(), unless the scan line is empty
- int startx() const override;
-
- //: Returns ending x-value of the current scan line.
- // endx() should be larger than startx(), unless the scan line is empty
- int endx() const override;
-
- //: returns the interpolated value at location x in the current scanline
- T value_at(int x);
-
- protected:
-
- vgl_triangle_scan_iterator<double> tri_it_;
-
- double s0_;
- double s1_;
- double s2_;
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/util/boxm_triangle_interpolation_iterator.hxx b/contrib/brl/bseg/boxm/util/boxm_triangle_interpolation_iterator.hxx
deleted file mode 100644
index 8ea38cb6c3..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_triangle_interpolation_iterator.hxx
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifndef boxm_triangle_interpolation_iterator_hxx_
-#define boxm_triangle_interpolation_iterator_hxx_
-//:
-// \file
-
-#include <vector>
-#include <cmath>
-#include <iostream>
-#include <algorithm>
-#include "boxm_triangle_interpolation_iterator.h"
-
-#include <vnl/algo/vnl_determinant.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-
-//: constructor
-template<class T>
-boxm_triangle_interpolation_iterator<T>::boxm_triangle_interpolation_iterator(double *verts_x, double *verts_y, T *vals, unsigned int v0, unsigned int v1, unsigned int v2)
-: tri_it_()
-{
- tri_it_.a.x = verts_x[v0] - 0.5;
- tri_it_.a.y = verts_y[v0] - 0.5;
- tri_it_.b.x = verts_x[v1] - 0.5;
- tri_it_.b.y = verts_y[v1] - 0.5;
- tri_it_.c.x = verts_x[v2] - 0.5;
- tri_it_.c.y = verts_y[v2] - 0.5;
-
-
- // compute s0, s1, s2 such that val = s0*x + s1*y + s2 for any point within the triangle
- double Acol0[] = {tri_it_.a.x + 0.5, tri_it_.b.x + 0.5, tri_it_.c.x + 0.5};
- double Acol1[] = {tri_it_.a.y + 0.5, tri_it_.b.y + 0.5, tri_it_.c.y + 0.5};
- double Acol2[] = {1.0, 1.0, 1.0};
-
- double Z[] = {vals[v0], vals[v1], vals[v2]};
-
- double detA = vnl_determinant(Acol0, Acol1, Acol2);
- s0_ = vnl_determinant(Z, Acol1, Acol2) / detA;
- s1_ = vnl_determinant(Acol0, Z, Acol2) / detA;
- s2_ = vnl_determinant(Acol0, Acol1, Z) / detA;
-
- //std::cout << "s0 = " << s0_ <<" s1 = " << s1_ << " s2 = " << s2_ << std::endl;
-}
-
-
-//: Resets the scan iterator to before the first scan line
-// After calling this function, next() needs to be called before
-// startx() and endx() form a valid scan line.
-template<class T>
-void boxm_triangle_interpolation_iterator<T>::reset()
-{
- tri_it_.reset();
-}
-
-//: Tries to move to the next scan line.
-// Returns false if there are no more scan lines.
-template<class T>
-bool boxm_triangle_interpolation_iterator<T>::next()
-{
- return tri_it_.next();
-}
-
-//: y-coordinate of the current scan line.
-template<class T>
-int boxm_triangle_interpolation_iterator<T>::scany() const
-{
- return tri_it_.scany();
-}
-
-//: Returns starting x-value of the current scan line.
-// startx() should be smaller than endx(), unless the scan line is empty
-template<class T>
-int boxm_triangle_interpolation_iterator<T>::startx() const
-{
- return tri_it_.startx();
-}
-
-//: Returns ending x-value of the current scan line.
-// endx() should be larger than startx(), unless the scan line is empty
-template<class T>
-int boxm_triangle_interpolation_iterator<T>::endx() const
-{
- return tri_it_.endx() + 1;
-}
-
-
-//: returns the interpolated value at location x in the current scanline
-template<class T>
-T boxm_triangle_interpolation_iterator<T>::value_at(int x)
-{
- return (T)((s0_*(x+0.5) + s1_*(tri_it_.scany()+0.5) + s2_));
-}
-
-
-#define BOXM_TRIANGLE_INTERPOLATION_ITERATOR_INSTANTIATE(T) \
- template class boxm_triangle_interpolation_iterator<T >
-
-
-#endif
diff --git a/contrib/brl/bseg/boxm/util/boxm_triangle_scan_iterator.cxx b/contrib/brl/bseg/boxm/util/boxm_triangle_scan_iterator.cxx
deleted file mode 100644
index c268ecca30..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_triangle_scan_iterator.cxx
+++ /dev/null
@@ -1,59 +0,0 @@
-#include <vector>
-#include <cmath>
-#include <iostream>
-#include <algorithm>
-#include "boxm_triangle_scan_iterator.h"
-//:
-// \file
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-
-//: constructor
-boxm_triangle_scan_iterator::boxm_triangle_scan_iterator(const double *verts_x, const double *verts_y, unsigned int v0, unsigned int v1, unsigned int v2)
-: tri_it_()
-{
- tri_it_.a.x = verts_x[v0] - 0.5;
- tri_it_.a.y = verts_y[v0] - 0.5;
- tri_it_.b.x = verts_x[v1] - 0.5;
- tri_it_.b.y = verts_y[v1] - 0.5;
- tri_it_.c.x = verts_x[v2] - 0.5;
- tri_it_.c.y = verts_y[v2] - 0.5;
-}
-
-
-//: Resets the scan iterator to before the first scan line
-// After calling this function, next() needs to be called before
-// startx() and endx() form a valid scan line.
-void boxm_triangle_scan_iterator::reset()
-{
- tri_it_.reset();
-}
-
-//: Tries to move to the next scan line.
-// Returns false if there are no more scan lines.
-bool boxm_triangle_scan_iterator::next()
-{
- return tri_it_.next();
-}
-
-//: y-coordinate of the current scan line.
-int boxm_triangle_scan_iterator::scany() const
-{
- return tri_it_.scany();
-}
-
-//: Returns starting x-value of the current scan line.
-// startx() should be smaller than endx(), unless the scan line is empty
-int boxm_triangle_scan_iterator::startx() const
-{
- return tri_it_.startx();
-}
-
-//: Returns ending x-value of the current scan line.
-// endx() should be larger than startx(), unless the scan line is empty
-int boxm_triangle_scan_iterator::endx() const
-{
- return tri_it_.endx() + 1;
-}
diff --git a/contrib/brl/bseg/boxm/util/boxm_triangle_scan_iterator.h b/contrib/brl/bseg/boxm/util/boxm_triangle_scan_iterator.h
deleted file mode 100644
index 47b52ebc26..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_triangle_scan_iterator.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef boxm_triangle_scan_iterator_h_
-#define boxm_triangle_scan_iterator_h_
-//:
-// \file
-
-#include <iostream>
-#include <vector>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <vgl/vgl_region_scan_iterator.h>
-#include <vgl/vgl_triangle_scan_iterator.h>
-
-class boxm_triangle_scan_iterator : public vgl_region_scan_iterator
-{
- public:
- //: constructor
- boxm_triangle_scan_iterator(const double *verts_x, const double *verts_y, unsigned int v0 = 0, unsigned int v1 = 1, unsigned int v2 = 2);
-
- //: Resets the scan iterator to before the first scan line
- // After calling this function, next() needs to be called before
- // startx() and endx() form a valid scan line.
- void reset() override;
-
- //: Tries to move to the next scan line.
- // Returns false if there are no more scan lines.
- bool next() override;
-
- //: y-coordinate of the current scan line.
- int scany() const override;
-
- //: Returns starting x-value of the current scan line.
- // startx() should be smaller than endx(), unless the scan line is empty
- int startx() const override;
-
- //: Returns ending x-value of the current scan line.
- // endx() should be larger than startx(), unless the scan line is empty
- int endx() const override;
-
- protected:
-
- vgl_triangle_scan_iterator<double> tri_it_;
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/util/boxm_utils.cxx b/contrib/brl/bseg/boxm/util/boxm_utils.cxx
deleted file mode 100644
index 2464b5c4a8..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_utils.cxx
+++ /dev/null
@@ -1,1469 +0,0 @@
-#include <cmath>
-#include <iostream>
-#include <algorithm>
-#include "boxm_utils.h"
-//:
-// \file
-#include "boxm_quad_scan_iterator.h"
-#include <boct/boct_tree_cell.h>
-#include <vgl/vgl_box_2d.h>
-#include <vgl/vgl_point_2d.h>
-#include <vgl/vgl_vector_2d.h>
-#include <vgl/vgl_polygon.h>
-#include <vgl/vgl_intersection.h>
-#include <vpgl/vpgl_perspective_camera.h>
-#include <vnl/algo/vnl_determinant.h>
-#include <vnl/algo/vnl_matrix_inverse.h>
-#include <cassert>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-bool boxm_utils::is_visible(vgl_box_3d<double> const& bbox,
- vpgl_camera_double_sptr const& camera,
- unsigned int img_ni, unsigned int img_nj,
- bool do_front_test)
-{
- if (camera->type_name().compare("vpgl_perspective_camera")==0) {
- // make a test for vertices for behind-front case
- auto* cam = static_cast<vpgl_perspective_camera<double>*>(camera.ptr());
- if (do_front_test) {
- if (cam->is_behind_camera(vgl_homg_point_3d<double>(bbox.min_x(),bbox.min_y(),bbox.min_z()))&&
- cam->is_behind_camera(vgl_homg_point_3d<double>(bbox.min_x(),bbox.min_y(),bbox.max_z()))&&
- cam->is_behind_camera(vgl_homg_point_3d<double>(bbox.min_x(),bbox.max_y(),bbox.min_z()))&&
- cam->is_behind_camera(vgl_homg_point_3d<double>(bbox.min_x(),bbox.max_y(),bbox.max_z()))&&
- cam->is_behind_camera(vgl_homg_point_3d<double>(bbox.max_x(),bbox.min_y(),bbox.min_z()))&&
- cam->is_behind_camera(vgl_homg_point_3d<double>(bbox.max_x(),bbox.min_y(),bbox.max_z()))&&
- cam->is_behind_camera(vgl_homg_point_3d<double>(bbox.max_x(),bbox.max_y(),bbox.min_z()))&&
- cam->is_behind_camera(vgl_homg_point_3d<double>(bbox.max_x(),bbox.max_y(),bbox.max_z())))
- return false;
- }
- }
-
- // make sure corners project into image bounds
- vgl_box_2d<double> cube_proj_bb;
- vgl_box_2d<double> img_bb;
- img_bb.add(vgl_point_2d<double>(0.0, 0.0));
- img_bb.add(vgl_point_2d<double>(img_ni, img_nj));
- // project corners of block into image
- double u,v;
- camera->project(bbox.min_x(),bbox.min_y(),bbox.min_z(),u,v);
- cube_proj_bb.add(vgl_point_2d<double>(u,v));
- camera->project(bbox.min_x(),bbox.min_y(),bbox.max_z(),u,v);
- cube_proj_bb.add(vgl_point_2d<double>(u,v));
- camera->project(bbox.min_x(),bbox.max_y(),bbox.min_z(),u,v);
- cube_proj_bb.add(vgl_point_2d<double>(u,v));
- camera->project(bbox.min_x(),bbox.max_y(),bbox.max_z(),u,v);
- cube_proj_bb.add(vgl_point_2d<double>(u,v));
- camera->project(bbox.max_x(),bbox.min_y(),bbox.min_z(),u,v);
- cube_proj_bb.add(vgl_point_2d<double>(u,v));
- camera->project(bbox.max_x(),bbox.min_y(),bbox.max_z(),u,v);
- cube_proj_bb.add(vgl_point_2d<double>(u,v));
- camera->project(bbox.max_x(),bbox.max_y(),bbox.min_z(),u,v);
- cube_proj_bb.add(vgl_point_2d<double>(u,v));
- camera->project(bbox.max_x(),bbox.max_y(),bbox.max_z(),u,v);
- cube_proj_bb.add(vgl_point_2d<double>(u,v));
- // check for intersection
- vgl_box_2d<double> intersection = vgl_intersection(cube_proj_bb, img_bb);
- return ! intersection.is_empty();
-}
-
-//:
-// \verbatim
-// MaxPosition
-//
-// 7-----------6
-// / /|
-// / / |
-// 4-----------5 |
-// | | |
-// | | |
-// | 3 | 2
-// Z | | /
-// | Y | |/
-// | / 0-----------1
-// | / MinPosition
-// O-----X
-//
-// \endverbatim
-std::vector<vgl_point_3d<double> >
-boxm_utils::corners_of_box_3d(vgl_box_3d<double> const& box)
-{
- std::vector<vgl_point_3d<double> > corners;
-
- corners.push_back(box.min_point());
- corners.emplace_back(box.min_x()+box.width(), box.min_y(), box.min_z());
- corners.emplace_back(box.min_x()+box.width(), box.min_y()+box.height(), box.min_z());
- corners.emplace_back(box.min_x(), box.min_y()+box.height(), box.min_z());
- corners.emplace_back(box.min_x(), box.min_y(), box.max_z());
- corners.emplace_back(box.min_x()+box.width(), box.min_y(), box.max_z());
- corners.push_back(box.max_point());
- corners.emplace_back(box.min_x(), box.min_y()+box.height(), box.max_z());
- return corners;
-}
-
-void
-boxm_utils::project_corners(std::vector<vgl_point_3d<double> > const& corners,
- const vpgl_camera_double_sptr& camera,
- double* xverts, double* yverts)
-{
- for (unsigned i=0; i<corners.size(); ++i)
- camera->project(corners[i].x(), corners[i].y(), corners[i].z(), xverts[i], yverts[i]);
-}
-
-void
-boxm_utils::project_corners(std::vector<vgl_point_3d<double> > const& corners,
- const vpgl_camera_double_sptr& camera,
- double* xverts, double* yverts,
- float* vertdist)
-{
- if (camera->type_name().compare("vpgl_perspective_camera")==0) {
- auto* cam = static_cast<vpgl_perspective_camera<double>*>(camera.ptr());
- vgl_point_3d<double> cam_center = vgl_point_3d<double>(cam->camera_center());
- for (unsigned i=0; i<corners.size(); ++i)
- {
- cam->project(corners[i].x(), corners[i].y(), corners[i].z(), xverts[i], yverts[i]);
- vertdist[i]=(float)(cam_center-corners[i]).length();
- }
- }
-}
-
-void
-boxm_utils::project_point3d(vgl_point_3d<double> const& point,
- const vpgl_camera_double_sptr& camera,
- double & xvert, double &yvert,
- double & vertdist)
-{
- if (camera->type_name().compare("vpgl_perspective_camera")==0) {
- auto* cam = static_cast<vpgl_perspective_camera<double>*>(camera.ptr());
- vgl_point_3d<double> cam_center = vgl_point_3d<double>(cam->camera_center());
- cam->project(point.x(), point.y(), point.z(), xvert,yvert);
- vertdist=(float)(cam_center-point).length();
- }
-}
-
-//: corners of the input face: visible?
-bool boxm_utils::is_face_visible(const double * xverts, const double *yverts,
- unsigned id1,unsigned id2,unsigned id3,unsigned /*id4*/) // id4 unused?!? - FIXME
-{
- double normal=(xverts[id2]-xverts[id1])*(yverts[id3]-yverts[id2])-(yverts[id2]-yverts[id1])*(xverts[id3]-xverts[id2]);
- return normal < 0;
-}
-
-//: corners of the input face: visible?
-bool boxm_utils::is_face_visible(std::vector<vgl_point_3d<double> > &face,
- vpgl_camera_double_sptr const& camera)
-{
- assert(face.size() >= 3);
- std::vector<vgl_point_2d<double> > vs;
-
- for (auto & i : face) {
- double u,v;
- camera->project(i.x(), i.y(), i.z(), u, v);
- vs.emplace_back(u,v);
- }
-
- vgl_vector_2d<double> v0 = vs[1] - vs[0];
- vgl_vector_2d<double> v1 = vs[2] - vs[1];
- auto normal = cross_product<double>(v0,v1);
- //if (normal>-1e-4 && normal<0.0)
- // std::cout<<"+";
- return normal < -1e-5;
-}
-
-std::vector<vgl_point_2d<double> >
-boxm_utils::project_face(std::vector<vgl_point_3d<double> > &face,
- vpgl_camera_double_sptr const& camera)
-{
- std::vector<vgl_point_2d<double> > vs;
-
- for (auto & i : face) {
- double u,v;
- camera->project(i.x(), i.y(), i.z(), u, v);
- vs.emplace_back(u,v);
- }
-
- return vs;
-}
-
-boct_face_idx
-boxm_utils::visible_faces(vgl_box_3d<double> const& bbox, const vpgl_camera_double_sptr& camera)
-{
- boct_face_idx face_idx = NONE;
- //if (camera->type_name().compare("vpgl_perspective_camera")==0) {
- // vpgl_perspective_camera<double>* cam = static_cast<vpgl_perspective_camera<double>*>(camera.ptr());
- // vgl_point_3d<double> const& cam_center = cam->camera_center();
-
- // if (cam_center.x() > bbox.max_x()) {
- // face_idx |= X_HIGH;
- // }
- // else if (cam_center.x() < bbox.min_x()) {
- // face_idx |= X_LOW;
- // }
- // if (cam_center.y() > bbox.max_y()) {
- // face_idx |= Y_HIGH;
- // }
- // else if (cam_center.y() < bbox.min_y()) {
- // face_idx |= Y_LOW;
- // }
- // if (cam_center.z() > bbox.max_x()) {
- // face_idx |= Z_HIGH;
- // }
- // else if (cam_center.z() < bbox.min_z()) {
- // face_idx |= Z_LOW;
- // }
- //}
- //// for other cameras, use projection and normals
- //else
- {
- // fix the face normals so that the vertices are in counter-clockwise order
- std::map<boct_face_idx, std::vector<vgl_point_3d<double> > > faces;
- faces_of_box_3d(bbox, faces);
-
- if (is_face_visible(faces.find(Z_LOW)->second, camera)) {
- face_idx |= Z_LOW;
-#ifdef DEBUG
- std::cout << "Z_LOW " ;
-#endif
- }
- if (is_face_visible(faces.find(Z_HIGH)->second, camera)) {
- face_idx |= Z_HIGH;
-#ifdef DEBUG
- std::cout << "Z_HIGH " ;
-#endif
- }
- if (is_face_visible(faces.find(X_LOW)->second, camera)) {
- face_idx |= X_LOW;
-#ifdef DEBUG
- std::cout << "X_LOW " ;
-#endif
- }
-
- if (is_face_visible(faces.find(X_HIGH)->second, camera)) {
- face_idx |= X_HIGH;
-#ifdef DEBUG
- std::cout << "X_HIGH " ;
-#endif
- }
-
- if (is_face_visible(faces.find(Y_LOW)->second, camera)) {
- face_idx |= Y_LOW;
-#ifdef DEBUG
- std::cout << "Y_LOW " ;
-#endif
- }
-
- if (is_face_visible(faces.find(Y_HIGH)->second, camera)) {
- face_idx |= Y_HIGH;
-#ifdef DEBUG
- std::cout << "Y_HIGH " ;
-#endif
- }
- }
-#ifdef DEBUG
- std::cout << std::endl;
-#endif
-
- return face_idx;
-}
-
-boct_face_idx
-boxm_utils::visible_faces(vgl_box_3d<double> const& /*bbox*/, // FIXME: currently unused -- see commented out code
- const vpgl_camera_double_sptr& /*camera*/, // idem
- double *xverts, double *yverts)
-{
- boct_face_idx face_idx = NONE;
-#if 0
- if (camera->type_name().compare("vpgl_perspective_camera")==0) {
- vpgl_perspective_camera<double>* cam = static_cast<vpgl_perspective_camera<double>*>(camera.ptr());
- vgl_point_3d<double> const& cam_center = cam->camera_center();
-
- if (cam_center.x() > bbox.max_x()) {
- face_idx |= X_HIGH;
- }
- else if (cam_center.x() < bbox.min_x()) {
- face_idx |= X_LOW;
- }
- if (cam_center.y() > bbox.max_y()) {
- face_idx |= Y_HIGH;
- }
- else if (cam_center.y() < bbox.min_y()) {
- face_idx |= Y_LOW;
- }
- if (cam_center.z() > bbox.max_x()) {
- face_idx |= Z_HIGH;
- }
- else if (cam_center.z() < bbox.min_z()) {
- face_idx |= Z_LOW;
- }
- }
- // for other cameras, use projection and normals
- else
-#endif // 0
- {
- // fix the face normals so that the vertices are the counter clockwise order
-#if 0
- std::map<boct_face_idx, std::vector<vgl_point_3d<double> > > faces;
- faces_of_box_3d(bbox, faces);
- project_corners(bbox,camera,xverts,yverts);
-#endif // 0
- if (is_face_visible(xverts,yverts,1,0,3,2)) {
- face_idx |= Z_LOW;
-#ifdef DEBUG
- std::cout << "Z_LOW " ;
-#endif
- }
- if (is_face_visible(xverts,yverts,4,5,6,7)) {
- face_idx |= Z_HIGH;
-#ifdef DEBUG
- std::cout << "Z_HIGH " ;
-#endif
- }
- if (is_face_visible(xverts,yverts,7,3,0,4)) {
- face_idx |= X_LOW;
-#ifdef DEBUG
- std::cout << "X_LOW " ;
-#endif
- }
-
- if (is_face_visible(xverts,yverts,1,2,6,5)) {
- face_idx |= X_HIGH;
-#ifdef DEBUG
- std::cout << "X_HIGH " ;
-#endif
- }
-
- if (is_face_visible(xverts,yverts,0,1,5,4)) {
- face_idx |= Y_LOW;
-#ifdef DEBUG
- std::cout << "Y_LOW " ;
-#endif
- }
-
- if (is_face_visible(xverts,yverts,2,3,7,6)) {
- face_idx |= Y_HIGH;
-#ifdef DEBUG
- std::cout << "Y_HIGH " ;
-#endif
- }
- }
-#ifdef DEBUG
- std::cout << std::endl;
-#endif
-
- return face_idx;
-}
-
-boct_face_idx
-boxm_utils::visible_faces_cell(vgl_box_3d<double> const& bbox, const vpgl_camera_double_sptr& camera,
- double *xverts, double *yverts)
-{
- boct_face_idx face_idx = NONE;
- if (camera->type_name().compare("vpgl_perspective_camera")==0) {
- auto* cam = static_cast<vpgl_perspective_camera<double>*>(camera.ptr());
- vgl_point_3d<double> const& cam_center = cam->camera_center();
-
- if (cam_center.x() > bbox.max_x()) {
- face_idx |= X_HIGH;
- }
- else if (cam_center.x() < bbox.min_x()) {
- face_idx |= X_LOW;
- }
- if (cam_center.y() > bbox.max_y()) {
- face_idx |= Y_HIGH;
- }
- else if (cam_center.y() < bbox.min_y()) {
- face_idx |= Y_LOW;
- }
- if (cam_center.z() > bbox.max_x()) {
- face_idx |= Z_HIGH;
- }
- else if (cam_center.z() < bbox.min_z()) {
- face_idx |= Z_LOW;
- }
- }
- // for other cameras, use projection and normals
- else
- {
- // fix the face normals so that the vertices are the counter clockwise order
-#if 0
- std::map<boct_face_idx, std::vector<vgl_point_3d<double> > > faces;
- faces_of_box_3d(bbox, faces);
- double * xverts; double *yverts;
- project_corners(bbox,camera,xverts,yverts);
-#endif // 0
- if (is_face_visible(xverts,yverts,1,0,3,2)) {
- face_idx |= Z_LOW;
-#ifdef DEBUG
- std::cout << "Z_LOW " ;
-#endif
- }
- if (is_face_visible(xverts,yverts,4,5,6,7)) {
- face_idx |= Z_HIGH;
-#ifdef DEBUG
- std::cout << "Z_HIGH " ;
-#endif
- }
- if (is_face_visible(xverts,yverts,7,3,0,4)) {
- face_idx |= X_LOW;
-#ifdef DEBUG
- std::cout << "X_LOW " ;
-#endif
- }
-
- if (is_face_visible(xverts,yverts,1,2,6,5)) {
- face_idx |= X_HIGH;
-#ifdef DEBUG
- std::cout << "X_HIGH " ;
-#endif
- }
-
- if (is_face_visible(xverts,yverts,0,1,5,4)) {
- face_idx |= Y_LOW;
-#ifdef DEBUG
- std::cout << "Y_LOW " ;
-#endif
- }
-
- if (is_face_visible(xverts,yverts,2,3,7,6)) {
- face_idx |= Y_HIGH;
-#ifdef DEBUG
- std::cout << "Y_HIGH " ;
-#endif
- }
- }
-#ifdef DEBUG
- std::cout << std::endl;
-#endif
-
- return face_idx;
-}
-
-//: returns the faces of a box, the vertices are ordered in the normal direction
-void boxm_utils::faces_of_box_3d(vgl_box_3d<double> const& bbox,
- std::map<boct_face_idx, std::vector<vgl_point_3d<double> > >& faces)
-{
- std::vector<vgl_point_3d<double> > corners=corners_of_box_3d(bbox);
-
- // face bottom [1,0,3,2]
- std::vector<vgl_point_3d<double> > face_corners;
- face_corners.push_back(corners[1]);
- face_corners.push_back(corners[0]);
- face_corners.push_back(corners[3]);
- face_corners.push_back(corners[2]);
- faces[Z_LOW] = face_corners;
-
- face_corners.resize(0);
- face_corners.push_back(corners[4]);
- face_corners.push_back(corners[5]);
- face_corners.push_back(corners[6]);
- face_corners.push_back(corners[7]);
- faces[Z_HIGH] = face_corners;
-
- face_corners.resize(0);
- face_corners.push_back(corners[7]);
- face_corners.push_back(corners[3]);
- face_corners.push_back(corners[0]);
- face_corners.push_back(corners[4]);
- faces[X_LOW] = face_corners;
-
- face_corners.resize(0);
- face_corners.push_back(corners[1]);
- face_corners.push_back(corners[2]);
- face_corners.push_back(corners[6]);
- face_corners.push_back(corners[5]);
- faces[X_HIGH] = face_corners;
-
- face_corners.resize(0);
- face_corners.push_back(corners[0]);
- face_corners.push_back(corners[1]);
- face_corners.push_back(corners[5]);
- face_corners.push_back(corners[4]);
- faces[Y_LOW] = face_corners;
-
- face_corners.resize(0);
- face_corners.push_back(corners[2]);
- face_corners.push_back(corners[3]);
- face_corners.push_back(corners[7]);
- face_corners.push_back(corners[6]);
- faces[Y_HIGH] = face_corners;
-}
-
-//: returns the union of the projected faces of a polygon
-void boxm_utils::project_cube(vgl_box_3d<double> &bbox,
- const vpgl_camera_double_sptr& camera,
- std::map<boct_face_idx, std::vector< vgl_point_3d<double> > > & faces,
- boct_face_idx & vis_face_ids)
-{
- faces_of_box_3d(bbox, faces);
- vis_face_ids=boxm_utils::visible_faces(bbox,camera);
-}
-
-
-void boxm_utils::quad_interpolate(boxm_quad_scan_iterator &poly_it,
- double* xvals, double* yvals, double* vals,
- vil_image_view<float> &img,unsigned img_plane_num,
- unsigned int v0, unsigned int v1,
- unsigned int v2,unsigned int v3 )
-{
- // first compute s0, s1, s2, s3 such that val = s0*x + s1*y + s2 for any point within the triangle
- // (no need to compute barycentric coordinates of a quadrilateral at each step)
- // subtract 0.5 from xvals and yvals, so that interpolated value at pixel x,y evaluates to coordinates x+0.5, y+0.5 (center of pixel)
-
- double Acol0[] = {(xvals[v0]-0.5)*(yvals[v0]-0.5),
- (xvals[v1]-0.5)*(yvals[v1]-0.5),
- (xvals[v2]-0.5)*(yvals[v2]-0.5),
- (xvals[v3]-0.5)*(yvals[v3]-0.5)};
- double Acol1[] = {xvals[v0]-0.5, xvals[v1]-0.5, xvals[v2]-0.5,xvals[v3]-0.5};
- double Acol2[] = {yvals[v0]-0.5, yvals[v1]-0.5, yvals[v2]-0.5,yvals[v3]-0.5};
- double Acol3[] = {1.0, 1.0, 1.0,1.0};
-
- double Z[] = {vals[v0], vals[v1], vals[v2],vals[v3]};
-
- double detA = vnl_determinant(Acol0, Acol1, Acol2,Acol3);
- double s0 = vnl_determinant(Z, Acol1, Acol2,Acol3) / detA;
- double s1 = vnl_determinant(Acol0, Z, Acol2,Acol3) / detA;
- double s2 = vnl_determinant(Acol0, Acol1, Z,Acol3) / detA;
- double s3 = vnl_determinant(Acol0, Acol1, Acol2,Z) / detA;
-
- poly_it.reset();
- while (poly_it.next()) {
- int y = poly_it.scany();
- if (y < 0){
- // not inside of image bounds yet. go to next scanline.
- continue;
- }
- auto yu = (unsigned int)y;
- if (yu >= img.nj() ) {
- // we have left the image bounds. no need to continue.
- break;
- }
- if ( (poly_it.startx() >= (int)img.ni()) || (poly_it.endx() <= 0) ) {
- // no part of this scanline is within the image bounds. go to next scanline.
- continue;
- }
- unsigned int startx = (unsigned int)std::max((int)0,poly_it.startx());
- unsigned int endx = (unsigned int)std::min((int)img.ni(),poly_it.endx());
-
- for (unsigned int x = startx; x < endx; ++x) {
- auto interp_val = (float)(s0*x*y + s1*x + s2*y+s3);
- img(x,yu,img_plane_num) += (poly_it.pix_coverage(x)*interp_val);
- }
- }
- return;
-#if 0 // commented out
- poly_it.reset();
- while (poly_it.next()) {
- int y = poly_it.scany();
- if (y < 0){
- // not inside of image bounds yet. go to next scanline.
- continue;
- }
- unsigned int yu = (unsigned int)y;
- if (yu >= img.nj() ) {
- // we have left the image bounds. no need to continue.
- break;
- }
- if ( (poly_it.startx() >= (int)img.ni()) || (poly_it.endx() <= 0) ) {
- // no part of this scanline is within the image bounds. go to next scanline.
- continue;
- }
- unsigned int startx = (unsigned int)std::max((int)0,poly_it.startx());
- unsigned int endx = (unsigned int)std::min((int)img.ni(),poly_it.endx());
-
- double start_val=0;
- double end_val=0;
-
- if (poly_it.x_start_end_val(vals,start_val,end_val))
- {
- float rx=endx-startx;
- for (unsigned int x = startx; x < endx; ++x) {
- float interp_val = start_val+(x-startx)/rx*(end_val-start_val);
- img(x,yu,img_plane_num) += (poly_it.pix_coverage(x)*interp_val);
- //img(x,yu,img_plane_num) =interp_val;
- }
- }
- }
- return;
-#endif // 0
-}
-
-void boxm_utils::quad_fill(boxm_quad_scan_iterator &poly_it,
- vil_image_view<float> &img, float val,
- unsigned img_plane_num)
-{
- poly_it.reset();
- while (poly_it.next()) {
- int y = poly_it.scany();
- if (y < 0){
- // not inside of image bounds yet. go to next scanline.
- continue;
- }
- auto yu = (unsigned int)y;
- if (yu >= img.nj() ) {
- // we have left the image bounds. no need to continue.
- break;
- }
- if ( (poly_it.startx() >= (int)img.ni()) || (poly_it.endx() <= 0) ) {
- // no part of this scanline is within the image bounds. go to next scanline.
- continue;
- }
- unsigned int startx = (unsigned int)std::max((int)0,poly_it.startx());
- unsigned int endx = (unsigned int)std::min((int)img.ni(),poly_it.endx());
-
- for (unsigned int x = startx; x < endx; ++x) {
- img(x,yu,img_plane_num) = val;
-#if 0 // was:
- img(x,yu,img_plane_num) += (poly_it.pix_coverage(x)*val);
- img(x,yu,img_plane_num) += (poly_it.pix_coverage(x)*val);
- if (poly_it.pix_coverage(x)>1)
- std::cout<<"ERROR ALERT "<<poly_it.pix_coverage(x)<<std::endl;
- assert(poly_it.pix_coverage(x)>1);
-#endif // 0
- }
- }
- return;
-}
-
-
-void boxm_utils::quad_fill(boxm_quad_scan_iterator &poly_it,
- vil_image_view<float> &img,
- vil_image_view<float> &weights_img,
- float val,
- unsigned img_plane_num)
-{
- poly_it.reset();
- while (poly_it.next()) {
- int y = poly_it.scany();
- if (y < 0){
- // not inside of image bounds yet. go to next scanline.
- continue;
- }
- auto yu = (unsigned int)y;
- if (yu >= img.nj() ) {
- // we have left the image bounds. no need to continue.
- break;
- }
- if ( (poly_it.startx() >= (int)img.ni()) || (poly_it.endx() <= 0) ) {
- // no part of this scanline is within the image bounds. go to next scanline.
- continue;
- }
- unsigned int startx = (unsigned int)std::max((int)0,poly_it.startx());
- unsigned int endx = (unsigned int)std::min((int)img.ni(),poly_it.endx());
-
- for (unsigned int x = startx; x < endx; ++x) {
- //img(x,yu,img_plane_num) += (poly_it.pix_coverage(x)*val);
- img(x,yu,img_plane_num) += (poly_it.pix_coverage(x)*val);
- weights_img(x,yu)+=poly_it.pix_coverage(x);
- }
- }
- return;
-}
-
-
-void boxm_utils::quad_mean(boxm_quad_scan_iterator &poly_it,
- vil_image_view<float> &img, float &val, float & count)
-{
- poly_it.reset();
- while (poly_it.next()) {
- int y = poly_it.scany();
- if (y < 0){
- // not inside of image bounds yet. go to next scanline.
- continue;
- }
- auto yu = (unsigned int)y;
- if (yu >= img.nj() ) {
- // we have left the image bounds. no need to continue.
- break;
- }
- if ( (poly_it.startx() >= (int)img.ni()) || (poly_it.endx() <= 0) ) {
- // no part of this scanline is within the image bounds. go to next scanline.
- continue;
- }
- unsigned int startx = (unsigned int)std::max((int)0,poly_it.startx());
- unsigned int endx = (unsigned int)std::min((int)img.ni(),poly_it.endx());
-
- for (unsigned int x = startx; x < endx; ++x) {
- val+=poly_it.pix_coverage(x)*img(x,yu) ;
- count+=poly_it.pix_coverage(x);
- }
- }
- return;
-}
-
-void boxm_utils::quad_weighted_mean(boxm_quad_scan_iterator &poly_it,
- vil_image_view<float> &img,
- vil_image_view<float> &weighted_img,
- float &numerator, float & denominator)
-{
- poly_it.reset();
- while (poly_it.next()) {
- int y = poly_it.scany();
- if (y < 0){
- // not inside of image bounds yet. go to next scanline.
- continue;
- }
- auto yu = (unsigned int)y;
- if (yu >= img.nj() ) {
- // we have left the image bounds. no need to continue.
- break;
- }
- if ( (poly_it.startx() >= (int)img.ni()) || (poly_it.endx() <= 0) ) {
- // no part of this scanline is within the image bounds. go to next scanline.
- continue;
- }
- unsigned int startx = (unsigned int)std::max((int)0,poly_it.startx());
- unsigned int endx = (unsigned int)std::min((int)img.ni(),poly_it.endx());
-
- for (unsigned int x = startx; x < endx; ++x) {
- numerator+=poly_it.pix_coverage(x)*img(x,yu)*weighted_img(x,yu);
- denominator+=poly_it.pix_coverage(x)*weighted_img(x,yu);
- //numerator+=img(x,yu)*weighted_img(x,yu);
- //denominator+=weighted_img(x,yu);
- }
- }
- return;
-}
-
-void boxm_utils::quad_sum(boxm_quad_scan_iterator &poly_it,
- vil_image_view<float> &img, float &val)
-{
- poly_it.reset();
- while (poly_it.next()) {
- int y = poly_it.scany();
- if (y < 0){
- // not inside of image bounds yet. go to next scanline.
- continue;
- }
- auto yu = (unsigned int)y;
- if (yu >= img.nj() ) {
- // we have left the image bounds. no need to continue.
- break;
- }
- if ( (poly_it.startx() >= (int)img.ni()) || (poly_it.endx() <= 0) ) {
- // no part of this scanline is within the image bounds. go to next scanline.
- continue;
- }
- unsigned int startx = (unsigned int)std::max((int)0,poly_it.startx());
- unsigned int endx = (unsigned int)std::min((int)img.ni(),poly_it.endx());
-
- for (unsigned int x = startx; x < endx; ++x) {
- val+=(poly_it.pix_coverage(x)*img(x,yu)) ;
- }
- }
- return;
-}
-
-bool boxm_utils::project_cube_xyz( std::map<boct_face_idx,std::vector< vgl_point_3d<double> > > & faces,
- boct_face_idx & vis_face_ids,
- vil_image_view<float> &front_xyz,
- vil_image_view<float> &back_xyz,
- const vpgl_camera_double_sptr& cam)
-{
- auto face_it=faces.begin();
- for (; face_it!=faces.end(); ++face_it)
- {
- std::vector<vgl_point_3d<double> > face_corners=face_it->second;
- std::vector<vgl_point_2d<double> > face_projected=project_face(face_corners,cam);
-
- double xs[]={face_projected[0].x(),face_projected[1].x(),face_projected[2].x(),face_projected[3].x()};
- double ys[]={face_projected[0].y(),face_projected[1].y(),face_projected[2].y(),face_projected[3].y()};
- boxm_quad_scan_iterator poly_it(xs,ys);
- double Xs[]={face_corners[0].x(),face_corners[1].x(),face_corners[2].x(),face_corners[3].x()};
- double Ys[]={face_corners[0].y(),face_corners[1].y(),face_corners[2].y(),face_corners[3].y()};
- double Zs[]={face_corners[0].z(),face_corners[1].z(),face_corners[2].z(),face_corners[3].z()};
-
- if (vis_face_ids & face_it->first){
- quad_interpolate(poly_it,xs,ys,Xs,front_xyz,0);
- quad_interpolate(poly_it,xs,ys,Ys,front_xyz,1);
- quad_interpolate(poly_it,xs,ys,Zs,front_xyz,2);
- }
- else
- {
- quad_interpolate(poly_it,xs,ys,Xs,back_xyz,0);
- quad_interpolate(poly_it,xs,ys,Ys,back_xyz,1);
- quad_interpolate(poly_it,xs,ys,Zs,back_xyz,2);
- }
- }
-
- return true;
-}
-
-
-bool boxm_utils::project_cube_xyz(std::vector< vgl_point_3d<double> > & corners,
- boct_face_idx & vis_face_ids,
- vil_image_view<float> &front_xyz,
- vil_image_view<float> &back_xyz,
- double *xverts,double * yverts)
-{
- // open extra scope, to allow redeclaration of xs[], ys[]
- {
- double xs[]={xverts[1],xverts[0],xverts[3],xverts[2]};
- double ys[]={yverts[1],yverts[0],yverts[3],yverts[2]};
-#if 0
- std::vector<vgl_point_2d<double> > face_polygon(4);
- for (unsigned i=0;i<4;++i)
- face_polygon.push_back(vgl_point_2d<double>(xs[i],ys[i]));
-#endif // 0
-
- boxm_quad_scan_iterator poly_it(xs,ys);
- vgl_polygon<double> p(xs,ys,4);
-
- double Xs[]={corners[1].x(),corners[0].x(),corners[3].x(),corners[2].x()};
- double Ys[]={corners[1].y(),corners[0].y(),corners[3].y(),corners[2].y()};
- double Zs[]={corners[1].z(),corners[0].z(),corners[3].z(),corners[2].z()};
- if (vis_face_ids & Z_LOW){
- quad_interpolate(poly_it,xs,ys,Xs,front_xyz,0);
- quad_interpolate(poly_it,xs,ys,Ys,front_xyz,1);
- quad_fill(poly_it,front_xyz,float(Zs[0]),2);
- }
- else
- {
- quad_interpolate(poly_it,xs,ys,Xs,back_xyz,0);
- quad_interpolate(poly_it,xs,ys,Ys,back_xyz,1);
- quad_fill(poly_it,back_xyz,float(Zs[0]),2);
- }
- }
- {
- double xs[]={xverts[4],xverts[5],xverts[6],xverts[7]};
- double ys[]={yverts[4],yverts[5],yverts[6],yverts[7]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- vgl_polygon<double> p(xs,ys,4);
-
- double Xs[]={corners[4].x(),corners[5].x(),corners[6].x(),corners[7].x()};
- double Ys[]={corners[4].y(),corners[5].y(),corners[6].y(),corners[7].y()};
- double Zs[]={corners[4].z(),corners[5].z(),corners[6].z(),corners[7].z()};
- if (vis_face_ids & Z_HIGH){
- quad_interpolate(poly_it,xs,ys,Xs,front_xyz,0);
- quad_interpolate(poly_it,xs,ys,Ys,front_xyz,1);
- quad_fill(poly_it,front_xyz,float(Zs[0]),2);
- }
- else
- {
- quad_interpolate(poly_it,xs,ys,Xs,back_xyz,0);
- quad_interpolate(poly_it,xs,ys,Ys,back_xyz,1);
- quad_fill(poly_it,back_xyz,float(Zs[0]),2);
- }
- }
- {
- double xs[]={xverts[7],xverts[3],xverts[0],xverts[4]};
- double ys[]={yverts[7],yverts[3],yverts[0],yverts[4]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- double Xs[]={corners[7].x(),corners[3].x(),corners[0].x(),corners[4].x()};
- double Ys[]={corners[7].y(),corners[3].y(),corners[0].y(),corners[4].y()};
- double Zs[]={corners[7].z(),corners[3].z(),corners[0].z(),corners[4].z()};
- if (vis_face_ids & X_LOW){
- quad_fill(poly_it,front_xyz,float(Xs[0]),0);
- quad_interpolate(poly_it,xs,ys,Ys,front_xyz,1);
- quad_interpolate(poly_it,xs,ys,Zs,front_xyz,2);
- }
- else
- {
- quad_fill(poly_it,back_xyz,float(Xs[0]),0);
- quad_interpolate(poly_it,xs,ys,Ys,back_xyz,1);
- quad_interpolate(poly_it,xs,ys,Zs,back_xyz,2);
- }
- }
- {
- double xs[]={xverts[1],xverts[2],xverts[6],xverts[5]};
- double ys[]={yverts[1],yverts[2],yverts[6],yverts[5]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- double Xs[]={corners[1].x(),corners[2].x(),corners[6].x(),corners[5].x()};
- double Ys[]={corners[1].y(),corners[2].y(),corners[6].y(),corners[5].y()};
- double Zs[]={corners[1].z(),corners[2].z(),corners[6].z(),corners[5].z()};
- if (vis_face_ids & X_HIGH){
- quad_fill(poly_it,front_xyz,float(Xs[0]),0);
- quad_interpolate(poly_it,xs,ys,Ys,front_xyz,1);
- quad_interpolate(poly_it,xs,ys,Zs,front_xyz,2);
- }
- else
- {
- quad_fill(poly_it,back_xyz,float(Xs[0]),0);
- quad_interpolate(poly_it,xs,ys,Ys,back_xyz,1);
- quad_interpolate(poly_it,xs,ys,Zs,back_xyz,2);
- }
- }
- {
- double xs[]={xverts[0],xverts[1],xverts[5],xverts[4]};
- double ys[]={yverts[0],yverts[1],yverts[5],yverts[4]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- vgl_polygon<double> p(xs,ys,4);
-
- double Xs[]={corners[0].x(),corners[1].x(),corners[5].x(),corners[4].x()};
- double Ys[]={corners[0].y(),corners[1].y(),corners[5].y(),corners[4].y()};
- double Zs[]={corners[0].z(),corners[1].z(),corners[5].z(),corners[4].z()};
- if (vis_face_ids & Y_LOW){
- quad_interpolate(poly_it,xs,ys,Xs,front_xyz,0);
-
- quad_fill(poly_it,front_xyz,float(Ys[0]),1);
- quad_interpolate(poly_it,xs,ys,Zs,front_xyz,2);
- }
- else
- {
- quad_interpolate(poly_it,xs,ys,Xs,back_xyz,0);
- quad_fill(poly_it,back_xyz,float(Ys[0]),1);
- quad_interpolate(poly_it,xs,ys,Zs,back_xyz,2);
- }
- }
- {
- double xs[]={xverts[2],xverts[3],xverts[7],xverts[6]};
- double ys[]={yverts[2],yverts[3],yverts[7],yverts[6]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- vgl_polygon<double> p(xs,ys,4);
-
- double Xs[]={corners[2].x(),corners[3].x(),corners[7].x(),corners[6].x()};
- double Ys[]={corners[2].y(),corners[3].y(),corners[7].y(),corners[6].y()};
- double Zs[]={corners[2].z(),corners[3].z(),corners[7].z(),corners[6].z()};
- if (vis_face_ids & Y_HIGH){
- quad_interpolate(poly_it,xs,ys,Xs,front_xyz,0);
- quad_fill(poly_it,front_xyz,float(Ys[0]),1);
- quad_interpolate(poly_it,xs,ys,Zs,front_xyz,2);
- }
- else
- {
- quad_interpolate(poly_it,xs,ys,Xs,back_xyz,0);
- quad_fill(poly_it,back_xyz,float(Ys[0]),1);
- quad_interpolate(poly_it,xs,ys,Zs,back_xyz,2);
- }
- }
-
- return true;
-}
-
-
-bool boxm_utils::project_cube_xyz(std::vector< vgl_point_3d<double> > & /*corners*/,
- boct_face_idx & vis_face_ids,
- vil_image_view<float> &front_xyz,
- vil_image_view<float> &back_xyz,
- double *xverts,double * yverts,float * vertdist)
-{
- // Use extra {} so that destructors will do their work
- {
- double xs[]={xverts[1],xverts[0],xverts[3],xverts[2]};
- double ys[]={yverts[1],yverts[0],yverts[3],yverts[2]};
- double ds[]={vertdist[1],vertdist[0],vertdist[3],vertdist[2]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- vgl_polygon<double> p(xs,ys,4);
- if (vis_face_ids & Z_LOW){ quad_interpolate(poly_it,xs,ys,ds,front_xyz,0); }
- else { quad_interpolate(poly_it,xs,ys,ds,back_xyz,0); }
- }
- {
- double xs[]={xverts[4],xverts[5],xverts[6],xverts[7]};
- double ys[]={yverts[4],yverts[5],yverts[6],yverts[7]};
- double ds[]={vertdist[4],vertdist[5],vertdist[6],vertdist[7]};
-
- boxm_quad_scan_iterator poly_it(xs,ys);
- vgl_polygon<double> p(xs,ys,4);
- if (vis_face_ids & Z_HIGH){ quad_interpolate(poly_it,xs,ys,ds,front_xyz,0); }
- else { quad_interpolate(poly_it,xs,ys,ds,back_xyz,0); }
- }
- {
- double xs[]={xverts[7],xverts[3],xverts[0],xverts[4]};
- double ys[]={yverts[7],yverts[3],yverts[0],yverts[4]};
- double ds[]={vertdist[7],vertdist[3],vertdist[0],vertdist[4]};
-
- boxm_quad_scan_iterator poly_it(xs,ys);
- if (vis_face_ids & X_LOW){ quad_interpolate(poly_it,xs,ys,ds,front_xyz,0); }
- else { quad_interpolate(poly_it,xs,ys,ds,back_xyz,0); }
- }
- {
- double xs[]={xverts[1],xverts[2],xverts[6],xverts[5]};
- double ys[]={yverts[1],yverts[2],yverts[6],yverts[5]};
- double ds[]={vertdist[1],vertdist[2],vertdist[6],vertdist[5]};
-
- boxm_quad_scan_iterator poly_it(xs,ys);
- if (vis_face_ids & X_HIGH){ quad_interpolate(poly_it,xs,ys,ds,front_xyz,0); }
- else { quad_interpolate(poly_it,xs,ys,ds,back_xyz,0); }
- }
- {
- double xs[]={xverts[0],xverts[1],xverts[5],xverts[4]};
- double ys[]={yverts[0],yverts[1],yverts[5],yverts[4]};
- double ds[]={vertdist[0],vertdist[1],vertdist[5],vertdist[4]};
-
- boxm_quad_scan_iterator poly_it(xs,ys);
- vgl_polygon<double> p(xs,ys,4);
- if (vis_face_ids & Y_LOW){ quad_interpolate(poly_it,xs,ys,ds,front_xyz,0); }
- else { quad_interpolate(poly_it,xs,ys,ds,back_xyz,0); }
- }
- {
- double xs[]={xverts[2],xverts[3],xverts[7],xverts[6]};
- double ys[]={yverts[2],yverts[3],yverts[7],yverts[6]};
- double ds[]={vertdist[2],vertdist[3],vertdist[7],vertdist[6]};
-
- boxm_quad_scan_iterator poly_it(xs,ys);
- vgl_polygon<double> p(xs,ys,4);
- if (vis_face_ids & Y_HIGH){ quad_interpolate(poly_it,xs,ys,ds,front_xyz,0); }
- else { quad_interpolate(poly_it,xs,ys,ds,back_xyz,0); }
- }
-
- return true;
-}
-
-
-#if 0
-bool boxm_utils::project_cube_fill_val( std::map<boct_face_idx,std::vector< vgl_point_3d<double> > > & faces,
- boct_face_idx & vis_face_ids,
- vil_image_view<float> &fill_img,
- float val, vpgl_camera_double_sptr cam)
-{
- for (std::map<boct_face_idx, std::vector<vgl_point_3d<double> > >::iterator face_it=faces.begin();
- face_it!=faces.end(); ++face_it)
- {
- std::vector<vgl_point_3d<double> > face_corners=face_it->second;
- std::vector<vgl_point_2d<double> > face_projected=project_face(face_corners,cam);
- vgl_polygon<double> face_polygon(face_projected);
- double xs[]={xverts[1],xverts[0],xverts[3],xverts[2]};
- double ys[]={yverts[1],yverts[0],yverts[3],yverts[2]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- if (vis_face_ids & face_it->first){
- quad_fill(poly_it,fill_img,val,0);
- }
- }
-}
-#else
-bool boxm_utils::project_cube_fill_val( std::map<boct_face_idx,std::vector< vgl_point_3d<double> > > &,
- boct_face_idx &, vil_image_view<float> &, float, const vpgl_camera_double_sptr&)
-{ return false; }
-#endif // 0
-
-bool boxm_utils::project_cube_fill_val(boct_face_idx & vis_face_ids,
- vil_image_view<float> &fill_img,
- float val, double *xverts,double * yverts)
-{
- if (vis_face_ids & Z_LOW){
- double xs[]={xverts[1],xverts[0],xverts[3],xverts[2]};
- double ys[]={yverts[1],yverts[0],yverts[3],yverts[2]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_fill(poly_it,fill_img,val,0);
- }
- if (vis_face_ids & Z_HIGH){
- double xs[]={xverts[4],xverts[5],xverts[6],xverts[7]};
- double ys[]={yverts[4],yverts[5],yverts[6],yverts[7]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_fill(poly_it,fill_img,val,0);
- }
- if (vis_face_ids & X_LOW){
- double xs[]={xverts[7],xverts[3],xverts[0],xverts[4]};
- double ys[]={yverts[7],yverts[3],yverts[0],yverts[4]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_fill(poly_it,fill_img,val,0);
- }
- if (vis_face_ids & X_HIGH){
- double xs[]={xverts[1],xverts[2],xverts[6],xverts[5]};
- double ys[]={yverts[1],yverts[2],yverts[6],yverts[5]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_fill(poly_it,fill_img,val,0);
- }
- if (vis_face_ids & Y_LOW){
- double xs[]={xverts[0],xverts[1],xverts[5],xverts[4]};
- double ys[]={yverts[0],yverts[1],yverts[5],yverts[4]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_fill(poly_it,fill_img,val,0);
- }
- if (vis_face_ids & Y_HIGH){
- double xs[]={xverts[2],xverts[3],xverts[7],xverts[6]};
- double ys[]={yverts[2],yverts[3],yverts[7],yverts[6]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_fill(poly_it,fill_img,val,0);
- }
- return true;
-}
-
-
-bool boxm_utils::project_cube_fill_val_aa(boct_face_idx & vis_face_ids,
- vil_image_view<float> &fill_img,
- vil_image_view<float> &weight_img,
- float val, double *xverts,double * yverts)
-{
- if (vis_face_ids & Z_LOW){
- double xs[]={xverts[1],xverts[0],xverts[3],xverts[2]};
- double ys[]={yverts[1],yverts[0],yverts[3],yverts[2]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_fill(poly_it,fill_img,weight_img,val,0);
- }
- if (vis_face_ids & Z_HIGH){
- double xs[]={xverts[4],xverts[5],xverts[6],xverts[7]};
- double ys[]={yverts[4],yverts[5],yverts[6],yverts[7]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_fill(poly_it,fill_img,weight_img,val,0);
- }
- if (vis_face_ids & X_LOW){
- double xs[]={xverts[7],xverts[3],xverts[0],xverts[4]};
- double ys[]={yverts[7],yverts[3],yverts[0],yverts[4]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_fill(poly_it,fill_img,weight_img,val,0);
- }
- if (vis_face_ids & X_HIGH){
- double xs[]={xverts[1],xverts[2],xverts[6],xverts[5]};
- double ys[]={yverts[1],yverts[2],yverts[6],yverts[5]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_fill(poly_it,fill_img,weight_img,val,0);
- }
- if (vis_face_ids & Y_LOW){
- double xs[]={xverts[0],xverts[1],xverts[5],xverts[4]};
- double ys[]={yverts[0],yverts[1],yverts[5],yverts[4]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_fill(poly_it,fill_img,weight_img,val,0);
- }
- if (vis_face_ids & Y_HIGH){
- double xs[]={xverts[2],xverts[3],xverts[7],xverts[6]};
- double ys[]={yverts[2],yverts[3],yverts[7],yverts[6]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_fill(poly_it,fill_img,weight_img,val,0);
- }
- return true;
-}
-
-bool boxm_utils::cube_sum(boct_face_idx & vis_face_ids,
- vil_image_view<float> &img,
- float & val, double *xverts,double * yverts)
-{
- val=0;
- if (vis_face_ids & Z_LOW){
- double xs[]={xverts[1],xverts[0],xverts[3],xverts[2]};
- double ys[]={yverts[1],yverts[0],yverts[3],yverts[2]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_sum(poly_it,img,val);
- }
- if (vis_face_ids & Z_HIGH){
- double xs[]={xverts[4],xverts[5],xverts[6],xverts[7]};
- double ys[]={yverts[4],yverts[5],yverts[6],yverts[7]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_sum(poly_it,img,val);
- }
- if (vis_face_ids & X_LOW){
- double xs[]={xverts[7],xverts[3],xverts[0],xverts[4]};
- double ys[]={yverts[7],yverts[3],yverts[0],yverts[4]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_sum(poly_it,img,val);
- }
- if (vis_face_ids & X_HIGH){
- double xs[]={xverts[1],xverts[2],xverts[6],xverts[5]};
- double ys[]={yverts[1],yverts[2],yverts[6],yverts[5]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_sum(poly_it,img,val);
- }
- if (vis_face_ids & Y_LOW){
- double xs[]={xverts[0],xverts[1],xverts[5],xverts[4]};
- double ys[]={yverts[0],yverts[1],yverts[5],yverts[4]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_sum(poly_it,img,val);
- }
- if (vis_face_ids & Y_HIGH){
- double xs[]={xverts[2],xverts[3],xverts[7],xverts[6]};
- double ys[]={yverts[2],yverts[3],yverts[7],yverts[6]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_sum(poly_it,img,val);
- }
-
- return true;
-}
-
-
-bool boxm_utils::cube_uniform_mean(boct_face_idx & vis_face_ids,
- vil_image_view<float> &img,
- float & val, double *xverts,double * yverts)
-{
- val=0;
- float count=0;
- if (vis_face_ids & Z_LOW){
- double xs[]={xverts[1],xverts[0],xverts[3],xverts[2]};
- double ys[]={yverts[1],yverts[0],yverts[3],yverts[2]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_mean(poly_it,img,val,count);
- }
- if (vis_face_ids & Z_HIGH){
- double xs[]={xverts[4],xverts[5],xverts[6],xverts[7]};
- double ys[]={yverts[4],yverts[5],yverts[6],yverts[7]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_mean(poly_it,img,val,count);
- }
- if (vis_face_ids & X_LOW){
- double xs[]={xverts[7],xverts[3],xverts[0],xverts[4]};
- double ys[]={yverts[7],yverts[3],yverts[0],yverts[4]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_mean(poly_it,img,val,count);
- }
- if (vis_face_ids & X_HIGH){
- double xs[]={xverts[1],xverts[2],xverts[6],xverts[5]};
- double ys[]={yverts[1],yverts[2],yverts[6],yverts[5]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_mean(poly_it,img,val,count);
- }
- if (vis_face_ids & Y_LOW){
- double xs[]={xverts[0],xverts[1],xverts[5],xverts[4]};
- double ys[]={yverts[0],yverts[1],yverts[5],yverts[4]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_mean(poly_it,img,val,count);
- }
- if (vis_face_ids & Y_HIGH){
- double xs[]={xverts[2],xverts[3],xverts[7],xverts[6]};
- double ys[]={yverts[2],yverts[3],yverts[7],yverts[6]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_mean(poly_it,img,val,count);
- }
-
- if (count > 0) {
- val/=(float)count;
- return true;
- }
- else {
- val = 0;
- return true;
- }
-}
-
-
-bool boxm_utils::cube_weighted_mean(boct_face_idx & vis_face_ids,
- vil_image_view<float> &img,
- vil_image_view<float> &weight_img,
- float & val, double *xverts,double * yverts)
-{
- val=0;
- float count=0;
- if (vis_face_ids & Z_LOW){
- double xs[]={xverts[1],xverts[0],xverts[3],xverts[2]};
- double ys[]={yverts[1],yverts[0],yverts[3],yverts[2]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_weighted_mean(poly_it,img,weight_img,val,count);
- }
- if (vis_face_ids & Z_HIGH){
- double xs[]={xverts[4],xverts[5],xverts[6],xverts[7]};
- double ys[]={yverts[4],yverts[5],yverts[6],yverts[7]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_weighted_mean(poly_it,img,weight_img,val,count);
- }
- if (vis_face_ids & X_LOW){
- double xs[]={xverts[7],xverts[3],xverts[0],xverts[4]};
- double ys[]={yverts[7],yverts[3],yverts[0],yverts[4]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_weighted_mean(poly_it,img,weight_img,val,count);
- }
- if (vis_face_ids & X_HIGH){
- double xs[]={xverts[1],xverts[2],xverts[6],xverts[5]};
- double ys[]={yverts[1],yverts[2],yverts[6],yverts[5]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_weighted_mean(poly_it,img,weight_img,val,count);
- }
- if (vis_face_ids & Y_LOW){
- double xs[]={xverts[0],xverts[1],xverts[5],xverts[4]};
- double ys[]={yverts[0],yverts[1],yverts[5],yverts[4]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_weighted_mean(poly_it,img,weight_img,val,count);
- }
- if (vis_face_ids & Y_HIGH){
- double xs[]={xverts[2],xverts[3],xverts[7],xverts[6]};
- double ys[]={yverts[2],yverts[3],yverts[7],yverts[6]};
- boxm_quad_scan_iterator poly_it(xs,ys);
- quad_weighted_mean(poly_it,img,weight_img,val,count);
- }
-
- if (count > 0) {
- val/=(float)count;
- return true;
- }
- else {
- val = 0;
- return true;
- }
-}
-
-
-bool
-boxm_utils::cube_entry_point(vgl_box_3d<double> cube,vgl_point_3d<double> pt,
- vgl_vector_3d<double> direction,
- vgl_point_3d<double> & entry_point,
- double & lambda,boct_face_idx & face_id)
-{
- // check each face
- if (direction.x() > 0 && pt.x()<=cube.min_x()) {
- // intersect with low x plane
- lambda = (cube.min_x() - pt.x()) / direction.x();
- entry_point = pt + direction * lambda;
- if ( (entry_point.y() >= cube.min_y()) && (entry_point.y() <= cube.max_y()) &&
- (entry_point.z() >= cube.min_z()) && (entry_point.z() <= cube.max_z()) ) {
- face_id=X_LOW;
- return true;
- }
- }
- else if (direction.x() < 0 && pt.x()>=cube.max_x()){
- // intersect with high x plane
- lambda = (cube.max_x() - pt.x()) / direction.x();
- entry_point = pt + direction * lambda;
- if ( (entry_point.y() >= cube.min_y()) && (entry_point.y() <= cube.max_y()) &&
- (entry_point.z() >= cube.min_z()) && (entry_point.z() <= cube.max_z()) ) {
- face_id=X_HIGH;
- return true;
- }
- }
- if (direction.y() > 0&& pt.y()<=cube.min_y()) {
- // intersect with low y plane
- lambda = (cube.min_y() - pt.y()) / direction.y();
- entry_point = pt + direction * lambda;
- if ( (entry_point.x() >= cube.min_x()) && (entry_point.x() <= cube.max_x()) &&
- (entry_point.z() >= cube.min_z()) && (entry_point.z() <= cube.max_z()) ) {
- face_id=Y_LOW;
- return true;
- }
- }
- else if (direction.y() < 0 && pt.y()>=cube.max_y()){
- // intersect with high y plane
- lambda = (cube.max_y() - pt.y()) / direction.y();
- entry_point = pt + direction * lambda;
- if ( (entry_point.x() >= cube.min_x()) && (entry_point.x() <= cube.max_x()) &&
- (entry_point.z() >= cube.min_z()) && (entry_point.z() <= cube.max_z()) ) {
- face_id=Y_HIGH;
- return true;
- }
- }
- if (direction.z() > 0&& pt.z()<=cube.min_z()) {
- // intersect with low z plane
- lambda = (cube.min_z() - pt.z()) / direction.z();
- entry_point = pt + direction * lambda;
- if ( (entry_point.x() >= cube.min_x()) && (entry_point.x() <= cube.max_x()) &&
- (entry_point.y() >= cube.min_y()) && (entry_point.y() <= cube.max_y()) ) {
- face_id=Z_LOW;
- return true;
- }
- }
- else if (direction.z() < 0 && pt.z()>=cube.max_z()){
- // intersect with high z plane
- lambda = (cube.max_z() - pt.z()) / direction.z();
- entry_point = pt + direction * lambda;
- if ( (entry_point.x() >= cube.min_x()) && (entry_point.x() <= cube.max_x()) &&
- (entry_point.y() >= cube.min_y()) && (entry_point.y() <= cube.max_y()) ) {
- face_id=Z_HIGH;
- return true;
- }
- }
- return false;
-}
-
-
-bool boxm_utils::cube_exit_point(vgl_box_3d<double> cube,vgl_point_3d<double> pt,
- vgl_vector_3d<double> direction,
- vgl_point_3d<double> & exit_pt,
- double & lambda,boct_face_idx & face_id)
-{
- // check each face
- if (direction.x() < 0 ) {
- // intersect with low x plane
- lambda = (cube.min_x() - pt.x()) / direction.x();
- exit_pt = pt + direction * lambda;
- if ( (exit_pt.y() >= cube.min_y()) && (exit_pt.y() <= cube.max_y()) &&
- (exit_pt.z() >= cube.min_z()) && (exit_pt.z() <= cube.max_z()) ) {
- face_id=X_LOW;
- return true;
- }
- }
- else if (direction.x() > 0 ) {
- // intersect with high x plane
- lambda = (cube.max_x() - pt.x()) / direction.x();
- exit_pt = pt + direction * lambda;
- if ( (exit_pt.y() >= cube.min_y()) && (exit_pt.y() <= cube.max_y()) &&
- (exit_pt.z() >= cube.min_z()) && (exit_pt.z() <= cube.max_z()) ) {
- face_id=X_HIGH;
- return true;
- }
- }
- if (direction.y() < 0 ) {
- // intersect with low y plane
- lambda = (cube.min_y() - pt.y()) / direction.y();
- exit_pt = pt + direction * lambda;
- if ( (exit_pt.x() >= cube.min_x()) && (exit_pt.x() <= cube.max_x()) &&
- (exit_pt.z() >= cube.min_z()) && (exit_pt.z() <= cube.max_z()) ) {
- face_id=Y_LOW;
- return true;
- }
- }
- else if (direction.y() > 0 ) {
- // intersect with high y plane
- lambda = (cube.max_y() - pt.y()) / direction.y();
- exit_pt = pt + direction * lambda;
- if ( (exit_pt.x() >= cube.min_x()) && (exit_pt.x() <= cube.max_x()) &&
- (exit_pt.z() >= cube.min_z()) && (exit_pt.z() <= cube.max_z()) ) {
- face_id=Y_HIGH;
- return true;
- }
- }
- if (direction.z() < 0 ) {
- // intersect with low z plane
- lambda = (cube.min_z() - pt.z()) / direction.z();
- exit_pt = pt + direction * lambda;
- if ( (exit_pt.x() >= cube.min_x()) && (exit_pt.x() <= cube.max_x()) &&
- (exit_pt.y() >= cube.min_y()) && (exit_pt.y() <= cube.max_y()) ) {
- face_id=Z_LOW;
- return true;
- }
- }
- else if (direction.z() > 0 ) {
- // intersect with high z plane
- lambda = (cube.max_z() - pt.z()) / direction.z();
- exit_pt = pt + direction * lambda;
- if ( (exit_pt.x() >= cube.min_x()) && (exit_pt.x() <= cube.max_x()) &&
- (exit_pt.y() >= cube.min_y()) && (exit_pt.y() <= cube.max_y()) ) {
- face_id=Z_HIGH;
- return true;
- }
- }
- return false;
-}
-
-
-boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype
-boxm_utils::obtain_mog_grey_unit_mode()
-{
- bsta_gauss_sf1 simple_gauss_sf1(1.0f,0.1f);
- bsta_num_obs<bsta_gauss_sf1> simple_obs_gauss_val_sf1(simple_gauss_sf1,1);
- bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, 3> simple_mix_gauss_val_sf1;
-
- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,1.0f);
-
- typedef bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>,3> simple_bsta_mixture_fixed_sf1_3;
- bsta_num_obs<simple_bsta_mixture_fixed_sf1_3> simple_obs_mix_gauss_val_sf1(simple_mix_gauss_val_sf1);
-
- return simple_obs_mix_gauss_val_sf1;
-}
-
-boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype
-boxm_utils::obtain_mog_grey_zero_mode()
-{
- bsta_gauss_sf1 simple_gauss_sf1(0.0f,0.1f);
- bsta_num_obs<bsta_gauss_sf1> simple_obs_gauss_val_sf1(simple_gauss_sf1,1);
- bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, 3> simple_mix_gauss_val_sf1;
-
- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,1.0f);
-
- typedef bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>,3> simple_bsta_mixture_fixed_sf1_3;
- bsta_num_obs<simple_bsta_mixture_fixed_sf1_3> simple_obs_mix_gauss_val_sf1(simple_mix_gauss_val_sf1);
-
- return simple_obs_mix_gauss_val_sf1;
-}
-
-boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype
-boxm_utils::obtain_mog_grey_single_mode(float mean)
-{
- bsta_gauss_sf1 simple_gauss_sf1(mean,0.1f);
- bsta_num_obs<bsta_gauss_sf1> simple_obs_gauss_val_sf1(simple_gauss_sf1,1);
- bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>, 3> simple_mix_gauss_val_sf1;
-
- simple_mix_gauss_val_sf1.insert(simple_obs_gauss_val_sf1,1.0f);
-
- typedef bsta_mixture_fixed<bsta_num_obs<bsta_gauss_sf1>,3> simple_bsta_mixture_fixed_sf1_3;
- bsta_num_obs<simple_bsta_mixture_fixed_sf1_3> simple_obs_mix_gauss_val_sf1(simple_mix_gauss_val_sf1);
-
- return simple_obs_mix_gauss_val_sf1;
-}
-
-double boxm_utils::max_point_to_box_dist(vgl_box_3d<double> box,vgl_point_3d<double> pt)
-{
- double dist_max=0;
-
- std::vector<vgl_point_3d<double> > corners=corners_of_box_3d(box);
- for (const auto & corner : corners)
- {
- if (dist_max<(corner-pt).length())
- dist_max=(corner-pt).length();
- }
- return dist_max;
-}
diff --git a/contrib/brl/bseg/boxm/util/boxm_utils.h b/contrib/brl/bseg/boxm/util/boxm_utils.h
deleted file mode 100644
index 86f74b3945..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_utils.h
+++ /dev/null
@@ -1,168 +0,0 @@
-#ifndef boxm_utils_h_
-#define boxm_utils_h_
-//:
-// \file
-// \brief The utility methods for the boxm project
-//
-// \author Gamze Tunali
-// \date Apr 07, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include "boxm_quad_scan_iterator.h"
-#include <vgl/vgl_box_3d.h>
-#include <vgl/vgl_point_3d.h>
-#include <vpgl/vpgl_camera_double_sptr.h>
-#include <boct/boct_tree_cell.h>
-#include <boxm/boxm_apm_traits.h>
-#include <vil/vil_image_view.h>
-
-class safe_inverse_functor
-{
- public:
- safe_inverse_functor(float tol = 0.0f) : tol_(tol) {}
-
- float operator()(float x) const { return (x > tol_)? 1.0f/x : 0.0f; }
-
- float tol_;
-};
-
-class boxm_utils
-{
- public:
-
- //: returns true if a given box is visible from the camera and the image plane
- static bool is_visible(vgl_box_3d<double> const& bbox,
- vpgl_camera_double_sptr const& camera,
- unsigned int img_ni, unsigned int img_nj,
- bool do_front_test = true);
-
- // returns the 8 corner points of a box
- static std::vector<vgl_point_3d<double> > corners_of_box_3d(vgl_box_3d<double> const& box);
-
- //: returns the indices of the faces visible from the camera
- static bool is_face_visible(std::vector<vgl_point_3d<double> > &face,
- vpgl_camera_double_sptr const& camera);
-
- //:
- static bool is_face_visible(const double * xverts, const double *yerts,
- unsigned id1,unsigned id2,unsigned id3,unsigned id4);
-
- //: returns the visible faces of a box given a camera.
- // It puts a bit 1 for each face visible based on the boct_cell_face values.
- static boct_face_idx visible_faces(vgl_box_3d<double> const& bbox,
- const vpgl_camera_double_sptr& camera,
- double *xverts, double *yerts);
- static boct_face_idx visible_faces_cell(vgl_box_3d<double> const& bbox,
- const vpgl_camera_double_sptr& camera,
- double *xverts, double *yverts);
-
- static boct_face_idx visible_faces(vgl_box_3d<double> const& bbox, const vpgl_camera_double_sptr& camera);
-
- static void faces_of_box_3d(vgl_box_3d<double> const& bbox,
- std::map<boct_face_idx, std::vector<vgl_point_3d<double> > > & faces);
-
- static void project_corners(std::vector<vgl_point_3d<double> > const& corners,const vpgl_camera_double_sptr& camera,
- double * xverts, double *yerts);
- static void project_point3d(vgl_point_3d<double> const& point,
- const vpgl_camera_double_sptr& camera,
- double & xvert, double &yert, double & vertdist);
-
- static void project_corners(std::vector<vgl_point_3d<double> > const& corners,
- const vpgl_camera_double_sptr& camera,
- double* xverts, double* yverts,
- float* vertdist);
- static void project_cube(vgl_box_3d<double> &bbox,
- const vpgl_camera_double_sptr& camera,
- std::map<boct_face_idx, std::vector< vgl_point_3d<double> > > & faces,
- boct_face_idx & vis_face_ids);
-
- static std::vector<vgl_point_2d<double> > project_face(std::vector<vgl_point_3d<double> > &face,
- vpgl_camera_double_sptr const& camera);
-
- static void quad_interpolate(boxm_quad_scan_iterator &poly_it,
- double* xvals, double* yvals, double* vals,
- vil_image_view<float> &img,unsigned img_plane_num=0,
- unsigned int v0=0, unsigned int v1=1,
- unsigned int v2=2,unsigned int v3=3);
-
- static void quad_fill(boxm_quad_scan_iterator &poly_it,
- vil_image_view<float> &img, float val,
- unsigned img_plane_num=0);
- static void quad_fill(boxm_quad_scan_iterator &poly_it,
- vil_image_view<float> &img,
- vil_image_view<float> &weights_img,
- float val,
- unsigned img_plane_num=0);
-
- static bool project_cube_xyz(std::map<boct_face_idx,std::vector< vgl_point_3d<double> > > & faces,
- boct_face_idx & vis_face_ids,
- vil_image_view<float> &front_xyz,
- vil_image_view<float> &back_xyz,
- const vpgl_camera_double_sptr& camera);
-
- static bool project_cube_xyz(std::vector< vgl_point_3d<double> > & corners,
- boct_face_idx & vis_face_ids,
- vil_image_view<float> &front_xyz,
- vil_image_view<float> &back_xyz,
- double *xverts,double * yerts);
- //: only for perspective camera
- static bool project_cube_xyz(std::vector< vgl_point_3d<double> > & corners,
- boct_face_idx & vis_face_ids,
- vil_image_view<float> &front_xyz,
- vil_image_view<float> &back_xyz,
- double *xverts,double * yverts,float * vertdist);
-
- static bool project_cube_fill_val( std::map<boct_face_idx,std::vector< vgl_point_3d<double> > > & faces,
- boct_face_idx & vis_face_ids,
- vil_image_view<float> &fill_img,
- float val, const vpgl_camera_double_sptr& cam);
-
- static bool project_cube_fill_val(boct_face_idx & vis_face_ids,
- vil_image_view<float> &fill_img,
- float val, double *xverts,double * yverts);
- static bool project_cube_fill_val_aa(boct_face_idx & vis_face_ids,
- vil_image_view<float> &fill_img,
- vil_image_view<float> &weights_img,
- float val, double *xverts,double * yverts);
-
- static bool cube_uniform_mean(boct_face_idx & vis_face_ids,
- vil_image_view<float> &img,
- float & val, double *xverts,double * yverts);
- static bool cube_weighted_mean(boct_face_idx & vis_face_ids,
- vil_image_view<float> &img,
- vil_image_view<float> &weight_img,
- float & val, double *xverts,double * yverts);
-
- static bool cube_sum(boct_face_idx & vis_face_ids,
- vil_image_view<float> &img,
- float & val, double *xverts,double * yverts);
-
- static void quad_mean(boxm_quad_scan_iterator &poly_it,
- vil_image_view<float> &img, float &val, float & count);
- static void quad_sum(boxm_quad_scan_iterator &poly_it,
- vil_image_view<float> &img, float &val);
- static void quad_weighted_mean(boxm_quad_scan_iterator &poly_it,
- vil_image_view<float> &img,
- vil_image_view<float> &weighted_img,
- float &numerator, float & denominator);
- static bool cube_entry_point(vgl_box_3d<double> box,vgl_point_3d<double> pt,
- vgl_vector_3d<double> dir,
- vgl_point_3d<double> & entry_point,
- double & lambda, boct_face_idx & face_id);
- static bool cube_exit_point(vgl_box_3d<double> box,vgl_point_3d<double> pt,
- vgl_vector_3d<double> dir, vgl_point_3d<double> & exit_point,
- double & lambda,boct_face_idx & face_id);
-
- static double max_point_to_box_dist(vgl_box_3d<double> box,vgl_point_3d<double> pt);
-
- static boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype obtain_mog_grey_unit_mode();
-
- static boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype obtain_mog_grey_zero_mode();
-
- static boxm_apm_traits<BOXM_APM_MOG_GREY>::apm_datatype obtain_mog_grey_single_mode(float mean);
-};
-
-#endif
diff --git a/contrib/brl/bseg/boxm/util/boxm_vrml_util.h b/contrib/brl/bseg/boxm/util/boxm_vrml_util.h
deleted file mode 100644
index 3e7bcdc580..0000000000
--- a/contrib/brl/bseg/boxm/util/boxm_vrml_util.h
+++ /dev/null
@@ -1,214 +0,0 @@
-// This is brl/bseg/boxm/util/boxm_vrml_util.h
-#ifndef boxm_vrml_util_h
-#define boxm_vrml_util_h
-//:
-// \file
-// \brief Set of utilities to save a boxm_scene as vrml files
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date Dec 9, 2009
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <fstream>
-#include <boxm/boxm_scene.h>
-#include "boxm_cell_data_traits.h"
-#include <bvrml/bvrml_write.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-class boxm_vrml_util
-{
- public:
-
- // Writes the values in the scene above the threshold as vrml dots
- template <class T_data>
- static void write_vrml_scene(std::ofstream& str, boxm_scene<boct_tree<short,T_data> > *scene,
- const float threshold= 0.0f);
-#if 0 // not yet working?
- static void write_vrml_scene(std::ofstream& str, bvxm_voxel_scene<bsta_num_obs<bsta_gauss_sf1> > *scene,
- const float threshold);
- static void write_vrml_scene_as_spheres(std::ofstream& str, bvxm_voxel_scene<float> *scene, float threshold);
- static void write_vrml_scene_as_spheres(std::ofstream& str, bvxm_voxel_scene<vnl_float_4> *scene, float threshold, int s=1);
- static void write_vrml_scene_as_pointers(std::ofstream& str, bvxm_voxel_scene<vnl_float_4> *scene, float threshold, int s=1);
-#endif // 0
-};
-
-
-template <class T_data>
-void boxm_vrml_util::write_vrml_scene(std::ofstream& str, boxm_scene<boct_tree<short,T_data> > *scene, float /*threshold*/)
-{
- typedef boct_tree<short, T_data> tree_type;
- typedef boct_tree_cell<short, T_data> cell_type;
- std::ofstream temp_stream("temp.txt");
-
- bvrml_write::write_vrml_header(str);
-
- str << "Shape {\n"
- << " appearance NULL\n"
- << " geometry PointSet {\n"
- << " color Color{\n"
- << " color[\n";
- // write the colors
- // iterate through the scene
- boxm_block_iterator<tree_type > iter= scene->iterator();
- iter.begin();
-
- for (; !iter.end(); iter++) {
- scene->load_block(iter.index());
- tree_type *tree = (*iter)->get_tree();
-
- // iterate through the tree
- std::vector<cell_type*> cells = tree->leaf_cells();
-
- for (unsigned i = 0; i < cells.size(); i++)
- {
- str <<" 0.5 0.2 0.8\n";
- vgl_point_3d<double> coord = tree->global_origin(cells[i]);
- temp_stream <<" " << (int)coord.x() << ' ' <<(int)coord.y() << ' ' << (int)coord.z() << '\n';
- }
- }
- temp_stream.close();
-
- str << " ]\n }\n"
- << " coord Coordinate{\n"
- << " point[\n";
-
- // write the coordinates.
- std::ifstream fin; // file in
- std::filebuf *fb; // file buffer
- fb = fin.rdbuf();
- fb->open ("temp.txt",std::ios::in);
- if (fb->is_open() )
- {
- while (fb->sgetc()!=EOF)
- {
- std::string temp_str;
- std::istream isbf(fb);
- std::getline(isbf, temp_str);
- str << temp_str << '\n';
- }
- }
- else
- std::cerr << "file is not open.\n";
-
- fin.close();
- str << " ]\n }\n }\n}\n";
-}
-
-#if 0 // not yet working?
-void bvxm_vrml_voxel_grid::write_vrml_grid(std::ofstream& str, bvxm_voxel_grid<bsta_num_obs<bsta_gauss_sf1> > *grid, float threshold)
-{
- bvxm_voxel_grid<bsta_num_obs<bsta_gauss_sf1> >::iterator grid_it = grid->begin();
-
- str << "Shape {\n"
- << " appearance NULL\n"
- << " geometry PointSet {\n"
- << " color Color{\n"
- << " color[\n";
- // write the colors
- for (unsigned k=0; grid_it != grid->end(); ++grid_it, ++k) {
- for (unsigned i=0; i<(*grid_it).nx(); ++i) {
- for (unsigned j=0; j < (*grid_it).ny(); ++j) {
- if ((((*grid_it)(i,j)).mean() > threshold))
- str <<" " << ((*grid_it)(i,j)).mean() << ' '<< ((*grid_it)(i,j)).mean() << ' '<< ((*grid_it)(i,j)).mean() << '\n';
- }
- }
- }
- str << " ]\n }\n"
- << " coord Coordinate{\n"
- << " point[\n";
-
- // write the coordinates
- grid_it = grid->begin();
- for (unsigned k=0; grid_it != grid->end(); ++grid_it, ++k) {
- std::cout << '.';
- for (unsigned i=0; i<(*grid_it).nx(); ++i) {
- for (unsigned j=0; j < (*grid_it).ny(); ++j) {
- if (((*grid_it)(i,j)).mean() > threshold)
- str<<" " << i << ' ' <<j << ' ' << k << '\n';
- }
- }
- }
- str << " ]\n }\n }\n}\n";
-}
-
-
-void bvxm_vrml_voxel_grid::write_vrml_grid_as_spheres(std::ofstream& str, bvxm_voxel_grid<float> *grid, float threshold)
-{
- bvxm_voxel_grid<float>::iterator grid_it = grid->begin();
- vgl_vector_3d<unsigned> dim=grid->grid_size();
- unsigned s=3;
- // write the colors
- for (unsigned k=dim.z()-1; grid_it != grid->end(); ++grid_it, --k) {
- if (k%1==0)
- {
- for (unsigned i=0; i<(*grid_it).nx(); i+=s) {
- for (unsigned j=0; j < (*grid_it).ny(); j+=s) {
- if (((*grid_it)(i,j) > threshold)) {
-#ifdef DEBUG
- vgl_sphere_3d<float> sphere((float)i,(float)j,(float)k,0.5f);
- write_vrml_sphere(str, sphere, (*grid_it)(i,j),(*grid_it)(i,j),(*grid_it)(i,j),1-(*grid_it)(i,j));
-#endif // DEBUG
- vgl_sphere_3d<float> sphere((float)i/s,(float)j/s,(float)k/s,0.4f);
- bvrml_write::write_vrml_sphere(str, sphere, 1,0,0,0);
- }
- }
- }
- }
- }
-}
-
-void bvxm_vrml_voxel_grid::write_vrml_grid_as_spheres(std::ofstream& str, bvxm_voxel_grid<vnl_float_4> *grid, float threshold, int s)
-{
- bvxm_voxel_grid<vnl_float_4>::iterator grid_it = grid->begin();
- // write the colors
- for (unsigned k=0; grid_it != grid->end(); ++grid_it, ++k) {
- for (unsigned i=0; i<(*grid_it).nx(); ) {
- for (unsigned j=0; j < (*grid_it).ny(); ) {
- if ((*grid_it)(i,j)[3]/255.0f > threshold) {
- vgl_sphere_3d<float> sphere((float)i/s,(float)j/s,(float)k/s,0.5f);
- bvrml_write::write_vrml_sphere(str, sphere, 1,0,0,0);
- }
- }
- }
- }
-}
-
-
-void bvxm_vrml_voxel_grid::write_vrml_grid_as_pointers(std::ofstream& str, bvxm_voxel_grid<vnl_float_4> *grid, float threshold, int s)
-{
- bvxm_voxel_grid<vnl_float_4>::iterator grid_it = grid->begin();
- vgl_point_3d<double> origin(0.0,0.0,0.0);
- vgl_vector_3d<double> dirx(1,0,0);
- vgl_vector_3d<double> diry(0,1,0);
- vgl_vector_3d<double> dirz(0,0,1);
- bvrml_write::write_vrml_line(str,origin,dirx,1,1,0,0);
- bvrml_write::write_vrml_line(str,origin,diry,1,0,1,0);
- bvrml_write::write_vrml_line(str,origin,dirz,1,0,0,1);
-
- vgl_vector_3d<unsigned> dim=grid->grid_size();
- // write the colors
- for (unsigned k=dim.z()-1; grid_it != grid->end(); ++grid_it, --k) {
- if (k%s==0)
- {
- for (unsigned i=0; i<(*grid_it).nx(); i=i+s) {
- for (unsigned j=0; j < (*grid_it).ny(); j=j+s) {
- if (((*grid_it)(i,j)[3] > threshold)) {
- vgl_vector_3d<double> dir((*grid_it)(i,j)[0],(*grid_it)(i,j)[1],(*grid_it)(i,j)[2]);
- vgl_point_3d<double> pt((double)i/s,(double)j/s,(double)k/s);
- bvrml_write::write_vrml_line(str, pt,dir,4*((*grid_it)(i,j)[3]-0.5f),1,0,0);
- bvrml_write::write_vrml_disk(str, pt,dir,2*((*grid_it)(i,j)[3]-0.5f),0,0.5f,0.0f);
- }
- }
- }
- }
- }
-}
-#endif // 0
-
-#endif // boxm_vrml_util_h
diff --git a/contrib/brl/bseg/boxm/util/tests/CMakeLists.txt b/contrib/brl/bseg/boxm/util/tests/CMakeLists.txt
deleted file mode 100644
index 91cc0db455..0000000000
--- a/contrib/brl/bseg/boxm/util/tests/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-add_executable( boxm_util_test_all
- test_driver.cxx
- test_boxm_plane_ransac.cxx
- test_boxm_rational_camera_utils.cxx
- test_quad_interpolate.cxx
- )
-
-target_link_libraries( boxm_util_test_all boxm_util boxm boxm_sample ${VXL_LIB_PREFIX}testlib boct bsta ${VXL_LIB_PREFIX}vcl ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vnl_algo ${VXL_LIB_PREFIX}vnl_io ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vgl_algo ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vpgl ${VXL_LIB_PREFIX}vpgl_algo ${VXL_LIB_PREFIX}vil bvrml)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/camera0.txt ${CMAKE_CURRENT_BINARY_DIR}/camera0.txt COPYONLY )
-
-add_test( NAME boxm_util_test_plane_ransac COMMAND $<TARGET_FILE:boxm_util_test_all> test_boxm_plane_ransac )
-add_test( NAME boxm_util_test_rational_camera_utils COMMAND $<TARGET_FILE:boxm_util_test_all> test_boxm_rational_camera_utils ${CMAKE_CURRENT_SOURCE_DIR})
-add_test( NAME boxm_util_test_quad_interpolate COMMAND $<TARGET_FILE:boxm_util_test_all> test_quad_interpolate ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
-
-add_executable( boxm_util_test_include test_include.cxx )
-target_link_libraries( boxm_util_test_include boxm_util)
-add_executable( boxm_util_test_template_include test_template_include.cxx )
-target_link_libraries( boxm_util_test_template_include boxm_util)
diff --git a/contrib/brl/bseg/boxm/util/tests/camera0.txt b/contrib/brl/bseg/boxm/util/tests/camera0.txt
deleted file mode 100644
index cf11c57707..0000000000
--- a/contrib/brl/bseg/boxm/util/tests/camera0.txt
+++ /dev/null
@@ -1,104 +0,0 @@
-satId = "????";
-bandId = "RGB";
-SpecId = "RPC00B";
-BEGIN_GROUP = IMAGE
-
-
- lineOffset = 0.0
- sampOffset = 0.0
- latOffset = 0.0
- longOffset = 0.0
- heightOffset = 0.0
- lineScale = 1.0
- sampScale = 1.0
- latScale = 1.0
- longScale = 1.0
- heightScale = 1.0
- lineNumCoef = (
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1);
- lineDenCoef = (
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1);
- sampNumCoef = (
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1);
- sampDenCoef = (
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1);
-END_GROUP = IMAGE
-END;
-lvcs
-47.550493 35.395931 664.186757
diff --git a/contrib/brl/bseg/boxm/util/tests/frame_00000.txt b/contrib/brl/bseg/boxm/util/tests/frame_00000.txt
deleted file mode 100644
index a66e2014bd..0000000000
--- a/contrib/brl/bseg/boxm/util/tests/frame_00000.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-1 0 0
-0 1 0
-0 0 1
-1 0 0
-0 1 0
-0 0 1
-0 0 0
diff --git a/contrib/brl/bseg/boxm/util/tests/test_boxm_plane_ransac.cxx b/contrib/brl/bseg/boxm/util/tests/test_boxm_plane_ransac.cxx
deleted file mode 100644
index 6664f28f37..0000000000
--- a/contrib/brl/bseg/boxm/util/tests/test_boxm_plane_ransac.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-//:
-// \file
-// \author Gamze Tunali
-// \brief this code tests the function boxm_plane_ransac.
-// Creates 10 planes that the same line goes through and 10 random planes
-// which do not contain the plane. It makes sure it returns only the
-// first 10 planes as the fittest ones.
-//
-// \date March 25, 2010
-
-#include <iostream>
-#include <vector>
-#include <testlib/testlib_test.h>
-#include <boxm/util/boxm_plane_ransac.h>
-#include <boxm/sample/boxm_plane_obs.h>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-#include <vgl/vgl_plane_3d.h>
-#include <vgl/vgl_infinite_line_3d.h>
-#include <vnl/vnl_random.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-static const unsigned int test_num=10;
-static const unsigned int test_set=10;
-
-static void test_boxm_plane_ransac()
-{
- // create 10 planes that the line go through and 10 random planes
- vgl_point_3d<float> p1(20,20,10);
- vgl_point_3d<float> p2(30,20,10);
- vgl_infinite_line_3d<float> line(p1,p2);
-
- std::vector<boxm_edge_tangent_sample<float> > planes;
- vnl_random rand;
- // get two points from the line, and create a random 3rd point to define a plane
-
- for (unsigned i=0; i<test_num; ++i) {
- auto x=float(rand.drand32()*100);
- auto y=float(rand.drand32()*100);
- auto z=float(rand.drand32()*100);
- vgl_point_3d<float> p3(x,y,z);
- vgl_plane_3d<float> plane(p1,p2,p3);
- boxm_plane_obs<float> obs(plane,1);
- boxm_edge_tangent_sample<float> sample;
- sample.insert(obs);
- planes.push_back(sample);
- }
-
- // add the random planes
- for (unsigned i=0; i<test_set; ++i) {
- auto a=float(rand.drand32()*100);
- auto b=float(rand.drand32()*100);
- auto c=float(rand.drand32()*100);
- auto d=float(rand.drand32()*100);
- vgl_plane_3d<float> plane(a,b,c,d);
- boxm_plane_obs<float> obs(plane,1);
- boxm_edge_tangent_sample<float> sample;
- sample.insert(obs);
- planes.push_back(sample);
- }
-
- std::cout << " planes size: " << planes.size() << std::endl;
-
- std::vector<float> weights(test_set,1);
- int threshold=2;
- float residual;
- vgl_infinite_line_3d<float> l;
- vgl_box_3d<double> cell_global_box(18,15,5,32,25,15);
- float ortho_thres = 0.01f;
- float volume_ratio = 128;
- boxm_plane_ransac<float>(planes, weights, l, residual, cell_global_box, threshold, ortho_thres, volume_ratio);
-
- TEST_NEAR("test_boxm_plane_ransac: found the right plane set",
- (l.point()-line.point()).sqr_length() + (l.direction()-line.direction()).sqr_length(),
- 0.0f, 0.01f);
-}
-
-TESTMAIN(test_boxm_plane_ransac);
diff --git a/contrib/brl/bseg/boxm/util/tests/test_boxm_rational_camera_utils.cxx b/contrib/brl/bseg/boxm/util/tests/test_boxm_rational_camera_utils.cxx
deleted file mode 100644
index bbee3d575d..0000000000
--- a/contrib/brl/bseg/boxm/util/tests/test_boxm_rational_camera_utils.cxx
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <testlib/testlib_test.h>
-#include <boxm/util/boxm_rational_camera_utils.h>
-#include <vgl/vgl_plane_3d.h>
-#include <vpgl/vpgl_local_rational_camera.h>
-
-
-static void test_boxm_rational_camera_utils()
-{
- std::string filename="camera0.txt";
-
- vpgl_local_rational_camera<double>* rcam=read_local_rational_camera<double>( "./" + filename);
- vgl_plane_3d<double> top(0,0,1,-200);
- vgl_plane_3d<double> bottom(0,0,1,0);
-
- unsigned ni=800,
- nj=800;
- double u, v;
-
- rcam->project(495,431,200,u,v);
- vgl_plane_3d<double> plane_parallel=boxm_rational_camera_utils::boxm_find_parallel_image_plane(rcam,top,bottom,ni,nj);
- // TODO: do something with plane_parallel !
-}
-
-TESTMAIN(test_boxm_rational_camera_utils);
diff --git a/contrib/brl/bseg/boxm/util/tests/test_driver.cxx b/contrib/brl/bseg/boxm/util/tests/test_driver.cxx
deleted file mode 100644
index 3bc9c909f2..0000000000
--- a/contrib/brl/bseg/boxm/util/tests/test_driver.cxx
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <testlib/testlib_register.h>
-
-DECLARE( test_boxm_plane_ransac );
-DECLARE( test_boxm_rational_camera_utils );
-DECLARE( test_quad_interpolate );
-
-void register_tests()
-{
- REGISTER( test_boxm_plane_ransac );
- REGISTER( test_boxm_rational_camera_utils );
- REGISTER( test_quad_interpolate );
-}
-
-
-DEFINE_MAIN;
diff --git a/contrib/brl/bseg/boxm/util/tests/test_include.cxx b/contrib/brl/bseg/boxm/util/tests/test_include.cxx
deleted file mode 100644
index fec661974c..0000000000
--- a/contrib/brl/bseg/boxm/util/tests/test_include.cxx
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <boxm/util/boxm_cell_data_traits.h>
-#include <boxm/util/boxm_plane_ransac.h>
-#include <boxm/util/boxm_quad_scan_iterator.h>
-#include <boxm/util/boxm_rational_camera_utils.h>
-#include <boxm/util/boxm_raytrace_operations.h>
-#include <boxm/util/boxm_triangle_interpolation_iterator.h>
-#include <boxm/util/boxm_triangle_scan_iterator.h>
-#include <boxm/util/boxm_utils.h>
-#include <boxm/util/boxm_vrml_util.h>
-#include <boxm/util/boxm_test_util.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm/util/tests/test_quad_interpolate.cxx b/contrib/brl/bseg/boxm/util/tests/test_quad_interpolate.cxx
deleted file mode 100644
index 2c8c986813..0000000000
--- a/contrib/brl/bseg/boxm/util/tests/test_quad_interpolate.cxx
+++ /dev/null
@@ -1,117 +0,0 @@
-#include <iostream>
-#include <fstream>
-#include <testlib/testlib_test.h>
-#include <boxm/util/boxm_utils.h>
-#include <vgl/vgl_point_2d.h>
-#include <vgl/vgl_polygon.h>
-#include <boxm/util/boxm_quad_scan_iterator.h>
-#include <vgl/vgl_box_3d.h>
-#include <boct/boct_tree.h>
-#include <boct/boct_tree_cell.h>
-#include <vil/vil_save.h>
-#include <vil/vil_plane.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vpgl/vpgl_camera_double_sptr.h>
-#include <vpgl/vpgl_perspective_camera.h>
-#include <vgl/vgl_point_3d.h>
-#include <vgl/algo/vgl_rotation_3d.h>
-
-
-static void test_quad_interpolate(int argc, char* argv[])
-{
- std::vector<vgl_point_2d<double> > points;
- points.emplace_back(10,10);
- points.emplace_back(10,12);
- points.emplace_back(12,12);
- points.emplace_back(12,10);
-
- double xvals[]={10,10,12,12};
- double yvals[]={10,12,12,10};
- double vals[]={10,10,12,12};
- //vgl_polygon<double> poly(points);
- boxm_quad_scan_iterator poly_it(xvals,yvals);
- vil_image_view<float> img_min(40,40);
- vil_image_view<float> img_max(40,40);
- vil_image_view<float> g_img_max(40,40);
-
- img_max.fill(0.0f);
- g_img_max.fill(0.0f);
- // creating ground truth
- g_img_max(10,10)=10.5f; g_img_max(10,11)=10.5f;
- g_img_max(11,10)=11.5f; g_img_max(11,11)=11.5f;
-
- boxm_utils::quad_interpolate(poly_it, xvals, yvals, vals,img_max,0);
- for (unsigned i=10;i<=12;i++)
- {
- for (unsigned j=10;j<=12;j++)
- {
- std::cout << img_max(j,i) << ' ';
- }
- std::cout << '\n';
- }
- bool flag=true;
- for (unsigned i=0; i<g_img_max.ni() && flag; ++i)
- for (unsigned j=0; j<g_img_max.nj() && flag; ++j)
- if (g_img_max(i,j)!=img_max(i,j))
- flag=false;
-
- TEST("Interpolated image", true, flag);
-
- std::vector<vgl_point_2d<double> > points1;
- points.emplace_back(10.25,10.25);
- points.emplace_back(10.25,12.25);
- points.emplace_back(12.25,12.25);
- points.emplace_back(12.25,10.25);
-
- double xvals1[]={10.3,10.3,11.4,11.4};
- double yvals1[]={10.3,11.4,11.4,10.3};
- //double vals1[]={10,10,12,12};
- ////vgl_polygon<double> poly(points);
- boxm_quad_scan_iterator poly_it_1(xvals1,yvals1);
- //vil_image_view<float> img_min(40,40);
- //vil_image_view<float> img_max(40,40);
-
- g_img_max.fill(0.0f);
- // creating ground truth
- g_img_max(10,10)=10;g_img_max(10,11)=10;
- g_img_max(11,10)=10;g_img_max(11,11)=10;
-
- float val=0;
- float count=0;
- boxm_utils::quad_mean(poly_it_1,g_img_max,val,count);
-
- // code to test the projection of a cube .
- vgl_box_3d<double> cell_bb(-0.8,19.2,-18.75,0.7625, 20.7625,-17.1875);
- std::string camera_input_path = (argc < 2) ? "." : argv[1];
- std::ifstream ifs((camera_input_path + "/frame_00000.txt").c_str());
- if (!ifs.is_open()) {
- std::cerr << "Failed to open file " << camera_input_path << "/frame_00000.txt\n";
- TEST("Opening camera file", true, false);
- return;
- }
- auto* cam = new vpgl_perspective_camera<double>();
- ifs >> *cam;
- double xverts[8];
- double yverts[8];
- float vertdist[8];
- unsigned int ni=1280;
- unsigned int nj=720;
-
- vpgl_camera_double_sptr cam_d(cam);
- vil_image_view<float> front_xyz(ni,nj,1);front_xyz.fill(0.0f);
- vil_image_view<float> back_xyz(ni,nj,1) ;back_xyz.fill(0.0f);
-
- std::vector<vgl_point_3d<double> > corners=boxm_utils::corners_of_box_3d(cell_bb);
- boxm_utils::project_corners(corners,cam_d,xverts,yverts,vertdist);
- boct_face_idx vis_face_ids=boxm_utils::visible_faces(cell_bb,cam_d,xverts,yverts);
- boxm_utils::project_cube_xyz(corners,vis_face_ids,front_xyz,back_xyz,xverts,yverts,vertdist);
-
- std::string image_output_path = (argc < 3) ? "." : argv[2];
- std::cout << "Saving two TIFF files to directory " << image_output_path << '\n';
- vil_save(vil_plane(front_xyz,0),(image_output_path + "/front.tiff").c_str());
- vil_save(vil_plane(back_xyz,0), (image_output_path + "/back.tiff").c_str());
-}
-
-TESTMAIN_ARGS(test_quad_interpolate);
diff --git a/contrib/brl/bseg/boxm/util/tests/test_template_include.cxx b/contrib/brl/bseg/boxm/util/tests/test_template_include.cxx
deleted file mode 100644
index a3fbe3c4ae..0000000000
--- a/contrib/brl/bseg/boxm/util/tests/test_template_include.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <boxm/util/boxm_triangle_interpolation_iterator.hxx>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm_batch/CMakeLists.txt b/contrib/brl/bseg/boxm_batch/CMakeLists.txt
deleted file mode 100644
index 643a441654..0000000000
--- a/contrib/brl/bseg/boxm_batch/CMakeLists.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-# contrib/brl/bseg/boxm_batch/CMakeLists.txt
-
-include( ${VXL_CMAKE_DIR}/NewCMake/FindPython.cmake )
-include( ${VXL_CMAKE_DIR}/NewCMake/FindOpenCL.cmake )
-
-if( PYTHON_FOUND )
- FIND_PACKAGE(EXPAT REQUIRED)
-FIND_PACKAGE(EXPATPP REQUIRED)
- if( EXPAT_FOUND )
- include_directories( ${PYTHON_INCLUDE_DIRS} )
- include_directories( ${BRL_INCLUDE_DIR} )
- include_directories( ${BRL_INCLUDE_DIR}/bpro )
- include_directories( ${BRL_INCLUDE_DIR}/bpro/core )
-
- include_directories( ${GEL_INCLUDE_DIR}/mrc )
- include_directories( ${GEL_INCLUDE_DIR}/mrc/vpgl )
- include_directories( ${MUL_INCLUDE_DIR} )
- include_directories( ${BRL_INCLUDE_DIR}/bseg/boxm )
- include_directories( ${BRL_INCLUDE_DIR}/bseg/boxm/algo )
- include_directories( ${BRL_INCLUDE_DIR}/bseg/brec )
- include_directories( ${BRL_INCLUDE_DIR}/bbas/bsta )
-
- set(boxm_batch_sources
- reg_boxm.h reg_boxm.cxx
- )
- if(NOT VXL_BUILD_POSITION_DEPENDENT_CODE)
- vxl_add_library(LIBRARY_NAME boxm_batch LIBRARY_SOURCES SHARED ${boxm_batch_sources})
-
- #library has to have different name depending on debug or release version.
- if(WIN32)
- set_target_properties(boxm_batch PROPERTIES OUTPUT_NAME boxm_batch DEBUG_POSTFIX _d SUFFIX .pyd)
- endif()
- if(APPLE)
- set_target_properties(boxm_batch PROPERTIES OUTPUT_NAME boxm_batch SUFFIX .so)
- endif()
- set_target_properties(boxm_batch PROPERTIES PREFIX "")
-
- target_link_libraries(boxm_batch bpro_batch boxm_pro boxm_sample_algo boxm_algo_rt_pro boxm_algo_sp_pro boxm_algo_pro ${VXL_LIB_PREFIX}vpgl_io vpgl_pro ${VXL_LIB_PREFIX}vil_io vil_pro sdet_pro bsta_pro icam_pro bapl_pro )
-
- if(PYTHON_DEBUG_LIBRARIES)
- target_link_libraries( boxm_batch debug ${PYTHON_DEBUG_LIBRARY})
- endif()
-
- if(PYTHON_LIBRARIES)
- target_link_libraries( boxm_batch optimized ${PYTHON_LIBRARY})
- endif()
-
- if( BUILD_TESTING )
- add_subdirectory(tests)
- endif()
-
- endif()
- endif()
-endif()
-
-include( ${VXL_CMAKE_DIR}/NewCMake/FindDirectShow.cmake )
-if(DIRECTSHOW_FOUND)
- add_definitions(-DHAS_DIRECTSHOW)
-endif()
diff --git a/contrib/brl/bseg/boxm_batch/reg_boxm.cxx b/contrib/brl/bseg/boxm_batch/reg_boxm.cxx
deleted file mode 100644
index baa2f55b02..0000000000
--- a/contrib/brl/bseg/boxm_batch/reg_boxm.cxx
+++ /dev/null
@@ -1,135 +0,0 @@
-#include "reg_boxm.h"
-#include <bprb/bprb_macros.h>
-#include <bprb/bprb_batch_process_manager.h>
-#include <brdb/brdb_selection.h>
-
-// processes
-#include <vil_pro/vil_register.h>
-#include <vpgl_pro/vpgl_register.h>
-#include <sdet_pro/sdet_register.h>
-//#include <icam_pro/icam_register.h>
-#include <boxm/pro/boxm_register.h>
-#include <boxm/algo/pro/boxm_algo_register.h>
-#include <boxm/algo/rt/pro/boxm_algo_rt_register.h>
-#include <boxm/algo/sp/pro/boxm_algo_sp_register.h>
-
-#include <bsta/pro/bsta_register.h>
-#include <bapl/pro/bapl_register.h>
-
-#include <bbas_pro/bbas_register.h>
-
-#include <boxm/basic/boxm_util_data_types.h>
-PyObject *
-register_processes(PyObject *self, PyObject *args)
-{
- vil_register::register_process();
- vpgl_register::register_process();
- boxm_register::register_process();
- boxm_algo_register::register_process();
-
- boxm_algo_rt_register::register_process();
- boxm_algo_sp_register::register_process();
- sdet_register::register_process();
- //icam_register::register_process();
- bapl_register::register_process();
- bbas_register::register_process();
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-PyObject *
-register_datatypes(PyObject *self, PyObject *args)
-{
- register_basic_datatypes();
- vil_register::register_datatype();
- vpgl_register::register_datatype();
- boxm_register::register_datatype();
- boxm_algo_register::register_process();
-
- boxm_algo_rt_register::register_datatype();
- boxm_algo_sp_register::register_datatype();
-
- bsta_register::register_datatype();
- //icam_register::register_datatype();
- bapl_register::register_datatype();
- bbas_register::register_datatype();
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-PyObject *get_boxm_array_1d_float(PyObject * /*self*/, PyObject *args)
-{
- unsigned id;
- boxm_array_1d_float_sptr value;
- if (!PyArg_ParseTuple(args, "i:get_boxm_array_1d_float", &id))
- return NULL;
-
- std::string relation_name = "boxm_array_1d_float_sptr_data";
-
- // query to get the data
- brdb_query_aptr Q = brdb_query_comp_new("id", brdb_query::EQ, id);
- brdb_selection_sptr selec = DATABASE->select(relation_name, std::move(Q));
- PyObject *array_1d=0;
- if (selec->size()!=1) {
- std::cout << "in get_boxm_array_1d_float() - no relation with type" << relation_name << " id: " << id << std::endl;
-
- return array_1d;
- }
-
- brdb_value_sptr brdb_value;
- if (!selec->get_value(std::string("value"), brdb_value)) {
- std::cout << "in get_boxm_array_1d_float() didn't get value\n";
- return array_1d;
- }
-
- if (!brdb_value) {
- std::cout << "in get_boxm_array_1d_float() - null value\n";
- return array_1d;
- }
-
- brdb_value_t<boxm_array_1d_float_sptr>* result_out = static_cast<brdb_value_t<boxm_array_1d_float_sptr>* >(brdb_value.ptr());
- value = result_out->value();
-
- array_1d = PyList_New(value->data_array.size());
- PyObject *x;
- for(unsigned i=0;i<value->data_array.size();i++)
- {
- x=PyFloat_FromDouble((double)value->data_array[i]);
- PyList_SetItem(array_1d, i,x);//Py_DECREF(x);
- }
- Py_INCREF(array_1d);
- return array_1d;
-}
-PyMODINIT_FUNC
-initboxm_batch(void)
-{
- PyMethodDef reg_pro;
- reg_pro.ml_name = "register_processes";
- reg_pro.ml_meth = register_processes;
- reg_pro.ml_doc = "register_processes() create instances of each defined process";
- reg_pro.ml_flags = METH_VARARGS;
-
-
- PyMethodDef reg_data;
- reg_data.ml_name = "register_datatypes";
- reg_data.ml_meth = register_datatypes;
- reg_data.ml_doc = "register_datatypes() insert tables in the database for each type";
- reg_data.ml_flags = METH_VARARGS;
-
- PyMethodDef get_boxm_array_1d_float_func;
- get_boxm_array_1d_float_func.ml_name = "get_boxm_array_1d_float";
- get_boxm_array_1d_float_func.ml_meth = get_boxm_array_1d_float;
- get_boxm_array_1d_float_func.ml_doc = "get_boxm_array_1d_float() Get 1-d array in python";
- get_boxm_array_1d_float_func.ml_flags = METH_VARARGS;
-
- boxm_batch_methods[0]=reg_pro;
- boxm_batch_methods[1]=reg_data;
- boxm_batch_methods[2]=get_boxm_array_1d_float_func;
-
- for (int i=0; i<METHOD_NUM; ++i) {
- boxm_batch_methods[i+3]=batch_methods[i];
- }
-
- Py_InitModule("boxm_batch", boxm_batch_methods);
-}
diff --git a/contrib/brl/bseg/boxm_batch/reg_boxm.h b/contrib/brl/bseg/boxm_batch/reg_boxm.h
deleted file mode 100644
index fa2ddfee33..0000000000
--- a/contrib/brl/bseg/boxm_batch/reg_boxm.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef reg_boxm_h_
-#define reg_boxm_h_
-
-#include <bpro/bpro_batch/bpro_batch.h>
-
-static PyObject *register_processes(PyObject *self, PyObject *args);
-static PyObject *register_datatypes(PyObject *self, PyObject *args);
-static PyObject *get_boxm_array_1d_float(PyObject * self, PyObject *args);
-
-static PyMethodDef boxm_batch_methods[METHOD_NUM+3];
-
-#endif
diff --git a/contrib/brl/bseg/boxm_batch/tests/CMakeLists.txt b/contrib/brl/bseg/boxm_batch/tests/CMakeLists.txt
deleted file mode 100644
index 8b72db0d89..0000000000
--- a/contrib/brl/bseg/boxm_batch/tests/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-add_executable( boxm_batch_test_include test_include.cxx )
-target_link_libraries( boxm_batch_test_include boxm_batch)
diff --git a/contrib/brl/bseg/boxm_batch/tests/test_include.cxx b/contrib/brl/bseg/boxm_batch/tests/test_include.cxx
deleted file mode 100644
index f962b339e8..0000000000
--- a/contrib/brl/bseg/boxm_batch/tests/test_include.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <boxm_batch/reg_boxm.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/boxm_bridge/CMakeLists.txt b/contrib/brl/bseg/boxm_bridge/CMakeLists.txt
deleted file mode 100644
index 7186a42583..0000000000
--- a/contrib/brl/bseg/boxm_bridge/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-if (HAS_GEOTIFF)
-include( ${VXL_CMAKE_DIR}/NewCMake/FindOpenCL.cmake )
-if(OPENCL_FOUND)
-
- add_definitions(-DHAS_OPENCL=1)
- include_directories( ${OPENCL_INCLUDE_PATH} )
- include_directories( ${GEL_INCLUDE_DIR}/mrc )
- include_directories( ${MUL_INCLUDE_DIR} )
-
- add_executable( boxm2_to_boxm_exe boxm2_to_boxm.cxx boxm2_to_boxm.h)
- target_link_libraries( boxm2_to_boxm_exe boxm2 boxm boxm_sample boxm2_io boct ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vcl)
-
- # executable to convert a bit scene to a boxm2_scene
- add_executable( boxm_to_boxm2_exe boxm_to_boxm2.cxx boxm_to_boxm2.h)
- target_link_libraries( boxm_to_boxm2_exe boxm2 boxm boxm_sample boxm2_io boct ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl ${VXL_LIB_PREFIX}vcl)
-
- #tests
- if( BUILD_TESTING )
- add_subdirectory(tests)
- endif()
-
-endif()
-else()
- message(STATUS "Skipping contrib/brl/bseg/boxm_bridge: requires geotiff")
-endif()
diff --git a/contrib/brl/bseg/boxm_bridge/boxm2_normails_to_boxm.cxx b/contrib/brl/bseg/boxm_bridge/boxm2_normails_to_boxm.cxx
deleted file mode 100644
index a9a7c43ba6..0000000000
--- a/contrib/brl/bseg/boxm_bridge/boxm2_normails_to_boxm.cxx
+++ /dev/null
@@ -1,233 +0,0 @@
-//:
-// \file
-#include <iostream>
-#include <queue>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <cassert>
-
-//executable args
-#include <vul/vul_arg.h>
-
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_box_3d.h>
-
-//boct files
-#include <boct/boct_tree.h>
-#include <boct/boct_bit_tree2.h>
-
-//boxm2 files
-#include <boxm2/boxm2_scene.h>
-#include <boxm2/boxm2_block.h>
-#include <boxm2/boxm2_data_traits.h>
-#include <boxm2/io/boxm2_sio_mgr.h>
-#include <boxm2/io/boxm2_lru_cache.h>
-
-// boxm files
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_apm_traits.h>
-
-#define BOXM2_SCENE_HAS_DIMENSIONS
-
-//: computes the log2 of a number and returns it.
-// power_of_2 is set to true if \p x is an exact power of two.
-// returns -1 when \p x is zero.
-int mylog2(unsigned x, bool& power_of_2)
-{
- unsigned orig_x = x;
- int l = -1; // mylog2(0) will return -1
- while (x != 0u) {
- x >>= 1u;
- ++l;
- }
- if (orig_x > std::pow(2.0,l)) {
- power_of_2 = false;
- ++l;
- }
- else
- power_of_2 = true;
- return l;
-}
-
-
-template <class T_loc, class T_data>
-void insert(boct_tree<T_loc,T_data>*& tree, boct_tree<T_loc,T_data>*& subtree, vgl_box_3d<double> cell_bb)
-{
- // find the leaf node in the tree to insert subtree
- boct_tree_cell<T_loc,T_data>* node = tree->locate_point(cell_bb.centroid());
- if (!node)
- std::cerr << "The node could NOT be FOUND\n";
- if (node->children()) {
- std::cerr << "The node is not a leaf node! Cannot insert here\n";
- return; // it should have been a leaf node
- }
-
- boct_tree_cell<T_loc,T_data>* sub_root = subtree->root();
- node->insert_subtree(sub_root);
-}
-
-// converts the bit tree to boct_octree representation
-template <class T_loc, class T_data>
-void convert_tree(boct_bit_tree2 const& bit_tree, boct_tree<T_loc,T_data>*& tree,
- boxm2_data<BOXM2_NORMAL>* normal_data)
-{
- // check if root has any child, if not return the empty tree
- tree = new boct_tree<T_loc,T_data>(4, 1);
-
- // if root has no child return a root node filled with data
- if (!bit_tree.bit_at(0)) {
- int data_idx = bit_tree.get_data_index(0,false);
- boxm2_data_traits<BOXM2_NORMAL>::datatype data = normal_data->data()[data_idx];
- tree->root()->set_data(vnl_vector_fixed<float, 3> (data[0], data[1], data[2]));
- return;
- }
-
- std::queue<boct_tree_cell<T_loc,T_data>*> Q;
- boct_tree_cell<T_loc,T_data>* root = tree->root();
- Q.push(root);
-
- // go through the bits and create cells
- int data_idx=bit_tree.get_data_index(0,false);
- for (unsigned i=0; i<73; i++) {
- int parent_idx = (i-1)/8;
- if (i==0 || bit_tree.bit_at(parent_idx)) {
- if (!Q.empty()) {
- boxm2_data_traits<BOXM2_NORMAL>::datatype data = normal_data->data()[data_idx];
- vnl_vector_fixed<float, 3> normal(data[0], data[1], data[2]);
- boct_tree_cell<T_loc,T_data>* ptr = Q.front();
- ptr->set_data(normal);
- Q.pop();
- if (bit_tree.bit_at(i)) {
- ptr->split();
- boct_tree_cell<T_loc,T_data>* children = ptr->children();
- for (unsigned j=0; j<8; j++) {
- Q.push(&children[j]);
- }
- }
- data_idx++;
- }
- }
- }
-
- // some of the leaf nodes are still in the queue, fill them with data
- while (!Q.empty()) {
- if (data_idx > bit_tree.get_data_index(0,false)+585)
- std::cerr << "ERROR! exceeded!\n";
- boxm2_data_traits<BOXM2_NORMAL>::datatype data = normal_data->data()[data_idx];
- vnl_vector_fixed<float, 3> normal(data[0], data[1], data[2]);
- boct_tree_cell<T_loc,T_data>* ptr = Q.front();
- ptr->set_data(normal);
- Q.pop();
- data_idx++;
- }
-}
-
-int main(int argc, char** argv)
-{
- std::cout<<"Converting boxm2 scene to boxm scene"<<std::endl;
- vul_arg<std::string> boxm2_file("-scene", "scene filename", "");
- vul_arg<std::string> boxm_dir("-out", "output directory", "");
- vul_arg_parse(argc, argv);
-
- boxm2_scene scene2(boxm2_file());
-
- //initialize a block and data cache
- boxm2_lru_cache::create(&scene2);
- boxm2_cache_sptr cache = boxm2_cache::instance();
-
- bgeo_lvcs lvcs = scene2.lvcs();
- //vgl_point_3d<double> origin = scene2.local_origin();
- vgl_box_3d<double> world = scene2.bounding_box();
- std::map<boxm2_block_id, boxm2_block_metadata> blocks = scene2.blocks();
- std::map<boxm2_block_id, boxm2_block_metadata>::iterator iter = blocks.begin();
-
- typedef boct_tree<short, vnl_vector_fixed<float, 3> > tree_type;
- vgl_vector_3d<unsigned int> block_nums = scene2.scene_dimensions();
- vgl_point_3d<int> min_block_index;
- vgl_point_3d<double> origin;
- scene2.min_block_index(min_block_index, origin);
- vgl_vector_3d<double> ww(world.width()/block_nums.x(),world.height()/block_nums.y(),world.depth()/block_nums.z());
-
-
- boxm_scene<tree_type> scene(lvcs, origin, ww, block_nums,false,true,true);
- std::string scene_path=boxm_dir(); //"C:/data/boxm2/downtown/boxm_scene";
- scene.set_paths(scene_path,"block");
- scene.set_appearance_model(VNL_FLOAT_3);
-
- int x_dim;
- while (iter != blocks.end()) {
- boxm2_block_metadata metadata = iter ->second;
- boxm2_block_id id = iter->first;
- boxm2_block * block = cache->get_block(iter->first);
- std::cout<<" DATA buffers "<< block->num_buffers()<<std::endl;
-
- boxm2_data_base * data_base = cache->get_data_base(iter->first,boxm2_data_traits<BOXM2_NORMAL>::prefix());
- boxm2_data<BOXM2_NORMAL> *data =new boxm2_data<BOXM2_NORMAL>(data_base->data_buffer(),data_base->buffer_length(),data_base->block_id());
-
- // compute the block bounding box etc
- vgl_vector_3d<unsigned int> dim = block->sub_block_num();
- vgl_vector_3d<double> subdim=block->sub_block_dim();
-
- // block dimensions should be equal
- bool equal = (dim.x()==dim.y());
- equal = equal && (dim.x()==dim.z());
- assert(equal);
-
- // the block dimensions should be the power of 2 for octree creation
- bool pow_of_2;
- x_dim = mylog2((double)dim.x(),pow_of_2);
- assert(pow_of_2);
-
- double p[3];
- p[0] = metadata.local_origin_.x();
- p[1] = metadata.local_origin_.y();
- p[2] = metadata.local_origin_.z();
- vgl_box_3d<double> block_bb(p, subdim.x()*dim.x(), subdim.y()*dim.y(), subdim.z()*dim.z(), vgl_box_3d<double>::min_pos);
- tree_type* block_tree=new tree_type(x_dim+4, x_dim+1); // FIX take max of 3 dims instead
- block_tree->set_bbox(block_bb);
- block_tree->init_cells(0);
-
- int block_i = id.i() - min_block_index.x();
- int block_j = id.j() - min_block_index.y();
- int block_k = id.k() - min_block_index.z();
-
- scene.load_block(block_i, block_j, block_k);
- // go over the subtrees
- for (unsigned z=0; z<dim.z(); z++) {
- for (unsigned y=0; y<dim.y(); y++) {
- for (unsigned x=0; x<dim.x(); x++) {
- boxm2_block::uchar16 tree = block->trees()[x][y][z];
- boct_bit_tree2 bit_tree((unsigned char*)tree.data_block());
- if (bit_tree.num_cells() >= 1) {
- tree_type* octree;
- convert_tree(bit_tree,octree,data);
- int n1=bit_tree.num_cells();
- int n2=octree->all_cells().size();
- if (n1 != n2) {
- std::cerr << x << ',' << y << ',' << z << '\n'
- << "ERROR! The converted tree is not right, should have " << n1 << " nodes instead of " << n2 << '\n';
- }
-
- // all three dimensions should be same now, so we can use the one value
- double cell_dim=1./dim.x();
- p[0] = x*cell_dim;
- p[1] = y*cell_dim;
- p[2] = z*cell_dim;
- vgl_box_3d<double> cell_bb(p, cell_dim, cell_dim, cell_dim, vgl_box_3d<double>::min_pos);
- insert(block_tree,octree, cell_bb);
-
- // since the subtree is added to the main tree, we can delete the root node now
- delete octree;
- }
- }
- }
- }
- boxm_block<tree_type>* block_new = scene.get_block(block_i, block_j, block_k);
- block_new->init_tree(block_tree);
- scene.write_active_block();
- iter++;
- }
- scene.set_octree_levels(x_dim+4, x_dim+1);
- scene.write_scene("boxm_scene.xml");
-}
diff --git a/contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.cxx b/contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.cxx
deleted file mode 100644
index a9d5135776..0000000000
--- a/contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.cxx
+++ /dev/null
@@ -1,292 +0,0 @@
-#include <iostream>
-#include <queue>
-#include "boxm2_to_boxm.h"
-//:
-// \file
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <cassert>
-
-//executable args
-#include <vul/vul_arg.h>
-
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_box_3d.h>
-
-//boct files
-#include <boct/boct_tree.h>
-#include <boct/boct_bit_tree.h>
-
-//boxm2 files
-#include <boxm2/boxm2_scene.h>
-#include <boxm2/io/boxm2_lru_cache.h>
-#include <boxm2/boxm2_block.h>
-#include <boxm2/boxm2_data_traits.h>
-#include <boxm2/io/boxm2_sio_mgr.h>
-
-// boxm files
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_apm_traits.h>
-
-#define BOXM2_SCENE_HAS_DIMENSIONS
-
-//: computes the log2 of a number and returns it.
-// power_of_2 is set to true if \p x is an exact power of two.
-// returns -1 when \p x is zero.
-int mylog2(unsigned x, bool& power_of_2)
-{
- unsigned orig_x = x;
- int l = -1; // mylog2(0) will return -1
- while (x != 0u) {
- x >>= 1u;
- ++l;
- }
- if (orig_x > std::pow(2.0,l)) {
- power_of_2 = false;
- ++l;
- }
- else
- power_of_2 = true;
- return l;
-}
-
-
-template <class T_loc, class T_data>
-void insert(boct_tree<T_loc,T_data>*& tree, boct_tree<T_loc,T_data>*& subtree, vgl_box_3d<double> cell_bb)
-{
- // find the leaf node in the tree to insert subtree
- boct_tree_cell<T_loc,T_data>* node = tree->locate_point(cell_bb.centroid());
- if (!node)
- std::cerr << "The node could NOT be FOUND\n";
- if (node->children()) {
- std::cerr << "The node is not a leaf node! Cannot insert here\n";
- return; // it should have been a leaf node
- }
-
- boct_tree_cell<T_loc,T_data>* sub_root = subtree->root();
- node->insert_subtree(sub_root);
-}
-
-//: combine the data values to create a sample
-boxm_sample<BOXM_APM_MOG_GREY> create_sample(float alpha,
- boxm2_data_traits<BOXM2_MOG3_GREY>::datatype data,
- boxm2_data_traits<BOXM2_NUM_OBS>::datatype num_obs)
-{
- float m0=data[0]/255.0f;
- float v0=data[1]/255.0f;
- float w0=data[2]/255.0f;
- float m1=data[3]/255.0f;
- float v1=data[4]/255.0f;
- float w1=data[5]/255.0f;
- float m2=data[6]/255.0f;
- float v2=data[7]/255.0f;
- float w2=0;
- if (w0>0 && w1>0)
- w2=1.0-w0-w1;
-
- unsigned short n0=num_obs[0];
- unsigned short n1=num_obs[1];
- unsigned short n2=num_obs[2];
- unsigned short nmix=num_obs[3];
-
- typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::gauss_type_sf1 gauss_type_sf1;
- typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::mix_gauss_sf1_type mix_gauss_sf1_type;
-
-
- bsta_gauss_sf1 dist0((float)m0, (float)v0);
- bsta_num_obs<bsta_gauss_sf1> num_obs_dist0(dist0, n0);
- bsta_gauss_sf1 dist1((float)m1, (float)v1);
- bsta_num_obs<bsta_gauss_sf1> num_obs_dist1(dist1, n1);
- bsta_gauss_sf1 dist2((float)m2, (float)v2);
- bsta_num_obs<bsta_gauss_sf1> num_obs_dist2(dist2, n2);
-
- bsta_mixture_fixed<gauss_type_sf1, 3> mf;
- mf.insert(num_obs_dist0,w0);
- mf.insert(num_obs_dist1,w1);
- mf.insert(num_obs_dist2,w2);
-
- bsta_num_obs<bsta_mixture_fixed<gauss_type_sf1, 3> > obs(mf,nmix/100.0f);
-
- boxm_sample<BOXM_APM_MOG_GREY> sample(alpha, obs);
- return sample;
-}
-
-// converts the bit tree to boct_octree representation
-template <class T_loc, class T_data>
-void convert_tree(boct_bit_tree const& bit_tree, boct_tree<T_loc,T_data>*& tree,
- boxm2_data<BOXM2_ALPHA>* alpha_data,
- boxm2_data<BOXM2_MOG3_GREY>* mog3_data,
- boxm2_data<BOXM2_NUM_OBS>* num_obs)
-{
- // check if root has any child, if not return the empty tree
- tree = new boct_tree<T_loc,T_data>(4, 1);
-
- // if root has no child return a root node filled with data
- if (!bit_tree.bit_at(0)) {
- int data_idx = bit_tree.get_data_index(0,false);
- boxm2_data_traits<BOXM2_MOG3_GREY>::datatype data = mog3_data->data()[data_idx];
- boxm2_data_traits<BOXM2_NUM_OBS>::datatype nums = num_obs->data()[data_idx];
- boxm2_data<BOXM2_ALPHA>::datatype alpha = alpha_data->data()[data_idx];
- boxm_sample<BOXM_APM_MOG_GREY> sample = create_sample(alpha,data,nums);
- tree->root()->set_data(sample);
- return;
- }
-
- std::queue<boct_tree_cell<T_loc,T_data>*> Q;
- boct_tree_cell<T_loc,T_data>* root = tree->root();
- Q.push(root);
-
- // go through the bits and create cells
- int data_idx=bit_tree.get_data_index(0,false);
- for (unsigned i=0; i<73; i++) {
- int parent_idx = (i-1)/8;
- if (i==0 || bit_tree.bit_at(parent_idx)) {
- if (!Q.empty()) {
- boxm2_data_traits<BOXM2_MOG3_GREY>::datatype data = mog3_data->data()[data_idx];
- boxm2_data_traits<BOXM2_NUM_OBS>::datatype nums = num_obs->data()[data_idx];
- boxm2_data<BOXM2_ALPHA>::datatype alpha = alpha_data->data()[data_idx];
- boxm_sample<BOXM_APM_MOG_GREY> sample = create_sample(alpha,data,nums);
-
- boct_tree_cell<T_loc,T_data>* ptr = Q.front();
- ptr->set_data(sample);
- Q.pop();
- if (bit_tree.bit_at(i)) {
- ptr->split();
- boct_tree_cell<T_loc,T_data>* children = ptr->children();
- for (unsigned j=0; j<8; j++) {
- Q.push(&children[j]);
- }
- }
- data_idx++;
- }
- }
- }
-
- // some of the leaf nodes are still in the queue, fill them with data
- while (!Q.empty()) {
- if (data_idx > bit_tree.get_data_index(0,false)+585)
- std::cerr << "ERROR! exceeded!\n";
- boxm2_data_traits<BOXM2_MOG3_GREY>::datatype data = mog3_data->data()[data_idx];
- boxm2_data_traits<BOXM2_NUM_OBS>::datatype nums = num_obs->data()[data_idx];
- boxm2_data<BOXM2_ALPHA>::datatype alpha = alpha_data->data()[data_idx];
- boxm_sample<BOXM_APM_MOG_GREY> sample = create_sample(alpha,data,nums);
- boct_tree_cell<T_loc,T_data>* ptr = Q.front();
- ptr->set_data(sample);
- Q.pop();
- data_idx++;
- }
-}
-
-int main(int argc, char** argv)
-{
- std::cout<<"Converting boxm2 scene to boxm scene"<<std::endl;
- vul_arg<std::string> boxm2_file("-scene", "scene filename", "");
- vul_arg<std::string> boxm_dir("-out", "output directory", "");
- vul_arg_parse(argc, argv);
-
- boxm2_scene_sptr scene2 = new boxm2_scene(boxm2_file());
-
- //initialize a block and data cache
- boxm2_lru_cache::create(scene2);
- boxm2_cache_sptr cache = boxm2_cache::instance();
-
- vpgl_lvcs lvcs = scene2->lvcs();
- //vgl_point_3d<double> origin = scene2->local_origin();
- vgl_box_3d<double> world = scene2->bounding_box();
- std::map<boxm2_block_id, boxm2_block_metadata> blocks = scene2->blocks();
- auto iter = blocks.begin();
-
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- vgl_vector_3d<unsigned int> block_nums = scene2->scene_dimensions();
- vgl_point_3d<int> min_block_index;
- vgl_point_3d<double> origin;
- scene2->min_block_index(min_block_index, origin);
- vgl_vector_3d<double> ww(world.width()/block_nums.x(),world.height()/block_nums.y(),world.depth()/block_nums.z());
-
-
- boxm_scene<tree_type> scene(lvcs, origin, ww, block_nums,false,true,true);
- std::string scene_path=boxm_dir(); //"C:/data/boxm2/downtown/boxm_scene";
- scene.set_paths(scene_path,"block");
- scene.set_appearance_model(BOXM_APM_MOG_GREY);
-
- int x_dim;
- while (iter != blocks.end()) {
- boxm2_block_metadata metadata = iter ->second;
- boxm2_block_id id = iter->first;
- boxm2_block * block = cache->get_block(scene2, iter->first);
- std::cout<<" DATA buffers "<< block->num_buffers()<<std::endl;
- boxm2_data_base * data_base = cache->get_data_base(scene2, iter->first,boxm2_data_traits<BOXM2_NUM_OBS>::prefix());
- boxm2_data<BOXM2_NUM_OBS> *num_obs=new boxm2_data<BOXM2_NUM_OBS>(data_base->data_buffer(),data_base->buffer_length(),data_base->block_id());
-
- boxm2_data_base * mog3_data_base = cache->get_data_base(scene2, iter->first,boxm2_data_traits<BOXM2_MOG3_GREY>::prefix());
- boxm2_data<BOXM2_MOG3_GREY> *mog3_data=new boxm2_data<BOXM2_MOG3_GREY>(mog3_data_base->data_buffer(),mog3_data_base->buffer_length(),mog3_data_base->block_id());
- boxm2_data_base * alpha_data_base = cache->get_data_base(scene2, iter->first,boxm2_data_traits<BOXM2_ALPHA>::prefix());
- boxm2_data<BOXM2_ALPHA> *alpha_data =new boxm2_data<BOXM2_ALPHA>(alpha_data_base->data_buffer(),alpha_data_base->buffer_length(),alpha_data_base->block_id());
-
- // compute the block bounding box etc
- vgl_vector_3d<unsigned int> dim = block->sub_block_num();
- vgl_vector_3d<double> subdim=block->sub_block_dim();
-
- // block dimensions should be equal
- bool equal = (dim.x()==dim.y());
- equal = equal && (dim.x()==dim.z());
- assert(equal);
-
- // the block dimensions should be the power of 2 for octree creation
- bool pow_of_2;
- x_dim = mylog2((double)dim.x(),pow_of_2);
- assert(pow_of_2);
-
- double p[3];
- p[0] = metadata.local_origin_.x();
- p[1] = metadata.local_origin_.y();
- p[2] = metadata.local_origin_.z();
- vgl_box_3d<double> block_bb(p, subdim.x()*dim.x(), subdim.y()*dim.y(), subdim.z()*dim.z(), vgl_box_3d<double>::min_pos);
- auto* block_tree=new tree_type(x_dim+4, x_dim+1); // FIX take max of 3 dims instead
- block_tree->set_bbox(block_bb);
- block_tree->init_cells(0);
-
- int block_i = id.i() - min_block_index.x();
- int block_j = id.j() - min_block_index.y();
- int block_k = id.k() - min_block_index.z();
-
- scene.load_block(block_i, block_j, block_k);
- // go over the subtrees
- for (unsigned z=0; z<dim.z(); z++) {
- for (unsigned y=0; y<dim.y(); y++) {
- for (unsigned x=0; x<dim.x(); x++) {
- boxm2_block::uchar16 tree = block->trees()[x][y][z];
- boct_bit_tree bit_tree((unsigned char*)tree.data_block());
- if (bit_tree.num_cells() >= 1) {
- tree_type* octree;
- convert_tree(bit_tree,octree,alpha_data,mog3_data,num_obs);
- int n1=bit_tree.num_cells();
- int n2=octree->all_cells().size();
- if (n1 != n2) {
- std::cerr << x << ',' << y << ',' << z << '\n'
- << "ERROR! The converted tree is not right, should have " << n1 << " nodes instead of " << n2 << '\n';
- }
-
- // all three dimensions should be same now, so we can use the one value
- double cell_dim=1./dim.x();
- p[0] = x*cell_dim;
- p[1] = y*cell_dim;
- p[2] = z*cell_dim;
- vgl_box_3d<double> cell_bb(p, cell_dim, cell_dim, cell_dim, vgl_box_3d<double>::min_pos);
- insert(block_tree,octree, cell_bb);
-
- // since the subtree is added to the main tree, we can delete the root node now
- delete octree;
- }
- }
- }
- }
- boxm_block<tree_type>* block_new = scene.get_block(block_i, block_j, block_k);
- block_new->init_tree(block_tree);
- scene.write_active_block();
- iter++;
- }
- scene.set_octree_levels(x_dim+4, x_dim+1);
- scene.write_scene("boxm_scene.xml");
-}
diff --git a/contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.h b/contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.h
deleted file mode 100644
index a4dec11806..0000000000
--- a/contrib/brl/bseg/boxm_bridge/boxm2_to_boxm.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef boxm2_to_boxm_h_
-#define boxm2_to_boxm_h_
-//:
-// \file
-
-#include <boct/boct_tree.h>
-#include <boct/boct_bit_tree.h>
-#include <boxm2/boxm2_data.h>
-#include <boxm2/boxm2_data_traits.h>
-#include <boxm/sample/boxm_sample.h>
-
-//: combine the data values to create a sample
-boxm_sample<BOXM_APM_MOG_GREY> create_sample(float alpha,
- boxm2_data_traits<BOXM2_MOG3_GREY>::datatype data,
- boxm2_data_traits<BOXM2_NUM_OBS>::datatype num_obs);
-
-//: converts the bit tree to boct_octree representation
-template <class T_loc, class T_data>
-void convert_tree(boct_bit_tree const& bit_tree, boct_tree<T_loc,T_data>*& tree,
- boxm2_data<BOXM2_ALPHA>* alpha_data,
- boxm2_data<BOXM2_MOG3_GREY>* mog3_data,
- boxm2_data<BOXM2_NUM_OBS>* num_obs);
-
-#endif // boxm2_to_boxm_h_
diff --git a/contrib/brl/bseg/boxm_bridge/boxm_normals_to_boxm2.cxx b/contrib/brl/bseg/boxm_bridge/boxm_normals_to_boxm2.cxx
deleted file mode 100644
index 54dc134841..0000000000
--- a/contrib/brl/bseg/boxm_bridge/boxm_normals_to_boxm2.cxx
+++ /dev/null
@@ -1,326 +0,0 @@
-#include <queue>
-#include <iostream>
-#include "boxm_to_boxm2.h"
-//:
-// \file
-//
-// boxm_normals_to_boxm2.cxx
-//
-// \author
-// Created by David Borton on 11/28/11.
-// Copyright (c) 2011 Brown University. All rights reserved.
-//
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-//executable args
-#include <vul/vul_arg.h>
-
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_box_3d.h>
-
-//boct files
-#include <boct/boct_tree.h>
-#include <boct/boct_bit_tree2.h>
-
-//boxm2 files
-#include <boxm2/boxm2_scene.h>
-#include <boxm2/boxm2_block.h>
-#include <boxm2/boxm2_data_traits.h>
-#include <boxm2/io/boxm2_sio_mgr.h>
-#include <boxm2/io/boxm2_lru_cache.h>
-
-// boxm files
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.h>
-
-
-//: extracts the tree cell's data into an array format for boxm2 representation
-template <class T_loc, class T_data>
-void convert_data(boct_tree<T_loc,T_data>* tree,
- boct_tree_cell<T_loc,T_data>* tree_cell,
- boct_tree_cell<T_loc, bool>* valid_cell,
- boct_tree_cell<T_loc, float>* alpha_cell,
- boxm2_data_traits<BOXM2_NORMAL>::datatype* normals_arr,
- boxm2_data_traits<BOXM2_POINT>::datatype* points_arr,
- boxm2_data_traits<BOXM2_ALPHA>::datatype* alpha_arr,
- int& data_idx)
-{
- // go through the tree, in depth first order to collect data
- std::queue<boct_tree_cell<T_loc,T_data>*> Q;
- std::queue<boct_tree_cell<T_loc,float>*> alpha_Q;
- std::queue<boct_tree_cell<T_loc,bool>*> valid_Q;
-
- Q.push(tree_cell);
- alpha_Q.push(alpha_cell);
- valid_Q.push(valid_cell);
-
- while (!Q.empty()) {
- boct_tree_cell<T_loc,T_data>* ptr = Q.front();
- boct_tree_cell<T_loc, bool>* valid_ptr = valid_Q.front();
- boct_tree_cell<T_loc, float> alpha_ptr = alpha_Q.front();
- vgl_point_3d<double> point = tree->global_centroid(tree_cell);
-
- if (ptr && valid_ptr && alpha_ptr)
- {
- if (valid_ptr->data()) {
- T_data normal = tree_cell->data();
-
- normals_arr[data_idx][0] = normal[0];
- normals_arr[data_idx][1] = normal[2];
- normals_arr[data_idx][2] = normal[3];
- normals_arr[data_idx][3] = 0.0f;
-
- points_arr[data_idx][0] = point.x();
- points_arr[data_idx][1] = point.y();
- points_arr[data_idx][2] = point.z();
- points_arr[data_idx][3] = 0.0f;
-
- alpha_arr[data_idx]=alpha_cell->data();
- }
- else {
- normals_arr[data_idx][0] = 0.0f;
- normals_arr[data_idx][1] = 0.0f;
- normals_arr[data_idx][2] = 0.0f;
- normals_arr[data_idx][3] = 0.0f;
-
- points_arr[data_idx][0] = point.x();
- points_arr[data_idx][1] = point.y();
- points_arr[data_idx][2] = point.z();
- points_arr[data_idx][3] = 0.0f;
-
- alpha_arr[data_idx]=alpha_cell->data();
- }
-
- data_idx++;
-
- if (!ptr->is_leaf()) {
- boct_tree_cell<T_loc,T_data>* children = ptr->children();
- boct_tree_cell<T_loc, bool>* valid_children = valid_ptr->children();
- boct_tree_cell<T_loc, float>* alpha_chidren = alpha_ptr->children();
- for (unsigned j=0; j<8; j++) {
- Q.push(&children[j]);
- alpha_Q.push(&alpha_chidren[j]);
- valid_Q.push(&valid_children[j]);
- }
- }
- }
- Q.pop();
- alpha_Q.pop();
- valid_Q.pop();
- }
-}
-
-//: recursively sets the bits based on the octree structure
-template <class T_loc, class T_data>
-void set_bits(boct_bit_tree2*& bit_tree, int idx, unsigned int child_idx, boct_tree_cell<T_loc,T_data> & cell)
-{
- if (cell.code_.level == 0)
- return;
-
- if (!cell.is_leaf()) {
- int bit_idx=idx*8+1+child_idx;
- bit_tree->set_bit_at(bit_idx,true);
- for (unsigned i=0; i<8; i++)
- set_bits(bit_tree, bit_idx, i, cell.children()[i]);
- }
-}
-
-//: converts the bit tree to boct_octree representation
-template <class T_loc, class T_data>
-void convert_to_bittree(boct_tree_cell<T_loc,T_data>* tree_cell, boct_bit_tree2*& bit_tree)
-{
- bit_tree = new boct_bit_tree2();
- // first set all the bits to 0
- for (unsigned i=0; i<73; i++)
- bit_tree->set_bit_at(i,false);
-
- // empty tree
- if (!tree_cell)
- return;
-
- // only root node
- if (tree_cell->is_leaf())
- return;
-
- int idx=0;
- bit_tree->set_bit_at(idx,true); // root
- for (unsigned i=0; i<8; i++) { // level root-1
- set_bits(bit_tree, idx, i, tree_cell->children()[i]);
- }
-}
-
-template <class T_loc, class T_data>
-void convert_scene( boxm_scene<boct_octree<T_loc, T_data> > &scene,
- boxm_scene<boct_octree<T_loc, bool> > &valid_scene,
- boxm_scene<boct_octree<T_loc, float> > &alpha_scene,
- boxm2_scene &new_scene)
-{
- std::map<boxm2_block_id, boxm2_block_metadata> new_blocks;
- unsigned int dim=sub_block_dim();
- typedef boct_octree<T_loc, T_data> tree_type;
- boxm_block_iterator<tree_type > iter(&scene);
- boxm_block_iterator<tree_type > validd_iter(&valid_scene);
- boxm_block_iterator<tree_type > alpha_iter(&alpha_scene);
-
- while (!iter.end()) {
- vgl_point_3d<int> idx = iter.index();
- scene.load_block(idx);
- boxm_block<tree_type >* block = scene.get_block(idx);
- vgl_box_3d<double> block_bb = block->bounding_box();
- std::cout<<block_bb<<std::endl;
- tree_type * tree = block->get_tree();
-
- valid_scene.load_block(idx);
- boxm_block<boct_tree<short, bool> >* valid_block = valid_scene.get_block(idx);
- boct_tree<short, bool> * valid_tree = valid_block->get_tree();
-
- alpha_scene.load_block(idx);
- boxm_block<boct_tree<short, float> >* alpha_block = alpha_scene.get_block(idx);
- boct_tree<short, float> * alpha_tree = alpha_block->get_tree();
-
- // create metadata for the block
- boxm2_block_id block_id(idx.x(),idx.y(),idx.z());
- vgl_vector_3d<double> sub_block_dim(1.0/dim,1.0/dim,1.0/dim);
- vgl_vector_3d<unsigned> sub_block_num(dim,dim,dim);
- vgl_vector_3d<double> real_block_dim(sub_block_dim.x()*scene.block_dim().x(),
- sub_block_dim.y()*scene.block_dim().y(),
- sub_block_dim.z()*scene.block_dim().z());
- boxm2_block_metadata metadata(block_id, block->bounding_box().min_point(),
- real_block_dim,sub_block_num,1,4,650.0,0.001);
- boxm2_block new_block(metadata);
- new_blocks[block_id]=metadata;
-
- // find the total number of cells to figure out data array sizes, as the first step
- int data_size=0;
- for (unsigned z=0; z<dim; z++) {
- for (unsigned y=0; y<dim; y++) {
- for (unsigned x=0; x<dim; x++) {
- double cell_dim=1./dim;
- double p[3];
- p[0] = x*cell_dim;
- p[1] = y*cell_dim;
- p[2] = z*cell_dim;
- vgl_box_3d<double> cell_bb(p, cell_dim, cell_dim, cell_dim, vgl_box_3d<double>::min_pos);
- boct_tree_cell<T_loc,T_data >* node = tree->locate_point_at_level(cell_bb.centroid(),3);
- if (!node)
- std::cout << "The node COULD not be FOUND" << std::endl;
- else {
- std::vector<boct_tree_cell<T_loc,T_data> > *> children;
- node->all_children(children);
- int n2= children.size()+1;
- data_size += n2;
- }
- }
- }
- }
-
- // allocate data array
- boxm2_data_traits<BOXM2_NORMAL>::datatype* normals_arr=new boxm2_data_traits<BOXM2_NORMAL>::datatype[data_size];
- boxm2_data_traits<BOXM2_POINT>::datatype* points_arr=new boxm2_data_traits<BOXM2_POINT>::datatype[data_size];
- boxm2_data_traits<BOXM2_ALPHA>::datatype* alpha_arr = new boxm2_data_traits<BOXM2_ALPHA>::datatype[data_size];
-
- // divide the blocks
- int data_idx=0;
- boxm2_array_3d<boxm2_block::uchar16>& trees = new_block.trees();
- for (unsigned z=0; z<dim; z++) {
- for (unsigned y=0; y<dim; y++) {
- for (unsigned x=0; x<dim; x++) {
- double cell_dim=1./dim;
- double p[3];
- p[0] = x*cell_dim;
- p[1] = y*cell_dim;
- p[2] = z*cell_dim;
- vgl_box_3d<double> cell_bb(p, cell_dim, cell_dim, cell_dim, vgl_box_3d<double>::min_pos);
- boct_tree_cell<T_loc, T_data >* node = tree->locate_point_at_level(cell_bb.centroid(),3);
- boct_tree_cell<T_loc, bool>* valid_node = valid_tree->locate_point_at_level(cell_bb.centroid(), 3);
- boct_tree_cell<T_loc, float> *alpha_node = alpha_tree->locate_point_at_level(cell_bb.centroid(), 3);
-
- if (!(node && valid_node && alpha_node) )
- std::cout << "One of the nodes COULD not be FOUND" << std::endl;
- else {
- std::vector<boct_tree_cell<T_loc, T_data > *> children;
- node->all_children(children);
- int n2= children.size()+1;
-
- boct_bit_tree2* bit_tree;
- convert_to_bittree(node, bit_tree);
- int n1=bit_tree->num_cells();
- int start=data_idx;
- convert_data(tree, node, valid_node, alpha_node, normals_arr, points_arr, alpha_arr, data_idx);
- // set the data index at the tree
- bit_tree->set_data_ptr(start, false);
- // set the tree at the block
- boxm2_block::uchar16& t=trees[x][y][z];
- t.set(bit_tree->get_bits());
- if (n1 != n2) {
- std::cout << x << ',' << y << ',' << z << '\n'
- << "ERROR! The converted tree is not right, should have " << n1 << " nodes instead of " << n2 << std::endl;
- }
- }
- }
- }
- }
- char* b1 = reinterpret_cast<char *>(normals_arr);
- boxm2_data<BOXM2_NORMAL> *normals_data=new boxm2_data<BOXM2_NORMAL>(b1,data_size*sizeof(boxm2_data_traits<BOXM2_NORMAL>::datatype),block_id);
- char* b2 = reinterpret_cast<char *>(pointa_arr);
- boxm2_data<BOXM2_POINT> *points_data=new boxm2_data<BOXM2_POINT>(b2,data_size*sizeof(boxm2_data_traits<BOXM2_POINT>::datatype),block_id);
- char* b3 = reinterpret_cast<char *>(alpha_arr);
- boxm2_data<BOXM2_ALPHA> *alpha_data = new boxm2_data<BOXM2_ALPHA>(b3, data_size*sizeof(boxm2_data_traits<BOXM2_ALPHA>::datatype),block_id);
-
- boxm2_sio_mgr::save_block(new_scene.data_path(), &new_block);
- boxm2_sio_mgr::save_block_data(new_scene.data_path(), block_id, normals_data);
- boxm2_sio_mgr::save_block_data(new_scene.data_path(), block_id, points_data);
- boxm2_sio_mgr::save_block_data(new_scene.data_path(), block_id, alpha_data);
-
- delete [] normals_arr;
- delete [] points_arr;
- delete [] alpha_arr;
- iter++;
- }
- new_scene.set_blocks(new_blocks);
- new_scene.save_scene();
-}
-
-int main(int argc, char** argv)
-{
- std::cout << "Converting boxm scene with normals to boxm2 normals and points" << std::endl;
- vul_arg<std::string> scene_path("-normals_scene", "scene filename", "");
- vul_arg<std::string> scene_path("-valid_scene", "scene filename", "");
- vul_arg<std::string> scene_path("-alpha_scene", "scene filename", "");
- vul_arg<std::string> out_dir("-out", "output directory", "");
- vul_arg<unsigned int> sub_block_dim("-dim", "sub block dimensions", 64);
- vul_arg_parse(argc, argv);
-
- boxm_scene_parser parser;
- boxm_scene_base_sptr n_scene_ptr=new boxm_scene_base();
- n_scene_ptr->load_scene(normals_scene(), parser);
-
- if (n_scene_ptr->appearence_model() == VNL_FLOAT_3)
- {
- typedef boct_tree<short, VNL_FLOAT_3 > tree_type;
- boxm_scene<tree_type > scene;
- scene.load_scene(normals_scene());
-
- boxm_scene<boct_tree<short, bool> > valid_scene;
- valid_scene.load_scene(valid_scene());
-
- boxm_scene<boct_tree<short, float> > alpha_scene;
- alpha_scene.load_scene(alpha_scene());
-
- // create a boxm2 scene
- boxm2_scene new_scene;
- new_scene.set_data_path(out_dir());
- new_scene.set_local_origin(scene.origin());
- new_scene.set_lvcs(scene.lvcs());
- new_scene.set_xml_path(out_dir()+"/scene.xml");
-
- //initialize a block
- boxm2_lru_cache::create(&new_scene);
-
- convert_scene(scene, valid_scene, alpha_scene, new_scene);
- }
-}
diff --git a/contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.cxx b/contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.cxx
deleted file mode 100644
index 5a3d2d6e83..0000000000
--- a/contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.cxx
+++ /dev/null
@@ -1,262 +0,0 @@
-#include <iostream>
-#include <queue>
-#include "boxm_to_boxm2.h"
-//:
-// \file
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-//executable args
-#include <vul/vul_arg.h>
-
-#include <vgl/vgl_point_3d.h>
-#include <vgl/vgl_box_3d.h>
-
-//boct files
-#include <boct/boct_tree.h>
-#include <boct/boct_bit_tree.h>
-
-//boxm2 files
-#include <boxm2/boxm2_scene.h>
-#include <boxm2/boxm2_block.h>
-#include <boxm2/boxm2_data_traits.h>
-#include <boxm2/io/boxm2_sio_mgr.h>
-#include <boxm2/io/boxm2_lru_cache.h>
-
-// boxm files
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_apm_traits.h>
-#include <boxm/sample/boxm_sample.h>
-
-
-//: extracts the parameters of a boxm_sample for boxm2 representation
-void deconstruct_sample(boxm_sample<BOXM_APM_MOG_GREY> sample,
- float &alpha,
- boxm2_data_traits<BOXM2_MOG3_GREY>::datatype& data,
- boxm2_data_traits<BOXM2_NUM_OBS>::datatype& num_obs)
-{
- alpha=sample.alpha;
-
- typedef boxm_apm_traits<BOXM_APM_MOG_GREY>::gauss_type_sf1 gauss_type_sf1;
-
- bsta_num_obs<bsta_mixture_fixed<gauss_type_sf1, 3> > obs = sample.appearance();
- unsigned int nmix = obs.num_observations*100.0;
- num_obs[3] = nmix;
-
- for (unsigned i=0; i<obs.num_components(); i++) {
- gauss_type_sf1 mf=obs.distribution(i);
- auto w = (unsigned char)std::floor(obs.weight(i)*255.0);
- unsigned int n = (unsigned char)mf.num_observations;
- auto m = (unsigned char)std::floor(mf.mean()*255.0);
- auto v = (unsigned char)std::floor(mf.var()*255.0);
- num_obs[i]=n;
- data[i*3]=m;
- data[i*3+1]=v;
- if (i<2)
- data[i*3+2]=w;
- }
-}
-
-//: extracts the tree cell's data into an array format for boxm2 representation
-template <class T_loc, class T_data>
-void convert_data(boct_tree_cell<T_loc,T_data>* tree_cell,
- float* alpha,
- boxm2_data_traits<BOXM2_MOG3_GREY>::datatype* data,
- boxm2_data_traits<BOXM2_NUM_OBS>::datatype* num_obs,
- int& data_idx)
-{
- // go through the tree, in depth first order to collect data
- std::queue<boct_tree_cell<T_loc,T_data>*> Q;
- Q.push(tree_cell);
- while (!Q.empty()) {
- boct_tree_cell<T_loc,T_data>* ptr = Q.front();
- {
- deconstruct_sample(ptr->data(),alpha[data_idx],data[data_idx],num_obs[data_idx]);
- data_idx++;
- if (!ptr->is_leaf()) {
- boct_tree_cell<T_loc,T_data>* children = ptr->children();
- for (unsigned j=0; j<8; j++) {
- Q.push(&children[j]);
- }
- }
- }
- Q.pop();
- }
-}
-
-//: recursively sets the bits based on the octree structure
-template <class T_loc, class T_data>
-void set_bits(boct_bit_tree*& bit_tree, int idx, unsigned int child_idx, boct_tree_cell<T_loc,T_data> & cell)
-{
- if (cell.code_.level == 0)
- return;
-
- if (!cell.is_leaf()) {
- int bit_idx=idx*8+1+child_idx;
- bit_tree->set_bit_at(bit_idx,true);
- for (unsigned i=0; i<8; i++)
- set_bits(bit_tree, bit_idx, i, cell.children()[i]);
- }
-}
-
-//: converts the bit tree to boct_octree representation
-template <class T_loc, class T_data>
-void convert_to_bittree(boct_tree_cell<T_loc,T_data>* tree_cell, boct_bit_tree*& bit_tree)
-{
- bit_tree = new boct_bit_tree();
- // first set all the bits to 0
- for (unsigned i=0; i<73; i++)
- bit_tree->set_bit_at(i,false);
-
- // empty tree
- if (!tree_cell)
- return;
-
- // only root node
- if (tree_cell->is_leaf()) {
- return;
- }
-
- int idx=0;
- bit_tree->set_bit_at(idx,true); // root
- for (unsigned i=0; i<8; i++) { // level root-1
- set_bits(bit_tree, idx, i, tree_cell->children()[i]);
- }
-}
-
-int main(int argc, char** argv)
-{
- std::cout << "Converting boxm scene to boxm2 Scene" << std::endl;
- vul_arg<std::string> scene_path("-scene", "scene filename", "");
- vul_arg<std::string> out_dir("-out", "output directory", "");
- vul_arg<unsigned int> sub_block_dim("-dim", "sub block dimensions", 64);
- vul_arg_parse(argc, argv);
-
- typedef boct_tree<short, boxm_sample<BOXM_APM_MOG_GREY> > tree_type;
- boxm_scene<tree_type > scene;
- scene.load_scene(scene_path());
-
- // create a boxm2 scene
- boxm2_scene new_scene;
- new_scene.set_data_path(out_dir());
- new_scene.set_local_origin(scene.origin());
- new_scene.set_lvcs(scene.lvcs());
- new_scene.set_xml_path(out_dir()+"/scene.xml");
-
- //initialize a block
- boxm2_lru_cache::create(&new_scene);
-
- std::map<boxm2_block_id, boxm2_block_metadata> new_blocks;
- unsigned int dim=sub_block_dim();
- if (scene.appearence_model() == BOXM_APM_MOG_GREY) {
- boxm_block_iterator<tree_type > iter(&scene);
- while (!iter.end()) {
- vgl_point_3d<int> idx = iter.index();
- scene.load_block(idx);
- boxm_block<tree_type >* block = scene.get_block(idx);
- vgl_box_3d<double> block_bb = block->bounding_box();
- std::cout<<block_bb<<std::endl;
- tree_type * tree = block->get_tree();
-
- // create metadata for the block
- boxm2_block_id block_id(idx.x(),idx.y(),idx.z());
- vgl_vector_3d<double> sub_block_dim(1.0/dim,1.0/dim,1.0/dim);
- vgl_vector_3d<unsigned> sub_block_num(dim,dim,dim);
- vgl_vector_3d<double> real_block_dim(sub_block_dim.x()*scene.block_dim().x(),
- sub_block_dim.y()*scene.block_dim().y(),
- sub_block_dim.z()*scene.block_dim().z());
- boxm2_block_metadata metadata(block_id, block->bounding_box().min_point(),
- real_block_dim,sub_block_num,1,4,650.0,0.001);
- boxm2_block new_block(metadata);
- new_blocks[block_id]=metadata;
-
- // find the total number of cells to figure out data array sizes, as the first step
- int data_size=0;
- for (unsigned z=0; z<dim; z++) {
- for (unsigned y=0; y<dim; y++) {
- for (unsigned x=0; x<dim; x++) {
- double cell_dim=1./dim;
- double p[3];
- p[0] = x*cell_dim;
- p[1] = y*cell_dim;
- p[2] = z*cell_dim;
- vgl_box_3d<double> cell_bb(p, cell_dim, cell_dim, cell_dim, vgl_box_3d<double>::min_pos);
- boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >* node = tree->locate_point_at_level(cell_bb.centroid(),3);
- if (!node)
- std::cout << "The node COULD not be FOUND" << std::endl;
- else {
- std::vector<boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> > *> children;
- node->all_children(children);
- int n2= children.size()+1;
- data_size += n2;
- }
- }
- }
- }
-
- // allocate data array
- auto* data_arr=new boxm2_data_traits<BOXM2_MOG3_GREY>::datatype[data_size];
- auto* num_obs_arr=new boxm2_data_traits<BOXM2_NUM_OBS>::datatype[data_size];
- auto* alpha_arr = new float[data_size];
-
- // divide the blocks
- int data_idx=0;
- boxm2_array_3d<boxm2_block::uchar16> trees = new_block.trees_copy();
- for (unsigned z=0; z<dim; z++) {
- for (unsigned y=0; y<dim; y++) {
- for (unsigned x=0; x<dim; x++) {
- double cell_dim=1./dim;
- double p[3];
- p[0] = x*cell_dim;
- p[1] = y*cell_dim;
- p[2] = z*cell_dim;
- vgl_box_3d<double> cell_bb(p, cell_dim, cell_dim, cell_dim, vgl_box_3d<double>::min_pos);
- boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> >* node = tree->locate_point_at_level(cell_bb.centroid(),3);
- if (!node)
- std::cout << "The node COULD not be FOUND" << std::endl;
- else {
- std::vector<boct_tree_cell<short,boxm_sample<BOXM_APM_MOG_GREY> > *> children;
- node->all_children(children);
- int n2= children.size()+1;
-
- boct_bit_tree* bit_tree;
- convert_to_bittree(node, bit_tree);
- int n1=bit_tree->num_cells();
- int start=data_idx;
- convert_data(node, alpha_arr, data_arr, num_obs_arr, data_idx);
- // set the data index at the tree
- bit_tree->set_data_ptr(start, false);
- // set the tree at the block
- boxm2_block::uchar16& t=trees[x][y][z];
- t.set(bit_tree->get_bits());
- if (n1 != n2) {
- std::cout << x << ',' << y << ',' << z << '\n'
- << "ERROR! The converted tree is not right, should have " << n1 << " nodes instead of " << n2 << std::endl;
- }
- }
- }
- }
- }
- new_block.set_trees(trees);
- char* b1 = reinterpret_cast<char *>(alpha_arr);
- boxm2_data<BOXM2_ALPHA> *alpha_data=new boxm2_data<BOXM2_ALPHA>(b1,data_size*sizeof(float),block_id);
- char* b2 = reinterpret_cast<char *>(data_arr);
- boxm2_data<BOXM2_MOG3_GREY> *mog_data=new boxm2_data<BOXM2_MOG3_GREY>(b2,data_size*sizeof(boxm2_data_traits<BOXM2_MOG3_GREY>::datatype),block_id);
- char* b3 = reinterpret_cast<char *>(num_obs_arr);
- boxm2_data<BOXM2_NUM_OBS> *num_data=new boxm2_data<BOXM2_NUM_OBS>(b3,data_size*sizeof(boxm2_data_traits<BOXM2_NUM_OBS>::datatype),block_id);
-
- boxm2_sio_mgr::save_block(new_scene.data_path(), &new_block);
- boxm2_sio_mgr::save_block_data(new_scene.data_path(), block_id, alpha_data);
- boxm2_sio_mgr::save_block_data(new_scene.data_path(), block_id, mog_data);
- boxm2_sio_mgr::save_block_data(new_scene.data_path(), block_id, num_data);
-
- delete [] alpha_arr;
- delete [] data_arr;
- delete [] num_obs_arr;
- iter++;
- }
- new_scene.set_blocks(new_blocks);
- new_scene.save_scene();
- }
-}
diff --git a/contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.h b/contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.h
deleted file mode 100644
index 6f15345854..0000000000
--- a/contrib/brl/bseg/boxm_bridge/boxm_to_boxm2.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef boxm_to_boxm2_h_
-#define boxm_to_boxm2_h_
-//:
-// \file
-
-#include <boct/boct_tree.h>
-#include <boct/boct_bit_tree.h>
-#include <boxm2/boxm2_data.h>
-#include <boxm2/boxm2_data_traits.h>
-#include <boxm/sample/boxm_sample.h>
-
-//: extracts the parameters of a boxm_sample for boxm2 representation
-void deconstruct_sample(boxm_sample<BOXM_APM_MOG_GREY> sample,
- float &alpha,
- boxm2_data_traits<BOXM2_MOG3_GREY>::datatype& data,
- boxm2_data_traits<BOXM2_NUM_OBS>::datatype& num_obs);
-
-//: extracts the tree cell's data into an array format for boxm2 representation
-template <class T_loc, class T_data>
-void convert_data(boct_tree_cell<T_loc,T_data>* tree_cell,
- float* alpha,
- boxm2_data_traits<BOXM2_MOG3_GREY>::datatype* data,
- boxm2_data_traits<BOXM2_NUM_OBS>::datatype* num_obs,
- int& data_idx);
-
-//: converts the boct_octree to bit tree representation
-template <class T_loc, class T_data>
-void convert_to_bittree(boct_tree_cell<T_loc,T_data>* tree_cell, boct_bit_tree*& bit_tree);
-
-#endif // boxm_to_boxm2_h_
diff --git a/contrib/brl/bseg/boxm_bridge/tests/CMakeLists.txt b/contrib/brl/bseg/boxm_bridge/tests/CMakeLists.txt
deleted file mode 100644
index 62cccc7c6f..0000000000
--- a/contrib/brl/bseg/boxm_bridge/tests/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-add_executable( boxm_bridge_test_include test_include.cxx )
-target_link_libraries( boxm_bridge_test_include boxm)
diff --git a/contrib/brl/bseg/boxm_bridge/tests/test_include.cxx b/contrib/brl/bseg/boxm_bridge/tests/test_include.cxx
deleted file mode 100644
index ee10496c92..0000000000
--- a/contrib/brl/bseg/boxm_bridge/tests/test_include.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <boxm_bridge/boxm2_to_boxm.h>
-#include <boxm_bridge/boxm_to_boxm2.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/bvpl/CMakeLists.txt b/contrib/brl/bseg/bvpl/CMakeLists.txt
index 424ed5bf50..2593480038 100644
--- a/contrib/brl/bseg/bvpl/CMakeLists.txt
+++ b/contrib/brl/bseg/bvpl/CMakeLists.txt
@@ -24,7 +24,6 @@ target_link_libraries(bvpl bvpl_kernels bvpl_functors bvxm_grid bdgl bsta ${VXL_
add_subdirectory(pro)
add_subdirectory(util)
-add_subdirectory(bvpl_octree)
add_subdirectory(kernels)
add_subdirectory(functors)
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/CMakeLists.txt
deleted file mode 100644
index 1f390f966c..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/CMakeLists.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-# This is contrib/brl/bseg/bvpl/bvpl_octree/CMakeLists.txt
-# Brown Voxel Processing library for octrees
-
-FIND_PACKAGE(EXPAT REQUIRED)
-FIND_PACKAGE(EXPATPP REQUIRED)
-
-#option( VXL_FORCE_V3P_RPLY "Use v3p ply library" YES)
-#mark_as_advanced( VXL_FORCE_V3P_RPLY )
-
-if(EXPAT_FOUND)
-
-find_package( Threads )
-
-#vxl_configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/bvpl_octree_config.h.in
-# ${CMAKE_CURRENT_BINARY_DIR}/bvpl_octree_config.h include/vxl/contrib/brl/bseg/bvpl/bvpl_octree)
-
-include_directories( ${EXPAT_INCLUDE_DIR} )
-include_directories( ${BRL_INCLUDE_DIR}/bseg/boct )
-include_directories( ${BRL_INCLUDE_DIR}/bseg/boxm )
-include_directories( ${BRL_INCLUDE_DIR}/bseg/bvpl )
-include_directories( ${BRL_INCLUDE_DIR}/b3p/expatpp )
-
-set(bvpl_octree_sources
- bvpl_octree_kernel_operator.h
- bvpl_octree_vector_operator.h
- bvpl_scene_kernel_operator.h
- bvpl_scene_vector_operator.h
- bvpl_block_kernel_operator.h
- bvpl_block_vector_operator.h
- bvpl_octree_vrml_util.h
- bvpl_cell_data_traits.h
- bvpl_octree_neighbors.h
- bvpl_scene_neighborhood_operator.h bvpl_scene_neighborhood_operator.cxx
- bvpl_scene_statistics.h bvpl_scene_statistics.cxx
- bvpl_discover_pca_kernels.h bvpl_discover_pca_kernels.cxx
- bvpl_pca_error_scenes.h bvpl_pca_error_scenes.cxx
- bvpl_global_pca.h bvpl_global_pca.hxx
- bvpl_taylor_scenes_map.h bvpl_taylor_scenes_map.cxx
- bvpl_taylor_basis.h bvpl_taylor_basis.cxx
- bvpl_global_taylor.h bvpl_global_taylor.hxx bvpl_global_taylor.cxx
- bvpl_global_corners.h bvpl_global_corners.cxx
- bvpl_corner_detector.h
- bvpl_corner_functors.h
- bvpl_gauss3D_steerable_filters.h bvpl_gauss3D_steerable_filters.cxx
- )
-
-aux_source_directory(Templates bvpl_octree_sources)
-
-vxl_add_library(LIBRARY_NAME bvpl_octree LIBRARY_SOURCES ${bvpl_octree_sources})
-target_link_libraries(bvpl_octree bvpl_kernels bvpl_functors bvpl_octree_sample bvrml boxm boct ${VXL_LIB_PREFIX}vnl_algo ${VXL_LIB_PREFIX}vnl_io ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl)
-
-#Binary io
-add_subdirectory(io)
-
-#Directory with python/c++ processes
-add_subdirectory(pro)
-
-# Octree samples needed by bvpl
-add_subdirectory(sample)
-
-if( BUILD_TESTING )
- add_subdirectory(tests)
-endif()
-
-if( CMAKE_USE_PTHREADS_INIT )
- add_definitions(-DBVPL_OCTREE_HAS_PTHREADS=1)
- set_target_properties(bvpl_octree PROPERTIES COMPILE_FLAGS -pthread)
- target_link_libraries(bvpl_octree pthread)
-endif()
-
-endif()
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1---.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1---.cxx
deleted file mode 100644
index 067773b3d9..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1---.cxx
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.hxx>
-#include <bsta/bsta_gauss_sf1.h>
-#include <bsta/io/bsta_io_attributes.h>
-#include <bsta/io/bsta_io_gaussian_sphere.h>
-#include <boct/boct_tree.hxx>
-#include <boct/boct_tree_cell.hxx>
-
-typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
-
-BOCT_TREE_INSTANTIATE(short, bvpl_octree_sample<gauss_type>);
-BOCT_TREE_CELL_INSTANTIATE(short, bvpl_octree_sample<gauss_type>);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_octree_sample+float--.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_octree_sample+float--.cxx
deleted file mode 100644
index a5900cfb6b..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_octree_sample+float--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.h>
-#include <boct/boct_tree.hxx>
-#include <boct/boct_tree_cell.hxx>
-
-BOCT_TREE_INSTANTIATE(short, bvpl_octree_sample<float>);
-BOCT_TREE_CELL_INSTANTIATE(short, bvpl_octree_sample<float>);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_pca_basis_sample+10--.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_pca_basis_sample+10--.cxx
deleted file mode 100644
index 7c2f63355a..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_pca_basis_sample+10--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.h>
-#include <boct/boct_tree.hxx>
-#include <boct/boct_tree_cell.hxx>
-
-BOCT_TREE_INSTANTIATE(short, bvpl_pca_basis_sample<10>);
-BOCT_TREE_CELL_INSTANTIATE(short, bvpl_pca_basis_sample<10>);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_taylor_basis2_sample-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_taylor_basis2_sample-.cxx
deleted file mode 100644
index 81366222a6..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boct_tree+short.bvpl_taylor_basis2_sample-.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <boct/boct_tree.hxx>
-#include <boct/boct_tree_cell.hxx>
-#include <bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.h>
-
-BOCT_TREE_INSTANTIATE(short, bvpl_taylor_basis2_sample);
-BOCT_TREE_CELL_INSTANTIATE(short, bvpl_taylor_basis2_sample);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1----.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1----.cxx
deleted file mode 100644
index 7cad8969f8..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1----.cxx
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <iostream>
-#include <string>
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.h>
-#include <boct/boct_tree.h>
-#include <boxm/boxm_block.hxx>
-#include <boxm/boxm_scene.hxx>
-#include <vbl/vbl_array_3d.hxx>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_gauss_sf1.h>
-
-typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
-typedef boct_tree<short, bvpl_octree_sample< gauss_type> > tree_type;
-
-BOXM_BLOCK_INSTANTIATE(tree_type);
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
-BOXM_SCENE_INSTANTIATE(tree_type);
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type> *);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_octree_sample+float---.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_octree_sample+float---.cxx
deleted file mode 100644
index 8a135d4e05..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_octree_sample+float---.cxx
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <iostream>
-#include <string>
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.h>
-#include <boct/boct_tree.h>
-#include <boxm/boxm_block.hxx>
-#include <boxm/boxm_scene.hxx>
-#include <vbl/vbl_array_3d.hxx>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-typedef boct_tree<short, bvpl_octree_sample<float> > tree_type;
-
-BOXM_BLOCK_INSTANTIATE(tree_type);
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
-BOXM_SCENE_INSTANTIATE(tree_type);
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type> *);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_pca_basis_sample+10---.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_pca_basis_sample+10---.cxx
deleted file mode 100644
index fcc60090f2..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_pca_basis_sample+10---.cxx
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.h>
-#include <boxm/boxm_block.hxx>
-#include <boxm/boxm_scene.hxx>
-#include <vbl/vbl_array_3d.hxx>
-
-typedef boct_tree<short, bvpl_pca_basis_sample<10> > tree_type;
-
-BOXM_BLOCK_INSTANTIATE(tree_type);
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
-BOXM_SCENE_INSTANTIATE(tree_type);
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type> *);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_taylor_basis2_sample--.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_taylor_basis2_sample--.cxx
deleted file mode 100644
index d4d340f12d..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/boxm_block+boct_tree+short.bvpl_taylor_basis2_sample--.cxx
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <boct/boct_tree.h>
-#include <boxm/boxm_block.hxx>
-#include <boxm/boxm_scene.hxx>
-#include <bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.h>
-#include <vbl/vbl_array_3d.hxx>
-
-typedef boct_tree<short, bvpl_taylor_basis2_sample> tree_type;
-
-BOXM_BLOCK_INSTANTIATE(tree_type);
-BOXM_BLOCK_ITERATOR_INSTANTIATE(tree_type);
-BOXM_SCENE_INSTANTIATE(tree_type);
-VBL_ARRAY_3D_INSTANTIATE(boxm_block<tree_type> *);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_pca+125-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_pca+125-.cxx
deleted file mode 100644
index cafd0cfaf7..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_pca+125-.cxx
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <bvpl/bvpl_octree/bvpl_global_pca.hxx>
-BVPL_GLOBAL_PCA(125);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_taylor+double.10-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_taylor+double.10-.cxx
deleted file mode 100644
index 9e815605e3..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_taylor+double.10-.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <bvpl_octree/bvpl_global_taylor.hxx>
-
-BVPL_GLOBAL_TAYLOR_INSTANTIATE(double, 10);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_taylor+float.3-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_taylor+float.3-.cxx
deleted file mode 100644
index b8312f8e7e..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/bvpl_global_taylor+float.3-.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <bvpl_octree/bvpl_global_taylor.hxx>
-
-BVPL_GLOBAL_TAYLOR_INSTANTIATE(float, 3);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_discover_pca_kernels-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_discover_pca_kernels-.cxx
deleted file mode 100644
index e32ee1303b..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_discover_pca_kernels-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <bvpl/bvpl_octree/bvpl_discover_pca_kernels.h>
-#include <vbl/vbl_smart_ptr.hxx>
-
-VBL_SMART_PTR_INSTANTIATE(bvpl_discover_pca_kernels);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_corners-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_corners-.cxx
deleted file mode 100644
index 1bf245a9f9..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_corners-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <bvpl/bvpl_octree/bvpl_global_corners.h>
-#include <vbl/vbl_smart_ptr.hxx>
-
-VBL_SMART_PTR_INSTANTIATE(bvpl_global_corners);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_pca+125--.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_pca+125--.cxx
deleted file mode 100644
index ff5175103e..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_pca+125--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <bvpl/bvpl_octree/bvpl_global_pca.h>
-#include <vbl/vbl_smart_ptr.hxx>
-
-typedef bvpl_global_pca<125> bvpl_global_pca_125;
-VBL_SMART_PTR_INSTANTIATE(bvpl_global_pca_125);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_taylor+double.10--.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_taylor+double.10--.cxx
deleted file mode 100644
index 254b91e81f..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_global_taylor+double.10--.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <bvpl/bvpl_octree/bvpl_global_taylor.h>
-#include <vbl/vbl_smart_ptr.hxx>
-
-typedef bvpl_global_taylor<double,10> gt;
-VBL_SMART_PTR_INSTANTIATE(gt);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_pca_error_scenes-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_pca_error_scenes-.cxx
deleted file mode 100644
index a13ebae610..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_pca_error_scenes-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <bvpl/bvpl_octree/bvpl_pca_error_scenes.h>
-#include <vbl/vbl_smart_ptr.hxx>
-
-VBL_SMART_PTR_INSTANTIATE(bvpl_pca_error_scenes);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_taylor_scenes_map-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_taylor_scenes_map-.cxx
deleted file mode 100644
index 07c500d5bb..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vbl_smart_ptr+bvpl_taylor_scenes_map-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <bvpl/bvpl_octree/bvpl_taylor_basis.h>
-#include <vbl/vbl_smart_ptr.hxx>
-
-VBL_SMART_PTR_INSTANTIATE(bvpl_taylor_scenes_map);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vnl_matrix_fixed+double.125.125-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vnl_matrix_fixed+double.125.125-.cxx
deleted file mode 100644
index e15416cdba..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/Templates/vnl_matrix_fixed+double.125.125-.cxx
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <vnl/vnl_matrix_fixed.hxx>
-VNL_MATRIX_FIXED_INSTANTIATE(double,125,125);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_block_kernel_operator.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_block_kernel_operator.h
deleted file mode 100644
index ec59fe4893..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_block_kernel_operator.h
+++ /dev/null
@@ -1,134 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_block_kernel_operator.h
-#ifndef bvpl_block_kernel_operator_h
-#define bvpl_block_kernel_operator_h
-
-//:
-// \file
-// \brief A class operates a kernel on a boxm_block
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 1-Feb-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-
-#include <iostream>
-#include <bvpl/kernels/bvpl_kernel.h>
-#include <boxm/boxm_scene.h>
-#include "bvpl_octree_kernel_operator.h"
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-//: A class which operates a kernel on a boxm_block.
-// This class differes from bvpl_octree_kernel_operator in that it loads neighbor block to process blocks appropriately.
-// This class is useful to run multithreading processes
-class bvpl_block_kernel_operator
-{
- public:
- //: "Convolves" kernel with an input octree, storing the output in an output octree.
- // This function only iterate through leaf_cells at level 0;
- template<class T_data, class F>
- void operate(boxm_scene<boct_tree<short, T_data > > &scene_in,
- F functor,
- bvpl_kernel_sptr kernel,
- unsigned i, unsigned j, unsigned k,
- boxm_scene<boct_tree<short, T_data > > &scene_out,
- boxm_scene<boct_tree<short, bool> > &valid_scene, double cell_length);
-};
-
-//: Operates a kernel on a scene by : (1)Traverse input scene and for every leaf cell, (2) request a region around it, and (3) apply the functor
-template<class T_data, class F>
-void bvpl_block_kernel_operator::operate(boxm_scene<boct_tree<short, T_data > > &scene_in,
- F functor,
- bvpl_kernel_sptr kernel,
- unsigned block_i, unsigned block_j, unsigned block_k,
- boxm_scene<boct_tree<short, T_data > > &scene_out,
- boxm_scene<boct_tree<short, bool> > &valid_scene, double cell_length)
-{
- typedef boct_tree<short, T_data> tree_type;
- typedef boct_tree_cell<short,T_data> cell_type;
-
- std::cout << "bvpl_block_kernel_operator: Operating on cells of length: " << cell_length << std::endl;
-
- //scene_in.clone_blocks(scene_out, T_data());
-
- // Load input and output blocks
- scene_in.load_block_and_neighbors(block_i,block_j,block_k);
- scene_out.load_block(block_i,block_j,block_k);
- valid_scene.load_block(block_i,block_j,block_k);
-
-
- tree_type *tree_in = scene_in.get_block(block_i, block_j, block_k)->get_tree();
- tree_type *tree_out = tree_in->clone();
- boct_tree<short, bool> *valid_tree = tree_in->template clone_to_type<bool>();
-
- std::vector<cell_type* > cells_in = tree_in->leaf_cells();
- std::vector<cell_type* > cells_out = tree_out->leaf_cells();
- std::vector<boct_tree_cell<short, bool> * > valid_cells = valid_tree->leaf_cells();
-
- //iterators
- typename std::vector<cell_type* >::iterator it_in = cells_in.begin();
- typename std::vector<cell_type* >::iterator it_out = cells_out.begin();
- typename std::vector<boct_tree_cell<short, bool> * >::iterator valid_it = valid_cells.begin();
- bvpl_kernel_iterator kernel_iter = kernel->iterator();
-
- for (; (it_in!=cells_in.end())&&(it_out!= cells_out.end())&& (valid_it!=valid_cells.end()); it_in++, it_out++, valid_it++)
- {
- boct_tree_cell<short,T_data> *center_cell = *it_in;
- boct_tree_cell<short,T_data> *out_center_cell = *it_out;
- boct_tree_cell<short, bool> *valid_center_cell = *valid_it;
- bool valid = true;
-
-#ifdef DEBUG
- boct_loc_code<short> out_code = out_center_cell->get_code();
- boct_loc_code<short> in_code = center_cell->get_code();
-
- //if level and location code of cells isn't the same then continue
- if ((center_cell->level() != out_center_cell->level()) || !(in_code.isequal(&out_code))){
- std::cerr << " Input and output cells don't have the same structure\n";
- continue;
- }
-#endif
-
- vgl_point_3d<double> center_cell_centroid = tree_in->global_centroid(center_cell);
-
- kernel_iter.begin(); // reset the kernel iterator
- while (!kernel_iter.isDone())
- {
- vgl_point_3d<int> kernel_idx = kernel_iter.index();
-
- vgl_point_3d<double> kernel_cell_centroid(center_cell_centroid.x() + (double)kernel_idx.x()*cell_length,
- center_cell_centroid.y() + (double)kernel_idx.y()*cell_length,
- center_cell_centroid.z() + (double)kernel_idx.z()*cell_length);
-
- boct_tree_cell<short,T_data> *this_cell = scene_in.locate_point_in_memory(kernel_cell_centroid);
-
- if (this_cell) {
- bvpl_kernel_dispatch d = *kernel_iter;
- T_data val = this_cell->data();
- functor.apply(val, d);
- }
- else {
- valid = false;
- break;
- }
-
- ++kernel_iter;
- }
-
- out_center_cell->set_data(functor.result());
- valid_center_cell->set_data(valid);
- }
-
- //write the output block
- std::cout << "Writing scenes\n";
- scene_out.get_block(block_i, block_j, block_k)->init_tree(tree_out);
- scene_out.write_active_block();
- valid_scene.get_block(block_i, block_j, block_k)->init_tree(valid_tree);
- valid_scene.write_active_block();
-}
-
-#endif // bvpl_block_kernel_operator_h
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_block_vector_operator.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_block_vector_operator.h
deleted file mode 100644
index 7c772dbd2f..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_block_vector_operator.h
+++ /dev/null
@@ -1,146 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_block_vector_operator.h
-#ifndef bvpl_block_vector_operator_h
-#define bvpl_block_vector_operator_h
-
-//:
-// \file
-// \brief A class operates a kernel on a boxm_block
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 1-Feb-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-
-#include <iostream>
-#include <bvpl/kernels/bvpl_kernel.h>
-#include <boxm/boxm_scene.h>
-#include "bvpl_octree_kernel_operator.h"
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-//:A class operates a kernel on a boxm_block.
-// This class differes from bvpl_octree_kernel_operator in that it loads neighbor block to process blocks appropriately.
-// This class is useful to run multathreding processes
-class bvpl_block_vector_operator
-{
- public:
- //: "Convolves" kernel with an input octree, storing the output in an output octree.
- // This function only iterate through leaf_cells at level 0;
- template<class T_data_in, class T_data_out,class F, unsigned dim >
- void operate(boxm_scene<boct_tree<short, T_data_in > > &scene_in,
- F functor,
- bvpl_kernel_vector_sptr kernel_vector,
- unsigned block_i, unsigned block_j, unsigned block_k,
- boxm_scene<boct_tree<short, vnl_vector_fixed<T_data_out, dim> > > &scene_out,
- boxm_scene<boct_tree<short, bool> > &valid_scene, double cell_length);
-};
-
-//: Operates a kernel on a scene by : (1)Traverse input scene and for every leaf cell, (2) request a region around it, and (3) apply the functor
-template<class T_data_in, class T_data_out,class F, unsigned dim >
-void bvpl_block_vector_operator::operate(boxm_scene<boct_tree<short, T_data_in > > &scene_in,
- F functor,
- bvpl_kernel_vector_sptr kernel_vector,
- unsigned block_i, unsigned block_j, unsigned block_k,
- boxm_scene<boct_tree<short, vnl_vector_fixed<T_data_out, dim> > > &scene_out,
- boxm_scene<boct_tree<short, bool> > &valid_scene, double cell_length)
-{
- if (kernel_vector->size()!=dim) {
- std::cout << "Error in bvpl_block_vector_operator::operate ---> size missmatch\n";
- return;
- }
-
- typedef boct_tree<short, T_data_in> tree_type_in;
- typedef boct_tree_cell<short,T_data_in> cell_type_in;
-
- typedef boct_tree<short, vnl_vector_fixed<T_data_out, dim> > tree_type_out;
- typedef boct_tree_cell<short, vnl_vector_fixed<T_data_out, dim> > cell_type_out;
-
- std::cout << "bvpl_block_kernel_operator: Operating on cells of length: " << cell_length << std::endl;
-
- // Load input and output blocks
- scene_in.load_block_and_neighbors(block_i,block_j,block_k);
- scene_out.load_block(block_i,block_j,block_k);
- valid_scene.load_block(block_i,block_j,block_k);
-
-
- tree_type_in *tree_in = scene_in.get_block(block_i, block_j, block_k)->get_tree();
- tree_type_out *tree_out = tree_in->template clone_to_type<vnl_vector_fixed<T_data_out, dim> >();
- boct_tree<short, bool> *valid_tree = tree_in->template clone_to_type<bool>();
-
- std::vector<cell_type_in* > cells_in = tree_in->leaf_cells();
- std::vector<cell_type_out* > cells_out = tree_out->leaf_cells();
- std::vector<boct_tree_cell<short, bool> * > valid_cells = valid_tree->leaf_cells();
-
- //iterators
- typename std::vector<cell_type_in* >::iterator it_in = cells_in.begin();
- typename std::vector<cell_type_out* >::iterator it_out = cells_out.begin();
- typename std::vector<boct_tree_cell<short, bool> * >::iterator valid_it = valid_cells.begin();
-
- for (; (it_in!=cells_in.end())&&(it_out!= cells_out.end() && (valid_it!=valid_cells.end())); ++it_in, ++it_out, ++valid_it)
- {
- cell_type_in *center_cell = *it_in;
- cell_type_out *out_center_cell = *it_out;
- boct_tree_cell<short, bool> *valid_center_cell = *valid_it;
- bool valid = true;
-
-#ifdef DEBUG
- boct_loc_code<short> out_code = out_center_cell->get_code();
- boct_loc_code<short> in_code = center_cell->get_code();
-
- //if level and location code of cells isn't the same then continue
- if ((center_cell->level() != out_center_cell->level()) || !(in_code.isequal(&out_code))){
- std::cerr << " Input and output cells don't have the same structure\n";
- continue;
- }
-#endif
-
- vgl_point_3d<double> center_cell_centroid = tree_in->global_centroid(center_cell);
-
- vnl_vector_fixed<T_data_out, dim> responses;
-
- for (unsigned k=0; k< kernel_vector->kernels_.size(); ++k)
- {
- bvpl_kernel_sptr kernel = kernel_vector->kernels_[k];
- bvpl_kernel_iterator kernel_iter = kernel->iterator();
- kernel_iter.begin(); // reset the kernel iterator
- while (!kernel_iter.isDone())
- {
- vgl_point_3d<int> kernel_idx = kernel_iter.index();
-
- vgl_point_3d<double> kernel_cell_centroid(center_cell_centroid.x() + (double)kernel_idx.x()*cell_length,
- center_cell_centroid.y() + (double)kernel_idx.y()*cell_length,
- center_cell_centroid.z() + (double)kernel_idx.z()*cell_length);
-
- boct_tree_cell<short,T_data_in> *this_cell = scene_in.locate_point_in_memory(kernel_cell_centroid);
-
- if (this_cell) {
- bvpl_kernel_dispatch d = *kernel_iter;
- T_data_in val =(T_data_in)this_cell->data();
- functor.apply(val, d);
- }
- else {
- valid = false;
- break;
- }
-
- ++kernel_iter;
- }
- responses[k] = (T_data_out)(functor.result());
- }
-
- out_center_cell->set_data(responses);
- valid_center_cell->set_data(valid);
- }
-
- //write the output block
- scene_out.get_block(block_i, block_j, block_k)->init_tree(tree_out);
- scene_out.write_active_block();
- valid_scene.get_block(block_i, block_j, block_k)->init_tree(valid_tree);
- valid_scene.write_active_block();
-}
-
-#endif // bvpl_block_vector_operator_h
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_cell_data_traits.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_cell_data_traits.h
deleted file mode 100644
index 7f28fa9bef..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_cell_data_traits.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_cell_data_traits.h
-#ifndef bvpl_cell_data_traits_h
-#define bvpl_cell_data_traits_h
-//:
-// \file
-// \brief Set of accessors of cell's data, taking care of different datatypes
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date Dec 16, 2009
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.h>
-#include <boct/boct_tree_cell.h>
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_gauss_sf1.h>
-
-//: Float to float
-template <class T_loc>
-float bvpl_cell_to_float(boct_tree_cell<T_loc, bvpl_octree_sample<float> >* cell)
-{
- return cell->data().response_;
-}
-
-//: Mixture of gaussians to float; return the mean
-template <class T_loc>
-float bvpl_cell_to_float(boct_tree_cell<T_loc, bvpl_octree_sample<bsta_num_obs<bsta_gauss_sf1> > >* cell)
-{
- return cell->data().response_.mean();
-}
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_corner_detector.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_corner_detector.h
deleted file mode 100644
index e3988f369f..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_corner_detector.h
+++ /dev/null
@@ -1,299 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_corner_detector.h
-#ifndef bvpl_corner_detector_h
-#define bvpl_corner_detector_h
-//:
-// \file
-// \brief A class to detect 3d Harris corners, based on the 2nd moment matrix
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 20-Jul-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <boxm/boxm_scene.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vnl/vnl_double_3x3.h>
-#include <vnl/algo/vnl_determinant.h>
-
-class bvpl_corner_detector
-{
- public:
- //: Detects Harris features kernel with an input octree
- // However, features below the Harris threshold are set as invalid in the valid_scene (in place)
- // The type of measure used, depends on the functor.
- template<class T_data, class F>
- void detect_and_threshold( boxm_scene<boct_tree<short, T_data > > *scene_in,
- F harris_functor,
- vgl_point_3d<int> min_neigborhood_idx,
- vgl_point_3d<int> max_neigborhood_idx,
- unsigned block_i, unsigned block_j, unsigned block_k,
- boxm_scene<boct_tree<short, bool> > *valid_scene,
- boxm_scene<boct_tree<short, float> > *corner_scene,
- double cell_length);
-
- //: Computes the corner measure and stores it in "corner_scene"
- // Input scene and auxiliary valid scene are not modified
- template<class T_data, class F>
- void compute_C( boxm_scene<boct_tree<short, T_data > > *scene_in,
- F harris_functor,
- vgl_point_3d<int> min_neigborhood_idx,
- vgl_point_3d<int> max_neigborhood_idx,
- unsigned block_i, unsigned block_j, unsigned block_k,
- boxm_scene<boct_tree<short, bool> > *valid_scene,
- boxm_scene<boct_tree<short, float> > *corner_scene,
- double cell_length);
-
- //: Compute the determinant of the hessian
- template<class T_data>
- void compute_det_H(boxm_scene<boct_tree<short, T_data > > *scene_in,
- unsigned block_i, unsigned block_j, unsigned block_k,
- boxm_scene<boct_tree<short, bool> > *valid_scene,
- boxm_scene<boct_tree<short, float> > *corner_scene);
-};
-
-
-template<class T_data, class F>
-void bvpl_corner_detector::detect_and_threshold( boxm_scene<boct_tree<short, T_data > > *scene_in,
- F harris_functor,
- vgl_point_3d<int> min_neigborhood_idx,
- vgl_point_3d<int> max_neigborhood_idx,
- unsigned block_i, unsigned block_j, unsigned block_k,
- boxm_scene<boct_tree<short, bool> > *valid_scene,
- boxm_scene<boct_tree<short, float> > *corner_scene,
- double cell_length)
-{
- typedef boct_tree<short, T_data> tree_type;
- typedef boct_tree_cell<short,T_data> cell_type;
-
- std::cout << "bvpl_block_kernel_operator: Operating on cells of length: " << cell_length << std::endl;
-
- // Load input and output blocks
- scene_in->load_block_and_neighbors(block_i,block_j,block_k);
- valid_scene->load_block(block_i,block_j,block_k);
- corner_scene->load_block(block_i,block_j,block_k);
-
- tree_type *tree_in = scene_in->get_block(block_i, block_j, block_k)->get_tree();
- boct_tree<short, bool> *valid_tree = valid_scene->get_block(block_i, block_j, block_k)->get_tree();
- boct_tree<short, float> *corner_tree = tree_in->template clone_to_type<float>();
- corner_tree->init_cells(0.0f);
-
- std::vector<cell_type* > cells_in = tree_in->leaf_cells();
- std::vector<boct_tree_cell<short, bool> * > valid_cells = valid_tree->leaf_cells();
- std::vector<boct_tree_cell<short, float> * > corner_cells = corner_tree->leaf_cells();
-
- //iterators
- typename std::vector<cell_type* >::iterator it_in = cells_in.begin();
- std::vector<boct_tree_cell<short, bool> * >::iterator valid_it = valid_cells.begin();
- std::vector<boct_tree_cell<short, float> * >::iterator corner_it = corner_cells.begin();
-
- unsigned long n_fail = 0;
-
- for (; (it_in!=cells_in.end())&& (valid_it!=valid_cells.end()) && (corner_it!=corner_cells.end()); it_in++, valid_it++, corner_it++)
- {
- boct_tree_cell<short,T_data> *center_cell = *it_in;
- boct_tree_cell<short, bool> *valid_center_cell = *valid_it;
- boct_tree_cell<short, float> *corner_center_cell = *corner_it;
-
- if (!valid_center_cell->data()) {
- continue;
- }
-#if 0
- boct_loc_code<short> in_code = center_cell->get_code();
-
- //if level and location code of cells isn't the same then continue
- if ((center_cell->level() != out_center_cell->level()) || !(in_code.isequal(&out_code))) {
- std::cerr << " Input and output cells don't have the same structure\n";
- continue;
- }
-#endif
-
- vgl_point_3d<double> center_cell_centroid = tree_in->global_centroid(center_cell);
-
- for (int k = min_neigborhood_idx.z(); k <= max_neigborhood_idx.z(); k++)
- for (int j = min_neigborhood_idx.y(); j <= max_neigborhood_idx.y(); j++)
- for (int i = min_neigborhood_idx.x(); i <= max_neigborhood_idx.x(); i++)
- {
- vgl_point_3d<int> neighbor_cell_idx(i, j, k);
-
- vgl_point_3d<double> neighbor_cell_centroid(center_cell_centroid.x() + ((double)neighbor_cell_idx.x())*cell_length,
- center_cell_centroid.y() + ((double)neighbor_cell_idx.y())*cell_length,
- center_cell_centroid.z() + ((double)neighbor_cell_idx.z())*cell_length);
-
- boct_tree_cell<short,T_data> *this_cell = scene_in->locate_point_in_memory(neighbor_cell_centroid);
-
- if (this_cell) {
- harris_functor.apply(this_cell->data());
- }
- else
- break;
- }
-
- double C = 0;
- if (!harris_functor.result(C)) {
- valid_center_cell->set_data(false);
- ++n_fail;
- }
- corner_center_cell->set_data(float(C));
- }
-
- std::cout << "Number of Harris fails: " << n_fail << std::endl;
- //write the output block
- valid_scene->get_block(block_i, block_j, block_k)->init_tree(valid_tree);
- valid_scene->write_active_block();
- corner_scene->get_block(block_i, block_j, block_k)->init_tree(corner_tree);
- corner_scene->write_active_block();
-}
-
-template<class T_data, class F>
-void bvpl_corner_detector::compute_C( boxm_scene<boct_tree<short, T_data > > *scene_in,
- F harris_functor,
- vgl_point_3d<int> min_neigborhood_idx,
- vgl_point_3d<int> max_neigborhood_idx,
- unsigned block_i, unsigned block_j, unsigned block_k,
- boxm_scene<boct_tree<short, bool> > *valid_scene,
- boxm_scene<boct_tree<short, float> > *corner_scene,
- double cell_length)
-{
- typedef boct_tree<short, T_data> tree_type;
- typedef boct_tree_cell<short,T_data> cell_type;
-
- std::cout << "bvpl_block_kernel_operator: Operating on cells of length: " << cell_length << std::endl;
-
- // Load input and output blocks
- scene_in->load_block_and_neighbors(block_i,block_j,block_k);
- valid_scene->load_block(block_i,block_j,block_k);
- corner_scene->load_block(block_i,block_j,block_k);
-
- tree_type *tree_in = scene_in->get_block(block_i, block_j, block_k)->get_tree();
- boct_tree<short, bool> *valid_tree = valid_scene->get_block(block_i, block_j, block_k)->get_tree();
- boct_tree<short, float> *corner_tree = tree_in->template clone_to_type<float>();
- corner_tree->init_cells(0.0f);
-
- std::vector<cell_type* > cells_in = tree_in->leaf_cells();
- std::vector<boct_tree_cell<short, bool> * > valid_cells = valid_tree->leaf_cells();
- std::vector<boct_tree_cell<short, float> * > corner_cells = corner_tree->leaf_cells();
-
- //iterators
- typename std::vector<cell_type* >::iterator it_in = cells_in.begin();
- std::vector<boct_tree_cell<short, bool> * >::iterator valid_it = valid_cells.begin();
- std::vector<boct_tree_cell<short, float> * >::iterator corner_it = corner_cells.begin();
-
- unsigned long n_fail = 0;
-
- for (; (it_in!=cells_in.end())&& (valid_it!=valid_cells.end()) && (corner_it!=corner_cells.end()); it_in++, valid_it++, corner_it++)
- {
- boct_tree_cell<short,T_data> *center_cell = *it_in;
- boct_tree_cell<short, bool> *valid_center_cell = *valid_it;
- boct_tree_cell<short, float> *corner_center_cell = *corner_it;
-
- if (!valid_center_cell->data()) {
- continue;
- }
-#if 0
- boct_loc_code<short> in_code = center_cell->get_code();
-
- //if level and location code of cells isn't the same then continue
- if ((center_cell->level() != out_center_cell->level()) || !(in_code.isequal(&out_code))) {
- std::cerr << " Input and output cells don't have the same structure\n";
- continue;
- }
-#endif
-
- vgl_point_3d<double> center_cell_centroid = tree_in->global_centroid(center_cell);
-
- for (int k = min_neigborhood_idx.z(); k <= max_neigborhood_idx.z(); k++)
- for (int j = min_neigborhood_idx.y(); j <= max_neigborhood_idx.y(); j++)
- for (int i = min_neigborhood_idx.x(); i <= max_neigborhood_idx.x(); i++)
- {
- vgl_point_3d<int> neighbor_cell_idx(i, j, k);
-
- vgl_point_3d<double> neighbor_cell_centroid(center_cell_centroid.x() + ((double)neighbor_cell_idx.x())*cell_length,
- center_cell_centroid.y() + ((double)neighbor_cell_idx.y())*cell_length,
- center_cell_centroid.z() + ((double)neighbor_cell_idx.z())*cell_length);
-
- boct_tree_cell<short,T_data> *this_cell = scene_in->locate_point_in_memory(neighbor_cell_centroid);
-
- if (this_cell) {
- harris_functor.apply(this_cell->data());
- }
- else
- break;
- }
-
- double C = 0;
- harris_functor.result(C);
- corner_center_cell->set_data(float(C));
- }
-
- std::cout << "Number of Harris fails: " << n_fail << std::endl;
- //write the output block
- corner_scene->get_block(block_i, block_j, block_k)->init_tree(corner_tree);
- corner_scene->write_active_block();
-}
-
-
-template<class T_data>
-void bvpl_corner_detector::compute_det_H( boxm_scene<boct_tree<short, T_data > > *scene_in,
- unsigned block_i, unsigned block_j, unsigned block_k,
- boxm_scene<boct_tree<short, bool> > *valid_scene,
- boxm_scene<boct_tree<short, float> > *corner_scene)
-{
- typedef boct_tree<short, T_data> tree_type;
- typedef boct_tree_cell<short,T_data> cell_type;
-
- // Load input and output blocks
- scene_in->load_block_and_neighbors(block_i,block_j,block_k);
- valid_scene->load_block(block_i,block_j,block_k);
- corner_scene->load_block(block_i,block_j,block_k);
-
- tree_type *tree_in = scene_in->get_block(block_i, block_j, block_k)->get_tree();
- boct_tree<short, bool> *valid_tree = valid_scene->get_block(block_i, block_j, block_k)->get_tree();
- boct_tree<short, float> *corner_tree = tree_in->template clone_to_type<float>();
- corner_tree->init_cells(0.0f);
-
- std::vector<cell_type* > cells_in = tree_in->leaf_cells();
- std::vector<boct_tree_cell<short, bool> * > valid_cells = valid_tree->leaf_cells();
- std::vector<boct_tree_cell<short, float> * > corner_cells = corner_tree->leaf_cells();
-
- //iterators
- typename std::vector<cell_type* >::iterator it_in = cells_in.begin();
- std::vector<boct_tree_cell<short, bool> * >::iterator valid_it = valid_cells.begin();
- std::vector<boct_tree_cell<short, float> * >::iterator corner_it = corner_cells.begin();
-
- for (; (it_in!=cells_in.end())&& (valid_it!=valid_cells.end()) && (corner_it!=corner_cells.end()); it_in++, valid_it++, corner_it++)
- {
- boct_tree_cell<short,T_data> *center_cell = *it_in;
- boct_tree_cell<short, bool> *valid_center_cell = *valid_it;
- boct_tree_cell<short, float> *corner_center_cell = *corner_it;
-
- if (!valid_center_cell->data()) {
- continue;
- }
-
- vnl_vector_fixed<double,10> mean_coeff = center_cell->data();
-
- vnl_double_3x3 H;
- H.put(0,0,mean_coeff[4]);
- H.put(0,1,mean_coeff[7]);
- H.put(0,2,mean_coeff[8]);
- H.put(1,0,mean_coeff[7]);
- H.put(1,1,mean_coeff[5]);
- H.put(1,2,mean_coeff[9]);
- H.put(2,0,mean_coeff[8]);
- H.put(2,1,mean_coeff[9]);
- H.put(2,2,mean_coeff[6]);
-
- corner_center_cell->set_data(float(vnl_determinant(H)));
- }
-
- //write the output block
- corner_scene->get_block(block_i, block_j, block_k)->init_tree(corner_tree);
- corner_scene->write_active_block();
-}
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_corner_functors.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_corner_functors.h
deleted file mode 100644
index 85231de3e0..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_corner_functors.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_corner_functors.h
-#ifndef bvpl_corner_functors_h
-#define bvpl_corner_functors_h
-//:
-// \file
-// \brief Set of functors based on Harris measures
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 20-Jul-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <vnl/vnl_double_3x3.h>
-#include <vnl/algo/vnl_determinant.h>
-
-// Functor to threshold on Harris corner measure proposed in:
-// I. Laptev. On space-time interest points. Int. J. Computer Vision, 64(2):107-123, 2005
-class bvpl_harris_laptev_functor
-{
- public:
- bvpl_harris_laptev_functor(double k)
- {
- H_ = vnl_double_3x3(0.0);
- count_ = 0;
- k_ = k;
- }
-
- //: Apply a given operation to value \p val, depending on the dispatch character
- void apply(vnl_vector_fixed<double,10> taylor_coeff)
- {
- vnl_double_3x3 temp_H;
- for (unsigned mi = 0; mi <3; mi++)
- for (unsigned mj = 0; mj <3; mj++)
- temp_H.put(mi,mj, taylor_coeff[mi+1] * taylor_coeff[mj+1]);
-
- H_ = H_ + temp_H;
- count_++;
- }
-
- //: Returns true if the harris threshold is passed, returns by reference the value of the harris ration
- bool result( double &C)
- {
- H_ /= (double)count_;
-
- double trace_H = H_[0][0] + H_[1][1] + H_[2][2];
- bool pass = false;
-
- C = vnl_determinant(H_) - k_*(trace_H * trace_H * trace_H);
-
- if (C >= 1e-7)
- pass = true;
-
- count_ = 0;
- H_.fill(0.0);
-
- return pass;
- }
-
- protected:
-
- vnl_double_3x3 H_;
- unsigned count_;
- double k_;
-};
-
-#endif // bvpl_corner_functors_h
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.cxx
deleted file mode 100644
index a2aa13a8c6..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.cxx
+++ /dev/null
@@ -1,1028 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 8-Nov-2010
-
-#include "bvpl_discover_pca_kernels.h"
-#include <vnl/algo/vnl_symmetric_eigensystem.h>
-#include <bxml/bxml_write.h>
-#include <bxml/bxml_read.h>
-#include <bxml/bxml_find.h>
-#include <boxm/boxm_scene_parser.h>
-#include <cassert>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-bvpl_discover_pca_kernels::bvpl_discover_pca_kernels(const std::string &path)
-{
- std::cout << "Loading pca info from xml-file" << std::endl;
-
- path_out_ = path;
- std::ifstream xml_ifs(xml_path().c_str());
-
- if (!xml_ifs)
- return;
- bxml_document doc = bxml_read(xml_ifs);
- bxml_element query("pca_info");
- bxml_data_sptr root = bxml_find_by_name(doc.root_element(), query);
- if (!root) {
- std::cout << "bvpl_discover_pca_kernels - could not parse xml root\n";
- }
-
- //Parse neighborhood bounding box - units are number of voxels
- bxml_element nbbox_query("neighborhood");
- bxml_data_sptr nbbox_data = bxml_find_by_name(root, nbbox_query);
- auto* nbbox_elm = dynamic_cast<bxml_element*>(nbbox_data.ptr());
- int min_x=0, min_y=0, min_z=0, max_x=0, max_y=0, max_z =0;
- nbbox_elm->get_attribute("min_x", min_x);
- nbbox_elm->get_attribute("min_y", min_y);
- nbbox_elm->get_attribute("min_z", min_z);
- nbbox_elm->get_attribute("max_x", max_x);
- nbbox_elm->get_attribute("max_y", max_y);
- nbbox_elm->get_attribute("max_z", max_z);
-
- nbbox_ = vgl_box_3d<int>(vgl_point_3d<int>(min_x, min_y, min_y), vgl_point_3d<int>(max_x, max_y, max_z));
- std::cout << "Neighborhood: " << nbbox_ << std::endl;
-
- //Parse Number of samples
- bxml_element nsamples_query("samples");
- bxml_data_sptr nsamples_data = bxml_find_by_name(root, nsamples_query);
- auto* nsamples_elm = dynamic_cast<bxml_element*>(nsamples_data.ptr());
- nsamples_elm->get_attribute("nsamples", nsamples_);
- std::cout << "Number of samples: " << nsamples_ << std::endl;
-
- //Parse dimension
- bxml_element dim_query("dimension");
- bxml_data_sptr dim_data = bxml_find_by_name(root, dim_query);
- auto* dim_elm = dynamic_cast<bxml_element*>(dim_data.ptr());
- dim_elm->get_attribute("feature_dim", feature_dim_);
- std::cout << "Feature dimension: " << feature_dim_ << std::endl;
-
- //Parse paths and set matrices
- bxml_element paths_query("paths");
- bxml_data_sptr paths_data = bxml_find_by_name(root, paths_query);
- auto* path_elm = dynamic_cast<bxml_element*>(paths_data.ptr());
-
- int valid = 0;
- std::string ifs_path;
-
- path_elm->get_attribute("pc_path", ifs_path);
- if (ifs_path != pc_path())
- valid = -1;
- else{
- std::ifstream ifs(ifs_path.c_str());
- ifs >> pc_;
- if (pc_.size()!=feature_dim_*feature_dim_)
- valid = -2;
- }
-
- path_elm->get_attribute("weights_path", ifs_path);
- if (ifs_path != weights_path())
- valid = -3;
- else{
- std::ifstream ifs(ifs_path.c_str());
- ifs >> weights_;
- if (weights_.size()!=feature_dim_)
- valid = -4;
- }
-
- path_elm->get_attribute("sample_mean_path", ifs_path);
- if (ifs_path != sample_mean_path())
- valid = -5;
- else
- {
- std::ifstream ifs(ifs_path.c_str());
- ifs >> sample_mean_feature_ ;
- if (sample_mean_feature_.size()!=feature_dim_)
- valid = -6;
- }
-
- path_elm->get_attribute("data_path", ifs_path);
- if (ifs_path != data_path())
- valid = -7;
-
- path_elm->get_attribute("positions_path", ifs_path);
- if (ifs_path != pos_path())
- valid = -8;
-
- path_elm->get_attribute("scene_path", scene_path_);
-
- //load scene
- boxm_scene_parser parser;
- data_scene_base_=new boxm_scene_base();
- data_scene_base_->load_scene(scene_path_, parser);
-
- //cast scene
- auto *scene= new boxm_scene<boct_tree<short, float > >();
- if (data_scene_base_->appearence_model() == BOXM_FLOAT){
- scene->load_scene(parser);
- data_scene_base_ = scene;
- }
-
- path_elm->get_attribute("data_mean_path", ifs_path);
- if (ifs_path != data_mean_path()){
- compute_mean_feature(scene);
- valid = -9;
- std::cout << "bvpl_discover_pca_kernels - errors parsing data_mean_feature.xml\n";
- }
- else
- {
- std::ifstream ifs(ifs_path.c_str());
- ifs >> data_mean_feature_ ;
- if (data_mean_feature_.size()!=feature_dim_)
- valid = -10;
- }
-
- //Parse dimension
- bxml_element cell_length_query("finest_cell_length");
- bxml_data_sptr cell_length_data = bxml_find_by_name(root, cell_length_query);
- auto* cell_length_elm = dynamic_cast<bxml_element*>(cell_length_data.ptr());
- bool has_length = cell_length_elm->get_attribute("length", finest_cell_length_);
- if (!has_length || finest_cell_length_ < 0.0){
- std::cout << "Error: Finest cell length read from file: " << finest_cell_length_ << " has length " << has_length << std::endl;
- finest_cell_length_ = scene->finest_cell_length();
- valid = -11;
- }
- std::cout << "Finest cell length: " << finest_cell_length_ << std::endl;
-
- if (valid<0){
- std::cout << "bvpl_discover_pca_kernels - errors parsing pca_info.xml. Error code: " << valid << std::endl;
- xml_write();
- }
-}
-
-
-//: Set Up the PCA matrix for the given scene
-void bvpl_discover_pca_kernels::set_up_pca_svd(boxm_scene<boct_tree<short,float> > *scene)
-{
- //zero-mean feature matrix
- vnl_matrix<double> M = this->compute_deviation_matrix(scene);
-
- vnl_svd<double> A(M);
-
- //columns of U contain principal components.
- pc_.set_size(feature_dim_, feature_dim_);
- A.U().extract(pc_);
- weights_.set_size(feature_dim_);
- weights_ = A.W().diagonal().extract(feature_dim_);
-
- weights_ = element_product(weights_, weights_);
-
-#ifdef DEBUG
- std::cerr << "Scatter Matix svd" << M*M.transpose() << '\n'
- << "PC Matix SVD:\n Size: " << pc_.size() << '\n' <<pc_ << '\n'
- << "Evals SVD:\nSize: " << weights_.size() << '\n' << weights_ << '\n';
- bvpl_write_pca(path_out_ + "/pca_matrices", M, weights_, pc_);
-#endif
-}
-
-
-//: Set Up the PCA matrix for the given scene
-// This method performs eigen value decomposition on the scatter matrix
-// Use this method when number of samples >> number of dimensions
-void bvpl_discover_pca_kernels::set_up_pca_evd(boxm_scene<boct_tree<short,float> > *scene)
-{
- //zero-mean feature matrix
- vnl_matrix<double> S = this->compute_scatter_matrix(scene);
-
- // Compute eigenvectors(principal components) and values of S
- pc_.set_size(feature_dim_,feature_dim_);
- weights_.set_size(feature_dim_);
-
- vnl_symmetric_eigensystem_compute(S, pc_, weights_);
-
- pc_.fliplr();
- weights_.flip();
-
-#ifdef DEBUG
- std::cerr << "Scatter Matix" << S << '\n'
- << "PC Matix EVD:\n Size: " << pc_.size() << '\n' <<pc_ << '\n'
- << "EVals EVD:\n Size: " << weights_.size() << '\n' <<weights_ << '\n';
- bvpl_write_pca(path_out_ + "/pca_evd", S, weights_, pc_);
-#endif
-}
-
-
-//: Ramndom samples according to octree structure.
-// Sampling is achieved by generating uniform random cell samples.
-// Since there are more cells where the resolution is finer, then these regions get sampled more often
-vnl_matrix<double> bvpl_discover_pca_kernels::compute_scatter_matrix( boxm_scene<boct_tree<short, float> > *scene)
-{
- //init variables
- double scene_ncells = scene->size();
- scene->unload_active_blocks();
- sample_mean_feature_.fill(0.0f);
- vnl_matrix<double> S(feature_dim_, feature_dim_, 0.0f);
- vnl_random rng;
- std::ofstream pos_ofs(pos_path().c_str());
- std::ofstream data_ofs(data_path().c_str());
- data_ofs.precision(15);
-
- // 1. Traverse through the blocks/trees
- boxm_block_iterator<boct_tree<short,float> > it = scene->iterator();
- unsigned long long nfeature = 1;
- for (it.begin(); !it.end(); ++it)
- {
- scene->load_block_and_neighbors(it.index());
- boct_tree<short, float> *tree = (*it)->get_tree();
- assert(tree != nullptr);
-
- //2. Sample cells from this tree. The number of samples from this tree depends on the portion of scene cells that live in this tree
- std::vector<boct_tree_cell<short, float> *> leaf_cells = tree->leaf_cells();
- int tree_ncells = leaf_cells.size();
- auto tree_nsamples = (unsigned long)((float)tree_ncells/scene_ncells*nsamples_);
-#ifdef DEBUG
- std::cout <<"Tree nsamples is: " << tree_nsamples << '\n'
- <<" nsamples is: " << nsamples_ <<std::endl;
-#endif
- for (unsigned i=0; i<tree_nsamples; ++i)
- {
- unsigned long sample = rng.lrand32(tree_ncells-1);
-
- boct_tree_cell<short, float> *center_cell = leaf_cells[sample];
- vgl_point_3d<double> center_cell_centroid = tree->global_centroid(center_cell);
-
- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors
- //convert neighborhood box to scene coordinates
- vgl_point_3d<int> nmin = nbbox_.min_point();
- vgl_point_3d<int> nmax = nbbox_.max_point();
-
- vgl_box_3d<double> roi(finest_cell_length_*(double)nmin.x(),finest_cell_length_*(double)nmin.y(),finest_cell_length_*(double)nmin.z(),
- finest_cell_length_*(double)nmax.x(),finest_cell_length_*(double)nmax.y(),finest_cell_length_*(double)nmax.z());
- roi.set_centroid(center_cell_centroid);
-
- //if neighborhood is not inclusive we would have missing features
- if (!((scene->get_world_bbox()).contains(roi))){
- --i;
- continue;
- }
-
- //3. Assemble neighborhood as a feature-vector
- vnl_vector<double> this_feature(feature_dim_, 0.0f);
-
- unsigned curr_dim = 0;
- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); ++z)
- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); ++y)
- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); ++x)
- {
- vgl_point_3d<double> neighbor_centroid(center_cell_centroid.x() + (double)x*finest_cell_length_,
- center_cell_centroid.y() + (double)y*finest_cell_length_,
- center_cell_centroid.z() + (double)z*finest_cell_length_);
-
- boct_tree_cell<short,float> *neighbor_cell = scene->locate_point_in_memory(neighbor_centroid);
-
- assert(neighbor_cell !=nullptr);
- this_feature[curr_dim] = (double)neighbor_cell->data();
- ++curr_dim;
- }
-
- assert(curr_dim == feature_dim_);
-
- pos_ofs << center_cell_centroid <<'\n' ;
- data_ofs << this_feature << '\n';
-
- //increment weights
- double rho = 1.0/(double)nfeature;
- double rho_comp = 1.0 - rho;
-
- // the difference vector between the sample and the mean
- vnl_vector<double> diff = this_feature - sample_mean_feature_;
-
- //update the covariance
- S += rho_comp*outer_product(diff,diff);
-
- //update the mean
- sample_mean_feature_ += (rho*diff);
-
- ++nfeature;
-#ifdef DEBUG
- std::cerr << "Feature EVD: " <<this_feature << '\n'
- << "Mean Feature EVD: " <<mean_feature << '\n';
-#endif
- }
- } //end of block-loop
-
- pos_ofs.close();
- data_ofs.close();
- std::ofstream mean_ofs(sample_mean_path().c_str());
- mean_ofs.precision(15);
- mean_ofs << sample_mean_feature_;
- mean_ofs.close();
-
- nsamples_ = nfeature-1;
-
- return S;
-}
-
-
-//: Samples according to octree structure.
-// Sampling is achieved by generating uniform random cell samples.
-// Since there are more cells where the resolution is finer, then these regions get sampled more often
-vnl_matrix<double> bvpl_discover_pca_kernels::compute_deviation_matrix( boxm_scene<boct_tree<short, float> > *scene)
-{
- //init variables
- unsigned long scene_ncells = scene->size();
- sample_mean_feature_.fill(0.0f);
- vnl_matrix<double> M(feature_dim_, (unsigned int)nsamples_);
- vnl_random rng(9667566ul);
- std::ofstream pos_ofs(pos_path().c_str());
-
- // 1. Traverse through the blocks/trees
- boxm_block_iterator<boct_tree<short,float> > it = scene->iterator();
- unsigned long feature_col = 0;
- for (it.begin(); !it.end(); ++it)
- {
- scene->load_block_and_neighbors(it.index());
- boct_tree<short, float> *tree = (*it)->get_tree();
- assert(tree != nullptr);
-
- //2. Sample cells from this tree. The number of samples from this tree depends on the portion of scene cells that live in this tree
- std::vector<boct_tree_cell<short, float> *> leaf_cells = tree->leaf_cells();
- int tree_ncells = leaf_cells.size();
- auto tree_nsamples = (unsigned long)(tree_ncells*nsamples_/scene_ncells); // possible overflow ...
-
- for (unsigned int i=0; i<tree_nsamples; ++i)
- {
- unsigned long sample = rng.lrand32(tree_ncells-1);
-
- boct_tree_cell<short, float> *center_cell = leaf_cells[sample];
- vgl_point_3d<double> center_cell_centroid = tree->global_centroid(center_cell);
-
- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors
- //convert neighborhood box to scene coordinates
- vgl_point_3d<int> nmin = nbbox_.min_point();
- vgl_point_3d<int> nmax = nbbox_.max_point();
-
- vgl_box_3d<double> roi(finest_cell_length_*(double)nmin.x(),finest_cell_length_*(double)nmin.y(),finest_cell_length_*(double)nmin.z(),
- finest_cell_length_*(double)nmax.x(),finest_cell_length_*(double)nmax.y(),finest_cell_length_*(double)nmax.z());
- roi.set_centroid(center_cell_centroid);
-
- //if neighborhood is not inclusive we would have missing features
- if (!((scene->get_world_bbox()).contains(roi))){
- --i;
- continue;
- }
-
- //3. Assemble neighborhood as a feature-vector
- vnl_vector<double> this_feature(feature_dim_, 0.0f);
-
- unsigned curr_dim = 0;
- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); ++z)
- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); ++y)
- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); ++x)
- {
- vgl_point_3d<double> neighbor_centroid(center_cell_centroid.x() + (double)x*finest_cell_length_,
- center_cell_centroid.y() + (double)y*finest_cell_length_,
- center_cell_centroid.z() + (double)z*finest_cell_length_);
-
- boct_tree_cell<short,float> *neighbor_cell = scene->locate_point_in_memory(neighbor_centroid);
-
- assert(neighbor_cell !=nullptr);
- this_feature[curr_dim] = (double)neighbor_cell->data();
- ++curr_dim;
- }
-
- assert(curr_dim == feature_dim_);
-
- pos_ofs << center_cell_centroid <<'\n' ;
-
- M.set_column(feature_col,this_feature);
- sample_mean_feature_+=this_feature;
- ++feature_col;
-#ifdef DEBUG
- std::cerr << "Feature SVD: " <<this_feature << '\n'
- << "Mean Feature SVD: " <<mean_feature/(double)feature_col << '\n';
-#endif
- }
- } //end of block-loop
-
- //the actual number of samples is different from desired number of smaples because only integer samples are drawn from each tree
- vnl_matrix<double> F(feature_dim_, feature_col);
-
- M.extract(F);
-
- //4. Normalize feature vector
- sample_mean_feature_/=feature_col;
-#ifdef DEBUG
- std::cerr << "Mean Feature SVD: " <<mean_feature << '\n';
-#endif
- std::ofstream mean_ofs(sample_mean_path().c_str());
- mean_ofs.precision(15);
- mean_ofs << sample_mean_feature_;
- mean_ofs.close();
-
- for (unsigned int j=0; j<feature_col; ++j)
- F.set_column(j,F.get_column(j) - sample_mean_feature_);
-
- return F;
-}
-
-
-//: Project training samples onto pca space and return error as a function of number of components used
-void bvpl_discover_pca_kernels::compute_training_error(vnl_vector<double> &proj_error)
-{
- std::ifstream data_ifs(data_path().c_str());
- std::cerr << data_path() << '\n';
- //a vector to keep projection error - first element refers to error when using only first pc,
- //the sencond elemend, to error when projecting on frist 2 components and so on
- proj_error.set_size(feature_dim_);
- proj_error.fill(0.0);
-
- //For all samples
- for (unsigned long i = 0; i < nsamples_; ++i)
- {
- if (data_ifs.eof())
- continue;
-
- //retrieve the data from file
- vnl_vector<double> norm_feature(feature_dim_, 0.0);
- data_ifs >> norm_feature;
-#ifdef DEBUG
- std::cerr << "Feature: " <<norm_feature << '\n';
-#endif
- norm_feature-=sample_mean_feature_;
-
- //solve for the coefficients
- vnl_vector<double> a(feature_dim_, 0.0);
- a = pc_.transpose() * (norm_feature);
-
- //project as a function of number of components
- for (unsigned c = 0; c < feature_dim_; ++c)
- {
- //reconstruct
- vnl_vector<double> norm_feature_approx = pc_.extract(feature_dim_, c+1) * a.extract(c+1);
- vnl_vector<double> rec_feature = pc_*a;
- //compute error
- proj_error[c]+= (norm_feature - norm_feature_approx).squared_magnitude();
- }
- }
-}
-
-
-//: Project training samples onto pca space and return error as a function of number of components used
-void bvpl_discover_pca_kernels::compute_normalized_training_error(vnl_vector<double> &proj_error)
-{
- theoretical_training_error(proj_error);
- proj_error /= (double)nsamples_;
-}
-
-//: Project training samples onto pca space and return error as a function of number of components used
-void bvpl_discover_pca_kernels::theoretical_training_error(vnl_vector<double> &proj_error)
-{
- //a vector to keep projection error - first element refers to error when using only first pc,
- //the sencond elemend, to error when projecting on frist 2 components and so on
- proj_error.set_size(feature_dim_);
- proj_error.fill(0.0);
-
- for (unsigned i=0; i<weights_.size(); ++i)
- {
- double error = weights_.extract(weights_.size() - (i+1), i+1).sum(); // * 0.5
- proj_error[i] = error;
- }
-}
-
-
-//: Project test samples onto pca space and return error as a function of number of components used
-void bvpl_discover_pca_kernels::compute_testing_error(vnl_vector<double> &proj_error)
-{
- //a vector to keep projection error - first element refers to error when using only first pc,
- //the sencond element, to error when projecting on frist 2 components and so on
- proj_error.set_size(feature_dim_);
- proj_error.fill(0.0);
-
- //cast scene
- auto *scene= dynamic_cast<boxm_scene<boct_tree<short, float > > *> (data_scene_base_.as_pointer());
-
- compute_mean_feature(scene);
-
- //iterate through leaves and arrage as vectors.
- boxm_cell_iterator<boct_tree<short, float > > cell_it = scene->cell_iterator(&boxm_scene<boct_tree<short, float> >::load_block_and_neighbors, true);
- cell_it.begin();
-
- while (!(cell_it.end()))
- {
- //boct_tree_cell<short, float> *center_cell = *cell_it;
- vgl_point_3d<double> center_cell_centroid = cell_it.global_centroid();
-
- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors
- //convert neighborhood box to scene coordinates
- vgl_point_3d<int> nmin = nbbox_.min_point();
- vgl_point_3d<int> nmax = nbbox_.max_point();
-
- vgl_box_3d<double> roi(finest_cell_length_*(double)nmin.x(),finest_cell_length_*(double)nmin.y(),finest_cell_length_*(double)nmin.z(),
- finest_cell_length_*(double)nmax.x(),finest_cell_length_*(double)nmax.y(),finest_cell_length_*(double)nmax.z());
- roi.set_centroid(center_cell_centroid);
-
- //if neighborhood is not inclusive we would have missing features
- if (!((scene->get_world_bbox()).contains(roi))){
- ++cell_it;
- continue;
- }
-
- //3. Assemble neighborhood as a feature-vector
- vnl_vector<double> this_feature(feature_dim_, 0.0f);
-
- unsigned curr_dim = 0;
- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); ++z)
- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); ++y)
- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); ++x)
- {
- vgl_point_3d<double> neighbor_centroid(center_cell_centroid.x() + (double)x*finest_cell_length_,
- center_cell_centroid.y() + (double)y*finest_cell_length_,
- center_cell_centroid.z() + (double)z*finest_cell_length_);
-
- boct_tree_cell<short,float> *neighbor_cell = scene->locate_point_in_memory(neighbor_centroid);
-
- assert(neighbor_cell !=nullptr);
- this_feature[curr_dim] = (double)neighbor_cell->data();
- ++curr_dim;
- }
-
- assert(curr_dim == feature_dim_);
-
- this_feature-=data_mean_feature_;
-
- //solve for the coefficients
- vnl_vector<double> a(feature_dim_, 0.0);
- a = pc_.transpose() * (this_feature);
-
-#ifdef DEBUG
- std::cout <<"This feature is " << this_feature <<std::endl;
-#endif
-
- //project as a function of number of components
- for (unsigned c = 0; c < feature_dim_; ++c)
- {
- //reconstruct
- vnl_vector<double> feature_approx = pc_.extract(feature_dim_, c+1) * a.extract(c+1);
- vnl_vector<double> rec_feature = pc_*a;
-#ifdef DEBUG
- std::cout <<"Feature approx at c = " << c << " is " << feature_approx <<std::endl;
-#endif
- //compute error
- proj_error[c]+= (this_feature - feature_approx).squared_magnitude();
- }
-
- ++cell_it;
- }
-#if 0
- vnl_vector<double> training_error;
- this->theoretical_training_error(training_error);
- proj_error-=training_error;
-#endif
-}
-
-
-//: Reconstructions error on testing samples. By block. Error is given as average error per sample
-void bvpl_discover_pca_kernels::compute_testing_error(const boxm_scene_base_sptr& error_scene_base, unsigned ncomponents,
- int block_i, int block_j, int block_k)
-{
- typedef boct_tree<short,float> float_tree_type;
- typedef boct_tree_cell<short,float> float_cell_type;
-
- //cast the scenes
- auto* data_scene = dynamic_cast<boxm_scene<float_tree_type>* > (data_scene_base_.as_pointer());
- auto * error_scene = dynamic_cast<boxm_scene<float_tree_type>* > (error_scene_base.as_pointer());
-
- if (!(data_scene &&error_scene)){
- std::cerr << "Error in bvpl_discover_pca_kernels::compute_testing_error: Faild to cast scene\n";
- return;
- }
-
- //get the cells for this block
- if (!(data_scene->valid_index(block_i, block_j, block_k) && error_scene->valid_index(block_i, block_j, block_k))){
- std::cerr << "In compute_testing_error: Invalid block\n";
- return;
- }
- data_scene->unload_active_blocks();
- error_scene->unload_active_blocks();
- data_scene->load_block_and_neighbors(block_i, block_j, block_k);
- error_scene->load_block(block_i, block_j, block_k);
-
- //get the trees
- float_tree_type* data_tree = data_scene->get_block(block_i, block_j, block_k)->get_tree();
- float_tree_type* error_tree = data_tree->clone();
- //error is always positive, therefore cells with negative errors can be identified as uninitialized.
- error_tree->init_cells(-1.0f);
-
- //get the leaves
- std::vector<float_cell_type*> data_leaves = data_tree->leaf_cells();
- std::vector<float_cell_type*> error_leaves = error_tree->leaf_cells();
-
- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors
- //convert neighborhood box to scene coordinates
- vgl_point_3d<int> min_point = nbbox_.min_point();
- vgl_point_3d<int> max_point = nbbox_.max_point();
-
- for (unsigned i=0; i<data_leaves.size(); ++i)
- {
- float_cell_type* data_cell = data_leaves[i];
-
- //create a region around the center cell
- vgl_point_3d<double> centroid = data_tree->global_centroid(data_cell);
-
- //change the coordinates of enpoints to be in global coordinates abd text if they are contained in the scene
- vgl_point_3d<double> min_point_global(centroid.x() + (double)min_point.x()*finest_cell_length_, centroid.y() + (double)min_point.y()*finest_cell_length_, centroid.z() + (double)min_point.z()*finest_cell_length_);
- vgl_point_3d<double> max_point_global(centroid.x() + (double)max_point.x()*finest_cell_length_, centroid.y() + (double)max_point.y()*finest_cell_length_, centroid.z() + (double)max_point.z()*finest_cell_length_);
- if (!(data_scene->locate_point_in_memory(min_point_global) && data_scene->locate_point_in_memory(max_point_global)))
- continue;
-
- //3. Assemble neighborhood as a feature-vector
- vnl_vector<double> this_feature(feature_dim_, 0.0f);
-
- unsigned curr_dim = 0;
- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); ++z)
- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); ++y)
- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); ++x)
- {
- vgl_point_3d<double> neighbor_centroid(centroid.x() + (double)x*finest_cell_length_,
- centroid.y() + (double)y*finest_cell_length_,
- centroid.z() + (double)z*finest_cell_length_);
-
- boct_tree_cell<short,float> *neighbor_cell = data_scene->locate_point_in_memory(neighbor_centroid);
-
- if (!neighbor_cell){
- std::cerr << "Error in compute_testing_error\n";
- return;
- }
-
- this_feature[curr_dim] = (double)neighbor_cell->data();
- ++curr_dim;
- }
-
- if (curr_dim != feature_dim_){
- std::cerr << "Error in compute_testing_error\n";
- return;
- }
- this_feature-=data_mean_feature_;
-
- //solve for the coefficients
- vnl_vector<double> a(feature_dim_, 0.0);
- a = pc_.transpose() * (this_feature);
-
- //project as a function of number of components
- vnl_vector<double> feature_approx = pc_.extract(feature_dim_, ncomponents) * a.extract(ncomponents);
-
- //compute error
- error_leaves[i]->set_data((float)((this_feature - feature_approx).squared_magnitude()));
- }
-
- // write and release memory
- error_scene->get_block(block_i, block_j, block_k)->init_tree(error_tree);
- error_scene->write_active_block();
- data_scene->unload_active_blocks();
- error_scene->unload_active_blocks();
-}
-
-
-#if BVPL_OCTREE_HAS_PTHREADS
-void bvpl_discover_pca_kernels::compute_testing_error_thread_safe(boxm_scene<boct_tree<short,float> > * error_scene,
- unsigned ncomponents,
- int block_i, int block_j, int block_k)
-{
- typedef boct_tree<short,float> float_tree_type;
- typedef boct_tree_cell<short,float> float_cell_type;
-
- //cast the scenes
- auto* data_scene = dynamic_cast<boxm_scene<float_tree_type>* > (data_scene_base_.as_pointer());
-
- if (!(data_scene &&error_scene)){
- std::cerr << "Error in bvpl_discover_pca_kernels::compute_testing_error: Faild to cast scene\n";
- return;
- }
-
- if (!(data_scene->load_all_blocks() && error_scene->load_all_blocks())){
- std::cerr << "Must load all blocks into memory before using threads\n";
- return;
- }
- //get the cells for this block
- if (!error_scene->valid_index(block_i, block_j, block_k)){
- std::cerr << "In compute_testing_error: Invalid block\n";
- return;
- }
-
- //error_scene->load_block_thread_safe(block_i, block_j, block_k);
-
- //get the trees
- boxm_block<float_tree_type> *data_block = data_scene->get_block(block_i, block_j, block_k);
- if (!data_block)
- return;
-
- float_tree_type* data_tree = data_block->get_tree();
- float_tree_type* error_tree = error_scene->get_block(block_i, block_j, block_k)->get_tree();
- //error is always positive, therefore cells with negative errors can be identified as uninitialized.
- // error_tree->init_cells(-1.0f);
-
- //get the leaves
- std::vector<float_cell_type*> data_leaves = data_tree->leaf_cells();
- //std::vector<float_cell_type*> error_leaves = error_tree->leaf_cells();
-
- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors
- //convert neighborhood box to scene coordinates
- vgl_point_3d<int> min_point = nbbox_.min_point();
- vgl_point_3d<int> max_point = nbbox_.max_point();
-
- for (auto data_cell : data_leaves)
- {
- //create a region around the center cell
- vgl_point_3d<double> centroid = data_tree->global_centroid(data_cell);
-
- //change the coordinates of enpoints to be in global coordinates abd text if they are contained in the scene
- vgl_point_3d<double> min_point_global(centroid.x() + (double)min_point.x()*finest_cell_length_, centroid.y() + (double)min_point.y()*finest_cell_length_, centroid.z() + (double)min_point.z()*finest_cell_length_);
- vgl_point_3d<double> max_point_global(centroid.x() + (double)max_point.x()*finest_cell_length_, centroid.y() + (double)max_point.y()*finest_cell_length_, centroid.z() + (double)max_point.z()*finest_cell_length_);
- if (!(data_scene->locate_point_in_memory(min_point_global) && data_scene->locate_point_in_memory(max_point_global)))
- continue;
-
- //3. Assemble neighborhood as a feature-vector
- vnl_vector<double> this_feature(feature_dim_, 0.0f);
-
- unsigned curr_dim = 0;
- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); ++z)
- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); ++y)
- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); ++x)
- {
- vgl_point_3d<double> neighbor_centroid(centroid.x() + (double)x*finest_cell_length_,
- centroid.y() + (double)y*finest_cell_length_,
- centroid.z() + (double)z*finest_cell_length_);
-
- boct_tree_cell<short,float> *neighbor_cell = data_scene->locate_point_in_memory(neighbor_centroid);
-
- if (!neighbor_cell){
- std::cerr << "Error in compute_testing_error\n";
- return;
- }
-
- this_feature[curr_dim] = (double)neighbor_cell->data();
- ++curr_dim;
- }
-
- if (curr_dim != feature_dim_){
- std::cerr << "Error in compute_testing_error\n";
- return;
- }
- this_feature-=data_mean_feature_;
-
- //solve for the coefficients
- vnl_vector<double> a(feature_dim_, 0.0);
- a = pc_.transpose() * (this_feature);
-
- //project as a function of number of components
- vnl_vector<double> feature_approx = pc_.extract(feature_dim_, ncomponents) * a.extract(ncomponents);
-
- //compute error
- //error_leaves[i]->set_data((float)((this_feature - feature_approx).squared_magnitude()));
- }
-
- // write and release memory
- error_scene->get_block(block_i, block_j, block_k)->init_tree(error_tree);
- error_scene->write_block_thread_safe(block_i, block_j, block_k);
-}
-#endif // BVPL_OCTREE_HAS_PTHREADS
-
-
-//: Compute mean feature of all "leaf-features" in a scene
-void bvpl_discover_pca_kernels::compute_mean_feature(boxm_scene<boct_tree<short, float> > *scene)
-{
- //a vector to keep projection error - first element refers to error when using only first pc,
- //the sencond element, to error when projecting on frist 2 components and so on
- data_mean_feature_.set_size(feature_dim_);
- data_mean_feature_.fill(0.0);
- unsigned long nfeatures = 0;
-
- //iterate through leaves and arrage as vectors.
- double cell_length = scene->finest_cell_length();
-
- boxm_cell_iterator<boct_tree<short, float > > cell_it = scene->cell_iterator(&boxm_scene<boct_tree<short, float> >::load_block_and_neighbors, true);
- cell_it.begin();
-
- while (!(cell_it.end()))
- {
- //boct_tree_cell<short, float> *center_cell = *cell_it;
- vgl_point_3d<double> center_cell_centroid = cell_it.global_centroid();
-
- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors
- //convert neighborhood box to scene coordinates
- vgl_point_3d<int> nmin = nbbox_.min_point();
- vgl_point_3d<int> nmax = nbbox_.max_point();
-
- vgl_box_3d<double> roi(cell_length*(double)nmin.x(),cell_length*(double)nmin.y(),cell_length*(double)nmin.z(),
- cell_length*(double)nmax.x(),cell_length*(double)nmax.y(),cell_length*(double)nmax.z());
- roi.set_centroid(center_cell_centroid);
-
- //if neighborhood is not inclusive we would have missing features
- if (!((scene->get_world_bbox()).contains(roi))){
- ++cell_it;
- continue;
- }
-
- //3. Assemble neighborhood as a feature-vector
- vnl_vector<double> this_feature(feature_dim_, 0.0f);
-
- unsigned curr_dim = 0;
- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); ++z)
- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); ++y)
- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); ++x)
- {
- vgl_point_3d<double> neighbor_centroid(center_cell_centroid.x() + (double)x*cell_length,
- center_cell_centroid.y() + (double)y*cell_length,
- center_cell_centroid.z() + (double)z*cell_length);
-
- boct_tree_cell<short,float> *neighbor_cell = scene->locate_point_in_memory(neighbor_centroid);
-
- assert(neighbor_cell !=nullptr);
- this_feature[curr_dim] = (double)neighbor_cell->data();
- ++curr_dim;
- }
-
- assert(curr_dim == feature_dim_);
-
- data_mean_feature_+=this_feature;
- ++nfeatures;
- ++cell_it;
- }
- data_mean_feature_ = data_mean_feature_/(double)nfeatures;
-
- std::ofstream mean_ofs(data_mean_path().c_str());
- mean_ofs.precision(15);
- mean_ofs << data_mean_feature_;
- mean_ofs.close();
-}
-
-
-#if 0 //too_slow
- //: Compute deviations i.e. zero-mean feature matrix
-vnl_matrix<float>& bvpl_discover_pca_kernels::compute_deviation_matrix(boxm_scene<boct_tree<short,float> > *scene)
-{
- unsigned long max_nsamples = scene->size();
-
- //iterate through leaves, keep random samples in memory and arrage as vectors.
- boxm_cell_iterator<boct_tree<short, float > > cell_it = scene->cell_iterator(&boxm_scene<boct_tree<short, float> >::load_block_and_neighbors, true);
- cell_it.begin();
-
- vnl_random rng(9667566ul);
- unsigned long pos_pre = 0; //previous position on random samples array
-
- for (unsigned i=1; i<nsamples_; ++i)
- {
- unsigned long sample = rng.lrand32(max_nsamples);
- vgl_box_3d<double> roi = nbbox_;
- for (unsigned u = 0; u + pos_pre < sample; ++u)
- ++cell_it;
- pos_pre = sample;
- roi.set_centroid(cell_it.global_centroid());
- if (!((scene->get_world_bbox()).contains(roi))){
- --i;
- continue;
- }
-
- positions_.push_back(sample);
- }
-
- //sort random numbers for easy access
- positions_.sort();
- if (nsamples_ != positions_.size())
- {
- std::cerr << "Error computing PCA features: Wrong number of random samples generated\n";
- return false;
- }
-
- cell_it.begin();
-
- //init cells array to first random element
- std::list<unsigned long>::const_iterator rand_it = positions_.begin();
- cell_it+=(*rand_it - pos_pre);
- pos_pre = *rand_it;
-
- //init quantities for mean
- unsigned feature_dim = nbbox_.width()*nbbox_.height()* nbbox_.depth();
- vnl_vector<float> mean(feature_dim);
- M.set_size(feature_dim, nsamples_);
- unsigned i=0;
-
- double cell_length = scene->finest_cell_length();
- while (!(cell_it.end()))
- {
- boct_tree_cell<short, float> *center_cell = *cell_it;
- vgl_point_3d<double> center_cell_centroid = cell_it.global_centroid();
-
- if (!center_cell){
- std::cerr << "Error is bvpl_discover_pca_kernels: Unexpected NULL cell\n";
- return false;
- }
-
- //assemble neighborhood as a feature-vector
- vnl_vector<float> this_feature(feature_dim);
-
- unsigned curr_dims = 0;
- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); ++z)
- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); ++y)
- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); ++x)
- {
- vgl_point_3d<double> neighbor_origin(center_cell_centroid.x() + (double)x*cell_length,
- center_cell_centroid.y() + (double)y*cell_length,
- center_cell_centroid.z() + (double)z*cell_length);
-
- boct_tree_cell<short,float> *neighbor_cell = scene->locate_point_in_memory(neighbor_origin);
-
- if (!neighbor_cell){
- std::cerr << "Error is bvpl_discover_pca_kernels: Unexpected NULL cell\n";
- return false;
- }
-
- this_feature[x + nbbox_.width()*y + nbbox_.width()*nbbox_.height()*z] = neighbor_cell->data();
- ++curr_dims;
- }
-
- M.set_column(i,this_feature);
- mean+=this_feature;
-
- //increment iterators
- cell_it+=(*rand_it - pos_pre);
- pos_pre = *rand_it;
- ++rand_it;
- ++i;
- }
-
- mean/=nsamples_;
-
- for (unsigned int j=0; j<nsamples_; ++j)
- M.set_column(j,M.get_column(j) - mean);
-
- return true;
-}
-#endif
-
-void bvpl_discover_pca_kernels::xml_write()
-{
- bxml_document doc;
- bxml_element *root = new bxml_element("pca_info");
- doc.set_root_element(root);
- root->append_text("\n");
-
- bxml_element* paths = new bxml_element("paths");
- paths->append_text("\n");
- paths->set_attribute("pc_path", pc_path() );
- paths->set_attribute("data_path", data_path() );
- paths->set_attribute("weights_path", weights_path() );
- paths->set_attribute("positions_path", pos_path()) ;
- paths->set_attribute("sample_mean_path", sample_mean_path());
- paths->set_attribute("data_mean_path", data_mean_path());
- paths->set_attribute("scene_path", scene_path_);
- root->append_data(paths);
- root->append_text("\n");
-
- bxml_element* neighborhood = new bxml_element("neighborhood");
- neighborhood->append_text("\n");
- neighborhood->set_attribute("min_x", nbbox_.min_point().x());
- neighborhood->set_attribute("min_y", nbbox_.min_point().y());
- neighborhood->set_attribute("min_z", nbbox_.min_point().z());
- neighborhood->set_attribute("max_x", nbbox_.max_point().x());
- neighborhood->set_attribute("max_y", nbbox_.max_point().y());
- neighborhood->set_attribute("max_z", nbbox_.max_point().z());
- root->append_data(neighborhood);
- root->append_text("\n");
-
- bxml_element* nsamples = new bxml_element("samples");
- nsamples->append_text("\n");
- nsamples->set_attribute("nsamples", nsamples_);
- root->append_data(nsamples);
- root->append_text("\n");
-
- bxml_element* dim = new bxml_element("dimension");
- dim->append_text("\n");
- dim->set_attribute("feature_dim", feature_dim_);
- root->append_data(dim);
- root->append_text("\n");
-
- bxml_element* cell_length = new bxml_element("finest_cell_length");
- cell_length->append_text("\n");
- cell_length->set_attribute("length", finest_cell_length_);
- root->append_data(cell_length);
- root->append_text("\n");
-
- std::ofstream os(xml_path().c_str());
- bxml_write(os, doc);
- os.close();
-
- //: Write pca main matrices -other matrices aren't class variables and should have been written during computation time
-
- write_pca_matrices();
-}
-
-
-//: Write a PCA file
-bool bvpl_discover_pca_kernels::write_pca_matrices()
-{
- std::ofstream pc_ofs(pc_path().c_str());
- pc_ofs.precision(15);
- std::ofstream weights_ofs(weights_path().c_str());
- weights_ofs.precision(15);
-
- pc_ofs << pc_;
- pc_ofs.close();
- weights_ofs << weights_;
- weights_ofs.close();
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.h
deleted file mode 100644
index 875504affa..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.h
+++ /dev/null
@@ -1,309 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_discover_pca_kernels.h
-#ifndef bvpl_discover_pca_kernels_h
-#define bvpl_discover_pca_kernels_h
-//:
-// \file
-// \brief A class to discover those features that represent the data the best in a least square sense using PCA
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 8-Nov-2010.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <list>
-#include <iostream>
-#include <utility>
-#include <vgl/vgl_box_3d.h>
-
-#include <boxm/boxm_scene.h>
-#include <bxml/bxml_document.h>
-
-#include <vnl/vnl_matrix.h>
-#include <vnl/vnl_vector.h>
-#include <vnl/algo/vnl_svd.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.h>
-
-#if BVPL_OCTREE_HAS_PTHREADS
-#include <pthread.h>
-#endif
-
-class bvpl_discover_pca_kernels;
-
-typedef vbl_smart_ptr<bvpl_discover_pca_kernels> bvpl_discover_pca_kernels_sptr;
-
-class bvpl_discover_pca_kernels: public vbl_ref_count
-{
- public:
- //: Constructor from neighborhood bounding boxm, number of samples to be drawn, scene and flag to indicate whether to use evd or svd
- bvpl_discover_pca_kernels(vgl_box_3d<int> nbbox, unsigned long long nsamples, boxm_scene<boct_tree<short,float> > *scene, std::string path_out=".", bool use_evd = true):
- nbbox_(nbbox), nsamples_(nsamples), path_out_(std::move(path_out))
- {
- scene_path_ = scene->filename();
- std::cout << "Scene path: " << scene->filename()<< std::endl;;
- data_scene_base_=scene;
-
- finest_cell_length_ = scene->finest_cell_length();
-
- feature_dim_ = (nbbox_.width()+1)*(nbbox_.height()+1)* (nbbox_.depth()+1);
- compute_mean_feature(scene);
-
- sample_mean_feature_.set_size(feature_dim_);
-
- if (use_evd)
- set_up_pca_evd(scene);
- else
- set_up_pca_svd(scene);
-
- scene->unload_active_blocks();
- }
-
- //: Construct from xml file
- bvpl_discover_pca_kernels(const std::string &path);
-
- //: Constructor from zero-mean matrix
- bvpl_discover_pca_kernels(const vnl_matrix<double>& M)
- {
- vnl_svd<double> A(M, -1e-8);
-
- //columns of U contain principal components.
- pc_.set_size(A.rank(), M.rows());
- A.U().extract(pc_);
- }
-
- //: Access the principal components
- const vnl_matrix<double>& principal_comps() { return pc_; }
-
- //: Access the coefficients
- const vnl_vector<double>& weights() { return weights_; }
-
- //: Access the mean of samples
- const vnl_vector<double>& mean() { return sample_mean_feature_; }
-
- //: Project training samples onto pca space and return error as a function of number of components used
- void compute_training_error(vnl_vector<double> &proj_error);
-
- //: Project training samples onto pca space and return error as a function of number of components used
- void compute_normalized_training_error(vnl_vector<double> &proj_error);
-
- //: Reconstrcution error on training samples. Same as above but it is not computed from samples.
- void theoretical_training_error(vnl_vector<double> &proj_error);
-
- //: Reconstructions error on testing samples. All training samples are excuded!
- void compute_testing_error(vnl_vector<double> &proj_error);
-
- //: Reconstructions error on testing samples. By block. Error is given as average error per sample
- void compute_testing_error(const boxm_scene_base_sptr& error_scene_base, unsigned ncomponents,
- int block_i, int block_j, int block_k);
-
-#if BVPL_OCTREE_HAS_PTHREADS
-
- void compute_testing_error_thread_safe(boxm_scene<boct_tree<short,float> > * error_scene, unsigned ncomponents,
- int block_i, int block_j, int block_k);
-
-// //: Reconstructions error on testing samples. By block. Error is the sse of feature vector approximation
-// bool compute_testing_error_thread_safe(boxm_scene_base_sptr error_scene_base, unsigned ncomponents);
-//
-// //: Reconstructions error on testing samples. By block. Error is the sse of feature vector approximation
-// friend void *compute_testing_error_thread( void *ptr);
-
-#endif
-
- //: Computes pca projection at each voxel on the block and it save the specified number of dimensions (dim)
- template <unsigned DIM>
- void project(boxm_scene<boct_tree<short, bvpl_pca_basis_sample<DIM> > > *proj_scene,
- int block_i, int block_j, int block_k);
-
- //: Compute the mean feature of all "leaf" samples in the data scene associated with this class
- void compute_mean_feature(boxm_scene<boct_tree<short,float> > *scene);
-
- //: Return the number of samples used
- unsigned long long nsamples() const { return nsamples_; }
-
- //: Return dimension of the features
- unsigned feature_dim() const { return feature_dim_; }
-
- //: Return scene path
- std::string scene_path() const { return scene_path_; }
-
- //: Return number of blocks in the data scene
- vgl_vector_3d<unsigned> data_scene_dim() const { return data_scene_base_->world_dim(); }
-
- bool load_all_scene_blocks()
- {
- boxm_scene<boct_tree<short,float> > *scene = dynamic_cast<boxm_scene<boct_tree<short,float> >* > (data_scene_base_.as_pointer());
- return scene->read_all_blocks();
- }
-
- void unload_all_scene_blocks()
- {
- boxm_scene<boct_tree<short,float> > *scene = dynamic_cast<boxm_scene<boct_tree<short,float> >* > (data_scene_base_.as_pointer());
- scene->unload_active_blocks();
- }
-
- //: Compute deviations i.e. zero-mean feature matrix
- vnl_matrix<double> compute_deviation_matrix(boxm_scene<boct_tree<short,float> > *scene);
-
- //: Compute the scatter matrix.
- vnl_matrix<double> compute_scatter_matrix(boxm_scene<boct_tree<short,float> > *scene);
-
- void xml_write();
-
- protected:
-
- //: Set Up the PCA matrix for the given scene.
- // This method computes the deviation matrix and performs SVD to find the principal components
- // If the number of samples is very large use set_up_pca_evd
- void set_up_pca_svd(boxm_scene<boct_tree<short,float> > *scene);
-
- //: Set Up the PCA matrix for the given scene
- // This method performs eigen value decomposition on the covariance matrix
- // Use this method when number of samples >> number of dimensions
- void set_up_pca_evd(boxm_scene<boct_tree<short,float> > *scene);
-
- //: Write a PCA file
- bool write_pca_matrices();
-
- //: The size around the central feature to include in PCA vectors
- vgl_box_3d<int> nbbox_;
- //: Number of total samples(leaves) to be drawn
- unsigned long long nsamples_;
- //: Number of dimension of feature vector
- unsigned feature_dim_;
- //: Principal components - eigen vectors of the scatter matrix
- vnl_matrix<double> pc_;
- //: Weights - eigen values of the scatter matrix
- vnl_vector<double> weights_;
- //: The mean of sample data
- vnl_vector<double> sample_mean_feature_;
- //: The mean of all features in the scene data
- vnl_vector<double> data_mean_feature_;
- //: Pointer to data scene
- boxm_scene_base_sptr data_scene_base_;
- //: Finest cell length of data scene
- double finest_cell_length_;
-
- //: Paths for i/o of matrices and vectors
- std::string path_out_;
- std::string scene_path_;
- std::string pc_path() const { return path_out_ + "/pc.txt" ; }
- std::string data_path() const { return path_out_ + "/data.txt"; }
- std::string weights_path() const { return path_out_ + "/weights.txt"; }
- std::string pos_path() const { return path_out_ + "/positions.txt"; }
- std::string sample_mean_path() const { return path_out_ + "/sample_mean.txt"; }
- std::string data_mean_path() const { return path_out_ + "/data_mean.txt"; }
- std::string xml_path() const { return path_out_ + "/pca_info.xml"; }
-
- //: Tolerance, retain eigenvalues above max(eigenVals)*tol
- double tol_;
-};
-
-
-//: Computes pca projection at each voxel on the block and it saves the specified number of coefficientes
-template <unsigned DIM>
-void bvpl_discover_pca_kernels::project(boxm_scene<boct_tree<short, bvpl_pca_basis_sample<DIM> > > *proj_scene,
- int block_i, int block_j, int block_k)
-{
- typedef boct_tree<short,float> float_tree_type;
- typedef boct_tree_cell<short,float> float_cell_type;
- typedef boct_tree<short,bvpl_pca_basis_sample<DIM> > pca_tree_type;
- typedef boct_tree_cell<short,bvpl_pca_basis_sample<DIM> > pca_cell_type;
-
- //cast the scenes
- boxm_scene<float_tree_type>* data_scene = dynamic_cast<boxm_scene<float_tree_type>* > (data_scene_base_.as_pointer());
-
- if (!(data_scene &&proj_scene)) {
- std::cerr << "Error in bvpl_discover_pca_kernels::compute_testing_error: Faild to cast scene\n";
- return;
- }
-
- double cell_length = data_scene->finest_cell_length();
-
- //get the cells for this block
- if (!(data_scene->valid_index(block_i, block_j, block_k) && proj_scene->valid_index(block_i, block_j, block_k))) {
- std::cerr << "In compute_testing_error: Invalid block\n";
- return;
- }
-
- data_scene->load_block_and_neighbors(block_i, block_j, block_k);
- proj_scene->load_block(block_i, block_j, block_k);
-
- //get the trees
- float_tree_type* data_tree = data_scene->get_block(block_i, block_j, block_k)->get_tree();
- pca_tree_type* proj_tree = data_tree->template clone_to_type<bvpl_pca_basis_sample<DIM> >();
-
- //get the leaves
- std::vector<float_cell_type*> data_leaves = data_tree->leaf_cells();
- std::vector<pca_cell_type*> proj_leaves = proj_tree->leaf_cells();
-
- //CAUTION: the neighborhood box was supposed to be defined as number of regular neighbors
- //convert neighborhood box to scene coordinates
- vgl_point_3d<int> min_point = nbbox_.min_point();
- vgl_point_3d<int> max_point = nbbox_.max_point();
-
- for (unsigned i =0; i<data_leaves.size(); i++)
- {
- float_cell_type* data_cell = data_leaves[i];
-
- //create a region around the center cell
- vgl_point_3d<double> centroid = data_tree->global_centroid(data_cell);
-
- //change the coordinates of enpoints to be in global coordinates abd test if they are contained in the scene
- vgl_point_3d<double> min_point_global(centroid.x() + (double)min_point.x()*cell_length, centroid.y() + (double)min_point.y()*cell_length, centroid.z() + (double)min_point.z()*cell_length);
- vgl_point_3d<double> max_point_global(centroid.x() + (double)max_point.x()*cell_length, centroid.y() + (double)max_point.y()*cell_length, centroid.z() + (double)max_point.z()*cell_length);
- if (!(data_scene->locate_point_in_memory(min_point_global) && data_scene->locate_point_in_memory(max_point_global))) {
- proj_leaves[i]->set_data(bvpl_pca_basis_sample<DIM>());
- continue;
- }
-
- //3. Assemble neighborhood as a feature-vector
- vnl_vector<double> this_feature(feature_dim_, 0.0f);
-
- unsigned curr_dim = 0;
- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); z++)
- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); y++)
- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); x++)
- {
- vgl_point_3d<double> neighbor_centroid(centroid.x() + (double)x*cell_length,
- centroid.y() + (double)y*cell_length,
- centroid.z() + (double)z*cell_length);
-
- boct_tree_cell<short,float> *neighbor_cell = data_scene->locate_point_in_memory(neighbor_centroid);
-
- if (!neighbor_cell) {
- std::cerr << "Error in compute_testing_error\n";
- return;
- }
-
- this_feature[curr_dim] = (double)neighbor_cell->data();
- curr_dim++;
- }
-
- if (curr_dim != feature_dim_) {
- std::cerr << "Error in compute_testing_error\n";
- return;
- }
- this_feature-=data_mean_feature_;
-
- //solve for the coefficients
- vnl_vector<double> a(feature_dim_, 0.0);
- a = pc_.transpose() * (this_feature);
-
- //compute error
- bvpl_pca_basis_sample<DIM> sample(a.extract(DIM), 0);
- proj_leaves[i]->set_data(sample);
- }
-
- // write and release memory
- proj_scene->get_block(block_i, block_j, block_k)->init_tree(proj_tree);
- proj_scene->write_active_block();
- data_scene->unload_active_blocks();
-}
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.cxx
deleted file mode 100644
index 978a9443de..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.cxx
+++ /dev/null
@@ -1,512 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 12-Aug-2011
-
-#include "bvpl_gauss3D_steerable_filters.h"
-#include <vgl/vgl_vector_3d.h>
-
-//: Constructor
-// Initializes the order separable filter tabs should be applied for eac bases
-bvpl_gauss3D_steerable_filters::bvpl_gauss3D_steerable_filters()
-{
- axis_.clear();
- axis_.emplace_back(1,0,0);
- axis_.emplace_back(0,1,0);
- axis_.emplace_back(0,0,1);
-
- //Initialize from lists - waiting for VXL to support TR1!
- basis_.clear();
- basis_names_.clear();
-
- //zerth order - that is gaussian functio
- std::string G0a[3] = {"f01", "f02", "f02"};
- basis_.emplace_back(&G0a[0], &G0a[3]);
- basis_names_.emplace_back("G0a");
-
- //first order derivatives
- std::string G1a[3] = {"f11", "f12", "f12"};
- std::string G1b[3] = {"f12", "f11", "f12"};
- std::string G1c[3] = {"f12", "f12", "f11"};
- basis_.emplace_back(&G1a[0], &G1a[3]);
- basis_.emplace_back(&G1b[0], &G1b[3]);
- basis_.emplace_back(&G1c[0], &G1c[3]);
- basis_names_.emplace_back("G1a");
- basis_names_.emplace_back("G1b");
- basis_names_.emplace_back("G1c");
-
- //second order derivatives
- std::string G2a[3] = {"f21", "f22", "f22"};
- std::string G2b[3] = {"f23", "f24", "f22"};
- std::string G2c[3] = {"f22", "f21", "f22"};
- std::string G2d[3] = {"f23", "f22", "f24"};
- std::string G2e[3] = {"f22", "f23", "f24"};
- std::string G2f[3] = {"f22", "f22", "f21"};
- basis_.emplace_back(&G2a[0], &G2a[3]);
- basis_.emplace_back(&G2b[0], &G2b[3]);
- basis_.emplace_back(&G2c[0], &G2c[3]);
- basis_.emplace_back(&G2d[0], &G2d[3]);
- basis_.emplace_back(&G2e[0], &G2e[3]);
- basis_.emplace_back(&G2f[0], &G2f[3]);
- basis_names_.emplace_back("G2a");
- basis_names_.emplace_back("G2b");
- basis_names_.emplace_back("G2c");
- basis_names_.emplace_back("G2d");
- basis_names_.emplace_back("G2e");
- basis_names_.emplace_back("G2f");
-}
-
-//: Computes the responses to separable filter taps.
-// There are 10 basis, corresponding to gaussians zeroth, first and second derivatives
-// Each basis is made up of 3 1-d filter taps (x, y, z)
-// "scene" should be initialized with a dim-dimensional vector of the real input scene.
-// the taps have size 5, this could be changed later on
-bool bvpl_gauss3D_steerable_filters::basis_response_at_leaves(boxm_scene<boct_tree<short, vnl_vector_fixed<float, bvpl_gauss3D_steerable_filters::DIM_> > > *scene,
- boxm_scene<boct_tree<short, bool> > *valid_scene, double cell_length)
-{
- this->assemble_basis_size_5();
-
- bvpl_algebraic_functor functor;
-
- // each basis function, should have 3 1-d taps (one in x, one in y, one in z)
- unsigned max_ntaps = 3;
-
- std::cout << "bvpl_block_kernel_operator: Operating on cells of length: " << cell_length << std::endl;
- typedef boct_tree<short, vnl_vector_fixed<float,DIM_> > tree_type;
- typedef boct_tree_cell<short, vnl_vector_fixed<float,DIM_> > cell_type;
-
- // Load input and output blocks
- scene->clone_blocks_to_type(*valid_scene, true);
-
- //create and init a temporary scene to hold the intermediate 1-d output.
- boxm_scene<tree_type> *temp_scene =
- new boxm_scene<tree_type>(scene->lvcs(), scene->origin(), scene->block_dim(), scene->world_dim(), scene->max_level(), scene->init_level());
- temp_scene->set_paths(".", "temp_gsf_scene");
- temp_scene->set_appearance_model(VNL_FLOAT_10);
- temp_scene->write_scene("temp_gsf_scene.xml");
- scene->clone_blocks(*temp_scene);
-
- for (unsigned tap_i=0; tap_i<max_ntaps; tap_i++)
- {
- //Assemple tabs into a map
- std::vector<vnl_vector_fixed<float,5> > one_d_taps;
-
- for (unsigned dim=0; dim< DIM_; dim++){
- std::string tap_name = basis_[dim][tap_i];
- one_d_taps.push_back(separable_taps_[tap_name]);
- }
-
- //Traverse applying the appropriate 1-d taps
- boxm_cell_iterator<tree_type> cell_it = scene->cell_iterator(&boxm_scene<tree_type>::load_block_and_neighbors);
- cell_it.begin();
-
- boxm_cell_iterator<tree_type> temp_cell_it = temp_scene->cell_iterator(&boxm_scene<tree_type>::load_block);
- temp_cell_it.begin();
-
- boxm_cell_iterator<boct_tree<short, bool> > valid_cell_it = valid_scene->cell_iterator(&boxm_scene<boct_tree<short, bool> >::load_block);
- valid_cell_it.begin();
-
- while ( !(cell_it.end() || temp_cell_it.end() || valid_cell_it.end()) )
- {
- cell_type *temp_center_cell = *temp_cell_it;
- boct_tree_cell<short, bool> *valid_center_cell = *valid_cell_it;
-
- if (!valid_center_cell->data())
- {
- ++cell_it; ++temp_cell_it; ++valid_cell_it;
- continue;
- }
-
- bool valid = true;
-
- vgl_point_3d<double> center_cell_centroid = cell_it.global_centroid();
-
- vnl_vector_fixed<float, DIM_> responses(0.0);
-
- for (unsigned response_dim=0; response_dim<=DIM_; response_dim++)
- {
- vnl_vector_fixed<float,5> this_tap = one_d_taps[response_dim];
-
- for (int i =-2; i<=2; i++)
- {
- vgl_vector_3d<int> kernel_idx = i*axis_[tap_i];
-
- vgl_point_3d<double> kernel_cell_centroid(center_cell_centroid.x() + (double)kernel_idx.x()*cell_length,
- center_cell_centroid.y() + (double)kernel_idx.y()*cell_length,
- center_cell_centroid.z() + (double)kernel_idx.z()*cell_length);
-
- cell_type *this_cell = scene->locate_point_in_memory(kernel_cell_centroid);
-
- if (this_cell) {
- bvpl_kernel_dispatch d(this_tap[i+2]);
- float val =(float)(this_cell->data()[response_dim]);
- functor.apply(val, d);
- }
- else {
- valid = false;
- break;
- }
- }
-
- if (!valid)
- break;
-
- responses[response_dim] = (float)(functor.result());
- }
-
- temp_center_cell->set_data(responses);
- valid_center_cell->set_data(valid);
- ++cell_it; ++temp_cell_it; ++valid_cell_it;
- }
-
- //copy temp cells into cells
- cell_it.begin();
- temp_cell_it.begin();
-
- while ( !(cell_it.end() || temp_cell_it.end()) )
- {
- (*cell_it)->set_data((*temp_cell_it)->data());
- ++cell_it; ++temp_cell_it;
- }
- }
-
- //clear memory
- scene->unload_active_blocks();
- valid_scene->unload_active_blocks();
- temp_scene->unload_active_blocks();
- delete temp_scene;
- return true;
-}
-
-
-//: Compute basis response at all levels - assumes the intermediate cells of the tree have ben filled with meaningful info, otherwise the result could be garbage
-bool bvpl_gauss3D_steerable_filters::multiscale_basis_response(boxm_scene<boct_tree<short, vnl_vector_fixed<float, bvpl_gauss3D_steerable_filters::DIM_> > > *scene,
- boxm_scene<boct_tree<short, bool> > *valid_scene, unsigned resolution_level)
-{
- this->assemble_basis_size_5();
-
- bvpl_algebraic_functor functor;
-
- // each basis function, should have 3 1-d taps (one in x, one in y, one in z)
- unsigned max_ntaps = 3;
-
- typedef boct_tree<short, vnl_vector_fixed<float,DIM_> > tree_type;
- typedef boct_tree_cell<short, vnl_vector_fixed<float,DIM_> > cell_type;
-
- // Load input and output blocks
- scene->clone_blocks_to_type(*valid_scene, true);
-
- //create and init a temporary scene to hold the intermediate 1-d output.
- boxm_scene<tree_type> *temp_scene =
- new boxm_scene<tree_type>(scene->lvcs(), scene->origin(), scene->block_dim(), scene->world_dim(), scene->max_level(), scene->init_level());
- temp_scene->set_paths(".", "temp_gsf_scene");
- temp_scene->set_appearance_model(VNL_FLOAT_10);
- temp_scene->write_scene("temp_gsf_scene.xml");
- scene->clone_blocks(*temp_scene);
-
- for (unsigned tap_i=0; tap_i<max_ntaps; tap_i++)
- {
- //Assemple tabs into a map
- std::vector<vnl_vector_fixed<float,5> > one_d_taps;
-
- for (unsigned dim=0; dim< DIM_; dim++){
- std::string tap_name = basis_[dim][tap_i];
- one_d_taps.push_back(separable_taps_[tap_name]);
- }
-
- //Traverse applying the appropriate 1-d taps
- boxm_cell_iterator<tree_type> cell_it = scene->cell_iterator(&boxm_scene<tree_type>::load_block_and_neighbors);
- cell_it.begin(true);
-
- boxm_cell_iterator<tree_type> temp_cell_it = temp_scene->cell_iterator(&boxm_scene<tree_type>::load_block);
- temp_cell_it.begin(true);
-
- boxm_cell_iterator<boct_tree<short, bool> > valid_cell_it = valid_scene->cell_iterator(&boxm_scene<boct_tree<short, bool> >::load_block);
- valid_cell_it.begin(true);
-
- while ( !(cell_it.end() || temp_cell_it.end() || valid_cell_it.end()) )
- {
- cell_type *temp_center_cell = *temp_cell_it;
- boct_tree_cell<short, bool> *valid_center_cell = *valid_cell_it;
-
- if (!valid_center_cell->data())
- {
- ++cell_it; ++temp_cell_it; ++valid_cell_it;
- continue;
- }
-
- bool valid = true;
-
- vgl_point_3d<double> center_cell_centroid = cell_it.global_centroid();
- double cell_length = cell_it.length();
-
- vnl_vector_fixed<float, DIM_> responses(0.0);
-
- for (unsigned response_dim=0; response_dim<=DIM_; response_dim++)
- {
- vnl_vector_fixed<float,5> this_tap = one_d_taps[response_dim];
-
- for (int i =-2; i<=2; i++)
- {
- vgl_vector_3d<int> kernel_idx = i*axis_[tap_i];
-
- vgl_point_3d<double> kernel_cell_centroid(center_cell_centroid.x() + (double)kernel_idx.x()*cell_length,
- center_cell_centroid.y() + (double)kernel_idx.y()*cell_length,
- center_cell_centroid.z() + (double)kernel_idx.z()*cell_length);
-
- cell_type *this_cell = scene->locate_point_in_memory(kernel_cell_centroid, resolution_level);
-
- if (this_cell) {
- bvpl_kernel_dispatch d(this_tap[i+2]);
- float val =(float)(this_cell->data()[response_dim]);
- functor.apply(val, d);
- }
- else {
- valid = false;
- break;
- }
- }
-
- if (!valid)
- break;
-
- responses[response_dim] = (float)(functor.result());
- }
-
- temp_center_cell->set_data(responses);
- valid_center_cell->set_data(valid);
- ++cell_it; ++temp_cell_it; ++valid_cell_it;
- }
-
- //copy temp cells into cells
- cell_it.begin();
- temp_cell_it.begin();
-
- while ( !(cell_it.end() || temp_cell_it.end()) )
- {
- (*cell_it)->set_data((*temp_cell_it)->data());
- ++cell_it; ++temp_cell_it;
- }
- }
-
- //clear memory
- scene->unload_active_blocks();
- valid_scene->unload_active_blocks();
- temp_scene->unload_active_blocks();
- delete temp_scene;
- return true;
-}
-
-#if 0
-//: Computes the responses to separable filter taps.
-// There are 10 basis, corresponding to gaussians zeroth, first and second derivatives
-// Each basis is made up of 3 1-d filter taps (x, y, z)
-// "scene" should be initialized with a dim-dimensional vector of the real input scene.
-// the taps have size 5, this could be changed later on
-bool bvpl_gauss3D_steerable_filters::basis_response(boxm_scene<boct_tree<short, vnl_vector_fixed<float, bvpl_gauss3D_steerable_filters::DIM_> > > *scene,
- int block_i, int block_j, int block_k,
- boxm_scene<boct_tree<short, bool> > *valid_scene, double cell_length)
-{
- this->assemble_basis_size_5();
-
- bvpl_algebraic_functor functor;
-
- // each basis function, should have 3 1-d taps (one in x, one in y, one in z)
- unsigned max_ntaps = 3;
-
- std::cout << "bvpl_block_kernel_operator: Operating on cells of length: " << cell_length << std::endl;
- typedef boct_tree<short, vnl_vector_fixed<float,DIM_> > tree_type;
- typedef boct_tree_cell<short, vnl_vector_fixed<float,DIM_> > cell_type;
-
- // Load input and output blocks
- scene->load_block_and_neighbors(block_i,block_j,block_k);
- valid_scene->load_block(block_i,block_j,block_k);
-
- tree_type *tree = scene->get_block(block_i, block_j, block_k)->get_tree();
- tree_type *temp_tree = tree->clone(); //a temporary tree to store partial results
- boct_tree<short, bool> *valid_tree = tree->clone_to_type<bool>();
- valid_tree->init_cells(true);
-
- std::vector<cell_type* > cells = tree->leaf_cells();
- std::vector<cell_type* > temp_cells = temp_tree->leaf_cells();
- std::vector<boct_tree_cell<short, bool> * > valid_cells = valid_tree->leaf_cells();
-
- std::cout << scene->locate_point_in_memory(test_point)->data()<< std::endl;
-
- for (unsigned tap_i=0; tap_i<max_ntaps; tap_i++)
- {
- //Assemple tabs into a map
- std::vector<vnl_vector_fixed<float,5> > one_d_taps;
-
- for (unsigned dim=0; dim< DIM_; dim++){
- std::string tap_name = basis_[dim][tap_i];
- one_d_taps.push_back(separable_taps_[tap_name]);
- }
-
- //Traverse applying the appropriate 1-d taps
- std::vector<cell_type* >::iterator cells_it = cells.begin();
- std::vector<cell_type* >::iterator temp_it = temp_cells.begin();
- std::vector<boct_tree_cell<short, bool> * >::iterator valid_it = valid_cells.begin();
- for (; (cells_it!=cells.end())&&(temp_it!=temp_cells.end())&&(valid_it!=valid_cells.end()); cells_it++, valid_it++, temp_it++)
- {
- cell_type *center_cell = *cells_it;
- cell_type *temp_center_cell = *temp_it;
- boct_tree_cell<short, bool> *valid_center_cell = *valid_it;
-
- if (!valid_center_cell->data())
- continue;
-
- bool valid = true;
-
- vgl_point_3d<double> center_cell_centroid = tree->global_centroid(center_cell);
-
- vnl_vector_fixed<float, DIM_> responses(0.0);
-
- for (unsigned response_dim=0; response_dim<=DIM_; response_dim++)
- {
- vnl_vector_fixed<float,5> this_tap = one_d_taps[response_dim];
-
- for (int i =-2; i<=2; i++)
- {
- vgl_vector_3d<int> kernel_idx = i*axis_[tap_i];
-
- vgl_point_3d<double> kernel_cell_centroid(center_cell_centroid.x() + (double)kernel_idx.x()*cell_length,
- center_cell_centroid.y() + (double)kernel_idx.y()*cell_length,
- center_cell_centroid.z() + (double)kernel_idx.z()*cell_length);
-
- cell_type *this_cell = scene->locate_point_in_memory(kernel_cell_centroid);
-
- if (this_cell) {
- bvpl_kernel_dispatch d(this_tap[i+2]);
- float val =(float)(this_cell->data()[response_dim]);
- functor.apply(val, d);
- }
- else {
- valid = false;
- break;
- }
- }
-
- if (!valid)
- break;
-
- responses[response_dim] = (float)(functor.result());
- }
-
- temp_center_cell->set_data(responses);
- valid_center_cell->set_data(valid);
- }
-
- //copy temp cells into cells
- cells_it = cells.begin();
- temp_it = temp_cells.begin();
- for (; (cells_it!=cells.end())&&(temp_it!=temp_cells.end()); cells_it++, temp_it++)
- (*cells_it)->set_data((*temp_it)->data());
-
- std::cout << scene->locate_point_in_memory(test_point)->data()<< std::endl;;
- }
-
- //write the output block
- scene->get_block(block_i, block_j, block_k)->init_tree(tree);
- scene->write_active_block();
- valid_scene->get_block(block_i, block_j, block_k)->init_tree(valid_tree);
- valid_scene->write_active_block();
-
- //clear memory
- scene->unload_active_blocks();
- valid_scene->unload_active_blocks();
- delete temp_tree;
- return true;
-}
-#endif
-
-
-bool bvpl_gauss3D_steerable_filters::rotation_invariant_interpolation(boxm_scene<boct_tree<short, vnl_vector_fixed<float, bvpl_gauss3D_steerable_filters::DIM_> > > *scene,
- boxm_scene<boct_tree<short, bool> > *valid_scene)
-{
- typedef boct_tree<short, vnl_vector_fixed<float,DIM_> > tree_type;
- typedef boct_tree_cell<short, vnl_vector_fixed<float,DIM_> > cell_type;
-
- //Traverse all cells
- boxm_cell_iterator<tree_type> cell_it = scene->cell_iterator(&boxm_scene<tree_type>::load_block);
- cell_it.begin();
- boxm_cell_iterator<boct_tree<short, bool> > valid_cell_it = valid_scene->cell_iterator(&boxm_scene<boct_tree<short, bool> >::load_block, true);
- valid_cell_it.begin();
-
- while ( !(cell_it.end() || valid_cell_it.end()) )
- {
- cell_type *center_cell = *cell_it;
- boct_tree_cell<short, bool> *valid_center_cell = *valid_cell_it;
-
- if (!valid_center_cell->data()){
- ++cell_it; ++valid_cell_it;
- continue;
- }
-
- vnl_vector_fixed<float, DIM_> responses=center_cell->data();
-
- vgl_vector_3d<float> grad(responses[1], responses[2],responses[3]);
- normalize(grad); //after normalizing the gradient the direction cosines are the cartesian coordinates of grad
-
- //rotate the responses according to the gradient
- vnl_vector_fixed<float, DIM_> rotation_weigths(1.0f);
- rotation_weigths[0] = 1;
- rotation_weigths[1] = grad.x(); rotation_weigths[2] = grad.y(); rotation_weigths[3] = grad.z();
- rotation_weigths[4] = grad.x()* grad.x(); rotation_weigths[5] = 2.0f* grad.x()*grad.y();
- rotation_weigths[6] = grad.y()* grad.y(); rotation_weigths[7] = 2.0f* grad.x()*grad.z();
- rotation_weigths[8] = 2.0f * grad.y()* grad.z(); rotation_weigths[9] = grad.z()*grad.z();
-
- responses = element_product(responses, rotation_weigths);
-
- center_cell->set_data(responses);
- ++cell_it; ++valid_cell_it;
- }
-
- //clear memory
- scene->unload_active_blocks();
- valid_scene->unload_active_blocks();
- return true;
-}
-
-
-void bvpl_gauss3D_steerable_filters::assemble_basis_size_5()
-{
- separable_taps_.clear();
-
- //Zeroth Derivative G0
- //Separable basis taps: f01, f02
- float f01_data[5] = {0.000402093f, 0.162216f, 1.19862f, 0.162216f, 0.000402093f};
- vnl_vector_fixed<float, 5> f01(f01_data);
- separable_taps_.insert(std::pair<std::string, vnl_vector_fixed<float, 5> >("f01", f01));
-
- float f02_data[5] = {0.000335463f, 0.135335f, 1.0f, 0.135335f, 0.000335463f};
- vnl_vector_fixed<float,5> f02(f02_data);
- separable_taps_.insert(std::pair<std::string, vnl_vector_fixed<float, 5> >("f02", f02));
-
- //First Derivative Basis: G1 = alpha*G1a + beta*G1b
- //Separable basis functions: f11, f12
- float f11_data[5] = {0.00227458f, 0.458816f, 0.0f, -0.458816f, -0.00227458f};
- vnl_vector_fixed<float,5> f11(f11_data);
- separable_taps_.insert(std::pair<std::string, vnl_vector_fixed<float, 5> >("f11", f11));
- float f12_data[5] = {0.000335463f, 0.135335f, 1.0f, 0.135335f, 0.000335463f};
- vnl_vector_fixed<float,5> f12(f12_data);
- separable_taps_.insert(std::pair<std::string, vnl_vector_fixed<float, 5> >("f12", f12));
-
- //Second derivative basis G2 = alpha^2*G2a + 2*alpha*beta*G2b + beta^2*G2c + 2*alpha*gamma*G2d + 2*beta*gamma*G2e + gamma^2*G2f
- //Separable basis taps = f21, f22, f23, f24
- float f21_data[5] = {0.00696448f, 0.561934f, -1.38405f, 0.561934f, 0.00696448f};
- vnl_vector_fixed<float,5> f21(f21_data);
- separable_taps_.insert(std::pair<std::string, vnl_vector_fixed<float, 5> >("f21", f21));
-
- float f22_data[5] = {0.000335463f, 0.135335f, 1.0f, 0.135335f, 0.000335463f};
- vnl_vector_fixed<float,5> f22(f22_data);
- separable_taps_.insert(std::pair<std::string, vnl_vector_fixed<float, 5> >("f22", f22));
-
- float f23_data[5] = {-0.00643349f, -1.29773f, 0.0f, 1.29773f, 0.00643349f};
- vnl_vector_fixed<float,5> f23(f23_data);
- separable_taps_.insert(std::pair<std::string, vnl_vector_fixed<float, 5> >("f23", f23));
-
- float f24_data[5] = {-0.000670925f, -0.135335f, 0.0f, 0.135335f, 0.000670925f};
- vnl_vector_fixed<float,5> f24(f24_data);
- separable_taps_.insert(std::pair<std::string, vnl_vector_fixed<float, 5> >("f24", f24));
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.h
deleted file mode 100644
index bda8905d49..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// This is bvpl_gauss3D_steerable_filters.h
-#ifndef bvpl_gauss3D_steerable_filters_h
-#define bvpl_gauss3D_steerable_filters_h
-
-//:
-// \file
-// \brief 3-d Streerable filters implemented theough separable basis
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 12-Aug-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <vnl/vnl_vector_fixed.h>
-#include <boxm/boxm_scene.h>
-#include <bvpl/functors/bvpl_algebraic_functor.h>
-#include <bvpl/kernels/bvpl_kernel.h>
-
-
-class bvpl_gauss3D_steerable_filters{
-
-public:
- bvpl_gauss3D_steerable_filters();
-
- //: The dimension of the filter response e.i. number of steerable filters
- enum { DIM_ = 10 };
-
- //: Compute basis response at all leaf cells
- bool basis_response_at_leaves(boxm_scene<boct_tree<short, vnl_vector_fixed<float, bvpl_gauss3D_steerable_filters::DIM_> > > *scene,
- boxm_scene<boct_tree<short, bool> > *valid_scene, double cell_length);
-
- //: Compute basis response at all levels - assumes the intermediate cells of the tree have ben filled with meaningful info, otherwise the result could be garbage
- bool multiscale_basis_response(boxm_scene<boct_tree<short, vnl_vector_fixed<float, bvpl_gauss3D_steerable_filters::DIM_> > > *scene,
- boxm_scene<boct_tree<short, bool> > *valid_scene, unsigned resolution_level);
-
- //: Assemble basis for: -2 -1 0 1 2
- void assemble_basis_size_5();
-
- std::vector<std::vector<std::string> > basis() {return basis_;}
- std::vector<std::string> basis_names() {return basis_names_;}
- std::map<std::string, vnl_vector_fixed<float,5> > separable_taps(){return separable_taps_;}
-
- bool rotation_invariant_interpolation(boxm_scene<boct_tree<short, vnl_vector_fixed<float, bvpl_gauss3D_steerable_filters::DIM_> > > *scene,
- boxm_scene<boct_tree<short, bool> > *valid_scene);
-
-protected:
-
- //: lists of 1-d filter tap names needed for each basis
- std::vector<std::vector<std::string> > basis_;
-
- //: list of basis identifying strings
- std::vector<std::string> basis_names_;
-
- //: map containing the 1-d filter taps (actual values) and their identifying string
- std::map<std::string, vnl_vector_fixed<float,5> > separable_taps_;
-
- std::vector<vgl_vector_3d<int> > axis_;
-};
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.cxx
deleted file mode 100644
index 391c7f157e..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.cxx
+++ /dev/null
@@ -1,475 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 21-Jul-2011
-
-#include <iostream>
-#include <fstream>
-#include "bvpl_global_corners.h"
-
-#include <bsta/bsta_histogram.h>
-
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_scene_parser.h>
-
-#include <bxml/bxml_write.h>
-#include <bxml/bxml_read.h>
-#include <bxml/bxml_find.h>
-#include <bvpl_octree/bvpl_corner_detector.h>
-#include <bvpl_octree/bvpl_corner_functors.h>
-
-#include <vul/vul_file.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-
-//: Constructor from xml file
-bvpl_global_corners::bvpl_global_corners(const std::string &path)
-{
- std::cout << "Loading corners info from xml-file" << std::endl;
- path_out_ = path;
- std::ifstream xml_ifs(xml_path().c_str());
- if (!xml_ifs.is_open()){
- std::cerr << "Error: could not open xml info file: " << xml_path() << '\n';
- throw;
- }
- bxml_document doc = bxml_read(xml_ifs);
- bxml_element query("global_corners_info");
- bxml_data_sptr root = bxml_find_by_name(doc.root_element(), query);
- if (!root) {
- std::cerr << "Error: bvpl_discover_pca_kernels - could not parse xml root\n";
- throw;
- }
-
- //Parse scenes
- bxml_element scenes_query("scene");
- std::vector<bxml_data_sptr> scenes_data = bxml_find_all_with_name(root, scenes_query);
-
- unsigned nscenes=scenes_data.size();
- std::cout << "Number of scenes: " << nscenes << std::endl;
-
- aux_dirs_.clear();
- aux_dirs_.resize(nscenes);
-
- finest_cell_length_.clear();
- finest_cell_length_.resize(nscenes);
-
- for (unsigned si = 0; si < nscenes; si++)
- {
- auto* scenes_elm = dynamic_cast<bxml_element*>(scenes_data[si].ptr());
- int id = -1;
- scenes_elm->get_attribute("id", id);
- scenes_elm->get_attribute("aux_dir", aux_dirs_[id]);
- scenes_elm->get_attribute("cell_length" , finest_cell_length_[id]);
-
- if (!(vul_file::exists(aux_dirs_[id]) && vul_file::is_directory(aux_dirs_[id]))){
- vul_file::make_directory(aux_dirs_[id]);
- }
- }
-
- //Parse kernels
- bxml_element params_query("parameters");
- bxml_data_sptr params_data = bxml_find_by_name(root, params_query);
- if (params_data)
- {
- auto* params_elm = dynamic_cast<bxml_element*>(params_data.ptr());
-
- params_elm->get_attribute("harris_k", harris_k_);
- std::cout << "Harris_k is " << harris_k_ << '\n';
- }
- else {
- std::cerr << " In Gobal Corners: no parameters element\n";
- }
-}
-
-
-//: Compute Harris' measure extension to 3-d as proposed by:
-// I. Laptev. On space-time interest points. Int. J. Computer Vision, 64(2):107--123, 2005
-void bvpl_global_corners::compute_laptev_corners(const bvpl_global_taylor_sptr& global_taylor,int scene_id, int block_i, int block_j, int block_k)
-{
- typedef boct_tree<short,vnl_vector_fixed<double,10> > taylor_tree_type;
- typedef boct_tree_cell<short,vnl_vector_fixed<double,10> > taylor_cell_type;
-
- boxm_scene_base_sptr proj_scene_base =global_taylor->load_projection_scene(scene_id);
- boxm_scene_base_sptr valid_scene_base = global_taylor->load_valid_scene(scene_id);
-
- auto* proj_scene = dynamic_cast<boxm_scene<taylor_tree_type>*>(proj_scene_base.as_pointer());
- auto* valid_scene = dynamic_cast<boxm_scene<boct_tree<short, bool> >*> (valid_scene_base.as_pointer());
- boxm_scene<boct_tree<short, float> >* corner_scene =
- new boxm_scene<boct_tree<short, float> >(valid_scene->lvcs(), valid_scene->origin(), valid_scene->block_dim(), valid_scene->world_dim(), valid_scene->max_level(), valid_scene->init_level());
- corner_scene->set_appearance_model(BOXM_FLOAT);
- corner_scene->set_paths(aux_dirs_[scene_id], "corner_scene");
- corner_scene->write_scene("harris_scene.xml");
-
- if (!( proj_scene && valid_scene && corner_scene ))
- {
- std::cerr << "Error in bvpl_global_corners::threshold_corners: Could not cast input scenes\n";
- return;
- }
-
- //init variables
- proj_scene->unload_active_blocks();
- valid_scene->unload_active_blocks();
- corner_scene->unload_active_blocks();
-
- //operate on scene
- bvpl_corner_detector corner_detector;
- bvpl_harris_laptev_functor harris_functor(harris_k_);
-
- vgl_point_3d<int> max_neighborhood_idx = global_taylor->kernel_vector_->max();
- vgl_point_3d<int> min_neighborhood_idx = global_taylor->kernel_vector_->min();
-
- std::cout << "Neighborhood for Harris threshold: " << min_neighborhood_idx << " , " << max_neighborhood_idx << std::endl;
-
- corner_detector.compute_C(proj_scene, harris_functor, min_neighborhood_idx, max_neighborhood_idx, block_i, block_j, block_k, valid_scene, corner_scene, finest_cell_length_[scene_id]);
-
- //clean memory
- proj_scene->unload_active_blocks();
- valid_scene->unload_active_blocks();
- corner_scene->unload_active_blocks();
-}
-
-
-//: Compute corner measure extension to 3-d as proposed by:
-// P. Beaudet, Rotationally invariant image operators, in Proc. 4th Int. Joint Conf. Patt. Recog. 1978.
-void bvpl_global_corners::compute_beaudet_corners(const bvpl_global_taylor_sptr& global_taylor,int scene_id, int block_i, int block_j, int block_k)
-{
- typedef boct_tree<short,vnl_vector_fixed<double,10> > taylor_tree_type;
- typedef boct_tree_cell<short,vnl_vector_fixed<double,10> > taylor_cell_type;
-
- boxm_scene_base_sptr proj_scene_base =global_taylor->load_projection_scene(scene_id);
- boxm_scene_base_sptr valid_scene_base = global_taylor->load_valid_scene(scene_id);
-
- auto* proj_scene = dynamic_cast<boxm_scene<taylor_tree_type>*>(proj_scene_base.as_pointer());
- auto* valid_scene = dynamic_cast<boxm_scene<boct_tree<short, bool> >*> (valid_scene_base.as_pointer());
- boxm_scene<boct_tree<short, float> >* corner_scene =
- new boxm_scene<boct_tree<short, float> >(valid_scene->lvcs(), valid_scene->origin(), valid_scene->block_dim(), valid_scene->world_dim(), valid_scene->max_level(), valid_scene->init_level());
- corner_scene->set_appearance_model(BOXM_FLOAT);
- corner_scene->set_paths(aux_dirs_[scene_id], "corner_scene");
- corner_scene->write_scene("harris_scene.xml");
-
- if (!( proj_scene && valid_scene && corner_scene ))
- {
- std::cerr << "Error in bvpl_global_corners::threshold_corners: Could not cast input scenes\n";
- return;
- }
-
- //init variables
- proj_scene->unload_active_blocks();
- valid_scene->unload_active_blocks();
- corner_scene->unload_active_blocks();
-
- //operate on scene
- bvpl_corner_detector corner_detector;
-
- corner_detector.compute_det_H(proj_scene, block_i, block_j, block_k, valid_scene, corner_scene);
-
- //clean memory
- proj_scene->unload_active_blocks();
- valid_scene->unload_active_blocks();
- corner_scene->unload_active_blocks();
-}
-
-
-//: Threshold a percentage of corners, based of the Harris' measure extension to 3-d proposed by:
-// I. Laptev. On space-time interest points. Int. J. Computer Vision, 64(2):107--123, 2005
-void bvpl_global_corners::threshold_laptev_corners(const bvpl_global_taylor_sptr& global_taylor,int scene_id, float harris_thresh, const std::string& output_path)
-{
- typedef boct_tree<short,vnl_vector_fixed<double,10> > taylor_tree_type;
-
- boxm_scene_base_sptr valid_scene_base = global_taylor->load_valid_scene(scene_id);
- boxm_scene_base_sptr corner_scene_base = this->load_corner_scene(scene_id);
- boxm_scene_base_sptr proj_scene_base =global_taylor->load_projection_scene(scene_id);
-
- auto* proj_scene = dynamic_cast<boxm_scene<taylor_tree_type>*>(proj_scene_base.as_pointer());
-
- auto* valid_scene = dynamic_cast<boxm_scene<boct_tree<short, bool> >*> (valid_scene_base.as_pointer());
-
- auto* corner_scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*> (corner_scene_base.as_pointer());
-
- if (!(vul_file::exists(output_path) && vul_file::is_directory(output_path)))
- vul_file::make_directory(output_path);
-
- boxm_scene<boct_tree<short, bool> >* valid_corner_scene =
- new boxm_scene<boct_tree<short, bool> >(valid_scene->lvcs(), valid_scene->origin(), valid_scene->block_dim(), valid_scene->world_dim(), valid_scene->max_level(), valid_scene->init_level());
- valid_corner_scene->set_appearance_model(BOXM_BOOL);
-
- std::stringstream valid_ss;
- valid_ss << "valid_scene_" << scene_id ;
-
- valid_corner_scene->set_paths(output_path, valid_ss.str());
- valid_corner_scene->write_scene(valid_ss.str() + ".xml");
- valid_scene->clone_blocks(*valid_corner_scene);
-
- std::stringstream proj_ss;
- proj_ss << "proj_taylor_scene_" << scene_id ;
-
- boxm_scene<taylor_tree_type >* copy_proj_scene =
- new boxm_scene<taylor_tree_type >(proj_scene->lvcs(), proj_scene->origin(), proj_scene->block_dim(), proj_scene->world_dim(), proj_scene->max_level(), proj_scene->init_level());
- copy_proj_scene->set_appearance_model(VNL_DOUBLE_10);
- copy_proj_scene->set_paths(proj_scene->path(), proj_scene->block_prefix());
- copy_proj_scene->write_scene(output_path, proj_ss.str() + ".xml");
-
- delete copy_proj_scene;
-
- if (!( valid_scene && corner_scene && valid_corner_scene))
- {
- std::cerr << "Error in bvpl_global_corners::threshold_corners: Could not cast input scenes\n";
- return;
- }
-
- //(1) Traverse the scene - is there an easy way to modify the cell iterator so to only use leaf cells at level 0;
- boxm_cell_iterator<boct_tree<short, bool > > valid_it = valid_scene->cell_iterator(&boxm_scene<boct_tree<short, bool > >::load_block, true);
- valid_it.begin();
-
- boxm_cell_iterator<boct_tree<short, float > > corners_it = corner_scene->cell_iterator(&boxm_scene<boct_tree<short, float > >::load_block, true);
- corners_it.begin();
-
- boxm_cell_iterator<boct_tree<short, bool > > valid_corners_it = valid_corner_scene->cell_iterator(&boxm_scene<boct_tree<short, bool > >::load_block);
- valid_corners_it.begin();
-
- while ( !(valid_it.end() || corners_it.end() || valid_corners_it.end()) )
- {
- boct_tree_cell<short,bool> *valid_cell = *valid_it;
- boct_tree_cell<short,float> *corner_cell = *corners_it;
- boct_tree_cell<short,bool> *valid_corner_cell = *valid_corners_it;
-
- boct_loc_code<short> valid_code = valid_cell->get_code();
- boct_loc_code<short> corner_code = corner_cell->get_code();
- boct_loc_code<short> valid_corner_code = valid_corner_cell->get_code();
-
- //if level and location code of cells isn't the same then continue
- if ((valid_cell->level() != corner_cell->level()) || (valid_cell->level() != valid_corner_cell->level()) || !(valid_code.isequal(&corner_code)) || !(valid_code.isequal(&valid_corner_code))){
- std::cerr << " Error in threshold_laptev_corners: Cells don't have the same structure\n";
- return;
- }
-
- /*****CAUTION: Only looking at cells at level 0*/
- if (valid_cell->level()!=0) {
- ++valid_it;
- ++corners_it;
- valid_corner_cell->set_data(false);
- ++valid_corners_it;
- continue;
- }
-
- if (corner_cell->data() < harris_thresh)
- valid_corner_cell->set_data(false);
- else
- valid_corner_cell->set_data(true);
-
- ++valid_it;
- ++corners_it;
- ++valid_corners_it;
- }
-
- //clean memory
- valid_scene->unload_active_blocks();
- corner_scene->unload_active_blocks();
- valid_corner_scene->unload_active_blocks();
-
- delete valid_corner_scene;
-}
-
-//: Take a histogram of corners and get different values for percentage of thresholds
-void bvpl_global_corners::explore_corner_statistics(const bvpl_global_taylor_sptr& global_taylor,int scene_id)
-{
- typedef boct_tree<short,vnl_vector_fixed<double,10> > taylor_tree_type;
-
- boxm_scene_base_sptr valid_scene_base = global_taylor->load_valid_scene(scene_id);
- boxm_scene_base_sptr corner_scene_base = this->load_corner_scene(scene_id);
-
- auto* valid_scene = dynamic_cast<boxm_scene<boct_tree<short, bool> >*> (valid_scene_base.as_pointer());
-
- auto* corner_scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*> (corner_scene_base.as_pointer());
-
- if (!( valid_scene && corner_scene))
- {
- std::cerr << "Error in bvpl_global_corners::explore_corner_statistics: Could not cast input scenes\n";
- return;
- }
-
- //init variables
- valid_scene->unload_active_blocks();
- corner_scene->unload_active_blocks();
-
- //compute scene statistics at valid cells only
-
- //(1) Traverse the scene - is there an easy way to modify the cell iterator so to only use leaf cells at level 0;
- boxm_cell_iterator<boct_tree<short, bool > > valid_it = valid_scene->cell_iterator(&boxm_scene<boct_tree<short, bool > >::load_block, true);
- valid_it.begin();
-
- boxm_cell_iterator<boct_tree<short, float > > corners_it = corner_scene->cell_iterator(&boxm_scene<boct_tree<short, float > >::load_block, true);
- corners_it.begin();
-
- float cell_count = 0;
- auto max = (float)(*corners_it)->data();
- float min = max;
- float this_val = max;
- while ( !(valid_it.end() || corners_it.end()) )
- {
- boct_tree_cell<short,bool> *valid_cell = *valid_it;
- boct_tree_cell<short,float> *corner_cell = *corners_it;
-
- boct_loc_code<short> valid_code = valid_cell->get_code();
- boct_loc_code<short> corner_code = corner_cell->get_code();
-
- //if level and location code of cells isn't the same then continue
- if ((valid_cell->level() != corner_cell->level()) || !(valid_code.isequal(&corner_code))){
- std::cerr << " Error in threshold_laptev_corners: Cells don't have the same structure\n";
- return;
- }
-
- /*****CAUTION: Only looking at cells at level 0*/
- if (valid_cell->level()!=0) {
- ++valid_it;
- ++corners_it;
- continue;
- }
-
- cell_count++;
- this_val = (float)(*corners_it)->data();
- if ( this_val > max) max = this_val;
- if ( this_val < min) min = this_val;
-
- ++valid_it;
- ++corners_it;
- }
-
- auto nbins = (unsigned int)std::floor(std::sqrt(cell_count));
- bsta_histogram<float> corner_hist(min, max, nbins);
- valid_it.begin();
- corners_it.begin();
- while ( !(valid_it.end() || corners_it.end()) )
- {
- boct_tree_cell<short,bool> *valid_cell = *valid_it;
- boct_tree_cell<short,float> *corner_cell = *corners_it;
-
- boct_loc_code<short> valid_code = valid_cell->get_code();
- boct_loc_code<short> corner_code = corner_cell->get_code();
-
- //if level and location code of cells isn't the same then continue
- if ((valid_cell->level() != corner_cell->level()) || !(valid_code.isequal(&corner_code))){
- std::cerr << " Error in threshold_laptev_corners: Cells don't have the same structure\n";
- return;
- }
-
- /*****CAUTION: Only looking at cells at level 0*/
- if (valid_cell->level()!=0) {
- ++valid_it;
- ++corners_it;
- continue;
- }
-
- corner_hist.upcount((float)(*corners_it)->data(), 1.0f);
-
- ++valid_it;
- ++corners_it;
- }
-
- std::string file = aux_dirs_[scene_id] + "/corner_threshold_values.txt";
- float threshold[] = {0.01f, 0.02f, 0.05f, 0.1f, 0.2f, 0.5f, 0.8f};
- std::ofstream ofs(file.c_str());
- ofs.precision(7);
- for (float i : threshold) {
- ofs << i << ' ' << corner_hist.value_with_area_above(i) << '\n';
- }
-
- //clean memory
- ofs.close();
- valid_scene->unload_active_blocks();
- corner_scene->unload_active_blocks();
-}
-
-//: Load scene info
-boxm_scene_base_sptr bvpl_global_corners::load_corner_scene(int scene_id)
-{
- if (scene_id<0 || scene_id>((int)aux_dirs_.size() -1))
- {
- std::cerr << "Error in bvpl_global_corners::load_corner_scene: Invalid scene id\n";
- return nullptr;
- }
- //load scene
- boxm_scene_base_sptr scene_base = new boxm_scene_base();
- boxm_scene_parser scene_parser;
- std::stringstream aux_scene_ss;
- aux_scene_ss << aux_dirs_[scene_id] << "/harris_scene.xml";
- scene_base->load_scene(aux_scene_ss.str(), scene_parser);
-
- //cast scene
- auto *scene= new boxm_scene<boct_tree<short, float > >();
- if (scene_base->appearence_model() == BOXM_FLOAT){
- scene->load_scene(scene_parser);
- scene_base = scene;
- }
- else {
- std::cerr << "Error in bvpl_global_corners::load_corner_scene: Invalid appearance model\n";
- return nullptr;
- }
-
- return scene_base;
-}
-
-//: Load auxiliary scene indicating if a cell is valid. e.g border cells are not valid
-boxm_scene_base_sptr bvpl_global_corners::load_valid_scene (int scene_id)
-{
- if (scene_id<0 || scene_id>((int)aux_dirs_.size() -1))
- {
- std::cerr << "Error in bvpl_global_corners::load_scene: Invalid scene id\n";
- return nullptr;
- }
- //load scene
- boxm_scene_base_sptr aux_scene_base = new boxm_scene_base();
- boxm_scene_parser aux_parser;
- std::stringstream aux_scene_ss;
- aux_scene_ss << aux_dirs_[scene_id] << "/valid_scene_" << scene_id << ".xml";
- aux_scene_base->load_scene(aux_scene_ss.str(), aux_parser);
-
- //cast scene
- auto *aux_scene= new boxm_scene<boct_tree<short, bool > >();
- if (aux_scene_base->appearence_model() == BOXM_BOOL){
- aux_scene->load_scene(aux_parser);
- aux_scene_base = aux_scene;
- }
- else {
- std::cerr << "Error in bvpl_global_corners::load_aux_scene: Invalid appearance model\n";
- return nullptr;
- }
-
- return aux_scene_base;
-}
-
-//: Write this class to xml file
-void bvpl_global_corners::xml_write()
-{
- bxml_document doc;
- bxml_element *root = new bxml_element("global_corners_info");
- doc.set_root_element(root);
- root->append_text("\n");
-
- //write the scene elements
- for (unsigned i =0; i<aux_dirs_.size(); i++)
- {
- bxml_element* scenes_elm = new bxml_element("scene");
- scenes_elm->append_text("\n");
- scenes_elm->set_attribute("id", i);
- scenes_elm->set_attribute("aux_dir", aux_dirs_[i]);
- scenes_elm->set_attribute("cell_length", finest_cell_length_[i]);
- root->append_data(scenes_elm);
- root->append_text("\n");
- }
-
- //write parameters for corner detection
- bxml_element* param_elm = new bxml_element("parameters");
- param_elm->append_text("\n");
- param_elm->set_attribute("harris_k", harris_k_);
- root->append_data(param_elm);
- root->append_text("\n");
-
- //write to disk
- std::ofstream os(xml_path().c_str());
- bxml_write(os, doc);
- os.close();
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.h
deleted file mode 100644
index 0e7924fe1b..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_global_corners.h
-#ifndef bvpl_global_corners_h
-#define bvpl_global_corners_h
-//:
-// \file
-// \brief A class to compute corner features across different boxm_scenes
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 21-Jul-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <boxm/boxm_scene.h>
-#include <bvpl_octree/bvpl_global_taylor.h>
-
-class bvpl_global_corners : public vbl_ref_count
-{
-
- typedef vbl_smart_ptr<bvpl_global_taylor<double, 10> > bvpl_global_taylor_sptr;
-
- public:
-
- //: Constructor from xml file
- bvpl_global_corners(const std::string &path);
-
- //: Compute Harris' measure extension to 3-d as proposed by:
- // I. Laptev. On space-time interest points. Int. J. Computer Vision, 64(2):107--123, 2005
- void compute_laptev_corners(const bvpl_global_taylor_sptr& global_taylor, int scene_id, int block_i, int block_j, int block_k);
-
- //: Compute corner measure extension to 3-d as proposed by:
- // P. Beaudet, Rotationally invariant image operators, in Proc. 4th Int. Joint Conf. Patt. Recog. 1978.
- void compute_beaudet_corners(const bvpl_global_taylor_sptr& global_taylor,int scene_id, int block_i, int block_j, int block_k);
-
- //: Threshold corners below a threshold
- void threshold_laptev_corners(const bvpl_global_taylor_sptr& global_taylor,int scene_id, float thresh, const std::string& output_path);
-
- //: Take a histogram of corners and get different values for percentage of thresholds
- void explore_corner_statistics(const bvpl_global_taylor_sptr& global_taylor,int scene_id);
-
- //: Write to global_corners_info.xml
- void xml_write();
-
- // Accessors
- std::string path_out() {return path_out_;}
- std::vector<std::string> aux_dirs() { return aux_dirs_; }
- std::string aux_dirs( unsigned i ) { return aux_dirs_[i]; }
- std::vector<double> cell_lengths() { return finest_cell_length_; }
-
- boxm_scene_base_sptr load_corner_scene (int scene_id);
- boxm_scene_base_sptr load_valid_scene (int scene_id);
-
- std::string xml_path() { return path_out_ + "/global_corners_info.xml"; }
-
- protected:
-
- //: A vector to hold paths to keep taylor coefficient scenes and valid scenes
- std::vector<std::string> aux_dirs_;
- //: A vector to hold the finest cell length of the corresponding scene scene
- std::vector<double> finest_cell_length_;
- //: Path to xml info file
- std::string path_out_;
- //: The value of the parameter k for harris corners
- float harris_k_;
-};
-
-typedef vbl_smart_ptr<bvpl_global_corners > bvpl_global_corners_sptr;
-
-
-#endif // bvpl_global_corners_h
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.cxx
deleted file mode 100644
index 7b33da89da..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "bvpl_global_pca.h"
-//:
-// \file
-// \author Isabel Restrepo
-// \date 15-Mar-2011
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.h
deleted file mode 100644
index 39ff106c20..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.h
+++ /dev/null
@@ -1,153 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.h
-#ifndef bvpl_global_pca_h
-#define bvpl_global_pca_h
-//:
-// \file
-// \brief A class to compute and learn pca features across different boxm_scenes
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 14-Mar-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <utility>
-#include <vnl/vnl_matrix_fixed.h>
-#include <vnl/vnl_vector_fixed.h>
-
-#include <boxm/boxm_scene.h>
-
-
-template <unsigned feature_dim>
-class bvpl_global_pca: public vbl_ref_count
-{
- public:
- //: Constructor
- bvpl_global_pca(std::vector<std::string> scenes, std::vector<std::string> aux_dirs, std::vector<double> finest_cell_length,
- vgl_box_3d<int> nbbox, double training_fraction = 0.1, std::string path_out = "./"):
- scenes_(std::move(scenes)), aux_dirs_(std::move(aux_dirs)), finest_cell_length_(std::move(finest_cell_length)), nbbox_(nbbox), training_fraction_(training_fraction),path_out_(std::move(path_out))
- {
- training_scenes_ = std::vector<bool>(scenes_.size(), true);
- nleaves_ = std::vector<unsigned long>(scenes_.size(), 0);
- nsamples_ = 0;
- training_mean_.fill(0.0);
- pc_.fill(0.0);
- weights_.fill(0.0);
- scatter_.fill(0.0);
- this->xml_write();
- }
-
- //:Create from xml file
- bvpl_global_pca(const std::string &path);
-
- //: Init auxiliary scenes and smallest cell length values
- void init(unsigned scene_id);
-
- //: Computes the scatter matrix and mean vector of a portion of random samples from a block
- bool sample_statistics( int scene_id, int block_i, int block_j, int block_k,
- vnl_matrix_fixed<double, feature_dim, feature_dim> &S,
- vnl_vector_fixed<double, feature_dim> &mean,
- unsigned long &nfeature);
-
- //: Update mean and scatter, given the mean and scatter of two sets.
- // Calculation is done according to Chan et al. Updating Formulae and a Pairwise Algorithm for Computing Sample Variances
- static void combine_pairwise_statistics( const vnl_vector_fixed<double,feature_dim> &mean1,
- const vnl_matrix_fixed<double,feature_dim,feature_dim> &scatter1,
- double const n1,
- const vnl_vector_fixed<double,feature_dim> &mean2,
- const vnl_matrix_fixed<double,feature_dim,feature_dim> &scatter2,
- double const n2,
- vnl_vector_fixed<double,feature_dim> & mean_out,
- vnl_matrix_fixed<double,feature_dim,feature_dim> & scatter_out,
- double &n_out );
-
- //: Set total scatter matrix, mean, sample, principal components and weights for this class
- void set_up_pca_evd(const vnl_matrix_fixed<double, feature_dim, feature_dim> &S,
- const vnl_vector_fixed<double, feature_dim> &mean,
- const double total_nsamples);
-
- //: Access the principal components
- const vnl_matrix_fixed<double, feature_dim, feature_dim>& principal_comps() { return pc_; }
-
- //: Access the coefficients
- const vnl_vector_fixed<double, feature_dim>& weights() { return weights_; }
-
- //: Access the mean of samples
- const vnl_vector_fixed<double, feature_dim>& mean() { return training_mean_; }
-
- bool register_scene(std::string scene_path, std::string aux_path)
- {
- if (scenes_.size()!=aux_dirs_.size())
- return false;
- scenes_.push_back(scene_path);
- aux_dirs_.push_back(aux_path);
- return true;
- }
-
- void xml_write();
-
- //: Computes 10-dimensional pca projection at each voxel on the block and saves it
- void project(int scene_id, int block_i, int block_j, int block_k);
-
- void projection_error(int scene_id, int block_i, int block_j, int block_k);
-
-
- std::string path_out() const { return path_out_; }
-
- inline std::vector<std::string> scenes() const { return scenes_; }
- inline std::vector<std::string> aux_dirs() const { return aux_dirs_; }
- inline std::vector<double> cell_lengths() const { return finest_cell_length_; }
- inline std::vector<bool> training_scenes() const { return training_scenes_; }
- inline vgl_box_3d<int> nbbox() const { return nbbox_; }
- inline unsigned nscenes() const { return scenes_.size(); }
- protected:
-
- //: A vector to hold scene paths
- std::vector<std::string> scenes_;
- //: A vector to hold paths to keep any kind of auxiliary scene or info(must be in the same order as scenes_)
- std::vector<std::string> aux_dirs_;
- //: A vector to hold the finest cell length of the corresponding scene scene
- std::vector<double> finest_cell_length_;
- //: A vector that indicates whether a scene should be used as train (True) or test(False). Order is equivalent to scenes_
- std::vector<bool> training_scenes_;
- //: A vector to keep the size of each scene
- std::vector<unsigned long> nleaves_;
-
- //: The size around the central feature to include in PCA vectors
- vgl_box_3d<int> nbbox_;
- //: Number of total samples(leaves) to be drawn
- unsigned long long nsamples_;
-
- //: Principal components - eigen vectors of the scatter matrix
- vnl_matrix_fixed<double, feature_dim, feature_dim> pc_;
- //: Weights - eigen values of the scatter matrix
- vnl_vector_fixed<double, feature_dim> weights_;
- //: The mean of sample data
- vnl_vector_fixed<double, feature_dim> training_mean_;
- //: Scatter matrix used to compute pca
- vnl_matrix_fixed<double, feature_dim, feature_dim> scatter_;
- //: Fraction of cells used for learning
- double training_fraction_;
-
- //: Paths for i/o of matrices and vectors
- std::string path_out_;
- std::string pc_path() const { return path_out_ + "/pc.txt" ; }
- std::string weights_path() const { return path_out_ + "/weights.txt"; }
- std::string mean_path() const { return path_out_ + "/mean.txt"; }
- std::string scatter_path() const { return path_out_ + "/scatter.txt"; }
- std::string xml_path() const { return path_out_ + "/pca_global_info.xml"; }
-
- void write_pca_matrices();
-
- public:
- boxm_scene_base_sptr load_scene (int scene_id);
- boxm_scene_base_sptr load_train_scene (int scene_id);
- boxm_scene_base_sptr load_valid_scene (int scene_id);
- boxm_scene_base_sptr load_projection_scene (int scene_id);
- boxm_scene_base_sptr load_error_scene (int scene_id);
-};
-
-typedef vbl_smart_ptr<bvpl_global_pca<125> > bvpl_global_pca_125_sptr;
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.hxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.hxx
deleted file mode 100644
index 6877b12a34..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_pca.hxx
+++ /dev/null
@@ -1,1018 +0,0 @@
-#ifndef bvpl_global_pca_hxx_
-#define bvpl_global_pca_hxx_
-//:
-// \file
-// \author Isabel Restrepo
-// \date 14-Mar-2011
-
-#include "bvpl_global_pca.h"
-#include <bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.h>
-
-
-#include <bxml/bxml_write.h>
-#include <bxml/bxml_read.h>
-#include <bxml/bxml_find.h>
-
-#include <boxm/boxm_scene_parser.h>
-
-#include <vnl/vnl_random.h>
-#include <vnl/vnl_vector_fixed.h>
-#include <vnl/vnl_matrix_fixed.h>
-#include <vnl/algo/vnl_symmetric_eigensystem.h>
-
-#include <vul/vul_file.h>
-
-#include <cassert>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-//#define DEBUG_PROJ
-
-//: Create from xml_file
-template <unsigned feature_dim>
-bvpl_global_pca<feature_dim>::bvpl_global_pca(const std::string &path)
-{
- std::cout << "Loading pca info from xml-file" << std::endl;
- int valid = 0;
- path_out_ = path;
- std::ifstream xml_ifs(xml_path().c_str());
- if (!xml_ifs.is_open()) {
- std::cerr << "Error: bvpl_discover_pca_kernels - could not open xml info file: " << xml_path() << '\n';
- throw;
- }
- bxml_document doc = bxml_read(xml_ifs);
- bxml_element query("pca_global_info");
- bxml_data_sptr root = bxml_find_by_name(doc.root_element(), query);
- if (!root) {
- std::cerr << "Error: bvpl_discover_pca_kernels - could not parse xml root\n";
- throw;
- }
-
- //Parse neighborhood bounding box - units are number of voxels
- bxml_element nbbox_query("neighborhood");
- bxml_data_sptr nbbox_data = bxml_find_by_name(root, nbbox_query);
- bxml_element* nbbox_elm = dynamic_cast<bxml_element*>(nbbox_data.ptr());
- int min_x, min_y, min_z, max_x, max_y, max_z =0;
- nbbox_elm->get_attribute("min_x", min_x);
- nbbox_elm->get_attribute("min_y", min_y);
- nbbox_elm->get_attribute("min_z", min_z);
- nbbox_elm->get_attribute("max_x", max_x);
- nbbox_elm->get_attribute("max_y", max_y);
- nbbox_elm->get_attribute("max_z", max_z);
-
- nbbox_ = vgl_box_3d<int>(vgl_point_3d<int>(min_x, min_y, min_y), vgl_point_3d<int>(max_x, max_y, max_z));
- std::cout << "Neighborhood: " << nbbox_ << std::endl;
-
- //Parse Number of samples
- bxml_element properties_query("properties");
- bxml_data_sptr properties_data = bxml_find_by_name(root, properties_query);
- bxml_element* properties_elm = dynamic_cast<bxml_element*>(properties_data.ptr());
- properties_elm->get_attribute("nsamples", nsamples_);
- unsigned temp_dim;
- properties_elm->get_attribute("feature_dim", temp_dim);
- if (temp_dim!=feature_dim) {
- valid = -10;
- }
- properties_elm->get_attribute("training_fraction", training_fraction_);
-
- unsigned nscenes = 0;
- properties_elm->get_attribute("nscenes", nscenes);
-
- std::cout << "Number of samples: " << nsamples_ << '\n'
- << "Feature dimension: " << temp_dim << '\n'
- << "Number of scenes: " << nscenes <<std::endl;
-
- //Parse scenes
- bxml_element scenes_query("scene");
- std::vector<bxml_data_sptr> scenes_data = bxml_find_all_with_name(root, scenes_query);
-
- if (nscenes !=scenes_data.size()) {
- std::cerr<<"Wrong number of scenes\n";
- throw;
- }
-
- scenes_.clear();
- scenes_.resize(nscenes);
-
- aux_dirs_.clear();
- aux_dirs_.resize(nscenes);
-
- finest_cell_length_.clear();
- finest_cell_length_.resize(nscenes);
-
- nleaves_.clear();
- nleaves_.resize(nscenes);
-
- for (unsigned si = 0; si < nscenes; si++)
- {
- bxml_element* scenes_elm = dynamic_cast<bxml_element*>(scenes_data[si].ptr());
- int id = -1;
- scenes_elm->get_attribute("id", id);
- scenes_elm->get_attribute("path", scenes_[id]);
- scenes_elm->get_attribute("aux_dir", aux_dirs_[id]);
- scenes_elm->get_attribute("cell_length" , finest_cell_length_[id]);
- scenes_elm->get_attribute("nleaves", nleaves_[id]);
-
- std::cout << "Scene " << id << " is " << scenes_[id] << '\n';
- }
-
- //Parse training scenes
- bxml_element train_query("training_scenes");
- bxml_element* train_elm = dynamic_cast<bxml_element*>(bxml_find_by_name(root, train_query).ptr());
- unsigned n_train_scenes = 0;
- train_elm->get_attribute("nscenes", n_train_scenes);
- training_scenes_.clear();
- training_scenes_.resize(nscenes, false);
-
- //read out the scenes
- for (bxml_element::const_data_iterator s_it = train_elm->data_begin(); s_it != train_elm->data_end(); s_it++) {
- if ((*s_it)->type() == bxml_data::TEXT) {
- bxml_text* t = dynamic_cast<bxml_text*>((*s_it).ptr());
- std::stringstream text_d(t->data()); std::string buf;
- std::vector<std::string> tokens;
- while (text_d >> buf) {
- tokens.push_back(buf);
- }
- if (tokens.size() != n_train_scenes)
- continue;
- for (unsigned i = 0; i < n_train_scenes; i++) {
- std::stringstream ss2(tokens[i]); int s_type_id;
- ss2 >> s_type_id;
- std::cout << "Scene: " << s_type_id << " is used for training\n";
- training_scenes_[s_type_id]=true;
- }
- break;
- }
- }
-
- //Parse paths and set matrices
- bxml_element paths_query("paths");
- bxml_data_sptr paths_data = bxml_find_by_name(root, paths_query);
- if (paths_data)
- {
- bxml_element* path_elm = dynamic_cast<bxml_element*>(paths_data.ptr());
-
- std::string ifs_path;
-
- path_elm->get_attribute("pc_path", ifs_path);
- if (ifs_path != pc_path())
- valid = -1;
- else{
- std::ifstream ifs(ifs_path.c_str());
- ifs >> pc_;
- ifs.close();
- if (pc_.size()!=feature_dim*feature_dim)
- valid = -2;
- }
-
- path_elm->get_attribute("weights_path", ifs_path);
- if (ifs_path != weights_path())
- valid = -3;
- else{
- std::ifstream ifs(ifs_path.c_str());
- ifs >> weights_;
- ifs.close();
- if (weights_.size()!=feature_dim)
- valid = -4;
- }
-
- path_elm->get_attribute("mean_path", ifs_path);
- if (ifs_path != mean_path())
- valid = -5;
- else
- {
- if ( vul_file::exists(ifs_path))
- {
- std::ifstream ifs(ifs_path.c_str());
- ifs >> training_mean_;
- ifs.close();
- }
- else{
- std::cerr << " Warning: Mean file is empty\n";
- training_mean_.fill(0.0);
- }
-
- path_elm->get_attribute("scatter_path", ifs_path);
- if (ifs_path != scatter_path())
- valid = -6;
- else if (vul_file::exists(ifs_path)) {
- std::ifstream(ifs_path);
- ifs_path >> scatter_;
- ifs_path.close();
- }
- else{
- std::cerr << " Warning: Scatter file is empty\n";
- scatter_.fill(0.0);
- }
-
- if (valid<0) {
- std::cout << "bvpl_discover_pca_kernels - errors parsing pca_info.xml. Error code: " << valid << std::endl;
- xml_write();
- }
- }
- }
-
- xml_ifs.close();
-}
-
-//: Init auxiliary scenes and smallest cell length values
-template <unsigned feature_dim>
-void bvpl_global_pca<feature_dim>::init(unsigned scene_id)
-{
- boxm_scene_base_sptr data_scene_base = load_scene(scene_id);
- boxm_scene<boct_tree<short, float> >* data_scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*> (data_scene_base.as_pointer());
- if (!data_scene) {
- std::cerr << "Error in bvpl_global_pca<feature_dim>::init(): Could not cast data scene\n";
- return;
- }
- double finest_cell_length = data_scene->finest_cell_length();
- finest_cell_length_[scene_id] = finest_cell_length;
- nleaves_[scene_id] = data_scene->size();
-
- if (!(vul_file::exists(aux_dirs_[scene_id]) && vul_file::is_directory(aux_dirs_[scene_id]))) {
- vul_file::make_directory(aux_dirs_[scene_id]);
- }
-
- {
- std::stringstream aux_scene_ss;
- aux_scene_ss << "train_scene_" << scene_id ;
- std::string aux_scene_path = aux_dirs_[scene_id] + "/" + aux_scene_ss.str() + ".xml";
- if (!vul_file::exists(aux_scene_path)) {
- std::cout<< "Scene: " << aux_scene_path << " does not exist, initializing" << std::endl;
- boxm_scene<boct_tree<short, bool> > *aux_scene =
- new boxm_scene<boct_tree<short, bool> >(data_scene->lvcs(), data_scene->origin(), data_scene->block_dim(), data_scene->world_dim(), data_scene->max_level(), data_scene->init_level());
- aux_scene->set_appearance_model(BOXM_BOOL);
- aux_scene->set_paths(aux_dirs_[scene_id], aux_scene_ss.str());
- aux_scene->write_scene("/" + aux_scene_ss.str() + ".xml");
- }
- }
- {
- std::stringstream aux_scene_ss;
- aux_scene_ss << "valid_scene_" << scene_id ;
- std::string aux_scene_path = aux_dirs_[scene_id] + "/" + aux_scene_ss.str() + ".xml";
- if (!vul_file::exists(aux_scene_path)) {
- std::cout<< "Scene: " << aux_scene_path << " does not exist, initializing" << std::endl;
- boxm_scene<boct_tree<short, bool> > *aux_scene =
- new boxm_scene<boct_tree<short, bool> >(data_scene->lvcs(), data_scene->origin(), data_scene->block_dim(), data_scene->world_dim(), data_scene->max_level(), data_scene->init_level());
- aux_scene->set_appearance_model(BOXM_BOOL);
- aux_scene->set_paths(aux_dirs_[scene_id], aux_scene_ss.str());
- aux_scene->write_scene("/" + aux_scene_ss.str() + ".xml");
- }
- }
-
- {
- std::stringstream proj_scene_ss;
- proj_scene_ss << "proj_pca_scene_" << scene_id ;
- std::string proj_scene_path = aux_dirs_[scene_id] + "/" + proj_scene_ss.str() + ".xml";
- if (!vul_file::exists(proj_scene_path)) {
- std::cout<< "Scene: " << proj_scene_path << " does not exist, initializing" << std::endl;
- typedef boct_tree<short,vnl_vector_fixed<double,10> > pca_tree_type;
- boxm_scene<pca_tree_type > *proj_scene =
- new boxm_scene<pca_tree_type >(data_scene->lvcs(), data_scene->origin(), data_scene->block_dim(), data_scene->world_dim(), data_scene->max_level(), data_scene->init_level());
- proj_scene->set_appearance_model(VNL_DOUBLE_10);
- proj_scene->set_paths(aux_dirs_[scene_id], proj_scene_ss.str());
- proj_scene->write_scene("/" + proj_scene_ss.str() + ".xml");
- }
- }
-
- xml_write();
-}
-
-//: Compute the scatter matrix of the specified block. A random number of cells are drawn for the calculation
-// The mask block indicates, whether a cell was used for learning the scatter matrix and mean
-// Ramndom samples according to octree structure.
-// Sampling is achieved by generating uniform random cell samples.
-// Since there are more cells where the resolution is finer, then these regions get sampled more often
-template <unsigned feature_dim>
-bool bvpl_global_pca<feature_dim>::sample_statistics( int scene_id, int block_i, int block_j, int block_k,
- vnl_matrix_fixed<double, feature_dim, feature_dim> &S,
- vnl_vector_fixed<double, feature_dim> &mean,
- unsigned long &nfeature)
-{
- if (!training_scenes_[scene_id]) {
- std::cout << "Skiping scene: " << scene_id <<", labeled for testing\n";
- return false;
- }
-
- typedef boct_tree<short,float> float_tree_type;
- typedef boct_tree_cell<short,float> float_cell_type;
-
- typedef boct_tree<short,bool> bool_tree_type;
- typedef boct_tree_cell<short,bool> bool_cell_type;
-
- boxm_scene_base_sptr data_scene_base =load_scene(scene_id);
- boxm_scene_base_sptr mask_scene_base =load_train_scene(scene_id);
-
- boxm_scene<boct_tree<short, float> >* data_scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*>(data_scene_base.as_pointer());
- boxm_scene<boct_tree<short, bool> >* mask_scene = dynamic_cast<boxm_scene<boct_tree<short, bool> >*>(mask_scene_base.as_pointer());
-
- if (!(data_scene))
- {
- std::cerr << "Error in bvpl_global_pca<feature_dim>::sample_statistics: Could not cast data scenes\n";
- return false;
- }
- if (!(mask_scene))
- {
- std::cerr << "Error in bvpl_global_pca<feature_dim>::sample_statistics: Could not cast mask scenes\n";
- return false;
- }
-
- //init variables
- data_scene->unload_active_blocks();
- mask_scene->unload_active_blocks();
-
- mean.fill(0.0);
- S.fill(0.0);
-
- vnl_random rng;
- //vnl_random rng(9667566ul);
-
- //get the cells for this block
- if (!(data_scene->valid_index(block_i, block_j, block_k) && mask_scene->valid_index(block_i, block_j, block_k))) {
- std::cerr << "In compute_testing_error: Invalid block\n";
- return false;
- }
-
- data_scene->load_block_and_neighbors(block_i, block_j, block_k);
- mask_scene->load_block(block_i, block_j, block_k);
-
- //get the trees
- float_tree_type* data_tree = data_scene->get_block(block_i, block_j, block_k)->get_tree();
- bool_tree_type* mask_tree = data_tree->template clone_to_type<bool>();
- mask_tree->init_cells(false);
-
- nfeature = 1;
-
- //2. Sample cells from this tree. The number of samples from this tree depends on the portion of scene cells that live in this tree
- std::vector<float_cell_type *> leaf_cells = data_tree->leaf_cells();
- std::vector<bool_cell_type*> mask_leaves = mask_tree->leaf_cells();
-
- int tree_ncells = leaf_cells.size();
- unsigned long tree_nsamples = (unsigned long)(tree_ncells*training_fraction_);
- double cell_length = finest_cell_length_[scene_id];
- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors
- //convert neighborhood box to scene coordinates
- vgl_point_3d<int> nmin = nbbox_.min_point();
- vgl_point_3d<int> nmax = nbbox_.max_point();
-
- std::cout <<" In block (" << block_i <<", " << block_j << ", " << block_k << "), number of nsamples is: " << tree_nsamples << ", cell length is: " << cell_length << std::endl;
-
- for (unsigned long i=0; i<tree_nsamples; i++)
- {
- unsigned long sample = rng.lrand32(tree_ncells-1);
-
- boct_tree_cell<short, float> *center_cell = leaf_cells[sample];
- vgl_point_3d<double> center_cell_centroid = data_tree->global_centroid(center_cell);
-
- vgl_box_3d<double> roi(cell_length*(double)nmin.x(),cell_length*(double)nmin.y(),cell_length*(double)nmin.z(),
- cell_length*(double)nmax.x(),cell_length*(double)nmax.y(),cell_length*(double)nmax.z());
- roi.set_centroid(center_cell_centroid);
-
- //if neighborhood is not inclusive we would have missing features
- if (!((data_scene->get_world_bbox()).contains(roi))) {
- i--;
- continue;
- }
-
- //3. Assemble neighborhood as a feature-vector
- vnl_vector_fixed<double, feature_dim> this_feature(0.0);
-
- unsigned curr_dim = 0;
- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); z++)
- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); y++)
- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); x++)
- {
- vgl_point_3d<double> neighbor_centroid(center_cell_centroid.x() + (double)x*cell_length,
- center_cell_centroid.y() + (double)y*cell_length,
- center_cell_centroid.z() + (double)z*cell_length);
-
- boct_tree_cell<short,float> *neighbor_cell = data_scene->locate_point_in_memory(neighbor_centroid);
-
- assert(neighbor_cell !=nullptr);
- this_feature[curr_dim] = (double)neighbor_cell->data();
- curr_dim++;
- }
-
- assert(curr_dim == feature_dim);
-
- mask_leaves[sample]->set_data(true);
-
- //increment weights
- double rho = 1.0/(double)nfeature;
- double rho_comp = 1.0 - rho;
-
- // the difference vector between the sample and the mean
- vnl_vector_fixed<double, feature_dim> diff = this_feature - mean;
-
- //update the covariance
- S += rho_comp*outer_product(diff,diff);
-
- //update the mean
- mean += (rho*diff);
-
- ++nfeature;
-#if 0
- std::cerr << "Feature EVD: " <<this_feature << '\n'
- << "Mean Feature EVD: " <<mean_feature << '\n';
-#endif
- }
-
- --nfeature;
- // write and release memory
- mask_scene->get_block(block_i, block_j, block_k)->init_tree(mask_tree);
- mask_scene->write_active_block();
-
- data_scene->unload_active_blocks();
- mask_scene->unload_active_blocks();
-
- return true;
-}
-
-
-//: Update mean and scatter, given the mean and scatter of two sets.
-// Calculation is done according to Chan et al. Updating Formulae and a Pairwise Algorithm for Computing Sample Variances
-template <unsigned feature_dim>
-void bvpl_global_pca<feature_dim>::combine_pairwise_statistics( const vnl_vector_fixed<double,feature_dim> &mean1,
- const vnl_matrix_fixed<double,feature_dim,feature_dim> &scatter1,
- double const n1,
- const vnl_vector_fixed<double,feature_dim> &mean2,
- const vnl_matrix_fixed<double,feature_dim,feature_dim> &scatter2,
- double const n2,
- vnl_vector_fixed<double,feature_dim> & mean_out,
- vnl_matrix_fixed<double,feature_dim,feature_dim> & scatter_out,
- double &n_out )
-{
- n_out = n1+n2;
- mean_out = (n1*mean1 + n2*mean2)* (1.0/n_out);
- vnl_vector_fixed<double, feature_dim> d = mean2 - mean1;
- scatter_out = scatter1 + scatter2 + (n1*n2/n_out)*outer_product(d,d);
-}
-
-//: Set total scatter matrix, mean, sample, principal components and weights for this class
-template <unsigned feature_dim>
-void bvpl_global_pca<feature_dim>::set_up_pca_evd(const vnl_matrix_fixed<double, feature_dim, feature_dim> &S,
- const vnl_vector_fixed<double, feature_dim> &mean,
- const double total_nsamples)
-{
- scatter_ = S;
- training_mean_ = mean;
- nsamples_ = (long unsigned int)total_nsamples;
-
- // Compute eigenvectors(principal components) and values of S
-
- vnl_matrix<double> pc_temp;
- vnl_vector<double> w_temp;
-
- vnl_symmetric_eigensystem_compute(scatter_.as_ref(), pc_temp, w_temp);
- pc_ = pc_temp.fliplr();
- weights_=w_temp.flip();
-
- //save the newly set vaeiables
- this->xml_write();
-}
-
-//: Computes 10-dimensional pca projection at each voxel on the block and saves it
-template <unsigned feature_dim>
-void bvpl_global_pca<feature_dim>::project(int scene_id, int block_i, int block_j, int block_k)
-{
- typedef boct_tree<short,float> float_tree_type;
- typedef boct_tree_cell<short,float> float_cell_type;
-
- typedef boct_tree<short,vnl_vector_fixed<double,10> > pca_tree_type;
- typedef boct_tree_cell<short,vnl_vector_fixed<double,10> > pca_cell_type;
-
- boxm_scene_base_sptr data_scene_base =load_scene(scene_id);
- boxm_scene_base_sptr proj_scene_base =load_projection_scene(scene_id);
- boxm_scene_base_sptr aux_scene_base = load_valid_scene(scene_id);
-
- boxm_scene<boct_tree<short, float> >* data_scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*>(data_scene_base.as_pointer());
- boxm_scene<pca_tree_type>* proj_scene = dynamic_cast<boxm_scene<pca_tree_type>*>(proj_scene_base.as_pointer());
- boxm_scene<boct_tree<short, bool> >* aux_scene = dynamic_cast<boxm_scene<boct_tree<short, bool> >*> (aux_scene_base.as_pointer());
- if (!(data_scene && proj_scene && aux_scene))
- {
- std::cerr << "Error in bvpl_global_pca<feature_dim>::sample_statistics: Could not cast input scenes\n";
- return;
- }
-
- //init variables
- data_scene->unload_active_blocks();
- proj_scene->unload_active_blocks();
- aux_scene->unload_active_blocks();
-
- //get the cells for this block
- if (!(data_scene->valid_index(block_i, block_j, block_k) && proj_scene->valid_index(block_i, block_j, block_k) && aux_scene->valid_index(block_i, block_j, block_k))) {
- std::cerr << "In compute_testing_error: Invalid block\n";
- return;
- }
-
- data_scene->load_block_and_neighbors(block_i, block_j, block_k);
- proj_scene->load_block(block_i, block_j, block_k);
- aux_scene->load_block(block_i, block_j, block_k);
-
- //get the trees
- float_tree_type* data_tree = data_scene->get_block(block_i, block_j, block_k)->get_tree();
- pca_tree_type* proj_tree = data_tree->template clone_to_type<vnl_vector_fixed<double,10> >();
- boct_tree<short, bool>* aux_tree = data_tree->template clone_to_type<bool>();
- aux_tree->init_cells(true);
-
- //get leaf cells
- std::vector<float_cell_type *> data_leaves = data_tree->leaf_cells();
- std::vector<pca_cell_type *> proj_leaves = proj_tree->leaf_cells();
- std::vector<boct_tree_cell<short, bool> *> aux_leaves = aux_tree->leaf_cells();
-
- double cell_length = finest_cell_length_[scene_id];
-
- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors
- //convert neighborhood box to scene coordinates
- vgl_point_3d<int> nmin = nbbox_.min_point();
- vgl_point_3d<int> nmax = nbbox_.max_point();
-#ifdef DEBUG_PROJ
- double error = 0.0;
- unsigned long n_valid_cells= 0;
-#endif
-
- for (unsigned long i =0; i<data_leaves.size(); i++)
- {
- float_cell_type* data_cell = data_leaves[i];
-
- //create a region around the center cell
- vgl_point_3d<double> centroid = data_tree->global_centroid(data_cell);
-
- //change the coordinates of enpoints to be in global coordinates abd test if they are contained in the scene
- vgl_point_3d<double> min_point_global(centroid.x() + (double)nmin.x()*cell_length, centroid.y() + (double)nmin.y()*cell_length, centroid.z() + (double)nmin.z()*cell_length);
- vgl_point_3d<double> max_point_global(centroid.x() + (double)nmax.x()*cell_length, centroid.y() + (double)nmax.y()*cell_length, centroid.z() + (double)nmax.z()*cell_length);
- if (!(data_scene->locate_point_in_memory(min_point_global) && data_scene->locate_point_in_memory(max_point_global))) {
- proj_leaves[i]->set_data(vnl_vector_fixed<double,10>(0.0));
- aux_leaves[i]->set_data(false);
- continue;
- }
-
- //3. Assemble neighborhood as a feature-vector
- vnl_vector_fixed<double, feature_dim> this_feature(0.0f);
-
- unsigned curr_dim = 0;
- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); z++)
- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); y++)
- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); x++)
- {
- vgl_point_3d<double> neighbor_centroid(centroid.x() + (double)x*cell_length,
- centroid.y() + (double)y*cell_length,
- centroid.z() + (double)z*cell_length);
-
- boct_tree_cell<short,float> *neighbor_cell = data_scene->locate_point_in_memory(neighbor_centroid);
-
- if (!neighbor_cell) {
- std::cerr << "Error in bvpl_global_pca<feature_dim>::project\n";
- return;
- }
-
- this_feature[curr_dim] = (double)neighbor_cell->data();
- curr_dim++;
- }
-
- if (curr_dim != feature_dim) {
- std::cerr << "Error in bvpl_global_pca<feature_dim>::project\n";
- return;
- }
- this_feature-=training_mean_;
-
- //solve for the coefficients
- vnl_vector_fixed<double, feature_dim> a(0.0);
- a = pc_.transpose() * (this_feature);
- vnl_vector_fixed<double,10> sample(a.extract(10));
- proj_leaves[i]->set_data(sample);
-
-#ifdef DEBUG_PROJ
- //project as a function of number of components
- vnl_vector_fixed<double, feature_dim> feature_approx = pc_.extract(feature_dim, 10) * sample;
-
- //compute error
- error+=(float)((this_feature - feature_approx).squared_magnitude());
- n_valid_cells++;
-#endif
- }
-
- // write and release memory
- proj_scene->get_block(block_i, block_j, block_k)->init_tree(proj_tree);
- proj_scene->write_active_block();
- proj_scene->unload_active_blocks();
- aux_scene->get_block(block_i, block_j, block_k)->init_tree(aux_tree);
- aux_scene->write_active_block();
- aux_scene->unload_active_blocks();
- data_scene->unload_active_blocks();
-
-#ifdef DEBUG_PROJ
- std::cout << "Total error in this block: " << error/(double)n_valid_cells << std::endl;
-#endif
-}
-
-//: Computes the projection error (as square magniture) given 10-dimensional pca projection at each voxel on the block
-template <unsigned feature_dim>
-void bvpl_global_pca<feature_dim>::projection_error(int scene_id, int block_i, int block_j, int block_k)
-{
- if (training_scenes_[scene_id]) {
- std::cout << "Skipping training scene: " <<scene_id << std::endl;
- return;
- }
- typedef boct_tree<short,float> float_tree_type;
- typedef boct_tree_cell<short,float> float_cell_type;
-
- typedef boct_tree<short,vnl_vector_fixed<double,10> > pca_tree_type;
- typedef boct_tree_cell<short,vnl_vector_fixed<double,10> > pca_cell_type;
-
- boxm_scene_base_sptr proj_scene_base = load_projection_scene(scene_id);
- boxm_scene_base_sptr error_scene_base = load_error_scene(scene_id);
- boxm_scene_base_sptr data_scene_base =load_scene(scene_id);
-
- boxm_scene<float_tree_type>* data_scene = dynamic_cast<boxm_scene<float_tree_type>*>(data_scene_base.as_pointer());
- boxm_scene<pca_tree_type>* proj_scene = dynamic_cast<boxm_scene<pca_tree_type>*>(proj_scene_base.as_pointer());
- boxm_scene<float_tree_type >* error_scene = dynamic_cast<boxm_scene<float_tree_type >*>(error_scene_base.as_pointer());
-
- if (!(data_scene && error_scene && proj_scene))
- {
- std::cerr << "Error in bvpl_global_pca<feature_dim>::sample_statistics: Could not cast input scenes\n";
- return;
- }
-
- //init variables
- data_scene->unload_active_blocks();
- proj_scene->unload_active_blocks();
- error_scene->unload_active_blocks();
-
- //get the cells for this block
- if (!(data_scene->valid_index(block_i, block_j, block_k) && proj_scene->valid_index(block_i, block_j, block_k) && error_scene->valid_index(block_i, block_j, block_k))) {
- std::cerr << "In compute_testing_error: Invalid block\n";
- return;
- }
-
- data_scene->load_block_and_neighbors(block_i, block_j, block_k);
- proj_scene->load_block(block_i, block_j, block_k);
- error_scene->load_block(block_i, block_j, block_k);
-
- //get the trees
- float_tree_type* data_tree = data_scene->get_block(block_i, block_j, block_k)->get_tree();
- pca_tree_type* proj_tree = proj_scene->get_block(block_i, block_j, block_k)->get_tree();
- float_tree_type* error_tree = data_tree->clone();
- error_tree->init_cells(-1.0f);
-
- //get leaf cells
- std::vector<float_cell_type *> data_leaves = data_tree->leaf_cells();
- std::vector<pca_cell_type *> proj_leaves = proj_tree->leaf_cells();
- std::vector<float_cell_type *> error_leaves = error_tree->leaf_cells();
-
- double cell_length = finest_cell_length_[scene_id];
-
- //CAUTION: the neighborhood box was suppossed to be defined as number of regular neighbors
- //convert neighborhood box to scene coordinates
- vgl_point_3d<int> nmin = nbbox_.min_point();
- vgl_point_3d<int> nmax = nbbox_.max_point();
-
- for (unsigned i =0; i<data_leaves.size(); i++)
- {
- float_cell_type* data_cell = data_leaves[i];
-
- //create a region around the center cell
- vgl_point_3d<double> centroid = data_tree->global_centroid(data_cell);
-
- //change the coordinates of enpoints to be in global coordinates aad test if they are contained in the scene
- vgl_point_3d<double> min_point_global(centroid.x() + (double)nmin.x()*cell_length, centroid.y() + (double)nmin.y()*cell_length, centroid.z() + (double)nmin.z()*cell_length);
- vgl_point_3d<double> max_point_global(centroid.x() + (double)nmax.x()*cell_length, centroid.y() + (double)nmax.y()*cell_length, centroid.z() + (double)nmax.z()*cell_length);
- if (!(data_scene->locate_point_in_memory(min_point_global) && data_scene->locate_point_in_memory(max_point_global))) {
- error_leaves[i]->set_data(-1.0f);
- continue;
- }
-
- //3. Assemble neighborhood as a feature-vector
- vnl_vector_fixed<double, feature_dim> this_feature(0.0f);
-
- unsigned curr_dim = 0;
- for (int z = nbbox_.min_z(); z<=nbbox_.max_z(); ++z)
- for (int y = nbbox_.min_y(); y<=nbbox_.max_y(); ++y)
- for (int x = nbbox_.min_x(); x<=nbbox_.max_x(); ++x)
- {
- vgl_point_3d<double> neighbor_centroid(centroid.x() + (double)x*cell_length,
- centroid.y() + (double)y*cell_length,
- centroid.z() + (double)z*cell_length);
-
- boct_tree_cell<short,float> *neighbor_cell = data_scene->locate_point_in_memory(neighbor_centroid);
-
- if (!neighbor_cell) {
- std::cerr << "Error in bvpl_global_pca<feature_dim>::project\n";
- return;
- }
-
- this_feature[curr_dim] = (double)neighbor_cell->data();
- curr_dim++;
- }
-
- if (curr_dim != feature_dim) {
- std::cerr << "Error in bvpl_global_pca<feature_dim>::project\n";
- return;
- }
- this_feature-=training_mean_;
-
- //get the coefficients
- vnl_vector_fixed<double, 10> a = proj_leaves[i]->data();
-
- //project
- vnl_vector_fixed<double, feature_dim> feature_approx = pc_.extract(feature_dim, 10) * a;
-
- //compute error
- error_leaves[i]->set_data((float)((this_feature - feature_approx).squared_magnitude()));
- }
-
- // write and release memory
- error_scene->get_block(block_i, block_j, block_k)->init_tree(error_tree);
- error_scene->write_active_block();
- error_scene->unload_active_blocks();
- data_scene->unload_active_blocks();
- proj_scene->unload_active_blocks();
-}
-
-
-//: Load scene info
-template <unsigned feature_dim>
-boxm_scene_base_sptr bvpl_global_pca<feature_dim>::load_scene (int scene_id)
-{
- if (scene_id<0 || scene_id>((int)scenes_.size() -1))
- {
- std::cerr << "Error in bvpl_global_pca::load_scene: Invalid scene id\n";
- return nullptr;
- }
- //load scene
- boxm_scene_base_sptr scene_base = new boxm_scene_base();
- boxm_scene_parser scene_parser;
- scene_base->load_scene(scenes_[scene_id], scene_parser);
-
- //cast scene
- boxm_scene<boct_tree<short, float > > *scene= new boxm_scene<boct_tree<short, float > >();
- if (scene_base->appearence_model() == BOXM_FLOAT) {
- scene->load_scene(scene_parser);
- scene_base = scene;
- }
- else {
- std::cerr << "Error in bvpl_global_pca::load_scene: Invalid appearance model\n";
- return nullptr;
- }
-
- return scene_base;
-}
-
-//: Load auxiliary scene indicating if a cell is valid. e.g border cells are not valid
-template <unsigned feature_dim>
-boxm_scene_base_sptr bvpl_global_pca<feature_dim>::load_valid_scene (int scene_id)
-{
- if (scene_id<0 || scene_id>((int)scenes_.size() -1))
- {
- std::cerr << "Error in bvpl_global_pca::load_scene: Invalid scene id\n";
- return nullptr;
- }
- //load scene
- boxm_scene_base_sptr aux_scene_base = new boxm_scene_base();
- boxm_scene_parser aux_parser;
- std::stringstream aux_scene_ss;
- aux_scene_ss << aux_dirs_[scene_id] << "/valid_scene_" << scene_id << ".xml";
- aux_scene_base->load_scene(aux_scene_ss.str(), aux_parser);
-
- //cast scene
- boxm_scene<boct_tree<short, bool > > *aux_scene= new boxm_scene<boct_tree<short, bool > >();
- if (aux_scene_base->appearence_model() == BOXM_BOOL) {
- aux_scene->load_scene(aux_parser);
- aux_scene_base = aux_scene;
- }
- else {
- std::cerr << "Error in bvpl_global_pca::load_aux_scene: Invalid appearance model\n";
- return nullptr;
- }
-
- return aux_scene_base;
-}
-
-//: Load auxiliary scene indicating if a cell is should be used for training
-template <unsigned feature_dim>
-boxm_scene_base_sptr bvpl_global_pca<feature_dim>::load_train_scene (int scene_id)
-{
- if (scene_id<0 || scene_id>((int)scenes_.size() -1))
- {
- std::cerr << "Error in bvpl_global_pca::load_scene: Invalid scene id\n";
- return nullptr;
- }
- //load scene
- boxm_scene_base_sptr aux_scene_base = new boxm_scene_base();
- boxm_scene_parser aux_parser;
- std::stringstream aux_scene_ss;
- aux_scene_ss << aux_dirs_[scene_id] << "/train_scene_" << scene_id << ".xml";
- aux_scene_base->load_scene(aux_scene_ss.str(), aux_parser);
-
- //cast scene
- boxm_scene<boct_tree<short, bool > > *aux_scene= new boxm_scene<boct_tree<short, bool > >();
- if (aux_scene_base->appearence_model() == BOXM_BOOL) {
- aux_scene->load_scene(aux_parser);
- aux_scene_base = aux_scene;
- }
- else {
- std::cerr << "Error in bvpl_global_pca::load_aux_scene: Invalid appearance model\n";
- return nullptr;
- }
-
- return aux_scene_base;
-}
-
-
-//: Load auxiliary scene info
-template <unsigned feature_dim>
-
-boxm_scene_base_sptr bvpl_global_pca<feature_dim>::load_projection_scene (int scene_id)
-{
- if (scene_id<0 || scene_id>((int)scenes_.size() -1))
- {
- std::cerr << "Error in bvpl_global_pca::load_projection_scene: Invalid scene id\n";
- return nullptr;
- }
- //load scene
- boxm_scene_base_sptr proj_scene_base = new boxm_scene_base();
- boxm_scene_parser proj_parser;
- std::stringstream proj_scene_ss;
- proj_scene_ss << aux_dirs_[scene_id] << "/proj_pca_scene_" << scene_id << ".xml";
- proj_scene_base->load_scene(proj_scene_ss.str(), proj_parser);
-
- //cast scene
- typedef boct_tree<short,vnl_vector_fixed<double,10> > pca_tree_type;
- boxm_scene<pca_tree_type > *proj_scene= new boxm_scene<pca_tree_type >();
- if (proj_scene_base->appearence_model() == VNL_DOUBLE_10) {
- proj_scene->load_scene(proj_parser);
- proj_scene_base = proj_scene;
- }
- else {
- std::cerr << "Error in bvpl_global_pca::load_proj_scene: Invalid appearance model\n";
- return nullptr;
- }
-
- return proj_scene_base;
-}
-
-
-//: Load auxiliary scene info
-template <unsigned feature_dim>
-boxm_scene_base_sptr bvpl_global_pca<feature_dim>::load_error_scene (int scene_id)
-{
- if (scene_id<0 || scene_id>((int)scenes_.size() -1))
- {
- std::cerr << "Error in bvpl_global_pca::load_error_scene: Invalid scene id\n";
- return nullptr;
- }
-
- boxm_scene_base_sptr data_scene_base = load_scene(scene_id);
- boxm_scene<boct_tree<short, float> >* data_scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*> (data_scene_base.as_pointer());
- if (!data_scene) {
- std::cerr << "Error in bvpl_global_pca<feature_dim>::init(): Could not cast data scene\n";
- return nullptr;
- }
-
- std::stringstream aux_scene_ss;
- aux_scene_ss << "error_pca_scene_" << scene_id ;
- std::string aux_scene_path = aux_dirs_[scene_id] + "/" + aux_scene_ss.str() + ".xml";
- if (!vul_file::exists(aux_scene_path)) {
- std::cout<< "Scene: " << aux_scene_path << " does not exist, initializing" << std::endl;
- boxm_scene<boct_tree<short, float> > *aux_scene =
- new boxm_scene<boct_tree<short, float> >(data_scene->lvcs(), data_scene->origin(), data_scene->block_dim(), data_scene->world_dim(), data_scene->max_level(), data_scene->init_level());
- aux_scene->set_appearance_model(BOXM_FLOAT);
- aux_scene->set_paths(aux_dirs_[scene_id], aux_scene_ss.str());
- aux_scene->write_scene("/" + aux_scene_ss.str() + ".xml");
- }
-
- //load scene
- boxm_scene_base_sptr error_scene_base = new boxm_scene_base();
- boxm_scene_parser error_parser;
- std::stringstream error_scene_ss;
- error_scene_ss << aux_dirs_[scene_id] << "/error_pca_scene_" << scene_id << ".xml";
- error_scene_base->load_scene(error_scene_ss.str(), error_parser);
-
- //cast scene
- boxm_scene<boct_tree<short, float> > *error_scene= new boxm_scene<boct_tree<short, float> >();
- if (error_scene_base->appearence_model() == BOXM_FLOAT) {
- error_scene->load_scene(error_parser);
- error_scene_base = error_scene;
- }
- else {
- std::cerr << "Error in bvpl_global_pca::load_error_scene: Invalid appearance model\n";
- return nullptr;
- }
-
- return error_scene_base;
-}
-
-
-//: Write this class to xml file
-template <unsigned feature_dim>
-void bvpl_global_pca<feature_dim>::xml_write()
-{
- bxml_document doc;
- bxml_element *root = new bxml_element("pca_global_info");
- doc.set_root_element(root);
- root->append_text("\n");
-
- bxml_element* paths = new bxml_element("paths");
- paths->append_text("\n");
- paths->set_attribute("pc_path", pc_path() );
- paths->set_attribute("weights_path", weights_path() );
- paths->set_attribute("mean_path", mean_path());
- paths->set_attribute("scatter_path", scatter_path());
- root->append_data(paths);
- root->append_text("\n");
-
- bxml_element* neighborhood = new bxml_element("neighborhood");
- neighborhood->append_text("\n");
- neighborhood->set_attribute("min_x", nbbox_.min_point().x());
- neighborhood->set_attribute("min_y", nbbox_.min_point().y());
- neighborhood->set_attribute("min_z", nbbox_.min_point().z());
- neighborhood->set_attribute("max_x", nbbox_.max_point().x());
- neighborhood->set_attribute("max_y", nbbox_.max_point().y());
- neighborhood->set_attribute("max_z", nbbox_.max_point().z());
- root->append_data(neighborhood);
- root->append_text("\n");
-
- bxml_element* properties = new bxml_element("properties");
- properties->append_text("\n");
- properties->set_attribute("nsamples", nsamples_);
- properties->set_attribute("feature_dim", feature_dim);
- //properties->set_attribute("finest_cell_length", finest_cell_length_);
- properties->set_attribute("nscenes", scenes_.size());
- properties->set_attribute("training_fraction", training_fraction_);
-
- root->append_data(properties);
- root->append_text("\n");
-
- //write the scenes
- for (unsigned i =0; i<scenes_.size(); i++)
- {
- bxml_element* scenes_elm = new bxml_element("scene");
- scenes_elm->append_text("\n");
- scenes_elm->set_attribute("id", i);
- scenes_elm->set_attribute("path", scenes_[i]);
- scenes_elm->set_attribute("aux_dir", aux_dirs_[i]);
- scenes_elm->set_attribute("cell_length", finest_cell_length_[i]);
- scenes_elm->set_attribute("nleaves", nleaves_[i]);
- root->append_data(scenes_elm);
- root->append_text("\n");
- }
-
- //write training scenes
- bxml_element* train_elm = new bxml_element("training_scenes");
- train_elm->append_text("\n");
-
- std::stringstream ss;
- unsigned ts = 0;
-
- for (unsigned i = 0; i< training_scenes_.size(); i++) {
- if (training_scenes_[i]) {
- ss << i << ' ';
- ts++;
- }
- }
-
- train_elm->set_attribute("nscenes", ts);
- train_elm->append_text(ss.str());
- train_elm->append_text("\n");
- root->append_data(train_elm);
- root->append_text("\n");
-
- //write to disk
- std::ofstream os(xml_path().c_str());
- bxml_write(os, doc);
- os.close();
-
- // Write pca main matrices -other matrices aren't class variables and should have been written during computation time
- write_pca_matrices();
-}
-
-//: Write a PCA file
-template <unsigned feature_dim>
-void bvpl_global_pca<feature_dim>::write_pca_matrices()
-{
- std::ofstream pc_ofs(pc_path().c_str());
- pc_ofs.precision(15);
- std::ofstream weights_ofs(weights_path().c_str());
- weights_ofs.precision(15);
- std::ofstream mean_ofs(mean_path().c_str());
- mean_ofs.precision(15);
- std::ofstream scatter_ofs(scatter_path().c_str());
- scatter_ofs.precision(15);
-
- pc_ofs << pc_;
- pc_ofs.close();
- weights_ofs << weights_;
- weights_ofs.close();
- mean_ofs << training_mean_;
- mean_ofs.close();
- scatter_ofs << scatter_;
- scatter_ofs.close();
-}
-
-
-#define BVPL_GLOBAL_PCA(feature_dim) \
-template class bvpl_global_pca<feature_dim>;
-
-
-#endif // bvpl_global_pca_hxx_
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.cxx
deleted file mode 100644
index 40ca062045..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.cxx
+++ /dev/null
@@ -1,12 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 11-Apr-2011
-
-#include "bvpl_global_taylor.h"
-
-template <>
-boxm_apm_type bvpl_taylor_apm<double, 10>(){return VNL_DOUBLE_10;}
-
-template <>
-boxm_apm_type bvpl_taylor_apm<float, 3>(){return VNL_FLOAT_3;}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.h
deleted file mode 100644
index 38c05600fb..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.h
+++ /dev/null
@@ -1,100 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.h
-#ifndef bvpl_global_taylor_h
-#define bvpl_global_taylor_h
-//:
-// \file
-// \brief A class to compute taylor features across different boxm_scenes
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 11-Apr-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <boxm/boxm_scene.h>
-#include <bvpl/kernels/bvpl_kernel.h>
-#include <vbl/vbl_ref_count.h>
-
-//Forward declaration
-class bvpl_global_corners;
-
-template <class T_data, unsigned DIM>
-boxm_apm_type bvpl_taylor_apm();
-
-namespace bvpl_global_tylor_defaults
-{
- const std::string kernel_names[10] = {"I0", "Ix", "Iy", "Iz", "Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz" };
-;
-}
-
-template<class T_data, unsigned DIM>
-class bvpl_global_taylor : public vbl_ref_count
-{
- public:
-
- //: Constructor from xml file
- bvpl_global_taylor(const std::string &path, const std::string kernel_names[]);
-
- //: Init auxiliary scenes and smallest cell length values
- void init();
-
- //: Compute the DIM taylor kernels for this scene at current block. The output is saved to the projection scene as a DIM-d vector
- void compute_taylor_coefficients(int scene_id, int block_i, int block_j, int block_k);
-
- //: Compute reconstruction error
- bool compute_approximation_error(int scene_id, int block_i, int block_j, int block_k);
-
- //: Extract a particular coefficient scene
- void extract_coefficient_scene(int scene_id, int coefficient_id, boxm_scene<boct_tree<short, float > > *coeff_scene);
-
- //: Threshold non-salient features according to Harris' measure
- void threshold_corners(int scene_id, int block_i, int block_j, int block_k, double k);
-
- //: Write to taylor_global_info.xml
- void xml_write();
-
- // Accessors
- std::string path_out() const { return path_out_; }
- std::vector<std::string> scenes() const { return scenes_; }
- std::vector<std::string> aux_dirs() const { return aux_dirs_; }
- std::string aux_dirs( unsigned i ) const { return aux_dirs_[i]; }
- std::vector<double> cell_lengths() const { return finest_cell_length_; }
- //std::vector<bool> training_scenes() const { return training_scenes_; }
-
- boxm_scene_base_sptr load_scene (int scene_id);
- boxm_scene_base_sptr load_error_scene (int scene_id);
- boxm_scene_base_sptr load_valid_scene (int scene_id);
- boxm_scene_base_sptr load_projection_scene (int scene_id);
-
- std::string xml_path() { return path_out_ + "/taylor_global_info.xml"; }
-
- friend class bvpl_global_corners;
-
- protected:
-
- //: A vector to hold scene paths
- std::vector<std::string> scenes_;
- //: A vector to hold paths to keep any kind of auxiliary scene or info(must be in the same order as scenes_)
- std::vector<std::string> aux_dirs_;
- //: A vector to hold the finest cell length of the corresponding scene scene
- std::vector<double> finest_cell_length_;
- //: A vector that indicates whether a scene should be used as train (True) or test(False). Order is equivalent to scenes_
- //std::vector<bool> training_scenes_;
-
- //: A vector to 2-degree taylor approximation kernels
- // The order is I0, Ix, Iy, Iz, Ixx, Iyy, Izz, Ixy, Ixz, Iyz (therefore this class works for dimensions 1-10)
- bvpl_kernel_vector_sptr kernel_vector_;
-
- //: Path to kernel files
- std::string kernels_path_;
- //: Path to xml info file
- std::string path_out_;
-};
-
-#include <vbl/vbl_smart_ptr.h>
-// This does not really seem like a good idea to me ... - PVr.
-typedef vbl_smart_ptr<bvpl_global_taylor<double,10> > bvpl_global_taylor_sptr;
-
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.hxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.hxx
deleted file mode 100644
index d8bdd3f0e4..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_global_taylor.hxx
+++ /dev/null
@@ -1,645 +0,0 @@
-#ifndef bvpl_global_taylor_hxx_
-#define bvpl_global_taylor_hxx_
-//:
-// \file
-#include "bvpl_global_taylor.h"
-// \author Isabel Restrepo
-// \date 11-Apr-2011
-
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_scene_parser.h>
-
-#include <bxml/bxml_write.h>
-#include <bxml/bxml_read.h>
-#include <bxml/bxml_find.h>
-
-#include <bvpl/bvpl_octree/bvpl_block_vector_operator.h>
-#include <bvpl/functors/bvpl_algebraic_functor.h>
-#include <bvpl/kernels/bvpl_taylor_basis_factory.h>
-#include <bvpl_octree/bvpl_corner_detector.h>
-#include <bvpl_octree/bvpl_corner_functors.h>
-
-#include <vul/vul_file.h>
-
-#include <vnl/algo/vnl_matrix_inverse.h>
-#include <vnl/vnl_double_3.h>
-#include <vnl/vnl_double_3x3.h>
-
-//: Constructor from xml file
-template<class T_data, unsigned DIM>
-bvpl_global_taylor<T_data, DIM>::bvpl_global_taylor(const std::string &path, const std::string kernel_names[])
-{
- std::cout << "Loading taylor info from xml-file" << std::endl;
- path_out_ = path;
- std::ifstream xml_ifs(xml_path().c_str());
- if (!xml_ifs.is_open()) {
- std::cerr << "Error: could not open xml info file: " << xml_path() << '\n';
- throw;
- }
- bxml_document doc = bxml_read(xml_ifs);
- bxml_element query("taylor_global_info");
- bxml_data_sptr root = bxml_find_by_name(doc.root_element(), query);
- if (!root) {
- std::cerr << "Error: bvpl_discover_pca_kernels - could not parse xml root\n";
- throw;
- }
-
- //Parse scenes
- bxml_element scenes_query("scene");
- std::vector<bxml_data_sptr> scenes_data = bxml_find_all_with_name(root, scenes_query);
-
- unsigned nscenes=scenes_data.size();
- std::cout << "Number of scenes: " << nscenes <<std::endl;
-
- scenes_.clear();
- scenes_.resize(nscenes);
-
- aux_dirs_.clear();
- aux_dirs_.resize(nscenes);
-
- finest_cell_length_.clear();
- finest_cell_length_.resize(nscenes);
-
- for (unsigned si = 0; si < nscenes; si++)
- {
- bxml_element* scenes_elm = dynamic_cast<bxml_element*>(scenes_data[si].ptr());
- int id = -1;
- scenes_elm->get_attribute("id", id);
- scenes_elm->get_attribute("path", scenes_[id]);
- scenes_elm->get_attribute("aux_dir", aux_dirs_[id]);
- scenes_elm->get_attribute("cell_length" , finest_cell_length_[id]);
-
- std::cout << "Scene " << id << " is " << scenes_[id] << '\n';
- }
-
- //Parse kernels
- bxml_element kernels_query("kernels");
- bxml_data_sptr kernels_data = bxml_find_by_name(root, kernels_query);
- if (kernels_data)
- {
- bxml_element* kernels_elm = dynamic_cast<bxml_element*>(kernels_data.ptr());
-
- kernels_elm->get_attribute("path", kernels_path_);
-
- std::cout << "Kernels path is " << kernels_path_ << '\n';
- kernel_vector_ = new bvpl_kernel_vector;
-
- if (vul_file::exists(kernels_path_) && vul_file::is_directory(kernels_path_)) {
- //read the kernels
-
- kernel_vector_->kernels_.clear();
-
- kernel_vector_->kernels_.resize(DIM, nullptr);
- //std::string kernel_names[]={"I0", "Ix", "Iy", "Iz", "Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz"};
- for (unsigned ki = 0; ki<DIM; ki++) {
- std::string filename = kernels_path_ + "/" + kernel_names[ki] + ".txt";
- std::cout << "Reading kernel file : " << filename << std::endl;
- bvpl_taylor_basis_factory factory(filename);
- bvpl_kernel_sptr kernel = new bvpl_kernel(factory.create());
- kernel_vector_->kernels_[ki] = kernel;
- }
- }
- }
- else {
- std::cerr << " In Gobal Taylor, path to kernels does not exist\n";
- }
-}
-
-//: Compute the DIM taylor kernels for this scene at current block. The output is saved to the projection scene as a DIM-d vector
-template<class T_data, unsigned DIM>
-void bvpl_global_taylor<T_data, DIM>::compute_taylor_coefficients(int scene_id, int block_i, int block_j, int block_k)
-{
- typedef boct_tree_cell<short,float> float_cell_type;
-
- typedef boct_tree<short,vnl_vector_fixed<T_data,DIM> > taylor_tree_type;
-
- boxm_scene_base_sptr data_scene_base =load_scene(scene_id);
- boxm_scene_base_sptr proj_scene_base =load_projection_scene(scene_id);
- boxm_scene_base_sptr valid_scene_base = load_valid_scene(scene_id);
-
- boxm_scene<boct_tree<short, float> >* data_scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*>(data_scene_base.as_pointer());
- boxm_scene<taylor_tree_type>* proj_scene = dynamic_cast<boxm_scene<taylor_tree_type>*>(proj_scene_base.as_pointer());
- boxm_scene<boct_tree<short, bool> >* valid_scene = dynamic_cast<boxm_scene<boct_tree<short, bool> >*> (valid_scene_base.as_pointer());
- if (!(data_scene && proj_scene && valid_scene))
- {
- std::cerr << "Error in bvpl_global_taylor::sample_statistics: Could not cast input scenes\n";
- return;
- }
-
- //init variables
- data_scene->unload_active_blocks();
- proj_scene->unload_active_blocks();
- valid_scene->unload_active_blocks();
-
- //operate on scene
- bvpl_block_vector_operator block_oper;
- bvpl_algebraic_functor functor;
- block_oper.operate(*data_scene, functor, kernel_vector_, block_i, block_j, block_k, *proj_scene, *valid_scene, finest_cell_length_[scene_id]);
-
- //clean memory
- data_scene->unload_active_blocks();
- proj_scene->unload_active_blocks();
- valid_scene->unload_active_blocks();
-}
-
-template<class T_data, unsigned DIM>
-bool bvpl_global_taylor<T_data, DIM>::compute_approximation_error(int scene_id, int block_i, int block_j, int block_k)
-{
- typedef boct_tree<short,float> float_tree_type;
- typedef boct_tree_cell<short,float> float_cell_type;
- typedef boct_tree<short,vnl_vector_fixed<double,10> > taylor_tree_type;
- typedef boct_tree_cell<short,vnl_vector_fixed<double,10> > taylor_cell_type;
-
- boxm_scene_base_sptr proj_scene_base = load_projection_scene(scene_id);
- boxm_scene_base_sptr error_scene_base = load_error_scene(scene_id);
- boxm_scene_base_sptr data_scene_base =load_scene(scene_id);
-
- //cast the scenes
- boxm_scene<float_tree_type>* data_scene = dynamic_cast<boxm_scene<float_tree_type>* > (data_scene_base.as_pointer());
- boxm_scene<taylor_tree_type>* basis_scene = dynamic_cast<boxm_scene<taylor_tree_type>* > (proj_scene_base.as_pointer());
- boxm_scene<float_tree_type> * error_scene = dynamic_cast<boxm_scene<float_tree_type>* > (error_scene_base.as_pointer());
-
- if (!data_scene || !basis_scene || !error_scene) {
- std::cerr << "Error in compute_approximation_error: Faild to cast scene\n";
- return false;
- }
-
- //load blocks of interest
- data_scene->load_block_and_neighbors(block_i, block_j, block_k);
- basis_scene->load_block(block_i, block_j, block_k);
- error_scene->load_block(block_i, block_j, block_k);
-
- //get the leaves
- float_tree_type* data_tree = data_scene->get_block(block_i, block_j, block_k)->get_tree();
- float_tree_type* error_tree = data_tree->clone();
-
- //error is always positive, therefore cells with negative errors can be identified as uninitialized.
- error_tree->init_cells(-1.0f);
- taylor_tree_type* basis_tree = basis_scene->get_block(block_i, block_j, block_k)->get_tree();
-
- std::vector<float_cell_type*> data_leaves = data_tree->leaf_cells();
- std::vector<float_cell_type*> error_leaves = error_tree->leaf_cells();
- std::vector<taylor_cell_type*> basis_leaves = basis_tree->leaf_cells();
-
- vgl_point_3d<int> min_point = kernel_vector_->min();
- vgl_point_3d<int> max_point = kernel_vector_->max();
- double cell_length = this->finest_cell_length_[scene_id];
- std::cout << "In computing taylor error, limits are: " <<min_point << " and " <<max_point <<std::endl;
-
- for (unsigned i =0; i<data_leaves.size(); i++)
- {
- //current cell is the center
- float_cell_type* data_cell = data_leaves[i];
- taylor_cell_type* basis_cell = basis_leaves[i];
-
- boct_loc_code<short> data_code = data_cell->get_code();
- boct_loc_code<short> basis_code = basis_cell->get_code();
-
- //check cells are at the same location
- if (! data_code.isequal(basis_code)) {
- std::cerr << "Error in compute_approximation_error: Cells don't have the same location in the tree\n"
- << "Data Code: " << data_code << '\n'
- << "Basis Code: " << basis_code << '\n';
-
- return false;
- }
-
- //create a region around the center cell
- vgl_point_3d<double> centroid = data_tree->global_centroid(data_cell);
-
- //change the coordinates of enpoints to be in global coordinates abd text if they are contained in the scene
- vgl_point_3d<double> min_point_global(centroid.x() + (double)min_point.x()*cell_length,
- centroid.y() + (double)min_point.y()*cell_length,
- centroid.z() + (double)min_point.z()*cell_length);
- if (! data_scene->locate_point_in_memory(min_point_global))
- continue;
- vgl_point_3d<double> max_point_global(centroid.x() + (double)max_point.x()*cell_length,
- centroid.y() + (double)max_point.y()*cell_length,
- centroid.z() + (double)max_point.z()*cell_length);
- if (! data_scene->locate_point_in_memory(max_point_global))
- continue;
-
- //assemble basis
-// double I0 = basis_cell->data().I0;
-// vnl_double_3 G= basis_cell->data().G;
-// vnl_double_3x3 H = basis_cell->data().H;
- vnl_vector_fixed<double,10> taylor_coeff = basis_cell->data();
-
- //form basis
- double I0 = taylor_coeff[0];
- vnl_double_3 G(taylor_coeff[1], taylor_coeff[2], taylor_coeff[3]);
- vnl_double_3x3 H;
- H.put(0,0,taylor_coeff[4]);
- H.put(0,1,taylor_coeff[7]);
- H.put(0,2,taylor_coeff[8]);
- H.put(1,0,taylor_coeff[7]);
- H.put(1,1,taylor_coeff[5]);
- H.put(1,2,taylor_coeff[9]);
- H.put(2,0,taylor_coeff[8]);
- H.put(2,1,taylor_coeff[9]);
- H.put(2,2,taylor_coeff[6]);
-
- double error = 0.0;
- for (int x = min_point.x(); x<= max_point.x(); x++) {
- for (int y = min_point.y(); y<=max_point.y(); y++) {
- for (int z = min_point.z(); z<=max_point.z(); z++) {
- vgl_point_3d<double> point2visit(centroid.x()+(double)x*cell_length, centroid.y()+ (double)y*cell_length, centroid.z() + (double)z*cell_length);
- boct_tree_cell<short,float> *this_cell = data_scene->locate_point_in_memory(point2visit);
- if (this_cell) {
- vnl_double_3 X((double)x,(double)y, (double)z);
- double approx = I0 + dot_product(X,G) + 0.5* (dot_product(X,(H*X)));
- error = error + (this_cell->data() - approx)*(this_cell->data() - approx);
- //std::cout << "Taylor Error :\n" << "This centroid: " << this_centroid << ", box_centroid: " <<box_centroid <<std::endl;
- //std::cout << "Taylor Error :\n" << "X: " << X << "\nI0: " << I0 <<"\nG: " << G << "\nH: " << H <<"\nApprox: " <<approx << "\nError: " << error << std::endl;
- }
- }
- }
- }
-
- error_leaves[i]->set_data((float)error);
- }
-
- // write and release memory
- error_scene->get_block(block_i, block_j, block_k)->set_tree(error_tree);
- error_scene->write_active_block();
- data_scene->unload_active_blocks();
- basis_scene->unload_active_blocks();
-
- return true;
-}
-
-
-//: Threshold non-salient features according to Harris' measure
-template<class T_data, unsigned DIM>
-void bvpl_global_taylor<T_data, DIM>::threshold_corners(int scene_id, int block_i, int block_j, int block_k, double harris_k)
-{
- typedef boct_tree<short,vnl_vector_fixed<double,10> > taylor_tree_type;
- typedef boct_tree_cell<short,vnl_vector_fixed<double,10> > taylor_cell_type;
-
- boxm_scene_base_sptr data_scene_base =load_scene(scene_id);
- boxm_scene_base_sptr proj_scene_base =load_projection_scene(scene_id);
- boxm_scene_base_sptr valid_scene_base = load_valid_scene(scene_id);
-
- boxm_scene<taylor_tree_type>* proj_scene = dynamic_cast<boxm_scene<taylor_tree_type>*>(proj_scene_base.as_pointer());
- boxm_scene<boct_tree<short, bool> >* valid_scene = dynamic_cast<boxm_scene<boct_tree<short, bool> >*> (valid_scene_base.as_pointer());
- boxm_scene<boct_tree<short, float> >* corner_scene =
- new boxm_scene<boct_tree<short, float> >(valid_scene->lvcs(), valid_scene->origin(), valid_scene->block_dim(), valid_scene->world_dim(), valid_scene->max_level(), valid_scene->init_level());
- corner_scene->set_appearance_model(BOXM_FLOAT);
- corner_scene->set_paths(valid_scene->path(), "harris_scene");
- corner_scene->write_scene("/harris_scene.xml");
-
- if (!( proj_scene && valid_scene && corner_scene ))
- {
- std::cerr << "Error in bvpl_global_taylor::threshold_corners: Could not cast input scenes\n";
- return;
- }
-
- //init variables
- proj_scene->unload_active_blocks();
- valid_scene->unload_active_blocks();
-
- //operate on scene
- bvpl_corner_detector corner_detector;
- bvpl_harris_laptev_functor harris_functor(harris_k);
-
- vgl_point_3d<int> max_neigborhood_idx = kernel_vector_->max();
- vgl_point_3d<int> min_neigborhood_idx = kernel_vector_->min();
-
- std::cout << "Neighborhood for harris threshhold: " << min_neigborhood_idx << " , " << max_neigborhood_idx << std::endl;
-
- corner_detector.detect_and_threshold(proj_scene, harris_functor, min_neigborhood_idx, max_neigborhood_idx,
- block_i, block_j, block_k, valid_scene, corner_scene, finest_cell_length_[scene_id]);
-
- //clean memory
- proj_scene->unload_active_blocks();
- valid_scene->unload_active_blocks();
- corner_scene->unload_active_blocks();
-}
-
-//: Init auxiliary scenes and smallest cell length values
-template<class T_data, unsigned DIM>
-void bvpl_global_taylor<T_data, DIM>::init()
-{
- for (unsigned i = 0; i < aux_dirs_.size(); i++)
- {
- boxm_scene_base_sptr data_scene_base = load_scene(i);
- boxm_scene<boct_tree<short, float> >* data_scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*> (data_scene_base.as_pointer());
- if (!data_scene) {
- std::cerr << "Error in bvpl_global_taylor::init(): Could not cast data scene\n";
- return;
- }
- double finest_cell_length = data_scene->finest_cell_length();
- finest_cell_length_[i] = finest_cell_length;
-
- if (!(vul_file::exists(aux_dirs_[i]) && vul_file::is_directory(aux_dirs_[i]))) {
- vul_file::make_directory(aux_dirs_[i]);
- }
-
- {
- std::stringstream aux_scene_ss;
- aux_scene_ss << "valid_scene_" << i ;
- std::string aux_scene_path = aux_dirs_[i] + "/" + aux_scene_ss.str() + ".xml";
- if (!vul_file::exists(aux_scene_path)) {
- std::cout<< "Scene: " << aux_scene_path << " does not exist, initializing" << std::endl;
- boxm_scene<boct_tree<short, bool> > *aux_scene =
- new boxm_scene<boct_tree<short, bool> >(data_scene->lvcs(), data_scene->origin(), data_scene->block_dim(), data_scene->world_dim(), data_scene->max_level(), data_scene->init_level());
- aux_scene->set_appearance_model(BOXM_BOOL);
- aux_scene->set_paths(aux_dirs_[i], aux_scene_ss.str());
- aux_scene->write_scene("/" + aux_scene_ss.str() + ".xml");
- }
- }
-
- {
- std::stringstream proj_scene_ss;
- proj_scene_ss << "proj_taylor_scene_" << i ;
- std::string proj_scene_path = aux_dirs_[i] + "/" + proj_scene_ss.str() + ".xml";
- if (!vul_file::exists(proj_scene_path)) {
- std::cout<< "Scene: " << proj_scene_path << " does not exist, initializing" << std::endl;
- typedef boct_tree<short,vnl_vector_fixed<T_data,DIM> > taylor_tree_type;
- boxm_scene<taylor_tree_type > *proj_scene =
- new boxm_scene<taylor_tree_type >(data_scene->lvcs(), data_scene->origin(), data_scene->block_dim(), data_scene->world_dim(), data_scene->max_level(), data_scene->init_level());
- proj_scene->set_appearance_model(bvpl_taylor_apm<T_data,DIM>());
- proj_scene->set_paths(aux_dirs_[i], proj_scene_ss.str());
- proj_scene->write_scene("/" + proj_scene_ss.str() + ".xml");
- }
- }
- }
-
- xml_write();
-}
-
-
-//: Load scene info
-template<class T_data, unsigned DIM>
-boxm_scene_base_sptr bvpl_global_taylor<T_data, DIM>::load_scene (int scene_id)
-{
- if (scene_id<0 || scene_id>((int)scenes_.size() -1))
- {
- std::cerr << "Error in bvpl_global_pca::load_scene: Invalid scene id\n";
- return nullptr;
- }
- //load scene
- boxm_scene_base_sptr scene_base = new boxm_scene_base();
- boxm_scene_parser scene_parser;
- scene_base->load_scene(scenes_[scene_id], scene_parser);
-
- //cast scene
- boxm_scene<boct_tree<short, float > > *scene= new boxm_scene<boct_tree<short, float > >();
- if (scene_base->appearence_model() == BOXM_FLOAT) {
- scene->load_scene(scene_parser);
- scene_base = scene;
- }
- else {
- std::cerr << "Error in bvpl_global_pca::load_scene: Invalid appearance model\n";
- return nullptr;
- }
-
- return scene_base;
-}
-
-//: Load auxiliary scene indicating if a cell is valid. e.g border cells are not valid
-template<class T_data, unsigned DIM>
-boxm_scene_base_sptr bvpl_global_taylor<T_data, DIM>::load_valid_scene (int scene_id)
-{
- if (scene_id<0 || scene_id>((int)scenes_.size() -1))
- {
- std::cerr << "Error in bvpl_global_taylor::load_scene: Invalid scene id\n";
- return nullptr;
- }
- //load scene
- boxm_scene_base_sptr aux_scene_base = new boxm_scene_base();
- boxm_scene_parser aux_parser;
- std::stringstream aux_scene_ss;
- aux_scene_ss << aux_dirs_[scene_id] << "/valid_scene_" << scene_id << ".xml";
- aux_scene_base->load_scene(aux_scene_ss.str(), aux_parser);
-
- //cast scene
- boxm_scene<boct_tree<short, bool > > *aux_scene= new boxm_scene<boct_tree<short, bool > >();
- if (aux_scene_base->appearence_model() == BOXM_BOOL) {
- aux_scene->load_scene(aux_parser);
- aux_scene_base = aux_scene;
- }
- else {
- std::cerr << "Error in bvpl_global_taylor::load_aux_scene: Invalid appearance model\n";
- return nullptr;
- }
-
- return aux_scene_base;
-}
-
-
-//: Load auxiliary scene info
-template<class T_data, unsigned DIM>
-boxm_scene_base_sptr bvpl_global_taylor<T_data, DIM>::load_error_scene (int scene_id)
-{
- if (scene_id<0 || scene_id>=(int)scenes_.size())
- {
- std::cerr << "Error in bvpl_global_taylor::load_error_scene: Invalid scene id\n";
- return nullptr;
- }
-
- boxm_scene_base_sptr data_scene_base = load_scene(scene_id);
- boxm_scene<boct_tree<short, float> >* data_scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*> (data_scene_base.as_pointer());
- if (!data_scene) {
- std::cerr << "Error in bvpl_global_pca<feature_dim>::init(): Could not cast data scene\n";
- return nullptr;
- }
-
- std::stringstream aux_scene_ss;
- aux_scene_ss << "error_taylor_scene_" << scene_id ;
- std::string aux_scene_path = aux_dirs_[scene_id] + "/" + aux_scene_ss.str() + ".xml";
- if (!vul_file::exists(aux_scene_path)) {
- std::cout<< "Scene: " << aux_scene_path << " does not exist, initializing" << std::endl;
- boxm_scene<boct_tree<short, float> > *aux_scene =
- new boxm_scene<boct_tree<short, float> >(data_scene->lvcs(), data_scene->origin(), data_scene->block_dim(), data_scene->world_dim(), data_scene->max_level(), data_scene->init_level());
- aux_scene->set_appearance_model(BOXM_FLOAT);
- aux_scene->set_paths(aux_dirs_[scene_id], aux_scene_ss.str());
- aux_scene->write_scene("/" + aux_scene_ss.str() + ".xml");
- }
-
- //load scene
- boxm_scene_base_sptr error_scene_base = new boxm_scene_base();
- boxm_scene_parser error_parser;
- std::stringstream error_scene_ss;
- error_scene_ss << aux_dirs_[scene_id] << "/error_taylor_scene_" << scene_id << ".xml";
- error_scene_base->load_scene(error_scene_ss.str(), error_parser);
-
- //cast scene
- boxm_scene<boct_tree<short, float> > *error_scene= new boxm_scene<boct_tree<short, float> >();
- if (error_scene_base->appearence_model() == BOXM_FLOAT) {
- error_scene->load_scene(error_parser);
- error_scene_base = error_scene;
- }
- else {
- std::cerr << "Error in bvpl_global_taylor::load_error_scene: Invalid appearance model\n";
- return nullptr;
- }
-
- return error_scene_base;
-}
-
-
-#if 0
-//: Load auxiliary scene indicating if a cell is should be used for training
-boxm_scene_base_sptr bvpl_global_taylor::load_train_scene (int scene_id)
-{
- if (scene_id<0 || scene_id>((int)scenes_.size() -1))
- {
- std::cerr << "Error in bvpl_global_taylor::load_scene: Invalid scene id\n";
- return NULL;
- }
- //load scene
- boxm_scene_base_sptr aux_scene_base = new boxm_scene_base();
- boxm_scene_parser aux_parser;
- std::stringstream aux_scene_ss;
- aux_scene_ss << aux_dirs_[scene_id] << "/train_scene_" << scene_id << ".xml";
- aux_scene_base->load_scene(aux_scene_ss.str(), aux_parser);
-
- //cast scene
- boxm_scene<boct_tree<short, bool > > *aux_scene= new boxm_scene<boct_tree<short, bool > >();
- if (aux_scene_base->appearence_model() == BOXM_BOOL) {
- aux_scene->load_scene(aux_parser);
- aux_scene_base = aux_scene;
- }
- else {
- std::cerr << "Error in bvpl_global_taylor::load_aux_scene: Invalid appearance model\n";
- return NULL;
- }
-
- return aux_scene_base;
-}
-#endif
-
-
-//: Load auxiliary scene info
-template<class T_data, unsigned DIM>
-boxm_scene_base_sptr bvpl_global_taylor<T_data, DIM>::load_projection_scene (int scene_id)
-{
- if (scene_id<0 || scene_id>((int)scenes_.size() -1))
- {
- std::cerr << "Error in bvpl_global_taylor::load_projection_scene: Invalid scene id\n";
- return nullptr;
- }
- //load scene
- boxm_scene_base_sptr proj_scene_base = new boxm_scene_base();
- boxm_scene_parser proj_parser;
- std::stringstream proj_scene_ss;
- proj_scene_ss << aux_dirs_[scene_id] << "/proj_taylor_scene_" << scene_id << ".xml";
- proj_scene_base->load_scene(proj_scene_ss.str(), proj_parser);
-
- //cast scene
- typedef boct_tree<short,vnl_vector_fixed<T_data,DIM> > taylor_tree_type;
- boxm_scene<taylor_tree_type > *proj_scene= new boxm_scene<taylor_tree_type >();
- if (proj_scene_base->appearence_model() == bvpl_taylor_apm<T_data,DIM>()) {
- proj_scene->load_scene(proj_parser);
- proj_scene_base = proj_scene;
- }
- else {
- std::cerr << "Error in bvpl_global_taylor::load_proj_scene: Invalid appearance model\n";
- return nullptr;
- }
-
- return proj_scene_base;
-}
-
-//: Write this class to xml file
-template<class T_data, unsigned DIM>
-void bvpl_global_taylor<T_data, DIM>::xml_write()
-{
- bxml_document doc;
- bxml_element *root = new bxml_element("taylor_global_info");
- doc.set_root_element(root);
- root->append_text("\n");
-
- //write the scenes
- for (unsigned i =0; i<scenes_.size(); i++)
- {
- bxml_element* scenes_elm = new bxml_element("scene");
- scenes_elm->append_text("\n");
- scenes_elm->set_attribute("id", i);
- scenes_elm->set_attribute("path", scenes_[i]);
- scenes_elm->set_attribute("aux_dir", aux_dirs_[i]);
- scenes_elm->set_attribute("cell_length", finest_cell_length_[i]);
- root->append_data(scenes_elm);
- root->append_text("\n");
- }
-
- //write path to kernels
- bxml_element* kernel_elm = new bxml_element("kernels");
- kernel_elm->append_text("\n");
- kernel_elm->set_attribute("path", kernels_path_);
- root->append_data(kernel_elm);
- root->append_text("\n");
-
- //write to disk
- std::ofstream os(xml_path().c_str());
- bxml_write(os, doc);
- os.close();
-}
-
-
-//: Extract a particular coefficient scene
-template<class T_data, unsigned DIM>
-void bvpl_global_taylor<T_data, DIM>::extract_coefficient_scene(int scene_id, int coefficient_id, boxm_scene<boct_tree<short, float > > *float_scene)
-{
- typedef boct_tree<short, float> float_tree_type;
- typedef boct_tree_cell<short, float> float_cell_type;
-
- typedef boct_tree<short,vnl_vector_fixed<double,10> > projection_tree_type;
- typedef boct_tree_cell<short,vnl_vector_fixed<double,10> > projection_cell_type;
- std::vector<vnl_vector_fixed<double,10> > projections;
-
- boxm_scene_base_sptr projection_scene_base = load_projection_scene(scene_id);
-
- boxm_scene<projection_tree_type>* projection_scene = dynamic_cast<boxm_scene<projection_tree_type>* >(projection_scene_base.as_pointer());
-
- if (!(projection_scene && float_scene))
- {
- std::cerr << "Error in bof_util::random_label_for_training: Could not cast scenes\n";
- return;
- }
-
- //init variables
- projection_scene->unload_active_blocks();
- float_scene->unload_active_blocks();
-
- //get the cells for these blocks
- boxm_block_iterator<projection_tree_type> it = projection_scene->iterator();
- for (it.begin(); !it.end(); ++it)
- {
- if (!(projection_scene->valid_index(it.index()) && float_scene->valid_index(it.index()))) {
- std::cerr << "In bof_util::random_label_for_training: invalid block\n";
- return;
- }
-
- projection_scene->load_block(it.index());
- float_scene->load_block(it.index());
-
- //get the trees
- projection_tree_type* projection_tree = projection_scene->get_block(it.index())->get_tree();
- float_tree_type* float_tree = projection_tree->clone_to_type<float>();
-
- //get leaf cells
- std::vector<projection_cell_type *> projection_leaves = projection_tree->leaf_cells();
- std::vector<float_cell_type *> float_leaves = float_tree->leaf_cells();
-
- unsigned int tree_ncells = projection_leaves.size();
-
- for (unsigned int i =0; i<tree_ncells; ++i)
- {
- float_leaves[i]->set_data(float(projection_leaves[i]->data()[coefficient_id]));
- }
- float_scene->get_block(it.index())->init_tree(float_tree);
- float_scene->write_active_block();
- }
-
- //release memory
- projection_scene->unload_active_blocks();
- float_scene->unload_active_blocks();
-}
-
-
-#define BVPL_GLOBAL_TAYLOR_INSTANTIATE(T1,T2) \
-template class bvpl_global_taylor<T1,T2 >
-
-#endif // bvpl_global_taylor_hxx_
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_kernel_operator.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_kernel_operator.h
deleted file mode 100644
index 6d3206a9c5..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_kernel_operator.h
+++ /dev/null
@@ -1,142 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_octree_kernel_operator.h
-#ifndef bvpl_octree_kernel_operator_h
-#define bvpl_octree_kernel_operator_h
-//:
-// \file
-// \brief A class that operates a bvpl_kernel on an octree or boxm scene
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date November 13, 2009
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <bvpl/kernels/bvpl_kernel.h>
-#include <boct/boct_tree.h>
-#include <boxm/boxm_scene.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template<class T_data>
-class bvpl_octree_kernel_operator
-{
- public:
- typedef boct_tree<short, T_data> tree_type;
- typedef boct_tree_cell<short,T_data> cell_type;
-
- //Constructor from a bvpl functor
- bvpl_octree_kernel_operator(tree_type* tree_in): tree_in_(tree_in){}
-
- // "Convolves" kernel with class tree, storing the output in an output octree.
- template<class F>
- void operate(F functor, bvpl_kernel_sptr kernel, tree_type* out_tree, short level, double cell_length)
- {
- // get all (leaf) cells at given scale
- std::vector<cell_type* > cells = tree_in_->leaf_cells_at_level(level);
- std::vector<cell_type* > out_cells = out_tree->leaf_cells_at_level(level);
-
- bvpl_kernel_iterator kernel_iter = kernel->iterator();
-
- // iterate, through all cells
- for (unsigned i = 0; i < cells.size();i++)
- {
- // iterate through vector and compute result
- cell_type* center_cell = cells[i];
-
- if (center_cell->level()!=level)
- std::cerr << "Error in bvpl_octree_kernel_operator: Cell is not at the right level\n";
-
- if (!center_cell->is_leaf())
- std::cerr << "Error in bvpl_octree_kernel_operator: Cell is a leaf\n";
-
- vgl_point_3d<double> this_cell_origin = tree_in_->local_origin(center_cell);
-
- // TODO: check bounds. Is it more efficient to check bounds for every kernel or to let is run and store a dummy value in it?
-
- kernel_iter.begin(); // reset the kernel iterator
- while (!kernel_iter.isDone())
- {
- vgl_point_3d<int> kernel_idx = kernel_iter.index();
-
- vgl_point_3d<double> this_cell_idx(this_cell_origin.x() + (double)kernel_idx.x()*cell_length,
- this_cell_origin.y() + (double)kernel_idx.y()*cell_length,
- this_cell_origin.z() + (double)kernel_idx.z()*cell_length);
-
- cell_type* this_cell = tree_in_->locate_point_at_level(this_cell_idx, level, true);
-
- if (this_cell) {
- bvpl_kernel_dispatch d = *kernel_iter;
- T_data val = this_cell->data();
- functor.apply(val, d);
- }
- else
- break;
- ++kernel_iter;
- }
-
- out_cells[i]->set_data(functor.result());
- }
- }
-
- // "Convolves" kernel with class tree, storing the output in an output octree.
- template<class F>
- void operate(F functor, bvpl_kernel_sptr kernel, short level, double cell_length);
-
- private:
- tree_type * tree_in_;
-};
-
-template <class T_data> template <class F>
-void bvpl_octree_kernel_operator<T_data>::operate(F functor, bvpl_kernel_sptr kernel, short level, double cell_length)
-{
- // get all (leaf) cells at given scale/tree level
- std::vector<cell_type* > cells = tree_in_->leaf_cells_at_level(level);
-
- bvpl_kernel_iterator kernel_iter = kernel->iterator();
-
- // iterate, through all cells
- for (unsigned i = 0; i < cells.size();i++)
- {
- // iterate through vector and compute result
- cell_type* center_cell = cells[i];
-
- if (center_cell->level()!=level)
- std::cerr << "Error in bvpl_octree_kernel_operator: Cell is not at the right level\n";
-
- if (!center_cell->is_leaf())
- std::cerr << "Error in bvpl_octree_kernel_operator: Cell is a not a leaf\n";
-
- vgl_point_3d<double> this_cell_origin = tree_in_->local_origin(center_cell);
-
- // TODO: check bounds. Is it more efficient to check bounds for every kernel or to let is run and store a dummy value in it?
-
- kernel_iter.begin(); // reset the kernel iterator
- while (!kernel_iter.isDone())
- {
- vgl_point_3d<int> kernel_idx = kernel_iter.index();
-
- vgl_point_3d<double> this_cell_idx(this_cell_origin.x() + (double)kernel_idx.x()*cell_length,
- this_cell_origin.y() + (double)kernel_idx.y()*cell_length,
- this_cell_origin.z() + (double)kernel_idx.z()*cell_length);
-
- cell_type* this_cell = tree_in_->locate_point_at_level(this_cell_idx, level, true);
-
- if (this_cell) {
- bvpl_kernel_dispatch d = *kernel_iter;
- T_data val = this_cell->data();
- functor.apply(val, d);
- }
- else
- break;
- ++kernel_iter;
- }
-
- center_cell->set_data(functor.result());
- }
-
-}
-
-#endif // bvpl_octree_kernel_operator_h
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_neighbors.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_neighbors.h
deleted file mode 100644
index be5efb6238..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_neighbors.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_octree_neighbors.h
-#ifndef bvpl_octree_neighbors_h
-#define bvpl_octree_neighbors_h
-//:
-// \file
-// \brief A class that operates a bvpl_kernel on an octree or boxm scene to find all the neighbor cells that correspond to that kernel, and returns a list of pointers to those neighbors
-// \author Gamze Tunali Gamze_Tunali@brown.edu
-// \date March 18, 2010
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <bvpl/kernels/bvpl_kernel.h>
-#include <boct/boct_tree.h>
-#include <boxm/boxm_scene.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-template<class T_data>
-class bvpl_octree_neighbors
-{
- public:
- typedef boct_tree<short, T_data> tree_type;
- typedef boct_tree_cell<short,T_data> cell_type;
-
- //Constructor from a bvpl functor
- bvpl_octree_neighbors(tree_type* tree_in): tree_in_(tree_in){}
-
- // "Convolves" kernel with class tree, storing the output in an output octree.
- void neighbors(bvpl_kernel_sptr kernel, cell_type* cell,
- std::vector<cell_type *>& neighb_cells)
- {
- bvpl_kernel_iterator kernel_iter = kernel->iterator();
- short level = cell->level();
- double cell_length = tree_in_->cell_length(cell);
- // iterate through vector and find the neighbors
- vgl_point_3d<double> cell_origin = tree_in_->local_origin(cell);
-
- kernel_iter.begin(); // reset the kernel iterator
- while (!kernel_iter.isDone())
- {
- vgl_point_3d<int> kernel_idx = kernel_iter.index();
- vgl_point_3d<double> this_cell_idx(cell_origin.x() + (double)kernel_idx.x()*cell_length,
- cell_origin.y() + (double)kernel_idx.y()*cell_length,
- cell_origin.z() + (double)kernel_idx.z()*cell_length);
-
- cell_type* this_cell = tree_in_->locate_point_at_level(this_cell_idx, level, true);
- if (this_cell) {
- // check if this cell is an internal node, if so get the children
- if (!this_cell->is_leaf()) {
- std::vector<cell_type *> children;
- this_cell->leaf_children(children);
- neighb_cells.insert(neighb_cells.end(), children.begin(), children.end());
- }
- else {
- // make sure that the same cell is not added more than once
- bool found=false;
- for (unsigned i=0; i<neighb_cells.size(); i++) {
- if (neighb_cells[i] == this_cell)
- found=true;
- }
- if (!found)
- neighb_cells.push_back(this_cell);
- }
- }
- ++kernel_iter;
- }
- }
-
- private:
- tree_type * tree_in_;
-};
-
-#endif // bvpl_octree_neighbors_h
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vector_operator.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vector_operator.h
deleted file mode 100644
index c5067b597e..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vector_operator.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_octree_vector_operator.h
-#ifndef bvpl_octree_vector_operator_h
-#define bvpl_octree_vector_operator_h
-//:
-// \file
-// \brief An abstract class with a template operation (as in template method pattern) to apply a vector of bvpl_kernel on an octree
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date November 17, 2009
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include "bvpl_octree_kernel_operator.h"
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.h>
-#include <bvpl/kernels/bvpl_kernel.h>
-#include <bvpl/functors/bvpl_local_max_functor.h>
-#include <boct/boct_tree.h>
-
-
-//: A class with a template operation (as in template method pattern) to apply a vector of bvpl_kernel on an octree
-// The class also contains abstract methods to be specialized in the subclasses
-template <class T_data>
-class bvpl_octree_vector_operator
-{
- public:
-
- //: Applies a vector of kernels and functor to a grid. Returns a grid that combines the responses of the kernels as specified in the subclass
- template <class F>
- bool operate(boct_tree<short ,T_data>* tree_in,
- F functor,
- bvpl_kernel_vector_sptr kernel_vector,
- boct_tree<short ,bvpl_octree_sample<T_data> >* tree_out,
- short level, double cell_length)
- {
- bvpl_local_max_functor<T_data> func_max;
- boct_tree<short ,T_data>* temp_tree = tree_in->clone();
- bvpl_octree_kernel_operator<T_data> oper(tree_in);
- for (unsigned int id = 0; id < kernel_vector->kernels_.size(); ++id)
- {
- temp_tree->init_cells(func_max.min_response());
- bvpl_kernel_sptr kernel = kernel_vector->kernels_[id];
- oper.operate(functor, kernel, temp_tree,level, cell_length);
- combine_kernel_responses(tree_out, temp_tree, id);
- }
-
- return true;
- }
-
- protected:
- //: Abstract function to be implemented on children on how to combine current kernel response with output response
-
- virtual void combine_kernel_responses(boct_tree<short ,bvpl_octree_sample<T_data> >* tree_out, boct_tree<short ,T_data>* tree_curr,
- int id_curr)=0;
-
- //: Compares response grids and stores in out, the maximum responses. This function gets called in subclasses when implementing combine_kernel_responses
-
- void keep_max_response_tree(boct_tree<short ,bvpl_octree_sample<T_data> >* tree_out, boct_tree<short ,T_data>* new_tree,
- int new_id);
-};
-
-
-//: Compares response grids and stores in grid1, the wining responses.
-template<class T_data>
-void bvpl_octree_vector_operator<T_data>::keep_max_response_tree(boct_tree<short ,bvpl_octree_sample<T_data> >* tree_out,
- boct_tree<short ,T_data>* new_tree,
- int new_id)
-{
- bvpl_local_max_functor<T_data> func_max;
-
- std::vector<boct_tree_cell<short,T_data>*> new_leaves = new_tree->leaf_cells();
- std::vector<boct_tree_cell<short,bvpl_octree_sample<T_data> >*> leaves_out = tree_out->leaf_cells();
-
- for (unsigned i=0; i< new_leaves.size(); i++)
- {
- T_data val1 = new_leaves[i]->data();
- T_data val2 = leaves_out[i]->data().response_;
- if (func_max.greater_than(val1, val2))
- leaves_out[i]->set_data(bvpl_octree_sample<T_data>(new_leaves[i]->data(), new_id));
- }
-}
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vector_operator_impl.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vector_operator_impl.h
deleted file mode 100644
index e01a23ca65..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vector_operator_impl.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_octree_vector_operator_impl.h
-#ifndef bvpl_octree_vector_operator_impl_h
-#define bvpl_octree_vector_operator_impl_h
-//:
-// \file
-// \brief Subclasses that implement the abstract interface of bvpl_octree_vector_operator. They can be used to queue operations
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date November 30, 2009
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include "bvpl_octree_vector_operator.h"
-
-
-//: Class to apply a vector of kernels and functor to a grid, returning a grid containing at each voxel the max response
-template <class T_data>
-class bvpl_max_vector_operator: public bvpl_octree_vector_operator<T_data>
-{
- public:
- void combine_kernel_responses(boct_tree<short ,bvpl_octree_sample <T_data> >* tree_out, boct_tree<short ,T_data>* tree_curr,
- int id_curr) override
- {
- this->keep_max_response_tree(tree_out, tree_curr, id_curr);
- }
-};
-
-#endif // bvpl_octree_vector_operator_impl_h
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vrml_util.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vrml_util.h
deleted file mode 100644
index ec024dfe41..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_octree_vrml_util.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_octree_vrml_util.h
-#ifndef bvpl_octree_vrml_util_h
-#define bvpl_octree_vrml_util_h
-//:
-// \file
-// \brief VRML utilities for scenes with bvpl_octree samples
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date December 10, 2009
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.h>
-#include <bvpl/kernels/bvpl_kernel.h>
-#include <bvpl/bvpl_octree/bvpl_cell_data_traits.h>
-
-#include <boxm/boxm_scene.h>
-#include <bvrml/bvrml_write.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-class bvpl_octree_vrml_util
-{
- public:
- //: Writes direction of kernel and magnitude of the response as disks of different sizes
- template<class T_data>
- static void write_scene_as_disks(std::ofstream &vrml_os,
- boxm_scene<boct_tree<short, bvpl_octree_sample<T_data> > > *scene,
- bvpl_kernel_vector_sptr kernel_vector);
-};
-
-template<class T_data>
-void bvpl_octree_vrml_util::write_scene_as_disks(std::ofstream &vrml_os,
- boxm_scene<boct_tree<short, bvpl_octree_sample<T_data> > > *scene,
- bvpl_kernel_vector_sptr kernel_vector)
-{
- typedef boct_tree<short, bvpl_octree_sample<T_data> > tree_type;
- typedef boct_tree_cell<short, bvpl_octree_sample<T_data> > cell_type;
-
- bvrml_write::write_vrml_header(vrml_os);
-
- // iterate through the scene
- boxm_block_iterator<tree_type > iter= scene->iterator();
- iter.begin();
-
- for (; !iter.end(); iter++)
- {
- scene->load_block(iter.index());
- tree_type *tree = (*iter)->get_tree();
-
- // iterate through the tree
- std::vector<cell_type*> cells = tree->leaf_cells();
- unsigned lines = 0;
- float max_response =bvpl_cell_to_float(cells[0]);
- for (unsigned i = 0; i < cells.size(); i+=10)
- {
- int id = cells[i]->data().id_;
- if (id < 0)
- continue;
- bvpl_kernel_sptr kernel = kernel_vector->kernels_[id];
- float response = bvpl_cell_to_float(cells[i]);
- if (response > max_response) {
- max_response = response;
- }
- std::cout << "response " << response << std::endl;
- vgl_vector_3d<double> dir((kernel->axis())[0],(kernel->axis())[1],(kernel->axis())[2]);
- vgl_point_3d<double> coord = tree->global_origin(cells[i]);
- if (response > 3.5f) {
- bvrml_write::write_vrml_line(vrml_os, coord, dir, .1f*response, 1, 0, 0);
- lines++;
- }
-#ifdef DEBUG
- bvrml_write::write_vrml_disk(vrml_os, coord, dir, 2*response-.5f, 0, .5f, 0);
-#endif
- }
- std::cout << "max response " << max_response << std::endl
- << "number of lines: " << lines << std::endl;
- }
-}
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_pca_error_scenes.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_pca_error_scenes.cxx
deleted file mode 100644
index 1d72f41d58..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_pca_error_scenes.cxx
+++ /dev/null
@@ -1,50 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 18-Feb-2011
-
-#include <iostream>
-#include <sstream>
-#include "bvpl_pca_error_scenes.h"
-
-#include <boxm/boxm_scene.h>
-
-#include <vul/vul_file.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-bvpl_pca_error_scenes::bvpl_pca_error_scenes(const boxm_scene_base_sptr& data_scene_base, const std::string& pca_path, unsigned dim)
-{
- typedef boct_tree<short,float> tree_type;
- for (unsigned i =0; i<dim+1; i++)
- scenes_.push_back(new boxm_scene_base());
-
- auto* data_scene= dynamic_cast<boxm_scene<tree_type>* > (data_scene_base.as_pointer());
- if (!data_scene)
- std::cerr << "In bvpl_pca_error_scenes: Null Scene\n";
-
- for (unsigned i = 0; i<dim+1; i++)
- {
- //path to error scenes
- std::stringstream error_path_ss;
- error_path_ss << pca_path << "/error_" << i;
- std::string error_path = error_path_ss.str();
- if (!vul_file::is_directory(error_path))
- vul_file::make_directory(error_path);
-
- boxm_scene<tree_type> *error_scene =
- new boxm_scene<tree_type>(data_scene->lvcs(), data_scene->origin(), data_scene->block_dim(), data_scene->world_dim(), data_scene->max_level(), data_scene->init_level());
- error_scene->set_appearance_model(BOXM_FLOAT);
-
- std::string scene_name = "error_scene";
- error_scene->set_paths(error_path, scene_name);
-
- if (!vul_file::exists(error_path + "/" + scene_name + ".xml"))
- error_scene->write_scene("/" +scene_name + ".xml");
-
- //data_scene->clone_blocks(*error_scene, -1.0);
-
- scenes_[i] = error_scene;
- }
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_pca_error_scenes.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_pca_error_scenes.h
deleted file mode 100644
index a50c851c2f..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_pca_error_scenes.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// This is bvpl_pca_error_scenes.h
-#ifndef bvpl_pca_error_scenes_h
-#define bvpl_pca_error_scenes_h
-
-//:
-// \file
-// \brief A class to hold the smartpointers to pca error scenes
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 15-Feb-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bvpl/kernels/bvpl_taylor_basis_factory.h>
-#include <boxm/boxm_scene_base.h>
-#include <vsl/vsl_binary_io.h>
-
-// Forward declarations
-class bvpl_pca_error_scenes;
-
-typedef vbl_smart_ptr<bvpl_pca_error_scenes> bvpl_pca_error_scenes_sptr;
-
-//: A class to hold the smartpointers to response scenes and their corresponding names
-class bvpl_pca_error_scenes : public vbl_ref_count
-{
-public:
-
- bvpl_pca_error_scenes(const boxm_scene_base_sptr& data_scene_base, const std::string& taylor_path, unsigned dim);
-
- //: Return the error scene associated with a number of components used for reconstruction
- boxm_scene_base_sptr get_scene(unsigned ncomponent) {return scenes_[ncomponent];}
-
-private:
- std::vector<boxm_scene_base_sptr> scenes_;
-
-};
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_kernel_operator.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_kernel_operator.h
deleted file mode 100644
index 2217b22966..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_kernel_operator.h
+++ /dev/null
@@ -1,213 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_scene_kernel_operator.h
-#ifndef bvpl_scene_kernel_operator_h
-#define bvpl_scene_kernel_operator_h
-//:
-// \file
-// \brief A class that operates a bvpl_kernel on a boxm_scene
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date November 18, 2009
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <bvpl/kernels/bvpl_kernel.h>
-#include <boxm/boxm_scene.h>
-#include "bvpl_octree_kernel_operator.h"
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-class bvpl_scene_kernel_operator
-{
- public:
- //: "Convolves" kernel with an input octree, storing the output in an output octree.
- // This function only iterate through leaf_cells at level 0;
- template<class T_data, class F>
- void operate(boxm_scene<boct_tree<short, T_data > > &scene_in,
- F functor,
- bvpl_kernel_sptr kernel,
- boxm_scene<boct_tree<short, T_data > > &scene_out);
-
- //: Performs in-situ non-maxima suppression over the area occupied by the kernel
- template<class T_data, class F>
- void local_non_maxima_suppression(boxm_scene<boct_tree<short, T_data > > &scene_in,
- F functor,
- bvpl_kernel_sptr kernel);
-
-#if 0 //Depracated
- // "Convolves" kernel with an input octree, storing the output in an output octree.
- template<class T_data, class F>
- void operate(boxm_scene<boct_tree<short, T_data > > &scene_in,
- F functor,
- bvpl_kernel_sptr kernel,
- boxm_scene<boct_tree<short, T_data > > &scene_out,
- short level)
- {
- typedef boct_tree<short, T_data > tree_type;
- boxm_block_iterator<tree_type> iter_in = scene_in.iterator();
- boxm_block_iterator<tree_type> iter_out = scene_out.iterator();
- iter_in.begin();
- iter_out.begin();
- for (; !iter_in.end(); iter_in++, iter_out++) {
- //Isa: change to load block and neighbors
- scene_in.load_block(iter_in.index());
- scene_out.load_block(iter_out.index());
- tree_type *tree_in= (*iter_in)->get_tree();
- tree_type *tree_out = tree_in->clone();
-
- // output tree has the same shape but is initialized to have response zero
- T_data zero_val = T_data();
- std::cout << "Response tree is initialized to: " << zero_val << std::endl;
- tree_out->init_cells(zero_val);
-
- bvpl_octree_kernel_operator<T_data> oper(tree_in);
- double cell_length = 1.0/(double)(1<<(tree_in->root_level() -level));
- oper.operate(functor, kernel, tree_out, level, cell_length);
- (*iter_out)->init_tree(tree_out);
- scene_out.write_active_block();
- }
- }
-#endif
-};
-
-//: Operates a kernel on a scene by : (1)Traverse input scene and for every leaf cell, (2) request a region around it, and (3) apply the functor
-template<class T_data, class F>
-void bvpl_scene_kernel_operator::operate(boxm_scene<boct_tree<short, T_data > > &scene_in,
- F functor,
- bvpl_kernel_sptr kernel,
- boxm_scene<boct_tree<short, T_data > > &scene_out)
-{
- double cell_length = kernel->voxel_length();
- short finest_level = scene_in.finest_level();
- std::cout << "bvpl_scene_kernel_operator: Operating on cells at level: " << finest_level << " and length: " << cell_length << std::endl;
-
- scene_in.clone_blocks(scene_out, T_data());
-
- //(1) Traverse the scene - is there an easy way to modify the cell iterator so to only use leaf cells at level 0;
- boxm_cell_iterator<boct_tree<short, T_data > > iterator = scene_in.cell_iterator(&boxm_scene<boct_tree<short, T_data > >::load_block_and_neighbors);
- iterator.begin();
-
- boxm_cell_iterator<boct_tree<short, T_data > > out_iter = scene_out.cell_iterator(&boxm_scene<boct_tree<short, T_data > >::load_block);
- out_iter.begin();
-
- bvpl_kernel_iterator kernel_iter = kernel->iterator();
-
- while ( !(iterator.end() || out_iter.end()) )
- {
- boct_tree_cell<short,T_data> *center_cell = *iterator;
- boct_tree_cell<short,T_data> *out_center_cell = *out_iter;
- boct_loc_code<short> out_code = out_center_cell->get_code();
- boct_loc_code<short> in_code = center_cell->get_code();
-
- //if level and location code of cells isn't the same then continue
- if ((center_cell->level() != out_center_cell->level()) || !(in_code.isequal(&out_code))){
- std::cerr << " Input and output cells don't have the same structure\n";
- ++iterator;
- ++out_iter;
- continue;
- }
-
- //we are only interested in finest resolution
- if ((!(center_cell->level() == finest_level)) || !center_cell->is_leaf()){
- ++iterator;
- ++out_iter;
- continue;
- }
-
- vgl_point_3d<double> center_cell_origin = iterator.global_origin();
-
- kernel_iter.begin(); // reset the kernel iterator
- while (!kernel_iter.isDone())
- {
- vgl_point_3d<int> kernel_idx = kernel_iter.index();
-
- vgl_point_3d<double> kernel_cell_origin(center_cell_origin.x() + (double)kernel_idx.x()*cell_length + 1.0e-7,
- center_cell_origin.y() + (double)kernel_idx.y()*cell_length + 1.0e-7,
- center_cell_origin.z() + (double)kernel_idx.z()*cell_length + 1.0e-7);
-
- boct_tree_cell<short,T_data> *this_cell = scene_in.locate_point_in_memory(kernel_cell_origin);
-
- if (this_cell) {
- bvpl_kernel_dispatch d = *kernel_iter;
- T_data val = this_cell->data();
- functor.apply(val, d);
- }
- else {
- break;
- }
-
- ++kernel_iter;
- }
-
- out_center_cell->set_data(functor.result());
- ++iterator;
- ++out_iter;
- }
-}
-
-//: Applies non-maxima suppression on the region occupied by the kernel. The output is stored in situ.
-//(1)Traverse input scene and for every leaf cell, (2) request a region around it, and (3) apply the functor
-template<class T_data, class F>
-void bvpl_scene_kernel_operator::local_non_maxima_suppression(boxm_scene<boct_tree<short, T_data > > &scene_in,
- F functor,
- bvpl_kernel_sptr kernel)
-{
- short finest_level = scene_in.finest_level();
- double cell_length = kernel->voxel_length();
-
- //(1) Traverse the scene - is there an easy way to modify the cell iterator so to only use leaf cells at level 0;
- boxm_cell_iterator<boct_tree<short, T_data > > iterator = scene_in.cell_iterator(&boxm_scene<boct_tree<short, T_data > >::load_block_and_neighbors);
- iterator.begin();
-
- bvpl_kernel_iterator kernel_iter = kernel->iterator();
-
- while ( !(iterator.end()) )
- {
- boct_tree_cell<short,T_data> *center_cell = *iterator;
-
- //we are only interested in finest resolution
- if (!center_cell->level() == finest_level || !center_cell->is_leaf()){
- ++iterator;
- continue;
- }
- T_data this_data = center_cell->data();
-
- //vgl_point_3d<double> center_cell_origin = iterator.global_origin();
- vgl_point_3d<double> center_cell_center = this_data.location();
- if (!functor.init(this_data)){
- ++iterator;
- continue;
- }
-
- kernel_iter.begin(); // reset the kernel iterator
- while (!kernel_iter.isDone())
- {
- vgl_point_3d<int> kernel_idx = kernel_iter.index();
-
- vgl_point_3d<double> kernel_cell_center(center_cell_center.x() + (double)kernel_idx.x()*cell_length,
- center_cell_center.y() + (double)kernel_idx.y()*cell_length,
- center_cell_center.z() + (double)kernel_idx.z()*cell_length);
-
- boct_tree_cell<short,T_data> *this_cell = scene_in.locate_point_in_memory(kernel_cell_center);
-
- if (this_cell) {
- //bvpl_kernel_dispatch d = *kernel_iter;
- T_data val = this_cell->data();
- functor.apply(val);
- }
- else {
- break;
- }
-
- ++kernel_iter;
- }
-
- center_cell->set_data(functor.result());
- ++iterator;
- }
-}
-
-#endif // bvpl_scene_kernel_operator_h
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.cxx
deleted file mode 100644
index c6fabe14e2..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 13-Aug-2010
-
-#include "bvpl_scene_neighborhood_operator.h"
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.h
deleted file mode 100644
index 5f8e43f92f..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.h
-#ifndef bvpl_scene_neighborhood_operator_h
-#define bvpl_scene_neighborhood_operator_h
-//:
-// \file
-// \brief A class to perform neighborhood operations on a boxm_scene.
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 13-Aug-2010.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <boxm/boxm_scene.h>
-
-#include <vgl/vgl_box_3d.h>
-
-//: A class to perform neighborhood operations on a bvxm_scene.
-// This class operates on all leaf cells within a region
-class bvpl_scene_neighborhood_operator
-{
- public:
- bvpl_scene_neighborhood_operator()= default;
-
- //: Applies the region-based functor on every leaf cell of the scene. The output is stored on a separate scene
- template <class T_data_in, class T_data_out, class F>
- void operate(boxm_scene<boct_tree<short, T_data_in > > *scene_in,
- F functor,
- vgl_box_3d<double> roi,
- boxm_scene<boct_tree<short, T_data_out > > *scene_out);
-
- //: Applies the region-based functor on every leaf cell of the scene. The region is obtained from scen2.
- // The output is stored on a separate scene
- template <class T_data_in1, class T_data_in2, class T_data_out, class F>
- void operate(boxm_scene<boct_tree<short, T_data_in1 > > *scene_in1,
- boxm_scene<boct_tree<short, T_data_in2 > > *scene_in2,
- F functor,
- vgl_box_3d<double> roi,
- boxm_scene<boct_tree<short, T_data_out > > *scene_out);
-
- //: Applies a non-maxima suppression functor on every leaf cell of the scene. The output is stored in situ
- template <class T_data, class F>
- void local_non_maxima_suppression(boxm_scene<boct_tree<short, T_data > > &scene_in,
- F functor,
- vgl_box_3d<double> &roi);
-};
-
-
-//: Applies the region-based functor on every leaf cell of the scene. The output is stored in situ. The ROI must be in scene-coordinates
-//(1)Traverse input scene and for every leaf cell, (2) request a region around it, and (3) apply the functor
-template <class T_data, class F>
-void bvpl_scene_neighborhood_operator::local_non_maxima_suppression(boxm_scene<boct_tree<short, T_data > > &scene_in,
- F functor,vgl_box_3d<double> &roi)
-{
- short finest_level = scene_in.finest_level();
-
- //(1) Traverse the scene
- boxm_cell_iterator<boct_tree<short, T_data > > iterator = scene_in.cell_iterator(&boxm_scene<boct_tree<short, T_data> >::load_block_and_neighbors);
-
- iterator.begin();
-
- while (!iterator.end())
- {
- boct_tree_cell<short,T_data> *cell = *iterator;
- if ((!(cell->level() == finest_level)) || !cell->is_leaf()){
- ++iterator;
- continue;
- }
- // the region is located with subvoxel accuracy so datastructure should contain subvoxel localization
- roi.set_centroid((cell->data()).location());
-
- T_data this_data= cell->data();
- functor.init(this_data, roi);
-
- // get all cells that intersect a region
- std::vector<boct_tree_cell<short, T_data>* > cells_in_roi;
-
- //Return all cells that intersec the region
- scene_in.leaves_in_region(roi,cells_in_roi);
-
- for (unsigned i = 0; i<cells_in_roi.size(); i++)
- {
- boct_tree_cell<short, T_data> *this_cell = cells_in_roi[i];
- if (!this_cell)
- continue;
- T_data val = this_cell->data();
- functor.apply(val);
- }
-
- cell->set_data(functor.result());
- ++iterator;
- }
-}
-
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.cxx
deleted file mode 100644
index 5f43040cc0..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.cxx
+++ /dev/null
@@ -1,80 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 22-Sep-2010
-
-#include "bvpl_scene_statistics.h"
-
-
-double bvpl_average_value(const boxm_scene_base_sptr& scene_base, int block_i, int block_j, int block_k, unsigned long tree_nsamples)
-{
- typedef boct_tree<short,float> float_tree_type;
- typedef boct_tree_cell<short,float> float_cell_type;
- auto * scene = dynamic_cast<boxm_scene<float_tree_type>* > (scene_base.as_pointer());
-
- scene->load_block(block_i, block_j, block_k);
-
- //get the leaves
- float_tree_type* tree = scene->get_block(block_i, block_j, block_k)->get_tree();
- std::vector<float_cell_type*> leaves = tree->leaf_cells();
-
- int tree_ncells = leaves.size();
- //unsigned long tree_nsamples = (tree_ncells/scene_ncells)*(float)nsamples_;
-
- double avg_val = 0.0;
- vnl_random rng(9667566ul);
- for (unsigned i=0; i<tree_nsamples; i++)
- {
- unsigned long sample = rng.lrand32(tree_ncells-1);
-
- boct_tree_cell<short, float> *center_cell = leaves[sample];
- // vgl_point_3d<double> center_cell_centroid = tree->global_centroid(center_cell);
-
- //if neighborhood is not inclusive we would have missing features
- if ((double)center_cell->data()< -0.5) {
- i--;
- continue;
- }
- else {
- avg_val+=(double)center_cell->data();
- }
- }
-
- return avg_val/tree_nsamples;
-}
-
-double bvpl_average_value(const boxm_scene_base_sptr& scene_base, int block_i, int block_j, int block_k)
-{
- typedef boct_tree<short,float> float_tree_type;
- typedef boct_tree_cell<short,float> float_cell_type;
- auto * scene = dynamic_cast<boxm_scene<float_tree_type>* > (scene_base.as_pointer());
- if (!scene) {
- std::cerr << "Error in bvpl_average_value: Error scene is of incorrect type\n";
- return false;
- }
- scene->load_block(block_i, block_j, block_k);
-
- //get the leaves
- float_tree_type* tree = scene->get_block(block_i, block_j, block_k)->get_tree();
- std::vector<float_cell_type*> leaves = tree->leaf_cells();
-
- double actual_samples = 0.0;
- double avg_val = 0.0;
- for (auto center_cell : leaves)
- {
- // vgl_point_3d<double> center_cell_centroid = tree->global_centroid(center_cell);
-
- //if neighborhood is not inclusive we would have missing features
- if ((double)center_cell->data()< -0.5) {
- continue;
- }
- else {
- avg_val+=(double)center_cell->data();
- actual_samples = actual_samples +1.0;
- }
- }
-
- std::cout << "Adding errors of : " << actual_samples << " samples" << std::endl;
-
- return avg_val/actual_samples;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.h
deleted file mode 100644
index f14813bc74..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.h
+++ /dev/null
@@ -1,102 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_scene_statistics.h
-#ifndef bvpl_scene_statistics_h
-#define bvpl_scene_statistics_h
-//:
-// \file
-// \brief A set of functions to provide statistics about response scenes
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 22-Sep-2010.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bsta/bsta_histogram.h>
-#include <boxm/boxm_scene.h>
-
-template <unsigned DIM>
-bool bvpl_compute_scene_statistics(boxm_scene< boct_tree<short, vnl_vector_fixed<float,DIM> > > *scene, bsta_histogram<float> &response_hist )
-{
- typedef boct_tree<short, vnl_vector_fixed<float,DIM> > tree_type;
-
- //(1) Traverse the leaves of the scene
- boxm_cell_iterator<tree_type > iterator = scene->cell_iterator(&boxm_scene<tree_type>::load_block, true);
-
- iterator.begin();
- float cell_count = 0;
- float max = (*iterator)->data().magnitude();
- float min = max;
- float mag = max;
- while (!iterator.end()) {
- cell_count++;
- mag = (*iterator)->data().magnitude();
- if ( mag > max) max = mag;
- if ( mag < min) min = mag;
- ++iterator;
- }
-
- unsigned int nbins = (unsigned int)std::floor(std::sqrt(cell_count));
- response_hist = bsta_histogram<float>(min, max, nbins);
-
- iterator.begin();
-
- while (!iterator.end()) {
- response_hist.upcount(static_cast<float>((*iterator)->data().magnitude()), 1.0f);
- ++iterator;
- }
-
- scene->unload_active_blocks();
-
- return true;
-}
-
-
-template <class T_loc, class T_data>
-bool bvpl_compute_scene_statistics(boxm_scene<boct_tree<T_loc, T_data > >* scene, bsta_histogram<float>& response_hist, unsigned int nbins = 0 )
- //, bsta_histogram<float>& level_hist, unsigned& n_leaves)
-{
- typedef boct_tree<T_loc, T_data> tree_type;
- typedef boct_tree_cell<T_loc,T_data> cell_type;
-
- //(1) Traverse the leaves of the scene
- boxm_cell_iterator<tree_type > iterator = scene->cell_iterator(&boxm_scene<tree_type>::load_block, true);
-
- iterator.begin();
- float cell_count = 0;
- T_data max = (*iterator)->data();
- T_data min = max;
- T_data this_val = max;
- while (!iterator.end()) {
- cell_count++;
- this_val = (*iterator)->data();
- if ( this_val > max) max = this_val;
- if ( this_val < min) min = this_val;
- ++iterator;
- }
-
- if (nbins == 0)
- nbins = (unsigned int)std::floor(std::sqrt(cell_count));
- response_hist = bsta_histogram<float>(min, max, nbins);
- scene->unload_active_blocks();
- iterator.begin();
- while (!iterator.end()) {
- response_hist.upcount(static_cast<T_data>((*iterator)->data()), 1.0f);
- ++iterator;
- }
-
- scene->unload_active_blocks();
-
- return true;
-}
-
-//: Function that compute average value of a fraction of samples in the specified block.
-// Datatype is assumed to be float, but if could be templated to expand to other types
-double bvpl_average_value(const boxm_scene_base_sptr& scene_base, int block_i, int block_j, int block_k, unsigned long tree_nsamples);
-
-//: Function that compute average value of all positive samples in the specified block.
-// Datatype is assumed to be float, but if could be templated to expand to other types
-double bvpl_average_value(const boxm_scene_base_sptr& scene_base, int block_i, int block_j, int block_k);
-
-
-#endif // bvpl_scene_statistics_h
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_vector_operator.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_vector_operator.h
deleted file mode 100644
index 49e7066a5c..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_scene_vector_operator.h
+++ /dev/null
@@ -1,178 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_scene_vector_operator.h
-#ifndef bvpl_scene_vector_operator_h
-#define bvpl_scene_vector_operator_h
-//:
-// \file
-// \brief A class that applies a vector of bvpl_kernels on a boxm_scene
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date November 30, 2009
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.h>
-#include <bvpl/kernels/bvpl_kernel.h>
-#include <bvpl/functors/bvpl_local_max_functor.h>
-
-#include <boxm/boxm_scene.h>
-
-#include <vnl/vnl_vector_fixed.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-class bvpl_scene_vector_operator
-{
- public:
-
- //: "Convolves" a vector of kernel with an input octree, storing the output in an output octree.
- // The shape of the output is determined by a templated function
- // This function only iterate through leaf_cells at level 0;
- template<class T_data_in, class T_data_out, class F >
- void operate(boxm_scene<boct_tree<short, T_data_in> > &scene_in,
- F functor,
- bvpl_kernel_vector_sptr kernel_vector,
- boxm_scene<boct_tree<short, T_data_out > > &scene_out);
-
- protected:
-
- //:Function incharged of combining results
- template<class T_data>
- void combine_kernel_responses(const std::vector<T_data>& responses, vnl_vector_fixed<T_data, 3> &response_out);
-
- //:Function incharged of combining results
- template<class T_data>
- void combine_kernel_responses(const std::vector<T_data>& responses, bvpl_octree_sample<T_data> &response_out);
-};
-
-
-//: Operates a vector of kernels on a scene by : (1)Traversing input scene and for every leaf cell, (2) request a region around it, and (3) apply the functor
-template<class T_data_in, class T_data_out,class F >
-void bvpl_scene_vector_operator::operate(boxm_scene<boct_tree<short, T_data_in> > &scene_in,
- F functor,
- bvpl_kernel_vector_sptr kernel_vector,
- boxm_scene<boct_tree<short, T_data_out > > &scene_out)
-{
- short finest_level = scene_in.finest_level();
- // CAUTION: kernel is run at finest resolution, but this may not always be desired
- double cell_length = scene_in.finest_cell_length();
-
- std::cout << "bvpl_scene_kernel_operator: Operating on cells at level: " << finest_level << " and length: " << cell_length << std::endl;
-
- T_data_out zero;
- scene_in.template clone_blocks_to_type<boct_tree<short, T_data_out > >(scene_out, zero);
- std::cout << "The initial zero-value for all cells is : " << zero << std::endl;
-
- //(1) Traverse the scene - is there an easy way to modify the cell iterator so to only use leaf cells at level 0;
- boxm_cell_iterator<boct_tree<short, T_data_in > > iterator = scene_in.cell_iterator(&boxm_scene<boct_tree<short, T_data_in > >::load_block_and_neighbors);
- iterator.begin();
-
- boxm_cell_iterator<boct_tree<short, T_data_out > > out_iter = scene_out.cell_iterator(&boxm_scene<boct_tree<short, T_data_out > >::load_block);
- out_iter.begin();
-
- while ( !(iterator.end() || out_iter.end()) )
- {
- boct_tree_cell<short,T_data_in> *center_cell = *iterator;
- boct_tree_cell<short,T_data_out> *out_center_cell = *out_iter;
- boct_loc_code<short> out_code = out_center_cell->get_code();
- boct_loc_code<short> in_code = center_cell->get_code();
-
- //if level and location code of cells isn't the same then continue
- if ((center_cell->level() != out_center_cell->level()) || !(in_code.isequal(&out_code))) {
- std::cerr << " Input and output cells don't have the same structure " << std::endl;
- ++iterator;
- ++out_iter;
- continue;
- }
-
- //we are only interested in finest resolution
- if ((!(center_cell->level() == finest_level)) || !center_cell->is_leaf()) {
- ++iterator;
- ++out_iter;
- continue;
- }
-
- vgl_point_3d<double> center_cell_centroid = iterator.global_centroid();
-
- //(2) Run vector of kernels
-
- std::vector<T_data_in> responses;
- for (auto kernel : kernel_vector->kernels_)
- {
- bvpl_kernel_iterator kernel_iter = kernel->iterator();
- kernel_iter.begin(); // reset the kernel iterator
- while (!kernel_iter.isDone())
- {
- vgl_point_3d<int> kernel_idx = kernel_iter.index();
-
- vgl_point_3d<double> kernel_cell_centroid(center_cell_centroid.x() + (double)kernel_idx.x()*cell_length,
- center_cell_centroid.y() + (double)kernel_idx.y()*cell_length,
- center_cell_centroid.z() + (double)kernel_idx.z()*cell_length);
-
- boct_tree_cell<short,T_data_in> *this_cell = scene_in.locate_point_in_memory(kernel_cell_centroid);
-
- if (this_cell) {
- bvpl_kernel_dispatch d = *kernel_iter;
- T_data_in val = this_cell->data();
- functor.apply(val, d);
- }
-
- ++kernel_iter;
- }
-
- responses.push_back(functor.result());
- }
-
- T_data_out data_out;
- combine_kernel_responses(responses, data_out);
- out_center_cell->set_data(data_out);
- ++iterator;
- ++out_iter;
- }
- return;
-}
-
-template <class T_data>
-void bvpl_scene_vector_operator::combine_kernel_responses(const std::vector<T_data>& responses, vnl_vector_fixed<T_data, 3> &response_out)
-{
- if (responses.size() != 3) {
- std::cerr << "Wrong number of responses" << std::endl;
- return;
- }
-
- for (unsigned i = 0 ; i < 3; i++)
- {
- response_out[i] = responses[i];
- }
- return;
-}
-
-template <class T_data>
-void bvpl_scene_vector_operator::combine_kernel_responses(const std::vector<T_data>& responses, bvpl_octree_sample<T_data> &response_out)
-{
- if (responses.size() != 3) {
- std::cerr << "Wrong number of responses" << std::endl;
- return;
- }
-
- bvpl_local_max_functor<T_data> func_max;
-
- T_data max= responses[0];
- int max_id =0;
- for (unsigned i = 1 ; i < responses.size(); i++)
- {
- if (func_max.greater_than(max, responses[i])){
- max = responses[i];
- max_id = i;
- }
- }
- response_out.response_=max;
- response_out.id_ = max_id;
- return;
-}
-
-#endif // bvpl_scene_vector_operator_h
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.cxx
deleted file mode 100644
index e8cac33615..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.cxx
+++ /dev/null
@@ -1,258 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 31-Jan-2011
-
-#include "bvpl_taylor_basis.h"
-#include <bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.h>
-
-#include <boxm/boxm_scene.h>
-
-bool bvpl_taylor_basis::compute_approximation_error(const boxm_scene_base_sptr& data_scene_base,
- const boxm_scene_base_sptr& basis_scene_base,
- const boxm_scene_base_sptr& error_scene_base,
- const bvpl_taylor_basis_loader& loader,
- int block_i, int block_j, int block_k, double cell_length)
-{
- typedef boct_tree<short,float> float_tree_type;
- typedef boct_tree_cell<short,float> float_cell_type;
- typedef boct_tree<short, bvpl_taylor_basis2_sample > taylor_tree_type;
- typedef boct_tree_cell<short, bvpl_taylor_basis2_sample > taylor_cell_type;
- //cast the scenes
- auto* data_scene = dynamic_cast<boxm_scene<float_tree_type>* > (data_scene_base.as_pointer());
- auto* basis_scene = dynamic_cast<boxm_scene<taylor_tree_type>* > (basis_scene_base.as_pointer());
- auto * error_scene = dynamic_cast<boxm_scene<float_tree_type>* > (error_scene_base.as_pointer());
-
- if (!(data_scene && basis_scene &&error_scene)){
- std::cerr << "Error in compute_approximation_error: Faild to cast scene\n";
- return false;
- }
-
- //load blocks of interest
- data_scene->load_block_and_neighbors(block_i, block_j, block_k);
- basis_scene->load_block(block_i, block_j, block_k);
- error_scene->load_block(block_i, block_j, block_k);
-
- //get the leaves
- float_tree_type* data_tree = data_scene->get_block(block_i, block_j, block_k)->get_tree();
- float_tree_type* error_tree = data_tree->clone();
-
- //error is always positive, therefore cells with negative errors can be identified as uninitialized.
- error_tree->init_cells(-1.0f);
- taylor_tree_type* basis_tree = basis_scene->get_block(block_i, block_j, block_k)->get_tree();
-
- std::vector<float_cell_type*> data_leaves = data_tree->leaf_cells();
- std::vector<float_cell_type*> error_leaves = error_tree->leaf_cells();
- std::vector<taylor_cell_type*> basis_leaves = basis_tree->leaf_cells();
-
- vgl_point_3d<int> min_point = loader.min_point();
- vgl_point_3d<int> max_point = loader.max_point();
-
-
- for (unsigned i =0; i<data_leaves.size(); i++) {
- //current cell is the center
- float_cell_type* data_cell = data_leaves[i];
- taylor_cell_type* basis_cell = basis_leaves[i];
-
- boct_loc_code<short> data_code = data_cell->get_code();
- boct_loc_code<short> basis_code = basis_cell->get_code();
-
- //check cells are at the same location
- if (! data_code.isequal(basis_code)){
- std::cerr << "Error in compute_approximation_error: Cells don't have the same location in the tree\n"
- << "Data Code: " << data_code << '\n'
- << "Basis Code: " << basis_code << '\n';
-
- return false;
- }
-
- //create a region around the center cell
- vgl_point_3d<double> centroid = data_tree->global_centroid(data_cell);
-
- //change the coordinates of enpoints to be in global coordinates abd text if they are contained in the scene
- vgl_point_3d<double> min_point_global(centroid.x() + (double)min_point.x()*cell_length, centroid.y() + (double)min_point.y()*cell_length, centroid.z() + (double)min_point.z()*cell_length);
- vgl_point_3d<double> max_point_global(centroid.x() + (double)max_point.x()*cell_length, centroid.y() + (double)max_point.y()*cell_length, centroid.z() + (double)max_point.z()*cell_length);
- if (!(data_scene->locate_point_in_memory(min_point_global) && data_scene->locate_point_in_memory(max_point_global)))
- continue;
-
- //retrieve basis
- double I0 = basis_cell->data().I0;
- vnl_double_3 G= basis_cell->data().G;
- vnl_double_3x3 H = basis_cell->data().H;
- double error = 0.0;
- for (int x = min_point.x(); x<= max_point.x(); x++) {
- for (int y = min_point.y(); y<=max_point.y(); y++) {
- for (int z = min_point.z(); z<=max_point.z(); z++) {
- vgl_point_3d<double> point2visit(centroid.x()+(double)x*cell_length, centroid.y()+ (double)y*cell_length, centroid.z() + (double)z*cell_length);
- boct_tree_cell<short,float> *this_cell = data_scene->locate_point_in_memory(point2visit);
- if (this_cell) {
- vnl_double_3 X((double)x,(double)y, (double)z);
- double approx = I0 + dot_product(X,G) + 0.5* (dot_product(X,(H*X)));
- error = error + (this_cell->data() - approx)*(this_cell->data() - approx);
- //std::cout << "Taylor Error :\n" << "This centroid: " << this_centroid << ", box_centroid: " <<box_centroid <<std::endl;
- //std::cout << "Taylor Error :\n" << "X: " << X << "\nI0: " << I0 <<"\nG: " << G << "\nH: " << H <<"\nApprox: " <<approx << "\nError: " << error << std::endl;
- }
- }
- }
- }
-
- error_leaves[i]->set_data((float)error);
- }
-
- // write and release memory
- error_scene->get_block(block_i, block_j, block_k)->set_tree(error_tree);
- error_scene->write_active_block();
- data_scene->unload_active_blocks();
- basis_scene->unload_active_blocks();
-
- return true;
-}
-
-
-double bvpl_taylor_basis::sum_errors(const boxm_scene_base_sptr& error_scene_base,
- int block_i, int block_j, int block_k, unsigned long tree_nsamples)
-{
- typedef boct_tree<short,float> float_tree_type;
- typedef boct_tree_cell<short,float> float_cell_type;
- auto * error_scene = dynamic_cast<boxm_scene<float_tree_type>* > (error_scene_base.as_pointer());
-
- error_scene->load_block(block_i, block_j, block_k);
-
- //get the leaves
- float_tree_type* error_tree = error_scene->get_block(block_i, block_j, block_k)->get_tree();
- std::vector<float_cell_type*> error_leaves = error_tree->leaf_cells();
-
- int tree_ncells = error_leaves.size();
- //unsigned long tree_nsamples = (unsigned long)((float)tree_ncells/scene_ncells*nsamples_);
-
- double error = 0.0;
- vnl_random rng(9667566ul);
- for (unsigned i=0; i<tree_nsamples; i++)
- {
- unsigned long sample = rng.lrand32(tree_ncells-1);
-
- boct_tree_cell<short, float> *center_cell = error_leaves[sample];
- // vgl_point_3d<double> center_cell_centroid = error_tree->global_centroid(center_cell);
-
- //if neighborhood is not inclusive we would have missing features
- if ((double)center_cell->data()< -0.5){
- i--;
- continue;
- }
- else {
- error+=(double)center_cell->data();
- }
- }
-
- return error/tree_nsamples;
-}
-
-//: Reads the values of basis responses and assembles them into matrices and vectors
-bool bvpl_taylor_basis::assemble_basis(const bvpl_taylor_scenes_map_sptr& taylor_scenes,int block_i, int block_j, int block_k)
-{
- typedef boct_tree<short,float> float_tree_type;
- typedef boct_tree<short, bvpl_taylor_basis2_sample > taylor_tree_type;
- typedef boct_tree_cell<short,float> float_cell_type;
- typedef boct_tree_cell<short, bvpl_taylor_basis2_sample > taylor_cell_type;
-
- std::cerr << "Caution: Using hardcoded size for taylor reconstruction\n";
-
- //load output scene
- boxm_scene<taylor_tree_type>* basis_scene = dynamic_cast<boxm_scene<taylor_tree_type>* > (taylor_scenes->get_scene("basis").as_pointer());
- if (!basis_scene)
- {
- std::cerr << "Error in reconstruct: Faild to cast output scene\n";
- return false;
- }
-
- //retieve basis scenes
- //zeroth derivative scene
- boxm_scene<float_tree_type>* I0_scene = dynamic_cast<boxm_scene<float_tree_type>* > (taylor_scenes->get_scene("I0").as_pointer());
- boxm_scene<float_tree_type>* Ix_scene = dynamic_cast<boxm_scene<float_tree_type>* > (taylor_scenes->get_scene("Ix").as_pointer());
- boxm_scene<float_tree_type>* Iy_scene = dynamic_cast<boxm_scene<float_tree_type>* > (taylor_scenes->get_scene("Iy").as_pointer());
- boxm_scene<float_tree_type>* Iz_scene = dynamic_cast<boxm_scene<float_tree_type>* > (taylor_scenes->get_scene("Iz").as_pointer());
- boxm_scene<float_tree_type>* Ixx_scene = dynamic_cast<boxm_scene<float_tree_type>* > (taylor_scenes->get_scene("Ixx").as_pointer());
- boxm_scene<float_tree_type>* Ixy_scene = dynamic_cast<boxm_scene<float_tree_type>* > (taylor_scenes->get_scene("Ixy").as_pointer());
- boxm_scene<float_tree_type>* Ixz_scene = dynamic_cast<boxm_scene<float_tree_type>* > (taylor_scenes->get_scene("Ixz").as_pointer());
- boxm_scene<float_tree_type>* Iyy_scene = dynamic_cast<boxm_scene<float_tree_type>* > (taylor_scenes->get_scene("Iyy").as_pointer());
- boxm_scene<float_tree_type>* Iyz_scene = dynamic_cast<boxm_scene<float_tree_type>* > (taylor_scenes->get_scene("Iyz").as_pointer());
- boxm_scene<float_tree_type>* Izz_scene = dynamic_cast<boxm_scene<float_tree_type>* > (taylor_scenes->get_scene("Izz").as_pointer());
-
-
- if (!(I0_scene && Ix_scene && Iy_scene && Iz_scene && Ixx_scene && Iyy_scene && Izz_scene && Ixy_scene && Ixz_scene && Iyz_scene))
- {
- std::cerr << "Error in assemble_basis: Faild to load taylor scenes\n";
- return false;
- }
-
- //load the blocks
- basis_scene->load_block(block_i, block_j,block_k);
- I0_scene->load_block(block_i, block_j,block_k);
- Ix_scene->load_block(block_i, block_j,block_k);
- Iy_scene->load_block(block_i, block_j,block_k);
- Iz_scene->load_block(block_i, block_j,block_k);
- Ixx_scene->load_block(block_i, block_j,block_k);
- Ixy_scene->load_block(block_i, block_j,block_k);
- Ixz_scene->load_block(block_i, block_j,block_k);
- Iyy_scene->load_block(block_i, block_j,block_k);
- Iyz_scene->load_block(block_i, block_j,block_k);
- Izz_scene->load_block(block_i, block_j,block_k);
-
-
- float_tree_type *treeI0 = I0_scene->get_block(block_i, block_j, block_k)->get_tree();
- taylor_tree_type *basis_tree = treeI0->clone_to_type<bvpl_taylor_basis2_sample>();
- basis_tree->init_cells(bvpl_taylor_basis2_sample());
- std::vector<taylor_cell_type*> leaves_basis = basis_tree->leaf_cells();
- std::vector<float_cell_type* > leaves_I0 = treeI0->leaf_cells();
- std::vector<float_cell_type* > leaves_Ix = Ix_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells();
- std::vector<float_cell_type* > leaves_Iy = Iy_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells();
- std::vector<float_cell_type* > leaves_Iz = Iz_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells();
- std::vector<float_cell_type* > leaves_Ixx =Ixx_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells();
- std::vector<float_cell_type* > leaves_Ixy =Ixy_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells();
- std::vector<float_cell_type* > leaves_Ixz =Ixz_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells();
- std::vector<float_cell_type* > leaves_Iyy =Iyy_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells();
- std::vector<float_cell_type* > leaves_Iyz =Iyz_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells();
- std::vector<float_cell_type* > leaves_Izz =Izz_scene->get_block(block_i, block_j, block_k)->get_tree()->leaf_cells();
-
-
- //iterate gathering and assembling the data
- for (unsigned i=0; i<leaves_basis.size(); i++)
- {
- auto I0 = (double)leaves_I0[i]->data();
- vnl_double_3 G((double)leaves_Ix[i]->data(),(double)leaves_Iy[i]->data(),(double)leaves_Iz[i]->data());
-
- vnl_double_3x3 H;
- H.put(0,0,(double)leaves_Ixx[i]->data());
- H.put(0,1,(double)leaves_Ixy[i]->data());
- H.put(0,2,(double)leaves_Ixz[i]->data());
- H.put(1,0,(double)leaves_Ixy[i]->data());
- H.put(1,1,(double)leaves_Iyy[i]->data());
- H.put(1,2,(double)leaves_Iyz[i]->data());
- H.put(2,0,(double)leaves_Ixz[i]->data());
- H.put(2,1,(double)leaves_Iyz[i]->data());
- H.put(2,2,(double)leaves_Izz[i]->data());
-
- bvpl_taylor_basis2_sample sample(I0, G, H);
-
- leaves_basis[i]->set_data(sample);
- }
-
- //write basis block
- basis_scene->get_block(block_i, block_j, block_k)->set_tree(basis_tree);
- basis_scene->write_active_block();
-
- //free up memory
- basis_scene->unload_active_blocks();
- I0_scene->unload_active_blocks();
- Ix_scene->unload_active_blocks();
- Iy_scene->unload_active_blocks();
- Iz_scene->unload_active_blocks();
- Ixx_scene->unload_active_blocks();
- Ixy_scene->unload_active_blocks();
- Ixz_scene->unload_active_blocks();
- Iyy_scene->unload_active_blocks();
- Iyz_scene->unload_active_blocks();
- Izz_scene->unload_active_blocks();
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.h
deleted file mode 100644
index 6d35064025..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/bvpl_taylor_basis.h
-#ifndef bvpl_taylor_basis_h
-#define bvpl_taylor_basis_h
-
-//:
-// \file
-// \brief A class with utilities to apply taylor kernels to a scene
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 31-Jan-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bvpl/kernels/bvpl_taylor_basis_factory.h>
-#include "bvpl_taylor_scenes_map.h"
-#include <boxm/boxm_scene_base.h>
-
-
-class bvpl_taylor_basis
-{
-
-public:
- // bvpl_taylor_basis(boxm_scene_base_sptr scene_base, bvpl_taylor_basis_loader loader, std::string path_out):
- // kernel_loader_(loader), scene_base_(scene_base), path_out_(path_out){}
- //
- static bool assemble_basis(const bvpl_taylor_scenes_map_sptr& taylor_scenes,int block_i, int block_j, int block_k);
-
- //: Computes the square errors between the scene and the taylor approximation at every voxel
- // This function operates on a block specified by an index
- static bool compute_approximation_error(const boxm_scene_base_sptr& data_scene_base,
- const boxm_scene_base_sptr& basis_scene_base,
- const boxm_scene_base_sptr& error_scene_base,
- const bvpl_taylor_basis_loader& loader,
- int block_i, int block_j, int block_k, double cell_length);
-
- //: Sums the square errors for a percenatge of random samples
- static double sum_errors(const boxm_scene_base_sptr& error_scene_base,
- int block_i, int block_j, int block_k, unsigned long tree_nsamples);
-
-protected:
-
- //
- // bvpl_taylor_basis_loader kernel_loader_;
- // boxm_scene_base_sptr scene_base_;
- // std::string path_out_;
-};
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_scenes_map.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_scenes_map.cxx
deleted file mode 100644
index 92128f59d6..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_scenes_map.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 15-Feb-2011
-
-#include "bvpl_taylor_scenes_map.h"
-#include <bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.h>
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_scene_parser.h>
-
-#include <vul/vul_file.h>
-
-bvpl_taylor_scenes_map::bvpl_taylor_scenes_map(bvpl_taylor_basis_loader loader)
-{
- loader_ = loader;
- typedef boct_tree<short,float> tree_type;
-
- std::vector<std::string> kernel_names;
- loader.files(kernel_names);
-
- //Load scenes one-by-one an insert them in the map
- for (auto & kernel_name : kernel_names)
- {
- std::string scene_in_file = loader.path() + '/' + kernel_name + "/float_response_scene.xml";
- boxm_scene_parser parser;
- boxm_scene_base_sptr scene_ptr=new boxm_scene_base();
- scene_ptr->load_scene(scene_in_file, parser);
-
- if (scene_ptr->appearence_model() != BOXM_FLOAT) {
- std::cerr << " bvpl_taylor_scenes, scenes must be of type float\n";
- }
-
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(parser);
- scene_ptr = scene;
-
- this->scenes_.insert(std::pair<std::string, boxm_scene_base_sptr>( kernel_name, scene_ptr));
- }
-
- // Create a scene to later save the taylor reconstruction (parameters of the scene are the same as those of the input scene)
- auto* scene_in = static_cast<boxm_scene<tree_type>* > (scenes_[kernel_names[0]].as_pointer());
- {
- boxm_scene<tree_type> *scene_out =
- new boxm_scene<tree_type>(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level());
- scene_out->set_paths(loader.path(), "error");
- scene_out->set_appearance_model(BOXM_FLOAT);
- if (!vul_file::exists(loader.path() + "/error_scene.xml"))
- scene_out->write_scene("error_scene.xml");
- this->scenes_.insert(std::pair<std::string, boxm_scene_base_sptr>( "error", scene_out));
- }
-
- {
- boxm_scene<boct_tree<short, bvpl_taylor_basis2_sample> > *scene_out =
- new boxm_scene<boct_tree<short, bvpl_taylor_basis2_sample> >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level());
- scene_out->set_paths(loader.path(), "basis");
- scene_out->set_appearance_model(BOXM_FLOAT);
- if (!vul_file::exists(loader.path() + "/basis_scene.xml"))
- scene_out->write_scene("basis_scene.xml");
- this->scenes_.insert(std::pair<std::string, boxm_scene_base_sptr>( "basis", scene_out));
- }
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_scenes_map.h b/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_scenes_map.h
deleted file mode 100644
index 51f783da43..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/bvpl_taylor_scenes_map.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// This is bvpl_taylor_scenes_map.h
-#ifndef bvpl_taylor_scenes_map_h
-#define bvpl_taylor_scenes_map_h
-
-//:
-// \file
-// \brief A class to hold the smartpointers to response scenes and their corresponding names
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 15-Feb-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bvpl/kernels/bvpl_taylor_basis_factory.h>
-#include <boxm/boxm_scene_base.h>
-#include <vsl/vsl_binary_io.h>
-
-// Forward declarations
-class bvpl_taylor_scenes_map;
-
-typedef vbl_smart_ptr<bvpl_taylor_scenes_map> bvpl_taylor_scenes_map_sptr;
-
-//: A class to hold the smartpointers to response scenes and their corresponding names
-class bvpl_taylor_scenes_map : public vbl_ref_count
-{
-public:
-
- bvpl_taylor_scenes_map(bvpl_taylor_basis_loader loader);
-
- boxm_scene_base_sptr get_scene(std::string basis) {return scenes_[basis];}
-
- const bvpl_taylor_basis_loader& loader() {return loader_ ;}
-
-private:
- std::map<std::string, boxm_scene_base_sptr> scenes_;
- bvpl_taylor_basis_loader loader_;
-
-};
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/io/CMakeLists.txt
deleted file mode 100644
index e1264a0f5c..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# contrib/brl/bseg/bvpl/io/CMakeLists.txt
-
-set(bvpl_octree_io_sources
- bvpl_io_taylor_scenes_map.h bvpl_io_taylor_scenes_map.cxx
- bvpl_io_pca_error_scenes.h bvpl_io_pca_error_scenes.cxx
- bvpl_io_discover_pca_kernels.h bvpl_io_discover_pca_kernels.cxx
- bvpl_io_global_pca.h bvpl_io_global_pca.cxx
- bvpl_io_global_taylor.h
- bvpl_io_global_corners.h bvpl_io_global_corners.cxx
-
-)
-
-aux_source_directory(Templates bvpl_octree_io_sources)
-
-vxl_add_library(LIBRARY_NAME bvpl_octree_io LIBRARY_SOURCES ${bvpl_octree_io_sources})
-target_link_libraries(bvpl_octree_io bvpl_octree ${VXL_LIB_PREFIX}vbl_io ${VXL_LIB_PREFIX}vsl)
-
-if( BUILD_TESTING )
- add_subdirectory(tests)
-endif()
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_discover_pca_kernels-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_discover_pca_kernels-.cxx
deleted file mode 100644
index 45954e1337..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_discover_pca_kernels-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.h>
-#include <vbl/io/vbl_io_smart_ptr.hxx>
-
-VBL_IO_SMART_PTR_INSTANTIATE(bvpl_discover_pca_kernels);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_corners-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_corners-.cxx
deleted file mode 100644
index ed29b40a54..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_corners-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <vbl/io/vbl_io_smart_ptr.hxx>
-#include <bvpl_octree/io/bvpl_io_global_corners.h>
-
-VBL_IO_SMART_PTR_INSTANTIATE(bvpl_global_corners);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_pca+125--.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_pca+125--.cxx
deleted file mode 100644
index fc4656672f..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_pca+125--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <vbl/io/vbl_io_smart_ptr.hxx>
-#include <bvpl_octree/io/bvpl_io_global_pca.h>
-
-typedef bvpl_global_pca<125> bvpl_global_pca_125;
-
-VBL_IO_SMART_PTR_INSTANTIATE(bvpl_global_pca_125);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_taylor+double.10--.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_taylor+double.10--.cxx
deleted file mode 100644
index ff9d7dc465..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_global_taylor+double.10--.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <vbl/io/vbl_io_smart_ptr.hxx>
-#include <bvpl_octree/io/bvpl_io_global_taylor.h>
-
-typedef bvpl_global_taylor<double, 10> bvpl_global_taylor_double_10;
-
-VBL_IO_SMART_PTR_INSTANTIATE(bvpl_global_taylor_double_10);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_pca_error_scenes-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_pca_error_scenes-.cxx
deleted file mode 100644
index 427e3937d4..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_pca_error_scenes-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.h>
-#include <vbl/io/vbl_io_smart_ptr.hxx>
-
-VBL_IO_SMART_PTR_INSTANTIATE(bvpl_pca_error_scenes);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_taylor_scenes_map-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_taylor_scenes_map-.cxx
deleted file mode 100644
index 25a60ca12c..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/Templates/vbl_io_smart_ptr+bvpl_taylor_scenes_map-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.h>
-#include <vbl/io/vbl_io_smart_ptr.hxx>
-
-VBL_IO_SMART_PTR_INSTANTIATE(bvpl_taylor_scenes_map);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.cxx
deleted file mode 100644
index 05fe44152d..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.cxx
+++ /dev/null
@@ -1,50 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 15-Feb-2011
-
-#include "bvpl_io_discover_pca_kernels.h"
-
-
-//: Binary save parameters to stream.
-void vsl_b_write(vsl_b_ostream & /*os*/, bvpl_discover_pca_kernels const & )
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-
-//: Binary load parameters from stream.
-void vsl_b_read(vsl_b_istream & /*is*/, bvpl_discover_pca_kernels & )
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_print_summary(std::ostream & /*os*/, const bvpl_discover_pca_kernels & )
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_b_read(vsl_b_istream& /*is*/,bvpl_discover_pca_kernels* /*p*/)
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_b_write(vsl_b_ostream& /*os*/, const bvpl_discover_pca_kernels* & /*p*/)
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_print_summary(std::ostream& os, const bvpl_discover_pca_kernels* &p)
-{
- if (p==nullptr)
- os << "NULL PTR";
- else {
- os << "T: ";
- vsl_print_summary(os, *p);
- }
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.h b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.h
deleted file mode 100644
index b52e2355b2..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// This is bvpl_io_discover_pca_kernels.h
-#ifndef bvpl_io_discover_pca_kernels_h
-#define bvpl_io_discover_pca_kernels_h
-
-//:
-// \file
-// \brief Binary IO for bvpl_discover_pca_kernels. Not implemented, only declared so it can be stored in the database
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 15-Feb-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <bvpl/bvpl_octree/bvpl_discover_pca_kernels.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vsl/vsl_binary_io.h>
-
-//: Binary save parameters to stream.
-void vsl_b_write(vsl_b_ostream & os, bvpl_discover_pca_kernels const &);
-
-
-//: Binary load parameters from stream.
-void vsl_b_read(vsl_b_istream & is, bvpl_discover_pca_kernels &m);
-
-
-void vsl_print_summary(std::ostream &os, const bvpl_discover_pca_kernels &m);
-
-
-void vsl_b_read(vsl_b_istream& is, bvpl_discover_pca_kernels* m);
-
-
-void vsl_b_write(vsl_b_ostream& os, const bvpl_discover_pca_kernels* &m);
-
-void vsl_print_summary(std::ostream& os, const bvpl_discover_pca_kernels* &m);
-
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.cxx
deleted file mode 100644
index ef10f3ad61..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.cxx
+++ /dev/null
@@ -1,50 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 21-Jul-2011
-
-#include "bvpl_io_global_corners.h"
-
-
-//: Binary save parameters to stream.
-void vsl_b_write(vsl_b_ostream & /*os*/, bvpl_global_corners const & )
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-
-//: Binary load parameters from stream.
-void vsl_b_read(vsl_b_istream & /*is*/, bvpl_global_corners & )
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_print_summary(std::ostream & /*os*/, const bvpl_global_corners & )
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_b_read(vsl_b_istream& /*is*/,bvpl_global_corners* /*p*/)
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_b_write(vsl_b_ostream& /*os*/, const bvpl_global_corners* & /*p*/)
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_print_summary(std::ostream& os, const bvpl_global_corners* &p)
-{
- if (p==nullptr)
- os << "NULL PTR";
- else {
- os << "T: ";
- vsl_print_summary(os, *p);
- }
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.h b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.h
deleted file mode 100644
index ac64d773d4..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_corners.h
-#ifndef bvpl_io_global_cornerss_h
-#define bvpl_io_global_cornerss_h
-//:
-// \file
-// \brief Binary IO for bvpl_global_corners_125. Not implemented, only declared so it can be stored in the database
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 15-Feb-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <bvpl/bvpl_octree/bvpl_global_corners.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vsl/vsl_binary_io.h>
-
-typedef bvpl_global_corners bvpl_global_corners;
-
-//: Binary save parameters to stream.
-void vsl_b_write(vsl_b_ostream & os, bvpl_global_corners const &);
-
-
-//: Binary load parameters from stream.
-void vsl_b_read(vsl_b_istream & is, bvpl_global_corners &m);
-
-
-void vsl_print_summary(std::ostream &os, const bvpl_global_corners &m);
-
-
-void vsl_b_read(vsl_b_istream& is, bvpl_global_corners* m);
-
-
-void vsl_b_write(vsl_b_ostream& os, const bvpl_global_corners* &m);
-
-void vsl_print_summary(std::ostream& os, const bvpl_global_corners* &m);
-
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.cxx
deleted file mode 100644
index cac12cb25b..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.cxx
+++ /dev/null
@@ -1,50 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 15-Feb-2011
-
-#include "bvpl_io_global_pca.h"
-
-
-//: Binary save parameters to stream.
-void vsl_b_write(vsl_b_ostream & /*os*/, bvpl_global_pca_125 const & )
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-
-//: Binary load parameters from stream.
-void vsl_b_read(vsl_b_istream & /*is*/, bvpl_global_pca_125 & )
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_print_summary(std::ostream & /*os*/, const bvpl_global_pca_125 & )
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_b_read(vsl_b_istream& /*is*/,bvpl_global_pca_125* /*p*/)
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_b_write(vsl_b_ostream& /*os*/, const bvpl_global_pca_125* & /*p*/)
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_print_summary(std::ostream& os, const bvpl_global_pca_125* &p)
-{
- if (p==nullptr)
- os << "NULL PTR";
- else {
- os << "T: ";
- vsl_print_summary(os, *p);
- }
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.h b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.h
deleted file mode 100644
index 2858d03895..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_pca.h
-#ifndef bvpl_io_global_pca_h
-#define bvpl_io_global_pca_h
-//:
-// \file
-// \brief Binary IO for bvpl_global_pca_125. Not implemented, only declared so it can be stored in the database
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 15-Feb-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <bvpl/bvpl_octree/bvpl_global_pca.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vsl/vsl_binary_io.h>
-
-typedef bvpl_global_pca<125> bvpl_global_pca_125;
-
-//: Binary save parameters to stream.
-void vsl_b_write(vsl_b_ostream & os, bvpl_global_pca_125 const &);
-
-
-//: Binary load parameters from stream.
-void vsl_b_read(vsl_b_istream & is, bvpl_global_pca_125 &m);
-
-
-void vsl_print_summary(std::ostream &os, const bvpl_global_pca_125 &m);
-
-
-void vsl_b_read(vsl_b_istream& is, bvpl_global_pca_125* m);
-
-
-void vsl_b_write(vsl_b_ostream& os, const bvpl_global_pca_125* &m);
-
-void vsl_print_summary(std::ostream& os, const bvpl_global_pca_125* &m);
-
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_taylor.h b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_taylor.h
deleted file mode 100644
index 8c57308415..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_global_taylor.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// This is bvpl_io_global_taylor.h
-#ifndef bvpl_io_global_taylor_h
-#define bvpl_io_global_taylor_h
-
-//:
-// \file
-// \brief Binary IO for bvpl_global_taylor. Not implemented, only declared so it can be stored in the database
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 15-Feb-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <bvpl/bvpl_octree/bvpl_global_taylor.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vsl/vsl_binary_io.h>
-
-
-//: Binary save parameters to stream.
-template <class T, unsigned N>
-void vsl_b_write(vsl_b_ostream & os, bvpl_global_taylor<T,N> const &)
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-//: Binary load parameters from stream.
-template <class T, unsigned N>
-void vsl_b_read(vsl_b_istream & is, bvpl_global_taylor<T,N> &p)
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-template <class T, unsigned N>
-void vsl_print_summary(std::ostream &os, const bvpl_global_taylor<T,N> &p)
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-
-template <class T, unsigned N>
-void vsl_b_read(vsl_b_istream& is, bvpl_global_taylor<T,N>* p)
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-
-template <class T, unsigned N>
-void vsl_b_write(vsl_b_ostream& os, const bvpl_global_taylor<T,N>* &mp)
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-template <class T, unsigned N>
-void vsl_print_summary(std::ostream& os, const bvpl_global_taylor<T,N>* &p)
-{
- if (p==0)
- os << "NULL PTR";
- else {
- os << "T: ";
- vsl_print_summary(os, *p);
- }
-}
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.cxx
deleted file mode 100644
index ff1de28596..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.cxx
+++ /dev/null
@@ -1,50 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 15-Feb-2011
-
-#include "bvpl_io_pca_error_scenes.h"
-
-
-//: Binary save parameters to stream.
-void vsl_b_write(vsl_b_ostream & /*os*/, bvpl_pca_error_scenes const & )
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-
-//: Binary load parameters from stream.
-void vsl_b_read(vsl_b_istream & /*is*/, bvpl_pca_error_scenes & )
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_print_summary(std::ostream & /*os*/, const bvpl_pca_error_scenes & )
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_b_read(vsl_b_istream& /*is*/,bvpl_pca_error_scenes* /*p*/)
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_b_write(vsl_b_ostream& /*os*/, const bvpl_pca_error_scenes* & /*p*/)
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_print_summary(std::ostream& os, const bvpl_pca_error_scenes* &p)
-{
- if (p==nullptr)
- os << "NULL PTR";
- else {
- os << "T: ";
- vsl_print_summary(os, *p);
- }
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.h b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.h
deleted file mode 100644
index b0e98d6299..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// This is bvpl_io_pca_error_scenes.h
-#ifndef bvpl_io_pca_error_scenes_h
-#define bvpl_io_pca_error_scenes_h
-
-//:
-// \file
-// \brief Binary IO for bvpl_pca_error_scenes. Not implemented, only declared so it can be stored in the database
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 15-Feb-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <bvpl/bvpl_octree/bvpl_pca_error_scenes.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vsl/vsl_binary_io.h>
-
-//: Binary save parameters to stream.
-void vsl_b_write(vsl_b_ostream & os, bvpl_kernel const &bvpl_pca_error_scenes);
-
-
-//: Binary load parameters from stream.
-void vsl_b_read(vsl_b_istream & is, bvpl_pca_error_scenes &m);
-
-
-void vsl_print_summary(std::ostream &os, const bvpl_pca_error_scenes &m);
-
-
-void vsl_b_read(vsl_b_istream& is, bvpl_pca_error_scenes* m);
-
-
-void vsl_b_write(vsl_b_ostream& os, const bvpl_pca_error_scenes* &m);
-
-void vsl_print_summary(std::ostream& os, const bvpl_pca_error_scenes* &m);
-
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.cxx
deleted file mode 100644
index ba4155da13..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.cxx
+++ /dev/null
@@ -1,50 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 15-Feb-2011
-
-#include "bvpl_io_taylor_scenes_map.h"
-
-
-//: Binary save parameters to stream.
-void vsl_b_write(vsl_b_ostream & /*os*/, bvpl_taylor_scenes_map const & )
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-
-//: Binary load parameters from stream.
-void vsl_b_read(vsl_b_istream & /*is*/, bvpl_taylor_scenes_map & )
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_print_summary(std::ostream & /*os*/, const bvpl_taylor_scenes_map & )
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_b_read(vsl_b_istream& /*is*/,bvpl_taylor_scenes_map* /*p*/)
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_b_write(vsl_b_ostream& /*os*/, const bvpl_taylor_scenes_map* & /*p*/)
-{
- std::cerr << "Error: Trying to save but binary io not implemented\n";
- return;
-}
-
-void vsl_print_summary(std::ostream& os, const bvpl_taylor_scenes_map* &p)
-{
- if (p==nullptr)
- os << "NULL PTR";
- else {
- os << "T: ";
- vsl_print_summary(os, *p);
- }
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.h b/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.h
deleted file mode 100644
index 3900318cd2..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.h
-#ifndef bvpl_io_taylor_scenes_map_h
-#define bvpl_io_taylor_scenes_map_h
-//:
-// \file
-// \brief Binary IO for bvpl_taylor_scenes_map.
-// Not implemented, only declared so it can be stored in the database
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 15-Feb-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <bvpl/bvpl_octree/bvpl_taylor_scenes_map.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vsl/vsl_binary_io.h>
-
-//: Binary save parameters to stream.
-void vsl_b_write(vsl_b_ostream & os, bvpl_kernel const &bvpl_taylor_scenes_map);
-
-//: Binary load parameters from stream.
-void vsl_b_read(vsl_b_istream & is, bvpl_taylor_scenes_map &m);
-
-void vsl_print_summary(std::ostream &os, const bvpl_taylor_scenes_map &m);
-
-void vsl_b_read(vsl_b_istream& is, bvpl_taylor_scenes_map* m);
-
-void vsl_b_write(vsl_b_ostream& os, const bvpl_taylor_scenes_map* &m);
-
-void vsl_print_summary(std::ostream& os, const bvpl_taylor_scenes_map* &m);
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/tests/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/io/tests/CMakeLists.txt
deleted file mode 100644
index 8c8f573ab9..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/tests/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-add_executable( bvpl_octree_io_test_include test_include.cxx )
-target_link_libraries( bvpl_octree_io_test_include bvpl_octree_io)
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/io/tests/test_include.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/io/tests/test_include.cxx
deleted file mode 100644
index 4ddefe5f48..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/io/tests/test_include.cxx
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <bvpl/bvpl_octree/io/bvpl_io_discover_pca_kernels.h>
-#include <bvpl/bvpl_octree/io/bvpl_io_global_corners.h>
-#include <bvpl/bvpl_octree/io/bvpl_io_global_pca.h>
-#include <bvpl/bvpl_octree/io/bvpl_io_global_taylor.h>
-#include <bvpl/bvpl_octree/io/bvpl_io_pca_error_scenes.h>
-#include <bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/pro/CMakeLists.txt
deleted file mode 100644
index bbc90f7cea..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# This is contrib/brl/bseg/bvpl/pro/CMakeLists.txt
-# bvxm's Process Library
-
-# bprb depends on expat and bvxm_pro depends on bprb primarily
-FIND_PACKAGE(EXPAT REQUIRED)
-FIND_PACKAGE(EXPATPP REQUIRED)
-if(EXPAT_FOUND)
-include_directories( ${BRL_INCLUDE_DIR}/bpro )
-include_directories( ${BRL_INCLUDE_DIR}/bpro/bprb )
-
-set(bvpl_octree_pro_sources
- bvpl_octree_processes.h
- bvpl_octree_register.h bvpl_octree_register.cxx
- )
-
-aux_source_directory(Templates bvpl_octree_pro_sources)
-aux_source_directory(processes bvpl_octree_pro_sources)
-aux_source_directory(processes/pca bvpl_octree_pro_sources)
-aux_source_directory(processes/taylor bvpl_octree_pro_sources)
-aux_source_directory(processes/corners bvpl_octree_pro_sources)
-aux_source_directory(processes/steerable_filters bvpl_octree_pro_sources)
-
-
-vxl_add_library(LIBRARY_NAME bvpl_octree_pro LIBRARY_SOURCES ${bvpl_octree_pro_sources})
-target_link_libraries(bvpl_octree_pro bvpl_octree_io bvpl_octree bvpl_kernels_io boxm boct boxm_algo_pro boxm_sample boxm_util bprb brdb ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl_io)
-
-if( BUILD_TESTING )
- add_subdirectory(tests)
-endif()
-
-endif()
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx
deleted file mode 100644
index 5de38b0662..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+boxm_scene_base_sptr-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <brdb/brdb_value.hxx>
-#include <boxm/boxm_scene_base.h>
-#include <vbl/io/vbl_io_smart_ptr.h>
-BRDB_VALUE_INSTANTIATE(boxm_scene_base_sptr, "boxm_scene_base_sptr");
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_discover_pca_kernels_sptr-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_discover_pca_kernels_sptr-.cxx
deleted file mode 100644
index 9cf83eebc4..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_discover_pca_kernels_sptr-.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <brdb/brdb_value.hxx>
-
-#include <vbl/io/vbl_io_smart_ptr.h>
-#include <bvpl/bvpl_octree/bvpl_discover_pca_kernels.h>
-
-BRDB_VALUE_INSTANTIATE(bvpl_discover_pca_kernels_sptr, "bvpl_discover_pca_kernels_sptr");
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_global_corners_sptr-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_global_corners_sptr-.cxx
deleted file mode 100644
index b2e7fa3fed..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_global_corners_sptr-.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <brdb/brdb_value.hxx>
-
-#include <vbl/io/vbl_io_smart_ptr.h>
-#include <bvpl/bvpl_octree/bvpl_global_corners.h>
-
-BRDB_VALUE_INSTANTIATE(bvpl_global_corners_sptr, "bvpl_global_corners_sptr");
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_global_pca_125_sptr-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_global_pca_125_sptr-.cxx
deleted file mode 100644
index f911ce4589..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_global_pca_125_sptr-.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <brdb/brdb_value.hxx>
-
-#include <vbl/io/vbl_io_smart_ptr.h>
-#include <bvpl/bvpl_octree/bvpl_global_pca.h>
-
-BRDB_VALUE_INSTANTIATE(bvpl_global_pca_125_sptr, "bvpl_global_pca_125_sptr");
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_pca_error_scenes_sptr-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_pca_error_scenes_sptr-.cxx
deleted file mode 100644
index 1a079ac413..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_pca_error_scenes_sptr-.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <brdb/brdb_value.hxx>
-
-#include <vbl/io/vbl_io_smart_ptr.h>
-#include <bvpl/bvpl_octree/bvpl_pca_error_scenes.h>
-
-BRDB_VALUE_INSTANTIATE(bvpl_pca_error_scenes_sptr, "bvpl_pca_error_scenes_sptr");
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_taylor_scenes_map_sptr-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_taylor_scenes_map_sptr-.cxx
deleted file mode 100644
index ee1188aea5..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+bvpl_taylor_scenes_map_sptr-.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <brdb/brdb_value.hxx>
-
-#include <vbl/io/vbl_io_smart_ptr.h>
-#include <bvpl/bvpl_octree/bvpl_taylor_basis.h>
-
-BRDB_VALUE_INSTANTIATE(bvpl_taylor_scenes_map_sptr, "bvpl_taylor_scenes_map_sptr");
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+vbl_smart_ptr+bvpl_global_taylor+double.10---.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+vbl_smart_ptr+bvpl_global_taylor+double.10---.cxx
deleted file mode 100644
index 600668ef3f..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/Templates/brdb_value_t+vbl_smart_ptr+bvpl_global_taylor+double.10---.cxx
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <brdb/brdb_value.hxx>
-
-#include <vbl/io/vbl_io_smart_ptr.h>
-#include <bvpl/bvpl_octree/bvpl_global_taylor.h>
-
-typedef vbl_smart_ptr<bvpl_global_taylor<double, 10> > bvpl_global_taylor_sptr;
-
-BRDB_VALUE_INSTANTIATE(bvpl_global_taylor_sptr, "bvpl_global_taylor_sptr");
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_processes.h b/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_processes.h
deleted file mode 100644
index 89d5581af3..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_processes.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef bvpl_octree_processes_h_
-#define bvpl_octree_processes_h_
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_macros.h>
-
-DECLARE_FUNC_CONS(bvpl_scene_vector_operator_process);
-DECLARE_FUNC_CONS(bvpl_scene_kernel_operator_process);
-DECLARE_FUNC_CONS(bvpl_block_kernel_operator_process);
-DECLARE_FUNC_CONS(bvpl_save_vrml_process);
-DECLARE_FUNC_CONS(bvpl_create_scene_process);
-DECLARE_FUNC_CONS(bvpl_plane_propagate_process);
-DECLARE_FUNC_CONS(bvpl_nonmax_supp_process);
-DECLARE_FUNC_CONS(bvpl_compute_gauss_gradients);
-DECLARE_FUNC_CONS(bvpl_scene_histogram_process);
-DECLARE_FUNC_CONS(bvpl_block_avg_value_process);
-DECLARE_FUNC_CONS(bvpl_grad_scene_to_bin_process);
-
-
-//PCA related
-DECLARE_FUNC_CONS(bvpl_discover_pca_features_process);
-DECLARE_FUNC_CONS(bvpl_compute_pca_test_error_process);
-DECLARE_FUNC_CONS(bvpl_compute_pca_error_scene_process);
-DECLARE_FUNC_CONS(bvpl_compute_pca_error_block_process);
-DECLARE_FUNC_CONS(bvpl_load_pca_error_scenes_process);
-DECLARE_FUNC_CONS(bvpl_add_pca_errors_process);
-DECLARE_FUNC_CONS(bvpl_load_pca_info_process);
-DECLARE_FUNC_CONS(bvpl_pca_project_process);
-DECLARE_FUNC_CONS(bvpl_normalize_pca_training_error_process);
-DECLARE_FUNC_CONS(bvpl_pca_global_statistics_process);
-DECLARE_FUNC_CONS(bvpl_combine_pairwise_statistics_process);
-DECLARE_FUNC_CONS(bvpl_global_pca_process);
-DECLARE_FUNC_CONS(bvpl_init_global_pca_process);
-DECLARE_FUNC_CONS(bvpl_load_global_pca_125_process);
-DECLARE_FUNC_CONS(bvpl_pca_global_proj_error_process);
-DECLARE_FUNC_CONS(bvpl_pca_global_add_error_process);
-
-//Taylor related
-DECLARE_FUNC_CONS(bvpl_load_taylor_scenes_process);
-DECLARE_FUNC_CONS(bvpl_compute_taylor_error_process);
-DECLARE_FUNC_CONS(bvpl_add_taylor_errors_process);
-DECLARE_FUNC_CONS(bvpl_init_global_taylor_process);
-DECLARE_FUNC_CONS(bvpl_compute_taylor_coefficients_process);
-DECLARE_FUNC_CONS(bvpl_explore_coefficient_scene_process);
-DECLARE_FUNC_CONS(bvpl_load_global_taylor_process);
-DECLARE_FUNC_CONS(bvpl_taylor_global_proj_error_process);
-DECLARE_FUNC_CONS(bvpl_taylor_global_add_error_process);
-
-//Corner related
-DECLARE_FUNC_CONS(bvpl_compute_harris_measure_process);
-DECLARE_FUNC_CONS(bvpl_load_global_corners_process);
-DECLARE_FUNC_CONS(bvpl_corner_statistics_process);
-DECLARE_FUNC_CONS(bvpl_threshold_corners_process);
-DECLARE_FUNC_CONS(bvpl_compute_beaudet_measure_process);
-
-//Steerable filters
-DECLARE_FUNC_CONS(bvpl_init_sf_response_scene_process);
-DECLARE_FUNC_CONS(bvpl_compute_sf_raw_response_process);
-
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_register.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_register.cxx
deleted file mode 100644
index 189cb04ae3..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_register.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-#include "bvpl_octree_register.h"
-
-#include <bprb/bprb_macros.h>
-#include <bprb/bprb_batch_process_manager.h>
-#include <bprb/bprb_func_process.h>
-
-#include "bvpl_octree_processes.h"
-#include <bvpl_octree/bvpl_taylor_scenes_map.h>
-#include <bvpl_octree/bvpl_pca_error_scenes.h>
-#include <bvpl_octree/bvpl_discover_pca_kernels.h>
-#include <bvpl_octree/bvpl_global_pca.h>
-#include <bvpl_octree/bvpl_global_taylor.h>
-#include <bvpl_octree/bvpl_global_corners.h>
-
-void bvpl_octree_register::register_datatype()
-{
- typedef vbl_smart_ptr<bvpl_global_taylor<double, 10> > bvpl_global_taylor_sptr;
-
- REGISTER_DATATYPE(bvpl_taylor_scenes_map_sptr);
- REGISTER_DATATYPE(bvpl_pca_error_scenes_sptr);
- REGISTER_DATATYPE(bvpl_discover_pca_kernels_sptr);
- REGISTER_DATATYPE(bvpl_global_pca_125_sptr);
- REGISTER_DATATYPE(bvpl_global_taylor_sptr);
- REGISTER_DATATYPE(bvpl_global_corners_sptr);
-
-}
-
-void bvpl_octree_register::register_process()
-{
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_scene_vector_operator_process, "bvplSceneVectorOperatorProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_scene_kernel_operator_process, "bvplSceneKernelOperatorProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_block_kernel_operator_process, "bvplBlockKernelOperatorProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_save_vrml_process, "bvplSaveVrmlProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_create_scene_process, "bvplCreateSceneProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_plane_propagate_process, "bvplPlanePropagateProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_nonmax_supp_process, "bvplNonmaxSuppProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_gauss_gradients, "bvplComputeGaussGradients");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_pca_test_error_process, "bvplComputeTestErrorProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_scene_histogram_process, "bvplSceneHistorgramProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_grad_scene_to_bin_process, "bvplGradSceneToBinProcess");
-
- //PCA related
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_discover_pca_features_process, "bvplDiscoverPCAFeaturesProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_pca_error_scene_process, "bvplComputePCAErrorSceneProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_pca_error_block_process, "bvplComputePCAErrorBlockProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_load_pca_error_scenes_process, "bvplLoadPCAErrorSceneProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_block_avg_value_process, "bvplBlockAvgValueProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_add_pca_errors_process, "bvplAddPCAErrorsProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_load_pca_info_process, "bvplLoadPCAInfoProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_pca_project_process, "bvplPCAProjectProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_normalize_pca_training_error_process, "bvplNormalizePCATrainingErrorProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_pca_global_statistics_process, "bvplPCAGlobalStatisticsProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_combine_pairwise_statistics_process, "bvplCombinePairwiseStatisticsProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_global_pca_process, "bvplGlobalPCAProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_init_global_pca_process, "bvplInitGlobalPCAProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_load_global_pca_125_process, "bvplLoadGlobalPCA125Process");
- REG_PROCESS_FUNC_CONS2(bvpl_pca_global_proj_error_process);
- REG_PROCESS_FUNC_CONS2(bvpl_pca_global_add_error_process);
-
- //Taylor related
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_load_taylor_scenes_process, "bvplLoadTaylorScenesProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_taylor_error_process, "bvplComputeTaylorErrorProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_add_taylor_errors_process, "bvplAddTaylorErrorsProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_init_global_taylor_process, "bvplInitGlobalTaylorProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_taylor_coefficients_process, "bvplComputeTaylorCoefficients");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_explore_coefficient_scene_process, "bvplExploreCoefficientSceneProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_load_global_taylor_process, "bvplLoadGlobalTaylorProcess");
- REG_PROCESS_FUNC_CONS2(bvpl_taylor_global_proj_error_process);
- REG_PROCESS_FUNC_CONS2(bvpl_taylor_global_add_error_process);
-
- //Corner related
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_threshold_corners_process, "bvplThresholdCornersProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_harris_measure_process, "bvplComputeHarrisMeasureProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_load_global_corners_process, "bvplLoadGlobalCornersProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_corner_statistics_process, "bvplCornerStatisticsProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_beaudet_measure_process, "bvplComputeBeaudetMeasureProcess");
-
- //Steerable filters
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_init_sf_response_scene_process, "bvplInitSFResponseSceneProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_compute_sf_raw_response_process, "bvplComputeSFRawResponseProcess");
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_register.h b/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_register.h
deleted file mode 100644
index a72acdd9a2..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/bvpl_octree_register.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef bvpl_octree_register_h_
-#define bvpl_octree_register_h_
-
-class bvpl_octree_register
-{
- public:
- static void register_datatype();
- static void register_process();
-};
-
-#endif // bvpl_octree_register_h_
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_block_avg_value_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_block_avg_value_process.cxx
deleted file mode 100644
index 5a37180f2d..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_block_avg_value_process.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-//:
-// \file
-// \brief A process to add taylor error at a percentage of voxels in a block
-// \author Isabel Restrepo
-// \date 15-Feb-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_scene_statistics.h>
-#include <boxm/boxm_scene.h>
-
-//:global variables
-namespace bvpl_block_avg_value_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//:sets input and output types
-bool bvpl_block_avg_value_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_block_avg_value_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "boxm_scene_base_sptr";
- input_types_[i++] = "double"; ////fraction [0,1] of cells used in the computation
- input_types_[i++] = "int" ; //block index in x-dimension
- input_types_[i++] = "int" ; //block index in y-dimension
- input_types_[i++] = "int" ; //block index in z-dimension
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "double";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_block_avg_value_process(bprb_func_process& pro)
-{
- using namespace bvpl_block_avg_value_process_globals;
-
- //get inputs
- unsigned i =0;
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(i++);
- auto fraction_nsamples = pro.get_input<double>(i++);
- int block_i = pro.get_input<int>(i++);
- int block_j = pro.get_input<int>(i++);
- int block_k = pro.get_input<int>(i++);
-
- if (!scene_base){
- std::cerr << "Error in bvpl_block_avg_value_process: Null error scene\n";
- return false;
- }
- auto* scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*> (scene_base.as_pointer());
- if (!scene){
- std::cerr << "Error in bvpl_block_avg_value_process: Error scene is of incorrect type\n";
- return false;
- }
- //sum errors within block
- auto scene_ncells = (double)scene->size();
- scene->load_block(block_i,block_j,block_k);
- auto tree_ncells = (double)scene->get_block(block_i,block_j,block_k)->get_tree()->size();
- double nsamples = scene_ncells * fraction_nsamples;
-
- //number of samples - 10% of total number of leaf-cells
- auto tree_nsamples = (unsigned long)((tree_ncells/scene_ncells)*nsamples);
- std::cout << "Number of samples in the scene " << scene_ncells << '\n'
- << "Adding errors from " << tree_nsamples << " samples in block: " << block_i << ',' << block_j << ',' << block_k << std::endl;
- double avg_value = bvpl_average_value(scene,block_i, block_j, block_k, tree_nsamples);
-
- //store output
- pro.set_output_val<double>(0, avg_value);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_block_kernel_operator_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_block_kernel_operator_process.cxx
deleted file mode 100644
index 0602d6d2ed..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_block_kernel_operator_process.cxx
+++ /dev/null
@@ -1,208 +0,0 @@
-//:
-// \file
-// \brief
-// \author Isabel Restrepo
-// \date 1-Feb-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_block_kernel_operator.h>
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.h>
-#include <bvpl/functors/bvpl_edge_geometric_mean_functor.h>
-#include <bvpl/functors/bvpl_edge_algebraic_mean_functor.h>
-#include <bvpl/functors/bvpl_gauss_convolution_functor.h>
-#include <bvpl/functors/bvpl_positive_gauss_conv_functor.h>
-#include <bvpl/functors/bvpl_algebraic_functor.h>
-
-#include <boxm/boxm_scene.h>
-#include <bsta/bsta_gauss_sf1.h>
-#include <bsta/bsta_attributes.h>
-
-#include <vul/vul_file.h>
-
-namespace bvpl_block_kernel_operator_process_globals
-{
- constexpr unsigned n_inputs_ = 8;
- constexpr unsigned n_outputs_ = 0;
-}
-
-//: process takes 6 inputs and has 1 output.
-// * input[0]: The boxm_scene
-// * input[1]: The kernels; bvpl_kernel_vector_sptr
-// * input[2,3,4]: block index (i,j,k);
-// * input[5]: String identifying functor type
-// * input[6]: Output path to a dir where to store response blocks
-
-
-bool bvpl_block_kernel_operator_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_block_kernel_operator_process_globals;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i=0;
- input_types_[i++] = "boxm_scene_base_sptr";
- input_types_[i++] = "bvpl_kernel_sptr";
- input_types_[i++] = "int";
- input_types_[i++] = "int";
- input_types_[i++] = "int";
- input_types_[i++] = "vcl_string";
- input_types_[i++] = "vcl_string";
- input_types_[i++] = "double";
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool bvpl_block_kernel_operator_process(bprb_func_process& pro)
-{
- using namespace bvpl_block_kernel_operator_process_globals;
-
- if (pro.n_inputs() < n_inputs_)
- {
- std::cerr << pro.name() << ": the input number should be " << n_inputs_
- << " but instead it is " << pro.n_inputs() << '\n';
- return false;
- }
-
- //get inputs:
- unsigned i = 0;
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(i++);
- bvpl_kernel_sptr kernel = pro.get_input<bvpl_kernel_sptr>(i++);
- int block_i = pro.get_input<int>(i++);
- int block_j = pro.get_input<int>(i++);
- int block_k = pro.get_input<int>(i++);
- std::string functor_name = pro.get_input<std::string>(i++);
- std::string output_path = pro.get_input<std::string>(i++);
- auto cell_length = pro.get_input<double>(i++);
- //short level = 0;
-
- //print inputs
- std::cout << "In bvpl_block_kernel_operator:\n"
- << "Index(i,j,k) : (" << block_i << ',' << block_j << ',' << block_k << ")\n"
- << "Functor Name: " << functor_name << '\n'
- << "Output path: " << output_path << '\n'
- << "Cell length" << cell_length << std::endl;
-
- //check input's validity
- if (!scene_base.ptr()) {
- std::cerr << " :-- Grid is not valid!\n";
- return false;
- }
-
- if (!kernel) {
- std::cerr << pro.name() << " :-- Kernel is not valid!\n";
- return false;
- }
-
-
- switch (scene_base->appearence_model())
- {
- case BSTA_GAUSS_F1:
- {
- typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
- typedef boct_tree<short, gauss_type > tree_type;
- auto *scene_in = static_cast<boxm_scene<tree_type>* > (scene_base.as_pointer());
-
-
- //parameters of the output scene are the same as those of the input scene
- boxm_scene<tree_type> *scene_out =
- new boxm_scene<tree_type>(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level());
- scene_out->set_paths(output_path, "gauss_response_scene");
- scene_out->set_appearance_model(BSTA_GAUSS_F1);
- if (!vul_file::exists(output_path + "/gauss_response_scene.xml"))
- scene_out->write_scene("/gauss_response_scene.xml");
-
- //parameters of the output scene are the same as those of the input scene
- boxm_scene<boct_tree<short,bool> > *valid_scene =
- new boxm_scene<boct_tree<short,bool > >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level());
- valid_scene->set_paths(output_path, "valid_scene");
- valid_scene->set_appearance_model(BOXM_BOOL);
- if (!vul_file::exists(output_path + "/valid_scene.xml"))
- valid_scene->write_scene("/valid_scene.xml");
-
- if (functor_name == "gauss_convolution") {
- bvpl_gauss_convolution_functor functor;
- bvpl_block_kernel_operator block_oper;
- //operate on scene
- block_oper.operate(*scene_in, functor, kernel, block_i, block_j, block_k, *scene_out, *valid_scene, cell_length);
- //clean memory
- scene_in->unload_active_blocks();
- scene_out->unload_active_blocks();
-
- return true;
- }
- else if (functor_name == "positive_gauss_convolution") {
- bvpl_positive_gauss_conv_functor functor;
- bvpl_block_kernel_operator block_oper;
- //operate on scene
- block_oper.operate(*scene_in, functor, kernel, block_i, block_j, block_k, *scene_out, *valid_scene, cell_length);
- //clean memory
- scene_in->unload_active_blocks();
- scene_out->unload_active_blocks();
-
- return true;
- }
- else
- return false;
-
- break;
- }
- case BOXM_FLOAT:
- {
- typedef boct_tree<short, float > tree_type;
- auto *scene_in = static_cast<boxm_scene<tree_type>* > (scene_base.as_pointer());
-
- //parameters of the output scene are the same as those of the input scene
- boxm_scene<tree_type> *scene_out =
- new boxm_scene<tree_type>(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level());
- scene_out->set_paths(output_path, "response_scene");
- scene_out->set_appearance_model(BOXM_FLOAT);
- if (!vul_file::exists(output_path + "/float_response_scene.xml"))
- scene_out->write_scene("/float_response_scene.xml");
-
- boxm_scene<boct_tree<short,bool> > *valid_scene =
- new boxm_scene<boct_tree<short,bool> >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level());
- valid_scene->set_paths(output_path, "valid_scene");
- valid_scene->set_appearance_model(BOXM_BOOL);
- if (!vul_file::exists(output_path + "/valid_scene.xml"))
- valid_scene->write_scene("/valid_scene.xml");
-
- if (functor_name == "edge_algebraic_mean")
- {
- bvpl_edge_algebraic_mean_functor<float> functor;
- bvpl_block_kernel_operator block_oper;
- //operate on scene
- block_oper.operate(*scene_in, functor, kernel, block_i, block_j, block_k, *scene_out, *valid_scene, cell_length);
-
- //clean memory
- scene_in->unload_active_blocks();
- scene_out->unload_active_blocks();
- return true;
- }
- else if (functor_name == "algebraic")
- {
- bvpl_algebraic_functor functor;
- bvpl_block_kernel_operator block_oper;
- //operate on scene
- block_oper.operate(*scene_in, functor, kernel, block_i, block_j, block_k, *scene_out, *valid_scene, cell_length);
-
- //clean memory
- scene_in->unload_active_blocks();
- scene_out->unload_active_blocks();
- return true;
- }
- else
- return false;
-
- break;
- }
- default:
- std::cout << "bvpl_block_kernel_operator_process: undefined APM type" << std::endl;
- return false;
- }
- return false;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_compute_gauss_gradients.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_compute_gauss_gradients.cxx
deleted file mode 100644
index 126deb3ac8..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_compute_gauss_gradients.cxx
+++ /dev/null
@@ -1,86 +0,0 @@
-//:
-// \file
-// \brief A process to run derivatives of gaussian in 3 dimensions - x, y, x
-// \author Isabel Restrepo
-// \date 13-Oct-2010
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/kernels/bvpl_gauss3d_x_kernel_factory.h>
-#include <bvpl/kernels/bvpl_create_directions.h>
-#include <bvpl/functors/bvpl_algebraic_functor.h>
-#include <bvpl/bvpl_octree/bvpl_scene_vector_operator.h>
-#include <bvpl/bvpl_octree/bvpl_scene_statistics.h>
-
-
-#include <boxm/boxm_scene.h>
-
-//: global variables
-namespace bvpl_compute_gauss_gradients_globals
-{
- constexpr unsigned n_inputs_ = 2;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//: sets input and output types
-bool bvpl_compute_gauss_gradients_cons(bprb_func_process& pro)
-{
- using namespace bvpl_compute_gauss_gradients_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr"; //input scene
- input_types_[1] = "vcl_string"; //output path
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr"; //output scene
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//: the process
-bool bvpl_compute_gauss_gradients(bprb_func_process& pro)
-{
- using namespace bvpl_compute_gauss_gradients_globals;
-
- //get inputs:
- unsigned i = 0;
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(i++);
- std::string output_path = pro.get_input<std::string>(i++);
-
- //Create the factory and get the vector of kernels
- bvpl_gauss3d_x_kernel_factory factory(1.0f,1.0f,1.0f);
- bvpl_create_directions_xyz dir;
- bvpl_kernel_vector_sptr kernels = factory.create_kernel_vector(dir);
-
- //get scene
- typedef boct_tree<short, float> float_tree_type;
- typedef boct_tree<short, vnl_vector_fixed< float,3 > > grad_tree_type;
-
- if (auto *scene_in = dynamic_cast<boxm_scene< float_tree_type >* >(scene_base.as_pointer()))
- {
- boxm_scene<grad_tree_type> *scene_out =
- new boxm_scene<grad_tree_type>(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level());
- scene_out->set_paths(output_path, "float_gradient_scene");
- scene_out->set_appearance_model(VNL_FLOAT_3);
- scene_out->write_scene("float_gradient_scene.xml");
-
- bvpl_algebraic_functor functor;
- bvpl_scene_vector_operator vector_oper;
- vector_oper.operate(*scene_in, functor, kernels, *scene_out);
- //store output
- boxm_scene_base_sptr scene_ptr=new boxm_scene_base();
- scene_ptr = scene_out;
- pro.set_output_val<boxm_scene_base_sptr>(0, scene_ptr);
-
- bsta_histogram<float> magnitude_hist;
- bvpl_compute_scene_statistics(scene_out, magnitude_hist);
- std::cout << "Histogram:\n" << magnitude_hist << std::endl;
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_create_scene_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_create_scene_process.cxx
deleted file mode 100644
index e175191e55..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_create_scene_process.cxx
+++ /dev/null
@@ -1,88 +0,0 @@
-//This is brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_create_scene_process.cxx
-#include <iostream>
-#include <string>
-#include <boxm/boxm_scene_base.h>
-//:
-// \file
-// \brief A process loading xml parameters of a boxm_scene of types specific to bvpl_octree
-//
-// \author Isabel Restrepo
-// \date Nov 15, 2009
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <boxm/boxm_scene.h>
-#include <boxm/boxm_scene_parser.h>
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.h>
-//:global variables
-namespace bvpl_create_scene_process_globals
-{
- //this process takes no inputs
- constexpr unsigned n_inputs_ = 1;
- constexpr unsigned n_outputs_ = 1;
-}
-
-//:sets input and output types
-bool bvpl_create_scene_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_create_scene_process_globals;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vcl_string";
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-//:creates a scene from parameters
-bool bvpl_create_scene_process(bprb_func_process& pro)
-{
- using namespace bvpl_create_scene_process_globals;
- std::string fname = pro.get_input<std::string>(0);
-
- boxm_scene_parser parser;
-
- boxm_scene_base_sptr scene_ptr=new boxm_scene_base();
- scene_ptr->load_scene(fname, parser);
- if (scene_ptr->appearence_model() == BVPL_SAMPLE_FLOAT) {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short,bvpl_octree_sample<float> > tree_type;
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(parser);
- scene_ptr = scene;
- }
- }
- else if (scene_ptr->appearence_model() == BVPL_SAMPLE_BSTA_GAUSS_F1) {
- if (!scene_ptr->multi_bin())
- {
- typedef boct_tree<short,bvpl_octree_sample<bsta_num_obs<bsta_gauss_sf1> > > tree_type;
- auto* scene = new boxm_scene<tree_type>();
- scene->load_scene(parser);
- scene_ptr = scene;
- }
- }
- else {
- std::cerr << "bvpl_create_scene_process: undefined datatype\n";
- return false;
- }
-
- //store output
- pro.set_output_val<boxm_scene_base_sptr>(0, scene_ptr);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_grad_scene_to_bin_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_grad_scene_to_bin_process.cxx
deleted file mode 100644
index 39195ec048..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_grad_scene_to_bin_process.cxx
+++ /dev/null
@@ -1,136 +0,0 @@
-//:
-// \file
-// \brief A process to save a gradient scene to a flat binary file
-// \author Isabel Restrepo
-// \date 3-Aug-2011
-
-#include <iostream>
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <boxm/boxm_scene.h>
-#include <vnl/vnl_vector_fixed.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-//:global variables
-namespace bvpl_grad_scene_to_bin_process_globals
-{
- constexpr unsigned n_inputs_ = 3;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_grad_scene_to_bin_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_grad_scene_to_bin_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i =0;
- input_types_[i++] = "boxm_scene_base_sptr"; //alpha scene
- input_types_[i++] = "boxm_scene_base_sptr"; //gradient scene
- input_types_[i++] = "vcl_string"; //output binary file
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_grad_scene_to_bin_process(bprb_func_process& pro)
-{
- using namespace bvpl_grad_scene_to_bin_process_globals;
-
- //get inputs
- unsigned i = 0;
- boxm_scene_base_sptr alpha_scene_base = pro.get_input<boxm_scene_base_sptr>(i++);
- boxm_scene_base_sptr grad_scene_base = pro.get_input<boxm_scene_base_sptr>(i++);
- std::string output_file = pro.get_input<std::string>(i++);
-
- //get scene
- typedef boct_tree<short, float> float_tree_type;
- typedef boct_tree<short, vnl_vector_fixed< float,3 > > grad_tree_type;
-
- std::ofstream os(output_file.c_str(), std::ios::out);
-
- if (auto *alpha_scene = dynamic_cast<boxm_scene< float_tree_type >* >(alpha_scene_base.as_pointer()))
- {
- if (auto *grad_scene = dynamic_cast<boxm_scene< grad_tree_type >* >(grad_scene_base.as_pointer()))
- {
- double cell_length = alpha_scene->finest_cell_length();
- short finest_level = alpha_scene->finest_level();
-
- bool read_only = true;
-
- boxm_cell_iterator<float_tree_type > alpha_iter = alpha_scene->cell_iterator(&boxm_scene<float_tree_type >::load_block_and_neighbors, read_only);
- alpha_iter.begin();
-
- boxm_cell_iterator<grad_tree_type > grad_iter = grad_scene->cell_iterator(&boxm_scene<grad_tree_type >::load_block, read_only);
- grad_iter.begin();
-
- long unsigned n_grads = 0;
-
- while ( !(alpha_iter.end() || grad_iter.end()) )
- {
- boct_tree_cell<short, float> *alpha_cell = *alpha_iter;
- boct_tree_cell<short, vnl_vector_fixed< float,3 > > *grad_cell = *grad_iter;
-
- boct_loc_code<short> grad_code = grad_cell->get_code();
- boct_loc_code<short> alpha_code = alpha_cell->get_code();
-
- //if level and location code of cells isn't the same then continue
- if ((alpha_cell->level() != grad_cell->level()) || !(alpha_code.isequal(&grad_code))) {
- std::cerr << " Input and output cells don't have the same structure\n";
- ++alpha_iter;
- ++grad_iter;
- continue;
- }
-
- //we are only interested in finest resolution
- if ((!(alpha_cell->level() == finest_level)) || !alpha_cell->is_leaf()) {
- ++alpha_iter;
- ++grad_iter;
- continue;
- }
-
- vgl_point_3d<double> centroid = alpha_iter.global_centroid();
- vnl_vector_fixed< float,3 > grad = grad_cell->data();
- float p_x = 1.0f - (float)std::exp(- (alpha_cell->data() * cell_length ));
-#if 0
- vsl_b_write(os, (float)centroid.x());
- vsl_b_write(os, (float)centroid.y());
- vsl_b_write(os, (float)centroid.z());
- vsl_b_write(os, grad[0]);
- vsl_b_write(os, grad[1]);
- vsl_b_write(os, grad[2]);
- vsl_b_write(os, p_x);
-#endif
-
- os << (float)centroid.x() << ' '
- << (float)centroid.y() << ' '
- << (float)centroid.z() << ' '
- << grad[0] << ' '
- << grad[1] << ' '
- << grad[2] << ' '
- << p_x << '\n';
-
- ++alpha_iter;
- ++grad_iter;
- n_grads++;
- }
-
- grad_scene->unload_active_blocks();
- alpha_scene->unload_active_blocks();
- os.close();
- std::cout << "Wrote " << n_grads << " gradients\n";
- }
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_nonmax_supp_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_nonmax_supp_process.cxx
deleted file mode 100644
index b53398692b..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_nonmax_supp_process.cxx
+++ /dev/null
@@ -1,178 +0,0 @@
-//This is brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_nonmax_supp_process.cxx
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A process for spreading the plane information of the cell to the neighbors
-// \author Gamze Tunali
-// \date Mar 19, 2010
-//
-// \verbatim
-// Modifications
-//
-// \endverbatim
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <brdb/brdb_value.h>
-#include <bprb/bprb_parameters.h>
-
-#include <boct/boct_tree.h>
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-
-#include <boxm/sample/boxm_inf_line_sample.h>
-
-#include <bvpl/bvpl_neighb_operator.h>
-#include <bvpl/kernels/bvpl_kernel_iterator.h>
-#include <bvpl/kernels/bvpl_kernel.h>
-#include <bvpl/bvpl_octree/bvpl_octree_neighbors.h>
-
-namespace bvpl_nonmax_supp_process_globals
-{
- constexpr unsigned int n_inputs_ = 4;
- constexpr unsigned int n_outputs_ = 1;
- //Define parameters here
-}
-
-
-//: set input and output types
-bool bvpl_nonmax_supp_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_nonmax_supp_process_globals;
-
- // process takes 4 inputs:
- //input[0]: The scene
- //input[1]: the scene path for the output scene
- //input[2]: block prefix for the output scene
- //input[3]: the filename for the new scene xml file
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vcl_string";
- input_types_[2] = "vcl_string";
- input_types_[3] = "vcl_string";
-
- // process has 1 output:
- // output[0]: the new scene with updated cell information
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr";
-
- if (!pro.set_input_types(input_types_))
- return false;
-
- if (!pro.set_output_types(output_types_))
- return false;
-
- return true;
-}
-
-//: Execute the process
-bool bvpl_nonmax_supp_process(bprb_func_process& pro)
-{
- using namespace bvpl_nonmax_supp_process_globals;
-
-
- // check number of inputs
- if (pro.n_inputs() != n_inputs_)
- {
- std::cout << pro.name() << "The number of inputs should be " << n_inputs_ << std::endl;
- return false;
- }
-
- // get the inputs
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(0);
- std::string scene_path = pro.get_input<std::string>(1);
- std::string block_prefix = pro.get_input<std::string>(2);
- std::string scene_filename = pro.get_input<std::string>(3);
- boxm_scene_base_sptr output_scene_sptr;
-
- // only applies to the edge_line type of scenes
- if (scene_base->appearence_model() == BOXM_EDGE_LINE) {
- typedef boct_tree<short,boxm_inf_line_sample<float> > tree_type;
- typedef boct_tree_cell<short,boxm_inf_line_sample<float> > cell_type;
- auto *scene=dynamic_cast<boxm_scene<tree_type>*>(scene_base.ptr());
- if (!scene) {
- std::cerr << "error casting scene_base to scene\n";
- return false;
- }
-
- auto *output_scene=new boxm_scene<tree_type>(*scene);
- output_scene->set_paths(scene_path, block_prefix);
- output_scene_sptr = output_scene;
-
- // create a kernel for 3x3 neighborhood
- bvpl_kernel_iterator k_iter;
- vgl_point_3d<int> min_pt(-1,-1,-1);
- vgl_point_3d<int> max_pt(1,1,1);
- for (int i=min_pt.x(); i<=max_pt.x(); i++) {
- for (int j=min_pt.y(); j<=max_pt.y(); j++) {
- for (int k=min_pt.z(); k<=max_pt.z(); k++) {
- k_iter.insert(vgl_point_3d<int>(i,j,k),bvpl_kernel_dispatch(1.0f));
- }
- }
- }
- bvpl_kernel_sptr kernel= new bvpl_kernel(k_iter, vnl_float_3(0,0,1), vnl_float_3(0,1,0), 0.0f, vgl_vector_3d<int>(3,3,3),min_pt,max_pt);
-
- boxm_block_iterator<tree_type> iter(scene);
- boxm_block_iterator<tree_type> output_iter(output_scene);
- iter.begin();
- output_iter.begin();
-
- while (!iter.end())
- {
- scene->load_block(iter.index());
- output_scene->load_block(iter.index());
- boxm_block<tree_type>* block = *iter;
- boxm_block<tree_type>* output_block = *output_iter;
-
- tree_type* tree = block->get_tree();
- std::vector<cell_type *> cells = tree->leaf_cells();
-
- tree_type* output_tree=tree->clone();
- std::vector<cell_type *> output_cells = output_tree->leaf_cells();
-
- bvpl_octree_neighbors<boxm_inf_line_sample<float> > oper(tree);
- for (unsigned i=0; i<cells.size(); i++) {
- cell_type *cell=cells[i];
- cell_type *output_cell=output_cells[i];
- std::vector<cell_type *> neighb_cells;
- oper.neighbors(kernel, cells[i], neighb_cells);
-
- float residual = cell->data().residual_;
-
- bool min=true;
- for (unsigned n=0; n<neighb_cells.size()&& min; n++) {
- cell_type *neighbor = neighb_cells[n];
- boct_loc_code<short> cell_code=cell->code_;
- boct_loc_code<short> n_code = neighbor->code_;
- bool itself = n_code.isequal(&cell_code);
- // do not include itself in the list
- if (!itself) {
- float r = neighbor->data().residual_;
- if ( r < residual)
- min=false;
- }
-
- if (min) {
- boxm_inf_line_sample<float> data = cell->data();
- output_cell->set_data(data);
- }
- }
- }
- output_block->delete_tree();
- output_block->set_tree(output_tree);
- output_scene->write_active_block();
- iter++;
- }
- output_scene->write_scene(scene_filename);
- }
-
- //store output
- pro.set_output_val<boxm_scene_base_sptr>(0, output_scene_sptr);
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_plane_propagate_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_plane_propagate_process.cxx
deleted file mode 100644
index 2c503cdbf2..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_plane_propagate_process.cxx
+++ /dev/null
@@ -1,209 +0,0 @@
-//This is brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_plane_propagate_process.cxx
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <set>
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A process for spreading the plane information of the cell to the neighbors
-// \author Gamze Tunali
-// \date Mar 19, 2010
-//
-// \verbatim
-// Modifications
-//
-// \endverbatim
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-#include <brdb/brdb_value.h>
-#include <bprb/bprb_parameters.h>
-
-#include <boct/boct_tree.h>
-
-#include <boxm/boxm_scene_base.h>
-#include <boxm/boxm_scene.h>
-
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-
-#include <bvpl/bvpl_neighb_operator.h>
-#include <bvpl/kernels/bvpl_kernel_iterator.h>
-#include <bvpl/kernels/bvpl_kernel.h>
-#include <bvpl/bvpl_octree/bvpl_octree_neighbors.h>
-
-struct ltstr
-{
- bool operator()(const boxm_plane_obs<float> & p1, const boxm_plane_obs<float> & p2) const
- {
- if(p1.plane_.a()<p2.plane_.a())
- return true;
- else if(p1.plane_.a()>p2.plane_.a())
- return false;
- else
- {
- if(p1.plane_.b()<p2.plane_.b())
- return true;
- else if(p1.plane_.b()>p2.plane_.b())
- return false;
- else
- {
- if(p1.plane_.c()<p2.plane_.c())
- return true;
- else if(p1.plane_.c()>p2.plane_.c())
- return false;
- else
- {
- if(p1.plane_.d()<p2.plane_.d())
- return true;
- else
- return false;
- }
- }
- }
- }
-};
-
-namespace bvpl_plane_propagate_process_globals
-{
- constexpr unsigned int n_inputs_ = 4;
- constexpr unsigned int n_outputs_ = 1;
- //Define parameters here
-}
-
-
-//: set input and output types
-bool bvpl_plane_propagate_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_plane_propagate_process_globals;
-
- // process takes 4 inputs:
- //input[0]: The scene
- //input[1]: the scene path for the output scene
- //input[2]: block prefix for the output scene
- //input[3]: the filename for the new scene xml file
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vcl_string";
- input_types_[2] = "vcl_string";
- input_types_[3] = "vcl_string";
-
- // process has 1 output:
- // output[0]: the new scene with updated cell information
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr";
-
- if (!pro.set_input_types(input_types_))
- return false;
-
- if (!pro.set_output_types(output_types_))
- return false;
-
- return true;
-}
-
-//: Execute the process
-bool bvpl_plane_propagate_process(bprb_func_process& pro)
-{
- using namespace bvpl_plane_propagate_process_globals;
-
-
- // check number of inputs
- if (pro.n_inputs() != n_inputs_)
- {
- std::cout << pro.name() << "The number of inputs should be " << n_inputs_ << std::endl;
- return false;
- }
-
- // get the inputs
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(0);
- std::string scene_path = pro.get_input<std::string>(1);
- std::string block_prefix = pro.get_input<std::string>(2);
- std::string scene_filename = pro.get_input<std::string>(3);
- boxm_scene_base_sptr output_scene_sptr;
- // only applies to the edge_line type of scenes
- if (scene_base->appearence_model() == BOXM_EDGE_TANGENT_LINE) {
- typedef boct_tree<short,boxm_edge_tangent_sample<float> > tree_type;
- typedef boct_tree_cell<short,boxm_edge_tangent_sample<float> > cell_type;
- auto *scene=dynamic_cast<boxm_scene<tree_type>*>(scene_base.ptr());
- if (!scene) {
- std::cerr << "error casting scene_base to scene\n";
- return false;
- }
-
- auto *output_scene=new boxm_scene<tree_type>(*scene);
- output_scene->set_paths(scene_path, block_prefix);
- output_scene_sptr = output_scene;
- // create a kernel for 3x3 neighborhood
- bvpl_kernel_iterator k_iter;
- vgl_point_3d<int> min_pt(-1,-1,-1);
- vgl_point_3d<int> max_pt(1,1,1);
- for (int i=min_pt.x(); i<=max_pt.x(); i++) {
- for (int j=min_pt.y(); j<=max_pt.y(); j++) {
- for (int k=min_pt.z(); k<=max_pt.z(); k++) {
- k_iter.insert(vgl_point_3d<int>(i,j,k),bvpl_kernel_dispatch(1.0f));
- }
- }
- }
- bvpl_kernel_sptr kernel= new bvpl_kernel(k_iter, vnl_float_3(0,0,1), vnl_float_3(0,1,0), 0.0f, vgl_vector_3d<int>(3,3,3),min_pt,max_pt);
-
- boxm_block_iterator<tree_type> iter(scene);
- boxm_block_iterator<tree_type> output_iter(output_scene);
- iter.begin();
- output_iter.begin();
-
- while (!iter.end())
- {
- scene->load_block(iter.index());
- output_scene->load_block(iter.index());
- boxm_block<tree_type>* block = *iter;
- boxm_block<tree_type>* output_block = *output_iter;
-
- tree_type* tree = block->get_tree();
- std::vector<cell_type *> cells = tree->leaf_cells();
-
- tree_type* output_tree=tree->clone();
- std::vector<cell_type *> output_cells = output_tree->leaf_cells();
-
- bvpl_octree_neighbors<boxm_edge_tangent_sample<float> > oper(tree);
- for (unsigned i=0; i<cells.size(); i++) {
- cell_type *cell=cells[i];
- cell_type *output_cell=output_cells[i];
- std::vector<cell_type *> neighb_cells;
- oper.neighbors(kernel, cells[i], neighb_cells);
- std::set<boxm_plane_obs<float>,ltstr> planes;
-
- for (auto neighbor : neighb_cells) {
- boct_loc_code<short> cell_code=cell->code_;
- boct_loc_code<short> n_code = neighbor->code_;
- bool itself = n_code.isequal(&cell_code);
- if (!itself) {
- std::vector<boxm_plane_obs<float> > observations = neighbor->data().obs_list();
- boxm_edge_tangent_sample<float> data=output_cell->data();
- data.insert(observations);
- output_cell->set_data(data);
- }
- }
- }
- // std::set<boxm_plane_obs<float>,ltstr >::iterator iter1=planes.begin();
- // boxm_edge_tangent_sample<float> data;
- // for(;iter1!=planes.end();iter1++)
- // {
- // data.insert(*iter1);
- // }
- // output_cell->set_data(data);
- //}
- output_block->delete_tree();
- output_block->set_tree(output_tree);
- output_scene->write_active_block();
- iter++;
- }
- output_scene->write_scene(scene_filename);
- }
-
- //store output
- pro.set_output_val<boxm_scene_base_sptr>(0, output_scene_sptr);
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_save_vrml_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_save_vrml_process.cxx
deleted file mode 100644
index 5adb8cc4ec..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_save_vrml_process.cxx
+++ /dev/null
@@ -1,89 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_save_vrml_process.cxx
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief process saves a boxm_scene of kernel responses to a vrml file
-//
-// \author Isabel Restrepo
-// \date December 10, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bvpl/bvpl_octree/bvpl_octree_vrml_util.h>
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.h>
-#include <bvpl/kernels/bvpl_kernel.h>
-
-#include <bprb/bprb_parameters.h>
-#include <brdb/brdb_value.h>
-
-
-namespace bvpl_save_vrml_process_globals
-{
- constexpr unsigned n_inputs_ = 3;
- constexpr unsigned n_outputs_ = 0;
-}
-
-//: process takes 3 inputs and has no outputs.
-// input[0]: The scene
-// input[1]: The vector of kernels
-// input[2]: Path to output vrml file
-// No outputs
-
-bool bvpl_save_vrml_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_save_vrml_process_globals;
-
- //process takes 3 inputs but has no outputs
- std::vector<std::string> output_types_(n_outputs_);
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "bvpl_kernel_vector_sptr";
- input_types_[2] = "vcl_string";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool bvpl_save_vrml_process(bprb_func_process& pro)
-{
- using namespace bvpl_save_vrml_process_globals;
-
- if (pro.n_inputs() != n_inputs_)
- {
- std::cout << pro.name() << ": the input number should be " << n_inputs_
- << " but instead it is " << pro.n_inputs() << std::endl;
- return false;
- }
-
- //get inputs:
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(0);
- bvpl_kernel_vector_sptr kernel_vector = pro.get_input<bvpl_kernel_vector_sptr>(1);
- std::string vrml_path = pro.get_input<std::string>(2);
-
- //check input's validity
- if (!scene_base.ptr()) {
- std::cout << " :-- Grid is not valid!\n";
- return false;
- }
-
- //:Note initial implementation is for fixed types, but this can be changed if more cases are needed
-
- std::ofstream ofs(vrml_path.c_str());
-
- if (auto *scene_in =
- dynamic_cast<boxm_scene<boct_tree<short, bvpl_octree_sample<float> > >* > (scene_base.as_pointer()))
- {
- bvpl_octree_vrml_util::write_scene_as_disks(ofs, scene_in, kernel_vector);
- }
- else if (auto *scene_in =
- dynamic_cast<boxm_scene<boct_tree<short, bvpl_octree_sample<bsta_num_obs<bsta_gauss_sf1> > > >* >(scene_base.as_pointer()))
- {
- bvpl_octree_vrml_util::write_scene_as_disks(ofs, scene_in, kernel_vector);
- }
- else {
- std::cerr << "In bvpl_save_vrml_process: Unsupported scene type\n";
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_histogram_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_histogram_process.cxx
deleted file mode 100644
index f3d93180ba..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_histogram_process.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-//:
-// \file
-// \brief Process to explore the histogram of a scene
-// \author Isabel Restrepo
-// \date 18-Feb-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_scene_statistics.h>
-
-//:global variables
-namespace bvpl_scene_histogram_process_globals
-{
- constexpr unsigned n_inputs_ = 1;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_scene_histogram_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_scene_histogram_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_scene_histogram_process(bprb_func_process& pro)
-{
- using namespace bvpl_scene_histogram_process_globals;
-
- //get inputs
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(0);
-
- if (!scene_base){
- std::cerr << "Null scene\n";
- return false;
- }
-
- switch (scene_base->appearence_model())
- {
- case BOXM_FLOAT:
- {
- typedef boct_tree<short, float > tree_type;
- auto *scene_in = static_cast<boxm_scene<tree_type>* > (scene_base.as_pointer());
- bsta_histogram<float> hist;
- bvpl_compute_scene_statistics(scene_in, hist);
- hist.pretty_print();
- break;
- }
- default:
- std::cout << "bvpl_block_kernel_operator_process: undefined APM type" << std::endl;
- return false;
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_kernel_operator_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_kernel_operator_process.cxx
deleted file mode 100644
index 9d7c20ba2c..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_kernel_operator_process.cxx
+++ /dev/null
@@ -1,179 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_kernel_operator_process.cxx
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A class for running a kernel to a boxm_scene
-// \author Isabel Restrepo
-// \date January 29, 2010
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bvpl/bvpl_octree/bvpl_scene_kernel_operator.h>
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.h>
-#include <bvpl/functors/bvpl_edge_geometric_mean_functor.h>
-#include <bvpl/functors/bvpl_edge_algebraic_mean_functor.h>
-#include <bvpl/functors/bvpl_gauss_convolution_functor.h>
-#include <bvpl/functors/bvpl_positive_gauss_conv_functor.h>
-#include <bvpl/functors/bvpl_algebraic_functor.h>
-
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <boxm/boxm_scene.h>
-
-#include <bsta/bsta_gauss_sf1.h>
-#include <bsta/bsta_attributes.h>
-
-namespace bvpl_scene_kernel_operator_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 1;
-}
-
-//: process takes 5 inputs and has 1 output.
-// * input[0]: The boxm_scene
-// * input[1]: The kernel
-// * input[2]: The grid type:
-// - float
-// - opinion
-// - ...
-// * input[3]: String identifying functor type
-// * input[4]: Output path to a dir where to store, id octree and response octree
-//
-// * output[0]: Output scene with response and kernel id
-
-bool bvpl_scene_kernel_operator_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_scene_kernel_operator_process_globals;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "bvpl_kernel_sptr";
- input_types_[2] = "vcl_string";
- input_types_[3] = "vcl_string";
- input_types_[4] = "vcl_string";
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool bvpl_scene_kernel_operator_process(bprb_func_process& pro)
-{
- using namespace bvpl_scene_kernel_operator_process_globals;
-
- if (pro.n_inputs() < n_inputs_)
- {
- std::cerr << pro.name() << ": the input number should be " << n_inputs_
- << " but instead it is " << pro.n_inputs() << '\n';
- return false;
- }
-
- //get inputs:
- unsigned i = 0;
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(i++);
- bvpl_kernel_sptr kernel = pro.get_input<bvpl_kernel_sptr>(i++);
- std::string datatype = pro.get_input<std::string>(i++);
- std::string functor_name = pro.get_input<std::string>(i++);
- std::string output_path = pro.get_input<std::string>(i++);
- //short level = 0;
-
- //print inputs
- std::cout << "In bvpl_scene_kernel_operator:\n"
- << "Datatype: " << datatype << std::endl
- << "Functor Name: " << functor_name << std::endl;
-
- //check input's validity
- if (!scene_base.ptr()) {
- std::cerr << " :-- Grid is not valid!\n";
- return false;
- }
-
- if ( !kernel ) {
- std::cerr << pro.name() << " :-- Kernel is not valid!\n";
- return false;
- }
-
- boxm_scene_base_sptr scene_ptr=new boxm_scene_base();
-
- if (datatype == "bsta_gauss_f1")
- {
- typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
- typedef boct_tree<short, gauss_type > tree_type;
- auto *scene_in = static_cast<boxm_scene<tree_type>* > (scene_base.as_pointer());
- double finest_cell_length = scene_in->finest_cell_length();
- kernel->set_voxel_length(finest_cell_length);
-
- //parameters of the output scene are the same as those of the input scene
- boxm_scene<tree_type> *scene_out =
- new boxm_scene<tree_type>(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level());
- scene_out->set_paths(output_path, "gauss_response_scene");
- scene_out->set_appearance_model(BSTA_GAUSS_F1);
- scene_out->write_scene("/gauss_response_scene.xml");
-
- if (functor_name == "gauss_convolution") {
- bvpl_gauss_convolution_functor functor;
- bvpl_scene_kernel_operator scene_oper;
- //operate on scene
- scene_oper.operate(*scene_in, functor, kernel, *scene_out);
- scene_ptr = scene_out;
- pro.set_output_val<boxm_scene_base_sptr>(0, scene_ptr);
- return true;
- }
- else if (functor_name == "positive_gauss_convolution") {
- bvpl_positive_gauss_conv_functor functor;
- bvpl_scene_kernel_operator scene_oper;
- //operate on scene
- scene_oper.operate(*scene_in, functor, kernel, *scene_out);
- scene_ptr = scene_out;
- pro.set_output_val<boxm_scene_base_sptr>(0, scene_ptr);
-
- //clean memory
- scene_in->unload_active_blocks();
- scene_out->unload_active_blocks();
-
- return true;
- }
- return false;
- }
- else if (datatype == "float")
- {
- typedef boct_tree<short, float > tree_type;
- auto *scene_in = static_cast<boxm_scene<tree_type>* > (scene_base.as_pointer());
- double finest_cell_length = scene_in->finest_cell_length();
- kernel->set_voxel_length(finest_cell_length);
- //parameters of the output scene are the same as those of the input scene
- boxm_scene<tree_type> *scene_out =
- new boxm_scene<tree_type>(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level());
- scene_out->set_paths(output_path, "response_scene");
- scene_out->set_appearance_model(BOXM_FLOAT);
- scene_out->write_scene("/float_response_scene.xml");
-
- if (functor_name == "edge_algebraic_mean") {
- bvpl_edge_algebraic_mean_functor<float> functor;
- bvpl_scene_kernel_operator scene_oper;
- //operate on scene
- scene_oper.operate(*scene_in, functor, kernel, *scene_out);
- scene_ptr = scene_out;
- pro.set_output_val<boxm_scene_base_sptr>(0, scene_ptr);
- return true;
- }
- else if (functor_name == "algebraic") {
- bvpl_algebraic_functor functor;
- bvpl_scene_kernel_operator scene_oper;
- //operate on scene
- scene_oper.operate(*scene_in, functor, kernel, *scene_out);
- scene_ptr = scene_out;
- pro.set_output_val<boxm_scene_base_sptr>(0, scene_ptr);
- return true;
- }
- else
- return false;
- }
- else
- return false;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_vector_operator_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_vector_operator_process.cxx
deleted file mode 100644
index 74762468c1..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_vector_operator_process.cxx
+++ /dev/null
@@ -1,151 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/pro/processes/bvpl_scene_vector_operator_process.cxx
-#include <bprb/bprb_func_process.h>
-//:
-// \file
-// \brief A class for successively running a kernel(of a vector), applying non-max suppression and combining with previous result
-// \author Isabel Restrepo
-// \date December 2, 2009
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bvpl/bvpl_octree/bvpl_scene_vector_operator.h>
-#include <bvpl/bvpl_octree/bvpl_octree_vector_operator_impl.h>
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.h>
-#include <bvpl/kernels/bvpl_kernel_factory.h>
-#include <bvpl/functors/bvpl_edge_geometric_mean_functor.h>
-#include <bvpl/functors/bvpl_gauss_convolution_functor.h>
-#include <bprb/bprb_parameters.h>
-#include <brdb/brdb_value.h>
-
-#include <boxm/boxm_scene.h>
-#include <bsta/bsta_gauss_sf1.h>
-#include <bsta/bsta_attributes.h>
-
-namespace bvpl_scene_vector_operator_process_globals
-{
- constexpr unsigned n_inputs_ = 6;
- constexpr unsigned n_outputs_ = 1;
-}
-
-//: process takes 6 inputs and has 1 output.
-// * input[0]: The boxm_scene
-// * input[1]: The kernels; bvpl_kernel_vector_sptr
-// * input[2]: The grid type:
-// - float
-// - opinion
-// - ...
-// * input[3]: String identifying octree_vector_operator (e.g. max)
-// * input[4]: String identifying functor type
-// * input[5]: Output path to a dir where to store, id octree and response octree
-//
-// * output[0]: Output scene with response and kernel id
-
-
-bool bvpl_scene_vector_operator_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_scene_vector_operator_process_globals;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "bvpl_kernel_vector_sptr";
- input_types_[2] = "vcl_string";
- input_types_[3] = "vcl_string";
- input_types_[4] = "vcl_string";
- input_types_[5] = "vcl_string";
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool bvpl_scene_vector_operator_process(bprb_func_process& pro)
-{
- using namespace bvpl_scene_vector_operator_process_globals;
-
- if (pro.n_inputs() < n_inputs_)
- {
- std::cout << pro.name() << ": the input number should be " << n_inputs_
- << " but instead it is " << pro.n_inputs() << std::endl;
- return false;
- }
-
- //get inputs:
- unsigned i = 0;
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(i++);
- bvpl_kernel_vector_sptr kernel_vec = pro.get_input<bvpl_kernel_vector_sptr>(i++);
- std::string datatype = pro.get_input<std::string>(i++);
- std::string operator_name = pro.get_input<std::string>(i++);
- std::string functor_name = pro.get_input<std::string>(i++);
- std::string output_path = pro.get_input<std::string>(i++);
-
- //check input's validity
- if (!scene_base.ptr()) {
- std::cout << " :-- Grid is not valid!\n";
- return false;
- }
-
- if ( !kernel_vec ) {
- std::cout << pro.name() << " :-- Kernel is not valid!\n";
- return false;
- }
-
- boxm_scene_base_sptr scene_ptr=new boxm_scene_base();
-
- if (datatype == "float")
- {
- typedef boct_tree<short, float > tree_type;
- auto *scene_in = static_cast<boxm_scene<tree_type>* > (scene_base.as_pointer());
-
- //parameters of the output scene are the same as thos of the input scene
- boxm_scene<boct_tree<short, bvpl_octree_sample<float> > > *scene_out =
- new boxm_scene<boct_tree<short, bvpl_octree_sample<float> > >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim());
- scene_out->set_paths(output_path, "response_scene");
- scene_out->set_appearance_model(BVPL_SAMPLE_FLOAT);
- scene_out->write_scene("/response_scene.xml");
- if (operator_name == "max_vector_operator")
- {
- bvpl_max_vector_operator<float> max_oper;
-
- if (functor_name == "edge_geometric_mean") {
- bvpl_edge_geometric_mean_functor<float> functor;
- bvpl_scene_vector_operator scene_oper;
- scene_oper.operate(*scene_in, functor, kernel_vec, *scene_out);
- scene_ptr = scene_out;
- pro.set_output_val<boxm_scene_base_sptr>(0, scene_ptr);
- return true;
- }
- }
- }
- if (datatype == "bsta_gauss_f1")
- {
- typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
- typedef boct_tree<short, gauss_type > tree_type;
- auto *scene_in = static_cast<boxm_scene<tree_type>* > (scene_base.as_pointer());
-
- //parameters of the output scene are the same as thos of the input scene
- boxm_scene<boct_tree<short, bvpl_octree_sample<gauss_type> > > *scene_out =
- new boxm_scene<boct_tree<short, bvpl_octree_sample<gauss_type> > >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim());
- scene_out->set_paths(output_path, "response_scene");
- scene_out->set_appearance_model(BVPL_SAMPLE_BSTA_GAUSS_F1);
- scene_out->write_scene("/response_scene.xml");
- if (operator_name == "max_vector_operator")
- {
- bvpl_max_vector_operator<gauss_type> max_oper;
-
- if (functor_name == "gauss_convolution") {
- bvpl_gauss_convolution_functor functor;
- bvpl_scene_vector_operator scene_oper;
- scene_oper.operate(*scene_in, functor, kernel_vec, *scene_out);
- scene_ptr = scene_out;
- pro.set_output_val<boxm_scene_base_sptr>(0, scene_ptr);
- return true;
- }
- }
- return false;
- }
- else
- return false;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_compute_beaudet_measure_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_compute_beaudet_measure_process.cxx
deleted file mode 100644
index 93af3679c8..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_compute_beaudet_measure_process.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-//:
-// \file
-// \brief A process to compute corner measure (beaudet)
-// \author Isabel Restrepo
-// \date 27-Jul-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_global_corners.h>
-
-//:global variables
-namespace bvpl_compute_beaudet_measure_process_globals
-{
- constexpr unsigned n_inputs_ = 6;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_compute_beaudet_measure_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_compute_beaudet_measure_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "bvpl_global_taylor_sptr" ;
- input_types_[i++] = "bvpl_global_corners_sptr" ;
- input_types_[i++] = "int"; //scene id
- input_types_[i++] = "int"; //block Indices
- input_types_[i++] = "int";
- input_types_[i++] = "int";
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_compute_beaudet_measure_process(bprb_func_process& pro)
-{
- using namespace bvpl_compute_beaudet_measure_process_globals;
-
- typedef vbl_smart_ptr<bvpl_global_taylor<double, 10> > bvpl_global_taylor_sptr;
-
- //get inputs
- unsigned i = 0;
- bvpl_global_taylor_sptr global_taylor = pro.get_input<bvpl_global_taylor_sptr>(i++);
- bvpl_global_corners_sptr global_corners = pro.get_input<bvpl_global_corners_sptr>(i++);
- int scene_id = pro.get_input<int>(i++);
- int block_i = pro.get_input<int>(i++);
- int block_j = pro.get_input<int>(i++);
- int block_k = pro.get_input<int>(i++);
-
- if (!(global_taylor && global_corners))
- return false;
-
- global_corners->compute_beaudet_corners(global_taylor, scene_id, block_i, block_j, block_k);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_compute_harris_measure_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_compute_harris_measure_process.cxx
deleted file mode 100644
index 94d872196d..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_compute_harris_measure_process.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-//:
-// \file
-// \brief A process to compute corner measure (Harris)
-// \author Isabel Restrepo
-// \date 20-Jul-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_global_corners.h>
-
-//:global variables
-namespace bvpl_compute_harris_measure_process_globals
-{
- constexpr unsigned n_inputs_ = 6;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_compute_harris_measure_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_compute_harris_measure_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "bvpl_global_taylor_sptr" ;
- input_types_[i++] = "bvpl_global_corners_sptr" ;
- input_types_[i++] = "int"; //scene id
- input_types_[i++] = "int"; //block Indices
- input_types_[i++] = "int";
- input_types_[i++] = "int";
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_compute_harris_measure_process(bprb_func_process& pro)
-{
- using namespace bvpl_compute_harris_measure_process_globals;
-
- //get inputs
- unsigned i = 0;
- typedef vbl_smart_ptr<bvpl_global_taylor<double, 10> > bvpl_global_taylor_sptr;
-
- bvpl_global_taylor_sptr global_taylor = pro.get_input<bvpl_global_taylor_sptr>(i++);
- bvpl_global_corners_sptr global_corners = pro.get_input<bvpl_global_corners_sptr>(i++);
- int scene_id = pro.get_input<int>(i++);
- int block_i = pro.get_input<int>(i++);
- int block_j = pro.get_input<int>(i++);
- int block_k = pro.get_input<int>(i++);
-
-
- if (!(global_taylor && global_corners))
- return false;
-
- global_corners->compute_laptev_corners(global_taylor, scene_id, block_i, block_j, block_k);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_corner_statistics_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_corner_statistics_process.cxx
deleted file mode 100644
index 16f6bd1cd0..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_corner_statistics_process.cxx
+++ /dev/null
@@ -1,57 +0,0 @@
-//:
-// \file
-// \brief A process to compute corner measure (Harris)
-// \author Isabel Restrepo
-// \date 20-Jul-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_global_corners.h>
-
-//:global variables
-namespace bvpl_corner_statistics_process_globals
-{
- constexpr unsigned n_inputs_ = 3;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_corner_statistics_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_corner_statistics_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "bvpl_global_taylor_sptr" ;
- input_types_[i++] = "bvpl_global_corners_sptr" ;
- input_types_[i++] = "int"; //scene id
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_corner_statistics_process(bprb_func_process& pro)
-{
- using namespace bvpl_corner_statistics_process_globals;
- typedef vbl_smart_ptr<bvpl_global_taylor<double, 10> > bvpl_global_taylor_sptr;
-
- //get inputs
- unsigned i = 0;
- bvpl_global_taylor_sptr global_taylor = pro.get_input<bvpl_global_taylor_sptr>(i++);
- bvpl_global_corners_sptr global_corners = pro.get_input<bvpl_global_corners_sptr>(i++);
- int scene_id = pro.get_input<int>(i++);
-
- if (!(global_taylor && global_corners))
- return false;
-
- global_corners->explore_corner_statistics(global_taylor, scene_id);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_load_global_corners_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_load_global_corners_process.cxx
deleted file mode 100644
index 9c003728ca..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_load_global_corners_process.cxx
+++ /dev/null
@@ -1,50 +0,0 @@
-//:
-// \file
-// \brief
-// \author Isabel Restrepo
-// \date 21-Jul-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl_octree/bvpl_global_corners.h>
-
-//: global variables
-namespace bvpl_load_global_corners_process_globals
-{
- constexpr unsigned n_inputs_ = 1;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//: sets input and output types
-bool bvpl_load_global_corners_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_load_global_corners_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vcl_string";
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "bvpl_global_corners_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//: the process
-bool bvpl_load_global_corners_process(bprb_func_process& pro)
-{
- using namespace bvpl_load_global_corners_process_globals;
-
- // get inputs
- std::string corners_file = pro.get_input<std::string>(0);
- auto *global_corners = new bvpl_global_corners(corners_file);
-
- // store output
- pro.set_output_val<bvpl_global_corners_sptr>(0, global_corners);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_threshold_corners_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_threshold_corners_process.cxx
deleted file mode 100644
index af283e13ec..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/corners/bvpl_threshold_corners_process.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-//:
-// \file
-// \brief A process to compute corner measure (Harris)
-// \author Isabel Restrepo
-// \date 20-Jul-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_global_corners.h>
-
-//:global variables
-namespace bvpl_threshold_corners_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_threshold_corners_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_threshold_corners_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "bvpl_global_taylor_sptr" ;
- input_types_[i++] = "bvpl_global_corners_sptr" ;
- input_types_[i++] = "int"; //scene id
- input_types_[i++] = "float"; //threshold
- input_types_[i++] = "vcl_string"; //output path for thresholded scenes
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_threshold_corners_process(bprb_func_process& pro)
-{
- using namespace bvpl_threshold_corners_process_globals;
- typedef vbl_smart_ptr<bvpl_global_taylor<double, 10> > bvpl_global_taylor_sptr;
-
- //get inputs
- unsigned i = 0;
- bvpl_global_taylor_sptr global_taylor = pro.get_input<bvpl_global_taylor_sptr>(i++);
- bvpl_global_corners_sptr global_corners = pro.get_input<bvpl_global_corners_sptr>(i++);
- int scene_id = pro.get_input<int>(i++);
- auto corner_thresh = pro.get_input<float>(i++);
- std::string output_path = pro.get_input<std::string>(i++);
-
- if (!(global_taylor && global_corners))
- return false;
-
- global_corners->threshold_laptev_corners(global_taylor, scene_id, corner_thresh, output_path);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_add_pca_errors_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_add_pca_errors_process.cxx
deleted file mode 100644
index c4eebb2560..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_add_pca_errors_process.cxx
+++ /dev/null
@@ -1,94 +0,0 @@
-//:
-// \file
-// \brief A process to add Taylor error at a percentage of voxels in a block
-// \author Isabel Restrepo
-// \date 15-Feb-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_pca_error_scenes.h>
-#include <bvpl/bvpl_octree/bvpl_scene_statistics.h>
-
-#include <boxm/boxm_scene.h>
-
-//:global variables
-namespace bvpl_add_pca_errors_process_globals
-{
- constexpr unsigned n_inputs_ = 6;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//:sets input and output types
-bool bvpl_add_pca_errors_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_add_pca_errors_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "bvpl_pca_error_scenes_sptr";
- input_types_[i++] = "unsigned"; //dimension
- input_types_[i++] = "double"; ////fraction [0,1] of cells used in the computation
- input_types_[i++] = "int" ; //block index in x-dimension
- input_types_[i++] = "int" ; //block index in y-dimension
- input_types_[i++] = "int" ; //block index in z-dimension
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "double";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_add_pca_errors_process(bprb_func_process& pro)
-{
- using namespace bvpl_add_pca_errors_process_globals;
-
- //get inputs
- unsigned i =0;
- bvpl_pca_error_scenes_sptr error_scenes = pro.get_input<bvpl_pca_error_scenes_sptr>(i++);
- auto dim = pro.get_input<unsigned>(i++);
- auto fraction_nsamples = pro.get_input<double>(i++);
- int block_i = pro.get_input<int>(i++);
- int block_j = pro.get_input<int>(i++);
- int block_k = pro.get_input<int>(i++);
-
- if (!error_scenes) {
- std::cerr << "Error in bvpl_add_pca_errors_process: Null error scene\n";
- return false;
- }
- boxm_scene<boct_tree<short, float> >* error_scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*> (error_scenes->get_scene(dim).as_pointer());
- if (!error_scene) {
- std::cerr << "Error in bvpl_add_pca_errors_process: Error scene is of incorrect type\n";
- return false;
- }
- //sum errors within block
- double error = 0;
- if (fraction_nsamples < 0.95)
- {
- auto scene_ncells = (double)error_scene->size();
- error_scene->load_block(block_i,block_j,block_k);
- auto tree_ncells = (double)error_scene->get_block(block_i,block_j,block_k)->get_tree()->size();
- double nsamples = scene_ncells * fraction_nsamples;
-
- auto tree_nsamples = (unsigned long)((tree_ncells/scene_ncells)*nsamples);
- std::cout << "Number of samples in the scene " << scene_ncells << '\n'
- << "Adding errors from " << tree_nsamples << " samples in block: " << block_i << ',' << block_j << ',' << block_k << '\n';
- error = bvpl_average_value(error_scene,block_i, block_j, block_k, tree_nsamples);
- std::cout << "Error at block: (" << block_i << ", " << block_j << ", " << block_k << ") and dim: " << dim << "is: " << error << '\n';
- }
- else
- {
- error = bvpl_average_value(error_scene,block_i, block_j, block_k);
- std::cout << "Error at block: (" << block_i << ", " << block_j << ", " << block_k << ") and dim: " << dim << "is: " << error << '\n';
- }
-
- //store output
- pro.set_output_val<double>(0, error);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_combine_pairwise_statistics_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_combine_pairwise_statistics_process.cxx
deleted file mode 100644
index f6fb2f5d0a..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_combine_pairwise_statistics_process.cxx
+++ /dev/null
@@ -1,95 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 17-Mar-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <vnl/vnl_vector_fixed.h>
-#include <vnl/vnl_matrix_fixed.h>
-
-#include <bvpl/bvpl_octree/bvpl_global_pca.h>
-
-//:global variables
-namespace bvpl_combine_pairwise_statistics_process_globals
-{
- constexpr unsigned n_inputs_ = 3;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_combine_pairwise_statistics_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_combine_pairwise_statistics_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i=0;
- input_types_[i++] = "vcl_string" ; //stats_file1
- input_types_[i++] = "vcl_string" ; //stats_file2
- input_types_[i++] = "vcl_string" ; //stats_file_out
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_combine_pairwise_statistics_process(bprb_func_process& pro)
-{
- using namespace bvpl_combine_pairwise_statistics_process_globals;
-
- //get inputs
- unsigned i= 0;
- std::string stats_file1 = pro.get_input<std::string>(i++);
- std::string stats_file2 = pro.get_input<std::string>(i++);
- std::string stats_file_out = pro.get_input<std::string>(i++);
-
- //load files
- vnl_matrix_fixed<double, 125, 125> S1(0.0);
- vnl_vector_fixed<double, 125> mean1(0.0);
- unsigned long nfeatures1 =0;
- {
- std::ifstream stats_ifs(stats_file1.c_str());
- if (!stats_ifs.is_open()) {
- std::cerr << "Error: Failed to open file1\n";
- return false;
- }
- stats_ifs >> nfeatures1 >> mean1 >> S1;
- stats_ifs.close();
-
- }
-
- vnl_matrix_fixed<double, 125, 125> S2(0.0);
- vnl_vector_fixed<double, 125> mean2(0.0);
- unsigned long nfeatures2 =0;
-
- {
- std::ifstream stats_ifs(stats_file2.c_str());
- if (!stats_ifs.is_open()) {
- std::cerr << "Warning: Failed to open file2 - output file will be identical to file1\n";
- std::ofstream stats_ofs(stats_file_out.c_str());
- stats_ofs.precision(15);
- stats_ofs << nfeatures1 << '\n' << mean1 << '\n' << S1;
- return true;
- }
- stats_ifs >> nfeatures2 >> mean2 >> S2;
- stats_ifs.close();
- }
-
- vnl_matrix_fixed<double, 125, 125> S_out(0.0);
- vnl_vector_fixed<double, 125> mean_out(0.0);
- double nfeatures_out =0.0;
- bvpl_global_pca<125>::combine_pairwise_statistics(mean1, S1, (double)nfeatures1, mean2, S2, (double)nfeatures2, mean_out, S_out, nfeatures_out);
-
- std::ofstream stats_ofs(stats_file_out.c_str());
- stats_ofs.precision(15);
- stats_ofs << nfeatures_out << '\n' << mean_out << '\n' << S_out;
- stats_ofs.close();
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_error_block_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_error_block_process.cxx
deleted file mode 100644
index e6acd1accd..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_error_block_process.cxx
+++ /dev/null
@@ -1,69 +0,0 @@
-//:
-// \file
-// \brief A process to compute reconstruction error over all samples in a scene (test + train)
-// \author Isabel Restrepo
-// \date 13-Jan-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_discover_pca_kernels.h>
-#include <bvpl/bvpl_octree/bvpl_pca_error_scenes.h>
-
-//:global variables
-namespace bvpl_compute_pca_error_block_process_globals
-{
- constexpr unsigned n_inputs_ = 6; //directory path, where pca_info.xml is
- constexpr unsigned n_outputs_ = 0; //error file
-}
-
-
-//:sets input and output types
-bool bvpl_compute_pca_error_block_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_compute_pca_error_block_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "bvpl_discover_pca_kernels_sptr" ; //directory path
- input_types_[i++] = "bvpl_pca_error_scenes_sptr";
- input_types_[i++] = "int"; //block Indices
- input_types_[i++] = "int";
- input_types_[i++] = "int";
- input_types_[i++] = "unsigned"; //num_components
-
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_compute_pca_error_block_process(bprb_func_process& pro)
-{
- using namespace bvpl_compute_pca_error_block_process_globals;
-
- //get inputs
- unsigned i = 0;
- bvpl_discover_pca_kernels_sptr pca_extractor = pro.get_input<bvpl_discover_pca_kernels_sptr>(i++);
- bvpl_pca_error_scenes_sptr pca_error_scenes = pro.get_input<bvpl_pca_error_scenes_sptr>(i++);
- int block_i = pro.get_input<int>(i++);
- int block_j = pro.get_input<int>(i++);
- int block_k = pro.get_input<int>(i++);
- auto num_components = pro.get_input<unsigned>(i++);
-
- if (!pca_extractor)
- return false;
-
- if (!pca_error_scenes)
- return false;
-
- //bvpl_discover_pca_kernels pca_extractor(pca_dir);
- boxm_scene<boct_tree<short, float> >* error_scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*> (pca_error_scenes->get_scene(num_components).as_pointer());
- pca_extractor->compute_testing_error(error_scene, num_components, block_i, block_j, block_k);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_error_scene_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_error_scene_process.cxx
deleted file mode 100644
index 70d9cf1a4b..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_error_scene_process.cxx
+++ /dev/null
@@ -1,132 +0,0 @@
-//:
-// \file
-// \brief A process to compute reconstruction error over all samples in a scene (test + train)
-// \author Isabel Restrepo
-// \date 13-Jan-2011
-
-#include <iostream>
-#include <cstdlib>
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_discover_pca_kernels.h>
-#include <bvpl/bvpl_octree/bvpl_pca_error_scenes.h>
-
-#include <vul/vul_file.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-// global variables
-namespace bvpl_compute_pca_error_scene_process_globals
-{
- constexpr unsigned n_inputs_ = 3; //directory path, where pca_info.xml is
- constexpr unsigned n_outputs_ = 0; //error file
-}
-
-
-// sets input and output types
-bool bvpl_compute_pca_error_scene_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_compute_pca_error_scene_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "vcl_string" ; //directory path
- input_types_[i++] = "bvpl_pca_error_scenes_sptr";
- input_types_[i++] = "unsigned"; //num_components
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-#if BVPL_OCTREE_HAS_PTHREADS
-// helper code to launch and manage pthreads
-namespace {
- struct pthread_data
- {
- bvpl_discover_pca_kernels* pca_extractor;
- boxm_scene<boct_tree<short,float> > * error_scene;
- vgl_point_3d<int> block_idx;
- unsigned num_components;
- };
-
- void* pthread_launcher(void *arg)
- {
- pthread_data *pd = reinterpret_cast<pthread_data*>(arg);
- vgl_point_3d<int> block_idx = pd->block_idx;
- pd->pca_extractor->compute_testing_error_thread_safe(pd->error_scene, pd->num_components, block_idx.x(), block_idx.y(), block_idx.z());
- //delete pd;
- return arg;
- }
-}
-#endif
-
-// the process
-bool bvpl_compute_pca_error_scene_process(bprb_func_process& pro)
-{
- using namespace bvpl_compute_pca_error_scene_process_globals;
-
- //get inputs
- unsigned i = 0;
- std::string pca_dir = pro.get_input<std::string>(i++);
- bvpl_pca_error_scenes_sptr pca_error_scenes = pro.get_input<bvpl_pca_error_scenes_sptr>(i++);
- auto num_components = pro.get_input<unsigned>(i++);
-
- if (!vul_file::is_directory(pca_dir))
- return false;
-
- if (!pca_error_scenes)
- return false;
-
- auto *pca_extractor = new bvpl_discover_pca_kernels(pca_dir);
- vgl_vector_3d<unsigned int> num_blocks = pca_extractor->data_scene_dim();
- boxm_scene<boct_tree<short, float> >* error_scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*> (pca_error_scenes->get_scene(num_components).as_pointer());
-
-#if BVPL_OCTREE_HAS_PTHREADS
- pca_extractor->load_all_scene_blocks();
- error_scene->read_all_blocks();
- unsigned num_threads = 0;
- std::vector<vgl_point_3d<int> > block_indices;
- for (unsigned block_i = 0; block_i < num_blocks.x(); ++block_i) {
- for (unsigned block_j = 0; block_j < num_blocks.y(); ++block_j) {
- for (unsigned block_k = 0; block_k < num_blocks.z(); ++block_k) {
- block_indices.push_back(vgl_point_3d<int>(block_i,block_j,block_k));
- ++num_threads;
- }
- }
- }
-
- pthread_t* thread_id = new pthread_t[num_threads]; // beware of memory leaks ...
-
- for (unsigned i =0; i < num_threads; ++i)
- {
- pthread_data* pd = new pthread_data();
- pd->pca_extractor = pca_extractor;
- pd->error_scene = error_scene;
- pd->num_components = num_components;
- pd->block_idx= block_indices[i];
- int rc = pthread_create(&thread_id[i], NULL, pthread_launcher, (void*) pd );
- //pthread_detach(thread_id[i]);
- if (rc)
- {
- std::cerr << "Error creating pthread, return code: "<<rc<<'\n';
- std::exit(-1);
- }
- }
-#if 0
- for (unsigned i =0; i < num_threads; ++i)
- {
- pca_extractor.compute_testing_error_thread_safe(error_scene, num_components, block_indices[i].x(), block_indices[i].y(), block_indices[i].z());
- }
- pca_extractor.unload_all_scene_blocks();
-#endif
-
-#endif // PTHREADS
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_test_error_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_test_error_process.cxx
deleted file mode 100644
index 775dc4cb23..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_compute_pca_test_error_process.cxx
+++ /dev/null
@@ -1,59 +0,0 @@
-//:
-// \file
-// \brief A process to compute reconstruction error over all samples in a scene (test + train)
-// \author Isabel Restrepo
-// \date 13-Jan-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_discover_pca_kernels.h>
-
-
-//:global variables
-namespace bvpl_compute_pca_test_error_process_globals
-{
- constexpr unsigned n_inputs_ = 1; //directory path, where pca_info.xml is
- constexpr unsigned n_outputs_ = 1; //error file
-}
-
-
-//:sets input and output types
-bool bvpl_compute_pca_test_error_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_compute_pca_test_error_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vcl_string" ;
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "vcl_string";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_compute_pca_test_error_process(bprb_func_process& pro)
-{
- using namespace bvpl_compute_pca_test_error_process_globals;
-
- //get inputs
- std::string pca_dir = pro.get_input<std::string>(0);
-
- bvpl_discover_pca_kernels pca_extractor(pca_dir);
-
- vnl_vector<double> t_error;
- pca_extractor.compute_testing_error(t_error);
- std::ofstream error_ofs((pca_dir+ "/test_error.txt").c_str());
-
- if (error_ofs)
- error_ofs << t_error;
-
- //store output
- pro.set_output_val<std::string>(0, pca_dir+ "/test_error.txt");
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_discover_pca_features_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_discover_pca_features_process.cxx
deleted file mode 100644
index e76b7b5d98..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_discover_pca_features_process.cxx
+++ /dev/null
@@ -1,98 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 17-Nov-2010
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <boxm/boxm_scene.h>
-
-#include <bvpl/bvpl_octree/bvpl_discover_pca_kernels.h>
-
-//:global variables
-namespace bvpl_discover_pca_features_process_globals
-{
- constexpr unsigned n_inputs_ = 9;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_discover_pca_features_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_discover_pca_features_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i =0;
- input_types_[i++] = "boxm_scene_base_sptr";
- input_types_[i++] = "vcl_string"; //directory to save PCA matrices
- input_types_[i++] = "double"; //fraction of the total number of leaves
- input_types_[i++] = "int"; // min and max of kernel
- input_types_[i++] = "int";
- input_types_[i++] = "int";
- input_types_[i++] = "int";
- input_types_[i++] = "int";
- input_types_[i++] = "int";
-
-
- return pro.set_input_types(input_types_);
-}
-
-
-//:the process
-bool bvpl_discover_pca_features_process(bprb_func_process& pro)
-{
- using namespace bvpl_discover_pca_features_process_globals;
- if (pro.n_inputs() != n_inputs_)
- {
- std::cout << pro.name() << ": the input number should be " << n_inputs_
- << " but instead it is " << pro.n_inputs() << std::endl;
- return false;
- }
-
- //get inputs
- unsigned i =0;
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(i++);
- std::string pca_dir = pro.get_input<std::string>(i++);
- auto frac = pro.get_input<double>(i++);
- int min_x = pro.get_input<int>(i++);
- int min_y = pro.get_input<int>(i++);
- int min_z = pro.get_input<int>(i++);
- int max_x = pro.get_input<int>(i++);
- int max_y = pro.get_input<int>(i++);
- int max_z = pro.get_input<int>(i++);
-
-
- //check input's validity
- if (!scene_base.ptr()) {
- std::cout << " :-- Base Scene is not valid!\n";
- return false;
- }
-
- //neighborhood box for volume "patches" 5x5x5 for now - this could be an input to the process
- vgl_box_3d<int> neighborhood(vgl_point_3d<int>(min_x,min_y, min_z), vgl_point_3d<int>(max_x, max_y, max_z));
-
- //cast scene
- auto *scene= dynamic_cast<boxm_scene<boct_tree<short, float > >* > (scene_base.as_pointer());
- if (!scene) {
- std::cout << " :-- Input Scene is not of supported type\n";
- return false;
- }
- std::cout << "Scene path: " << scene->filename()<< std::endl;;
-
-
- //number of samples - 10% of total number of leaf-cells
- auto nsamples = (unsigned long)((double)scene->size() * frac);
- std::cout << "Number of samples: " << nsamples << std::endl;
-
- //bvpl_discover_pca_kernels pca_extractor(neighborhood, nsamples, scene);
- bvpl_discover_pca_kernels pca_extractor(neighborhood, nsamples, scene, pca_dir);
-
- //write matrices to disk
- pca_extractor.xml_write();
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_global_pca_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_global_pca_process.cxx
deleted file mode 100644
index 365a0eb791..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_global_pca_process.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-//:
-// \file
-// \brief A process that performs PCA analysis given the statistics collected from various scenes using bvpl_pca_global
-// \author Isabel Restrepo
-// \date 23-Mar-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_global_pca.h>
-
-//:global variables
-namespace bvpl_global_pca_process_globals
-{
- constexpr unsigned n_inputs_ = 2;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_global_pca_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_global_pca_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vcl_string"; //path pca_global_info file
- input_types_[1] = "vcl_string"; //path to statistics file
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_global_pca_process(bprb_func_process& pro)
-{
- using namespace bvpl_global_pca_process_globals;
-
- //get inputs
- std::string pca_file = pro.get_input<std::string>(0);
- std::string stats_file = pro.get_input<std::string>(1);
-
- //load file into matrices
- vnl_matrix_fixed<double, 125, 125> S(0.0);
- vnl_vector_fixed<double, 125> mean(0.0);
- unsigned long nfeatures =0;
- {
- std::ifstream stats_ifs(stats_file.c_str());
- if (!stats_ifs.is_open()) {
- std::cerr << "Error: Failed to open stats file\n";
- return false;
- }
- stats_ifs >> nfeatures >> mean >> S;
- }
-
- bvpl_global_pca<125> global_pca(pca_file);
-
- global_pca.set_up_pca_evd(S,mean,nfeatures);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_init_global_pca_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_init_global_pca_process.cxx
deleted file mode 100644
index 10e35faddb..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_init_global_pca_process.cxx
+++ /dev/null
@@ -1,50 +0,0 @@
-//:
-// \file
-// \brief A process to init auxiliary scenes and other variables
-// \author Isabel Restrepo
-// \date 23-Mar-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_global_pca.h>
-
-//:global variables
-namespace bvpl_init_global_pca_process_globals
-{
- constexpr unsigned n_inputs_ = 2;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_init_global_pca_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_init_global_pca_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vcl_string"; // path to pca_global_info file
- input_types_[1] = "unsigned"; //id of the scene to initialize
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_init_global_pca_process(bprb_func_process& pro)
-{
- using namespace bvpl_init_global_pca_process_globals;
-
- //get inputs
- std::string pca_dir = pro.get_input<std::string>(0);
- auto scene_id = pro.get_input<unsigned>(1);
-
- bvpl_global_pca<125> global_pca(pca_dir);
- global_pca.init(scene_id);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_global_pca_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_global_pca_process.cxx
deleted file mode 100644
index 8b2070e215..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_global_pca_process.cxx
+++ /dev/null
@@ -1,50 +0,0 @@
-//:
-// \file
-// \brief
-// \author Isabel Restrepo
-// \date 15-May-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl_octree/bvpl_global_pca.h>
-
-//: global variables
-namespace bvpl_load_global_pca_process_globals
-{
- constexpr unsigned n_inputs_ = 1;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//: sets input and output types
-bool bvpl_load_global_pca_125_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_load_global_pca_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vcl_string";
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "bvpl_global_pca_125_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//: the process
-bool bvpl_load_global_pca_125_process(bprb_func_process& pro)
-{
- using namespace bvpl_load_global_pca_process_globals;
-
- // get inputs
- std::string pca_file = pro.get_input<std::string>(0);
- auto *global_pca = new bvpl_global_pca<125>(pca_file);
-
- // store output
- pro.set_output_val<bvpl_global_pca_125_sptr>(0, global_pca);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_pca_error_scenes_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_pca_error_scenes_process.cxx
deleted file mode 100644
index 39161edf02..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_pca_error_scenes_process.cxx
+++ /dev/null
@@ -1,58 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 21-Feb-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_pca_error_scenes.h>
-
-//:global variables
-namespace bvpl_load_pca_error_scenes_process_globals
-{
- constexpr unsigned n_inputs_ = 3;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//:sets input and output types
-bool bvpl_load_pca_error_scenes_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_load_pca_error_scenes_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i =0;
- input_types_[i++] = "boxm_scene_base_sptr"; //data scene
- input_types_[i++] = "vcl_string"; //pca path
- input_types_[i++] = "unsigned"; //dimension pca feture
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "bvpl_pca_error_scenes_sptr" ;
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_load_pca_error_scenes_process(bprb_func_process& pro)
-{
- using namespace bvpl_load_pca_error_scenes_process_globals;
-
- //get inputs
- unsigned i = 0;
- boxm_scene_base_sptr data_scene_base = pro.get_input<boxm_scene_base_sptr>(i++);
- std::string pca_path = pro.get_input<std::string>(i++);
- auto feature_dim = pro.get_input<unsigned>(i++);
-
- if (!data_scene_base)
- return false;
-
- bvpl_pca_error_scenes *error_scenes = new bvpl_pca_error_scenes(data_scene_base, pca_path, feature_dim);
- //store output
- pro.set_output_val<bvpl_pca_error_scenes_sptr>(0, error_scenes);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_pca_info_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_pca_info_process.cxx
deleted file mode 100644
index 48082ecb75..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_load_pca_info_process.cxx
+++ /dev/null
@@ -1,55 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 3-Mar-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <vul/vul_file.h>
-
-#include <bvpl/bvpl_octree/bvpl_discover_pca_kernels.h>
-
-//:global variables
-namespace bvpl_load_pca_info_process_globals
-{
- constexpr unsigned n_inputs_ = 1;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//:sets input and output types
-bool bvpl_load_pca_info_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_load_pca_info_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vcl_string" ; //directory path
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "bvpl_discover_pca_kernels_sptr"; //pca info
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_load_pca_info_process(bprb_func_process& pro)
-{
- using namespace bvpl_load_pca_info_process_globals;
-
- //get inputs
- std::string pca_dir = pro.get_input<std::string>(0);
-
- if (!vul_file::is_directory(pca_dir))
- return false;
-
- bvpl_discover_pca_kernels_sptr pca_extractor = new bvpl_discover_pca_kernels(pca_dir);
-
- //store output
- pro.set_output_val<bvpl_discover_pca_kernels_sptr>(0, pca_extractor);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_normalize_pca_training_error_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_normalize_pca_training_error_process.cxx
deleted file mode 100644
index fb29aeaa8c..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_normalize_pca_training_error_process.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 4-Mar-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_discover_pca_kernels.h>
-
-#include <vul/vul_file.h>
-
-//:global variables
-namespace bvpl_normalize_pca_training_error_process_globals
-{
- constexpr unsigned n_inputs_ = 1; //directory path
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_normalize_pca_training_error_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_normalize_pca_training_error_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vcl_string";
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_normalize_pca_training_error_process(bprb_func_process& pro)
-{
- using namespace bvpl_normalize_pca_training_error_process_globals;
-
- //get inputs
- std::string pca_dir = pro.get_input<std::string>(0);
-
- if (!vul_file::is_directory(pca_dir)){
- std::cerr << " Invalid pca directory\n";
- return false;
- }
-
-
- bvpl_discover_pca_kernels pca_extractor(pca_dir);
-
- vnl_vector<double> error;
- pca_extractor.compute_normalized_training_error(error);
-
- std::ofstream ofs((pca_dir + "/normalized_training_error.txt").c_str());
- ofs.precision(15);
- ofs << error;
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_add_error_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_add_error_process.cxx
deleted file mode 100644
index 40149c3411..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_add_error_process.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-//:
-// \file
-// \brief A process to compute pca projection coeffiecients
-// \author Isabel Restrepo
-// \date 28-Feb-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_global_pca.h>
-#include <bvpl/bvpl_octree/bvpl_scene_statistics.h>
-
-
-//:global variables
-namespace bvpl_pca_global_add_error_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//:sets input and output types
-bool bvpl_pca_global_add_error_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_pca_global_add_error_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "bvpl_global_pca_125_sptr" ; //global pca class
- input_types_[i++] = "int"; //scene id
- input_types_[i++] = "int"; //block Indices
- input_types_[i++] = "int";
- input_types_[i++] = "int";
-
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "double";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_pca_global_add_error_process(bprb_func_process& pro)
-{
- using namespace bvpl_pca_global_add_error_process_globals;
-
- //get inputs
- unsigned i = 0;
- bvpl_global_pca_125_sptr global_pca = pro.get_input<bvpl_global_pca_125_sptr>(i++);
- int scene_id = pro.get_input<int>(i++);
- int block_i = pro.get_input<int>(i++);
- int block_j = pro.get_input<int>(i++);
- int block_k = pro.get_input<int>(i++);
-
- if (!global_pca)
- {
- std::cerr << "Global PCA is NULL\n";
- return false;
- }
-
- boxm_scene_base_sptr error_scene_base = global_pca->load_error_scene(scene_id);
- if (!error_scene_base) {
- std::cerr << "Error in bvpl_add_pca_errors_process: Error scene is of incorrect type\n";
- return false;
- }
-
- double error = bvpl_average_value(error_scene_base,block_i, block_j, block_k);
- std::cout << "Error at block: (" << block_i << ", " << block_j << ", " << block_k << ") is: " << error << '\n';
-
- //store output
- pro.set_output_val<double>(0, error);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_proj_error_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_proj_error_process.cxx
deleted file mode 100644
index 0e127a6a1c..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_proj_error_process.cxx
+++ /dev/null
@@ -1,63 +0,0 @@
-//:
-// \file
-// \brief A process to compute pca projection coeffiecients
-// \author Isabel Restrepo
-// \date 28-Feb-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_global_pca.h>
-
-//:global variables
-namespace bvpl_pca_global_proj_error_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_pca_global_proj_error_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_pca_global_proj_error_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "bvpl_global_pca_125_sptr" ; //global pca class
- input_types_[i++] = "int"; //scene id
- input_types_[i++] = "int"; //block Indices
- input_types_[i++] = "int";
- input_types_[i++] = "int";
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_pca_global_proj_error_process(bprb_func_process& pro)
-{
- using namespace bvpl_pca_global_proj_error_process_globals;
-
- //get inputs
- unsigned i = 0;
- bvpl_global_pca_125_sptr global_pca = pro.get_input<bvpl_global_pca_125_sptr>(i++);
- int scene_id = pro.get_input<int>(i++);
- int block_i = pro.get_input<int>(i++);
- int block_j = pro.get_input<int>(i++);
- int block_k = pro.get_input<int>(i++);
-
- if (!global_pca)
- {
- std::cerr << "Global PCA is NULL\n";
- return false;
- }
-
- global_pca->projection_error(scene_id, block_i, block_j, block_k);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_statistics_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_statistics_process.cxx
deleted file mode 100644
index fc2e46ff3e..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_global_statistics_process.cxx
+++ /dev/null
@@ -1,75 +0,0 @@
-//:
-// \file
-// \brief A process that computes pca statistics (scatter matrix and mean) on a per block basis
-// \author Isabel Restrepo
-// \date 14-Mar-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_global_pca.h>
-
-//:global variables
-namespace bvpl_pca_global_statistics_process_globals
-{
- constexpr unsigned n_inputs_ = 6;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_pca_global_statistics_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_pca_global_statistics_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i =0;
- input_types_[i++] = "bvpl_global_pca_125_sptr" ; //global pca class
- input_types_[i++] = "int"; //scene_id (this can be confirmed in xml file pca_info.xml)
- input_types_[i++] = "int"; //block Indices
- input_types_[i++] = "int";
- input_types_[i++] = "int";
- input_types_[i++] = "vcl_string"; //path to file to hold statistics of this block
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_pca_global_statistics_process(bprb_func_process& pro)
-{
- using namespace bvpl_pca_global_statistics_process_globals;
-
- //get inputs
- unsigned i = 0;
- bvpl_global_pca_125_sptr global_pca = pro.get_input<bvpl_global_pca_125_sptr>(i++);
- int scene_id = pro.get_input<int>(i++);
- int block_i = pro.get_input<int>(i++);
- int block_j = pro.get_input<int>(i++);
- int block_k = pro.get_input<int>(i++);
- std::string stats_file = pro.get_input<std::string>(i++);
-
- if(!global_pca)
- {
- std::cerr << "Global PCA is NULL \n";
- return false;
- }
- vnl_matrix_fixed<double, 125, 125> S(0.0);
- vnl_vector_fixed<double, 125> mean(0.0);
- unsigned long nfeatures = 0;
-
-
- if(global_pca->sample_statistics(scene_id, block_i, block_j, block_k, S, mean, nfeatures))
- {
- std::ofstream stats_ofs(stats_file.c_str());
- stats_ofs.precision(15);
- stats_ofs << nfeatures << '\n' << mean << '\n' << S;
- stats_ofs.close();
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_project_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_project_process.cxx
deleted file mode 100644
index 341a8e76ac..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/pca/bvpl_pca_project_process.cxx
+++ /dev/null
@@ -1,63 +0,0 @@
-//:
-// \file
-// \brief A process to compute pca projection coeffiecients
-// \author Isabel Restrepo
-// \date 28-Feb-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_global_pca.h>
-
-//:global variables
-namespace bvpl_pca_project_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_pca_project_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_pca_project_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "bvpl_global_pca_125_sptr" ; //global pca class
- input_types_[i++] = "int"; //scene id
- input_types_[i++] = "int"; //block Indices
- input_types_[i++] = "int";
- input_types_[i++] = "int";
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_pca_project_process(bprb_func_process& pro)
-{
- using namespace bvpl_pca_project_process_globals;
-
- //get inputs
- unsigned i = 0;
- bvpl_global_pca_125_sptr global_pca = pro.get_input<bvpl_global_pca_125_sptr>(i++);
- int scene_id = pro.get_input<int>(i++);
- int block_i = pro.get_input<int>(i++);
- int block_j = pro.get_input<int>(i++);
- int block_k = pro.get_input<int>(i++);
-
- if (!global_pca)
- {
- std::cerr << "Global PCA is NULL\n";
- return false;
- }
-
- global_pca->project(scene_id, block_i, block_j, block_k);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/steerable_filters/bvpl_compute_sf_raw_response_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/steerable_filters/bvpl_compute_sf_raw_response_process.cxx
deleted file mode 100644
index 3f4d2adf17..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/steerable_filters/bvpl_compute_sf_raw_response_process.cxx
+++ /dev/null
@@ -1,70 +0,0 @@
-//:
-// \file
-// \brief A process to run derivatives of gaussian in 3 dimensions - x, y, x
-// \author Isabel Restrepo
-// \date 13-Oct-2010
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/functors/bvpl_algebraic_functor.h>
-#include <bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.h>
-
-
-#include <boxm/boxm_scene.h>
-
-//: global variables
-namespace bvpl_compute_sf_raw_response_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//: sets input and output types
-bool bvpl_compute_sf_raw_response_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_compute_sf_raw_response_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "boxm_scene_base_sptr"; //input/response scene
- input_types_[i++] = "boxm_scene_base_sptr"; //valid scene
-
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//: the process
-bool bvpl_compute_sf_raw_response_process(bprb_func_process& pro)
-{
- using namespace bvpl_compute_sf_raw_response_process_globals;
-
- //get inputs:
- unsigned i = 0;
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(i++);
- boxm_scene_base_sptr valid_scene_base = pro.get_input<boxm_scene_base_sptr>(i++);
-
- //get scene
- typedef boct_tree<short, vnl_vector_fixed< float,10 > > response_tree_type;
- typedef boct_tree<short, bool > valid_tree_type;
-
-
- if (auto *scene_in = dynamic_cast<boxm_scene< response_tree_type >* >(scene_base.as_pointer()))
- {
- double cell_length = scene_in->finest_cell_length();
-
- if (auto *valid_scene = dynamic_cast<boxm_scene< valid_tree_type >* >(valid_scene_base.as_pointer()))
- {
- bvpl_gauss3D_steerable_filters sf;
- sf.basis_response_at_leaves(scene_in,valid_scene, cell_length);
- }
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/steerable_filters/bvpl_init_sf_response_scene_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/steerable_filters/bvpl_init_sf_response_scene_process.cxx
deleted file mode 100644
index 3ceffbbc47..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/steerable_filters/bvpl_init_sf_response_scene_process.cxx
+++ /dev/null
@@ -1,87 +0,0 @@
-//:
-// \file
-// \brief A process to initialize the response scene for steerable filter bank
-// \author Isabel Restrepo
-// \date 22-Aug-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/kernels/bvpl_gauss3d_x_kernel_factory.h>
-#include <bvpl/kernels/bvpl_create_directions.h>
-#include <bvpl/functors/bvpl_algebraic_functor.h>
-#include <bvpl/bvpl_octree/bvpl_scene_vector_operator.h>
-#include <bvpl/bvpl_octree/bvpl_scene_statistics.h>
-
-
-#include <boxm/boxm_scene.h>
-
-//: global variables
-namespace bvpl_init_sf_response_scene_process_globals
-{
- constexpr unsigned n_inputs_ = 2;
- constexpr unsigned n_outputs_ = 2;
-}
-
-
-//: sets input and output types
-bool bvpl_init_sf_response_scene_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_init_sf_response_scene_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr"; //input scene
- input_types_[1] = "vcl_string"; //output path
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr"; //response scene
- output_types_[1] = "boxm_scene_base_sptr"; //valid scene
-
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//: the process
-bool bvpl_init_sf_response_scene_process(bprb_func_process& pro)
-{
- using namespace bvpl_init_sf_response_scene_process_globals;
-
- //get inputs:
- unsigned i = 0;
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(i++);
- std::string output_path = pro.get_input<std::string>(i++);
-
- //get scene
- typedef boct_tree<short, float> float_tree_type;
- typedef boct_tree<short, vnl_vector_fixed< float,10 > > out_tree_type;
-
- if (auto *scene_in = dynamic_cast<boxm_scene< float_tree_type >* >(scene_base.as_pointer()))
- {
- boxm_scene<out_tree_type> *scene_out =
- new boxm_scene<out_tree_type>(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level());
- scene_out->set_paths(output_path, "steerable_gauss_3d_scene");
- scene_out->set_appearance_model(VNL_FLOAT_10);
- scene_out->write_scene("steerable_gauss_3d_scene.xml");
- scene_in->clone_blocks_to_vector<10>(*scene_out);
-
- boxm_scene<boct_tree<short, bool> > *valid_scene =
- new boxm_scene<boct_tree<short, bool> >(scene_in->lvcs(), scene_in->origin(), scene_in->block_dim(), scene_in->world_dim(), scene_in->max_level(), scene_in->init_level());
- valid_scene->set_paths(output_path, "valid_scene");
- valid_scene->set_appearance_model(BOXM_BOOL);
- valid_scene->write_scene("valid_scene.xml");
-
-
- //store output
- boxm_scene_base_sptr scene_ptr=new boxm_scene_base();
- scene_ptr = scene_out;
- boxm_scene_base_sptr valid_scene_ptr=new boxm_scene_base();
- valid_scene_ptr = valid_scene;
- pro.set_output_val<boxm_scene_base_sptr>(0, scene_ptr);
- pro.set_output_val<boxm_scene_base_sptr>(1, valid_scene_ptr);
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_add_taylor_errors_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_add_taylor_errors_process.cxx
deleted file mode 100644
index c1b1c309c0..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_add_taylor_errors_process.cxx
+++ /dev/null
@@ -1,90 +0,0 @@
-//:
-// \file
-// \brief A process to add Taylor error at a percentage of voxels in a block
-// \author Isabel Restrepo
-// \date 15-Feb-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_taylor_basis.h>
-#include <bvpl/bvpl_octree/bvpl_scene_statistics.h>
-
-#include <boxm/boxm_scene.h>
-
-//:global variables
-namespace bvpl_add_taylor_errors_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//:sets input and output types
-bool bvpl_add_taylor_errors_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_add_taylor_errors_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "boxm_scene_base_sptr";
- input_types_[i++] = "double"; ////fraction [0,1] of cells used in the computation
- input_types_[i++] = "int" ; //block index in x-dimension
- input_types_[i++] = "int" ; //block index in y-dimension
- input_types_[i++] = "int" ; //block index in z-dimension
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "double";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_add_taylor_errors_process(bprb_func_process& pro)
-{
- using namespace bvpl_add_taylor_errors_process_globals;
-
- //get inputs
- unsigned i =0;
- boxm_scene_base_sptr error_scene_base = pro.get_input<boxm_scene_base_sptr>(i++);
- auto fraction_nsamples = pro.get_input<double>(i++);
- int block_i = pro.get_input<int>(i++);
- int block_j = pro.get_input<int>(i++);
- int block_k = pro.get_input<int>(i++);
-
- if (!error_scene_base) {
- std::cerr << "Error in bvpl_add_taylor_errors_process: Null error scene\n";
- return false;
- }
- auto* error_scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*> (error_scene_base.as_pointer());
- if (!error_scene) {
- std::cerr << "Error in bvpl_add_taylor_errors_process: Error scene is of incorrect type\n";
- return false;
- }
- //sum errors within block
- auto scene_ncells = (double)error_scene->size();
- error_scene->load_block(block_i,block_j,block_k);
- auto tree_ncells = (double)error_scene->get_block(block_i,block_j,block_k)->get_tree()->size();
- double nsamples = scene_ncells * fraction_nsamples;
-
- //number of samples - 10% of total number of leaf-cells
- double error = 0.0;
- if (fraction_nsamples < 0.95) {
- auto tree_nsamples = (unsigned long)((tree_ncells/scene_ncells)*nsamples);
- std::cout << "Number of samples in the scene " << scene_ncells << '\n'
- << "Adding errors from " << tree_nsamples << " samples in block: " << block_i << ',' << block_j << ',' << block_k << std::endl;
- error = bvpl_taylor_basis::sum_errors(error_scene,block_i, block_j, block_k, tree_nsamples);
- }
- else {
- error = bvpl_average_value(error_scene,block_i, block_j, block_k);
- std::cout << "Error at block: (" << block_i << ", " << block_j << ", " << block_k << ") is: " << error << std::endl;
- }
-
- //store output
- pro.set_output_val<double>(0, error);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_compute_taylor_coefficients_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_compute_taylor_coefficients_process.cxx
deleted file mode 100644
index 50c28a393e..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_compute_taylor_coefficients_process.cxx
+++ /dev/null
@@ -1,80 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 12-Apr-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_global_taylor.h>
-
-#include <vul/vul_file.h>
-
-//:global variables
-namespace bvpl_compute_taylor_coefficients_process_globals
-{
- constexpr unsigned n_inputs_ = 6;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_compute_taylor_coefficients_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_compute_taylor_coefficients_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "vcl_string" ; //path of taylor_global_info.xml
- input_types_[i++] = "int"; //scene id
- input_types_[i++] = "int"; //block Indices
- input_types_[i++] = "int";
- input_types_[i++] = "int";
- input_types_[i++] = "int"; // dimension (3 for xyz derivatives, 10 for all 1st and 2nd order derivatives)
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_compute_taylor_coefficients_process(bprb_func_process& pro)
-{
- using namespace bvpl_compute_taylor_coefficients_process_globals;
-
- //get inputs
- unsigned i = 0;
- std::string taylor_dir = pro.get_input<std::string>(i++);
- int scene_id = pro.get_input<int>(i++);
- int block_i = pro.get_input<int>(i++);
- int block_j = pro.get_input<int>(i++);
- int block_k = pro.get_input<int>(i++);
- int dim = pro.get_input<int>(i++);
-
- if (!vul_file::is_directory(taylor_dir))
- return false;
-
- switch (dim) {
- case 3:
- {
- std::string kernel_names[] = {"Ix", "Iy", "Iz"};
- bvpl_global_taylor<float, 3> global_taylor(taylor_dir, kernel_names);
- global_taylor.compute_taylor_coefficients(scene_id, block_i, block_j, block_k);
- break;
- }
- case 10:
- {
- const std::string kernel_names[10] = {"I0", "Ix", "Iy", "Iz", "Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz" };
- bvpl_global_taylor<double, 10> global_taylor(taylor_dir, kernel_names);
- global_taylor.compute_taylor_coefficients(scene_id, block_i, block_j, block_k);
- break;
- }
- default:
- break;
- }
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_compute_taylor_error_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_compute_taylor_error_process.cxx
deleted file mode 100644
index b992c1b5ae..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_compute_taylor_error_process.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-//:
-// \file
-// \brief A process to compute the Taylor reconstruction error of a block (Assumes, basis has been applied)
-// \author Isabel Restrepo
-// \date 9-Feb-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_taylor_basis.h>
-#include <boxm/boxm_scene.h>
-
-//:global variables
-namespace bvpl_compute_taylor_error_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//:sets input and output types
-bool bvpl_compute_taylor_error_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_compute_taylor_error_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "boxm_scene_base_sptr"; //the original data scene
- input_types_[i++] = "bvpl_taylor_scenes_map_sptr" ; //scenes needed for Taylor operations
- input_types_[i++] = "int" ; //block index in x-dimension
- input_types_[i++] = "int" ; //block index in y-dimension
- input_types_[i++] = "int" ; //block index in z-dimension
-
- std::vector<std::string> output_types_(n_outputs_);
- i=0;
- output_types_[i++] = "boxm_scene_base_sptr"; //the error for this block
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_compute_taylor_error_process(bprb_func_process& pro)
-{
- using namespace bvpl_compute_taylor_error_process_globals;
-
- //get inputs
- unsigned i = 0;
- boxm_scene_base_sptr data_scene_base = pro.get_input<boxm_scene_base_sptr>(i++);
- bvpl_taylor_scenes_map_sptr taylor_scenes = pro.get_input<bvpl_taylor_scenes_map_sptr>(i++);
- int block_i = pro.get_input<int>(i++);
- int block_j = pro.get_input<int>(i++);
- int block_k = pro.get_input<int>(i++);
- if (!data_scene_base) {
- std::cerr << "Error in bvpl_compute_taylor_error_process: Null data scene\n";
- return false;
- }
- if (!taylor_scenes) {
- std::cerr << "Error in bvpl_compute_taylor_error_process: Null scenes map\n";
- return false;
- }
-
- //assemble the Taylor basis
- bvpl_taylor_basis::assemble_basis(taylor_scenes, block_i, block_j, block_k);
-
- //compute the error block
- boxm_scene<boct_tree<short, float> >* error_scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*> (taylor_scenes->get_scene("error").as_pointer());
- auto* data_scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*> (data_scene_base.as_pointer());
- double cell_length = data_scene->finest_cell_length();
- bvpl_taylor_basis::compute_approximation_error(data_scene, taylor_scenes->get_scene("basis"),
- error_scene,taylor_scenes->loader(),
- block_i, block_j, block_k, cell_length);
-
- pro.set_output_val<boxm_scene_base_sptr>(0, error_scene);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_explore_coefficient_scene_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_explore_coefficient_scene_process.cxx
deleted file mode 100644
index 0b57bb488d..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_explore_coefficient_scene_process.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-//:
-// \file
-// \brief A process to extract a Taylor coefficient from the 10-d vector
-// \author Isabel Restrepo
-// \date 12-Apr-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_global_taylor.h>
-
-//:global variables
-namespace bvpl_explore_coefficient_scene_process_globals
-{
- constexpr unsigned n_inputs_ = 3;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//:sets input and output types
-bool bvpl_explore_coefficient_scene_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_explore_coefficient_scene_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "vcl_string"; //path to Taylor info file
- input_types_[i++] = "int"; //scene id
- input_types_[i++] = "int"; //coefficient
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "boxm_scene_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_explore_coefficient_scene_process(bprb_func_process& pro)
-{
- using namespace bvpl_explore_coefficient_scene_process_globals;
-
- //get inputs
- std::string taylor_dir = pro.get_input<std::string>(0);
- int scene_id = pro.get_input<int>(1);
- int coeff_id = pro.get_input<int>(2);
-
- const std::string kernel_names[10] = {"I0", "Ix", "Iy", "Iz", "Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz" };
- bvpl_global_taylor<double, 10> taylor(taylor_dir, kernel_names);
-
- boxm_scene_base_sptr valid_scene_base = taylor.load_valid_scene(scene_id);
- auto* valid_scene = dynamic_cast<boxm_scene<boct_tree<short, bool> >*> (valid_scene_base.as_pointer());
- if (!valid_scene) {
- std::cerr << "Error in bvpl_explore_coefficient_scene_process: Could not cast valid scene\n";
- return false;
- }
-
- std::stringstream scene_ss;
- scene_ss << "coefficient_" << coeff_id << "_scene_" << scene_id ;
- std::string scene_path = taylor.aux_dirs(scene_id) + "/" + scene_ss.str() + ".xml";
-
- std::cout << "Initializing " << scene_path << '\n'
- << "Scene: " << scene_path << " does not exist, initializing xml" << std::endl;
- boxm_scene<boct_tree<short, float> > *scene =
- new boxm_scene<boct_tree<short, float> >(valid_scene->lvcs(), valid_scene->origin(), valid_scene->block_dim(), valid_scene->world_dim(), valid_scene->max_level(), valid_scene->init_level());
- scene->set_appearance_model(BOXM_FLOAT);
- scene->set_paths(taylor.aux_dirs(scene_id), scene_ss.str());
- scene->write_scene("/" + scene_ss.str() + ".xml");
- taylor.extract_coefficient_scene(scene_id, coeff_id, scene);
-
- //store output
- pro.set_output_val<boxm_scene_base_sptr>(0, scene);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_init_global_taylor_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_init_global_taylor_process.cxx
deleted file mode 100644
index c900aeef5d..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_init_global_taylor_process.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-//:
-// \file
-// \brief A process to init auxiliary scenes and other variables
-// \author Isabel Restrepo
-// \date 12-Apr-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_global_taylor.h>
-
-//:global variables
-namespace bvpl_init_global_taylor_process_globals
-{
- constexpr unsigned n_inputs_ = 2;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_init_global_taylor_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_init_global_taylor_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vcl_string"; // path to taylor_global_info file
- input_types_[1] = "int"; // dimension (3 for xyz derivatives, 10 for all 1st and 2nd order derivatives)
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_init_global_taylor_process(bprb_func_process& pro)
-{
- using namespace bvpl_init_global_taylor_process_globals;
-
- //get inputs
- std::string taylor_dir = pro.get_input<std::string>(0);
- int dim = pro.get_input<int>(1);
-
- switch (dim) {
- case 3:
- {
- std::string kernel_names[] = {"Ix", "Iy", "Iz"};
- bvpl_global_taylor<float, 3> global_taylor(taylor_dir, kernel_names);
- global_taylor.init();
- break;
- }
- case 10:
- {
- const std::string kernel_names[10] = {"I0", "Ix", "Iy", "Iz", "Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz" };
- bvpl_global_taylor<double, 10> global_taylor(taylor_dir, kernel_names);
- global_taylor.init();
- break;
- }
- default:
- break;
- }
-
-
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_load_global_taylor_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_load_global_taylor_process.cxx
deleted file mode 100644
index 0e5713c4dc..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_load_global_taylor_process.cxx
+++ /dev/null
@@ -1,52 +0,0 @@
-//:
-// \file
-// \brief
-// \author Isabel Restrepo
-// \date 21-Jul-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl_octree/bvpl_global_taylor.h>
-
-//: global variables
-namespace bvpl_load_global_taylor_process_globals
-{
- constexpr unsigned n_inputs_ = 1;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//: sets input and output types
-bool bvpl_load_global_taylor_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_load_global_taylor_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vcl_string";
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "bvpl_global_taylor_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//: the process
-bool bvpl_load_global_taylor_process(bprb_func_process& pro)
-{
- typedef vbl_smart_ptr<bvpl_global_taylor<double, 10> > bvpl_global_taylor_sptr;
- using namespace bvpl_load_global_taylor_process_globals;
-
- // get inputs
- std::string taylor_file = pro.get_input<std::string>(0);
- const std::string kernel_names[10] = {"I0", "Ix", "Iy", "Iz", "Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz" };
- auto *global_taylor = new bvpl_global_taylor<double, 10>(taylor_file, kernel_names);
-
- // store output
- pro.set_output_val<bvpl_global_taylor_sptr>(0, global_taylor);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_load_taylor_scenes_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_load_taylor_scenes_process.cxx
deleted file mode 100644
index 0b405689b0..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_load_taylor_scenes_process.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-//:
-// \file
-// \brief A process to load to memory all smart pointers of scenes needed for Taylor reconstruction
-// \author Isabel Restrepo
-// \date 14-Feb-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <vul/vul_file.h>
-
-#include <bvpl/bvpl_octree/bvpl_taylor_basis.h>
-
-//:global variables
-namespace bvpl_load_taylor_scenes_process_globals
-{
- constexpr unsigned n_inputs_ = 7;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//:sets input and output types
-bool bvpl_load_taylor_scenes_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_load_taylor_scenes_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "vcl_string"; //dir to Taylor scenes
- input_types_[i++] = "int"; // min and max of Taylor kernel
- input_types_[i++] = "int";
- input_types_[i++] = "int";
- input_types_[i++] = "int";
- input_types_[i++] = "int";
- input_types_[i++] = "int";
- std::vector<std::string> output_types_(n_outputs_);
- i = 0;
- output_types_[i++] = "bvpl_taylor_scenes_map_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_load_taylor_scenes_process(bprb_func_process& pro)
-{
- using namespace bvpl_load_taylor_scenes_process_globals;
-
- //get inputs
- unsigned i = 0;
- std::string taylor_dir = pro.get_input<std::string>(i++);
- int min_x = pro.get_input<int>(i++);
- int min_y = pro.get_input<int>(i++);
- int min_z = pro.get_input<int>(i++);
- int max_x = pro.get_input<int>(i++);
- int max_y = pro.get_input<int>(i++);
- int max_z = pro.get_input<int>(i++);
-
- if (!vul_file::is_directory(taylor_dir)) {
- std::cerr<<"Error in bvpl_load_taylor_scenes_process_process: Taylor directory doesn't exist\n";
- }
-
- bvpl_taylor_basis_loader loader(taylor_dir, vgl_point_3d<int>(min_x,min_y, min_z), vgl_point_3d<int>(max_x, max_y, max_z));
- bvpl_taylor_scenes_map_sptr taylor_scenes = new bvpl_taylor_scenes_map(loader);
-
- //store output
- pro.set_output_val<bvpl_taylor_scenes_map_sptr>(0, taylor_scenes);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_taylor_global_add_error_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_taylor_global_add_error_process.cxx
deleted file mode 100644
index 6fe31b4168..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_taylor_global_add_error_process.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-//:
-// \file
-// \brief A process to compute taylor projection coeffiecients
-// \author Isabel Restrepo
-// \date 28-Feb-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_global_taylor.h>
-#include <bvpl/bvpl_octree/bvpl_scene_statistics.h>
-
-
-//:global variables
-namespace bvpl_taylor_global_add_error_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//:sets input and output types
-bool bvpl_taylor_global_add_error_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_taylor_global_add_error_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "bvpl_global_taylor_sptr" ; //global taylor class
- input_types_[i++] = "int"; //scene id
- input_types_[i++] = "int"; //block Indices
- input_types_[i++] = "int";
- input_types_[i++] = "int";
-
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "double";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_taylor_global_add_error_process(bprb_func_process& pro)
-{
- using namespace bvpl_taylor_global_add_error_process_globals;
-
- //get inputs
- unsigned i = 0;
- bvpl_global_taylor_sptr global_taylor = pro.get_input<bvpl_global_taylor_sptr>(i++);
- int scene_id = pro.get_input<int>(i++);
- int block_i = pro.get_input<int>(i++);
- int block_j = pro.get_input<int>(i++);
- int block_k = pro.get_input<int>(i++);
-
- if (!global_taylor)
- {
- std::cerr << "Global taylor is NULL\n";
- return false;
- }
-
- boxm_scene_base_sptr error_scene_base = global_taylor->load_error_scene(scene_id);
- if (!error_scene_base) {
- std::cerr << "Error in bvpl_add_taylor_errors_process: Error scene is of incorrect type\n";
- return false;
- }
-
- double error = bvpl_average_value(error_scene_base,block_i, block_j, block_k);
- std::cout << "Error at block: (" << block_i << ", " << block_j << ", " << block_k << ") is: " << error << '\n';
-
- //store output
- pro.set_output_val<double>(0, error);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_taylor_global_proj_error_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_taylor_global_proj_error_process.cxx
deleted file mode 100644
index 3f3ca0a701..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/processes/taylor/bvpl_taylor_global_proj_error_process.cxx
+++ /dev/null
@@ -1,63 +0,0 @@
-//:
-// \file
-// \brief A process to compute taylor projection coeffiecients
-// \author Isabel Restrepo
-// \date 28-Feb-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/bvpl_octree/bvpl_global_taylor.h>
-
-//:global variables
-namespace bvpl_taylor_global_proj_error_process_globals
-{
- constexpr unsigned n_inputs_ = 5;
- constexpr unsigned n_outputs_ = 0;
-}
-
-
-//:sets input and output types
-bool bvpl_taylor_global_proj_error_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_taylor_global_proj_error_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- unsigned i = 0;
- input_types_[i++] = "bvpl_global_taylor_sptr" ; //global taylor class
- input_types_[i++] = "int"; //scene id
- input_types_[i++] = "int"; //block Indices
- input_types_[i++] = "int";
- input_types_[i++] = "int";
-
- std::vector<std::string> output_types_(n_outputs_);
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_taylor_global_proj_error_process(bprb_func_process& pro)
-{
- using namespace bvpl_taylor_global_proj_error_process_globals;
-
- //get inputs
- unsigned i = 0;
- bvpl_global_taylor_sptr global_taylor = pro.get_input<bvpl_global_taylor_sptr>(i++);
- int scene_id = pro.get_input<int>(i++);
- int block_i = pro.get_input<int>(i++);
- int block_j = pro.get_input<int>(i++);
- int block_k = pro.get_input<int>(i++);
-
- if (!global_taylor)
- {
- std::cerr << "Global taylor is NULL\n";
- return false;
- }
-
- global_taylor->compute_approximation_error(scene_id, block_i, block_j, block_k);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/CMakeLists.txt
deleted file mode 100644
index 320399fb72..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-include_directories( ${BRL_INCLUDE_DIR}/bseg/bvpl/bvpl_octree )
-include_directories( ${BRL_INCLUDE_DIR}/bseg/bvpl/bvpl_octree/pro)
-
-add_executable( bvpl_octree_pro_test_all
- test_driver.cxx
- test_bvpl_plane_propagation_process.cxx
-)
-
-target_link_libraries( bvpl_octree_pro_test_all ${VXL_LIB_PREFIX}testlib bvpl_octree_pro bvpl_octree boxm boxm_pro boxm_sample boxm_util boct bvpl bprb brdb sdet ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vcl)
-
-if(SEGFAULT_FIXED)
-add_test( NAME bvpl_octree_pro_plane_propagation_process COMMAND $<TARGET_FILE:bvpl_octree_pro_test_all> test_bvpl_plane_propagation_process)
-endif()
-
-add_executable( bvpl_octree_pro_test_include test_include.cxx )
-target_link_libraries( bvpl_octree_pro_test_include bvpl_octree_pro sdet )
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_bvpl_plane_propagation_process.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_bvpl_plane_propagation_process.cxx
deleted file mode 100644
index 1073b2e437..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_bvpl_plane_propagation_process.cxx
+++ /dev/null
@@ -1,144 +0,0 @@
-#include <iostream>
-#include <vector>
-#include <testlib/testlib_test.h>
-//:
-// \file
-// \brief This test creates a tree with 8 leaf cells and inserts only one plane to each
-// After the boxm_plane_propagation_process is applied, each cell will insert their
-// neighbors' observation planes and insert into itself. At the end each cell should
-// have 8 planes in the observation list since each cell has 7 neighbors (all the
-// other cells in the tree)
-//
-// \author Gamze Tunali
-// \date March 24, 2010
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <brdb/brdb_value.h>
-#include <brdb/brdb_query.h>
-#include <brdb/brdb_selection.h>
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_batch_process_manager.h>
-#include <bprb/bprb_macros.h>
-#include <bprb/bprb_parameters_sptr.h>
-#include <bprb/bprb_parameters.h>
-
-#include <boct/boct_tree_cell.h>
-#include <boct/boct_tree.h>
-
-#include <boxm/boxm_scene.h>
-#include <boxm/sample/boxm_edge_tangent_sample.h>
-#include <bvpl/bvpl_octree/pro/bvpl_octree_processes.h>
-#include <vul/vul_file.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-
-static void test_bvpl_plane_propagation_process()
-{
- typedef boxm_edge_tangent_sample<float> data_type;
- typedef boct_tree<short,data_type > tree_type;
- typedef boxm_scene<boct_tree<short,data_type > > scene_type;
-
- // create the main scene
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(10,10,20);
- vgl_vector_3d<double> block_dim(10,10,10);
- vgl_vector_3d<unsigned> world_dim(1,1,1);
- scene_type scene(lvcs, origin, block_dim, world_dim);
- scene.set_octree_levels(3,2);
- scene.set_paths("./boxm_scene", "block");
- scene.set_appearance_model(BOXM_EDGE_LINE);
- x_write(std::cout, scene, "scene");
- vul_file::make_directory("./boxm_scene");
- scene.write_scene();
-
- boxm_block_iterator<boct_tree<short,data_type > > iter(&scene);
- while (!iter.end())
- {
- scene.load_block(iter.index().x(),iter.index().y(),iter.index().z());
- boxm_block<boct_tree<short,data_type > > * block=scene.get_active_block();
- boct_tree<short,data_type > * tree= block->get_tree();
-
- // get the leaf nodes and insert one plane to each
- std::vector<boct_tree_cell<short,data_type >*> cells=tree->leaf_cells();
- for (unsigned i=0; i<cells.size(); i++) {
- boxm_plane_obs<float> p(vgl_homg_plane_3d<float>(float(i+1),0.f,0.f,1.f), 1.0f);
- data_type data = cells[i]->data();
- data.insert(p);
- cells[i]->set_data(data);
- }
- block->init_tree(tree);
- block->get_tree()->print();
- scene.write_active_block();
- iter++;
- }
-
- DECLARE_FUNC_CONS(bvpl_plane_propagate_process);
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_plane_propagate_process, "bvplPlanePropagateProcess");
- REGISTER_DATATYPE(boxm_scene_base_sptr);
-
- //: set the inputs
- brdb_value_sptr v0 = new brdb_value_t<boxm_scene_base_sptr>(new boxm_scene<boct_tree<short,data_type > >(scene));
- brdb_value_sptr v1 = new brdb_value_t<std::string>(scene.path());
- brdb_value_sptr v2 = new brdb_value_t<std::string>("new_scene");
- brdb_value_sptr v3 = new brdb_value_t<std::string>("new_scene.xml");
-
- //: inits with the default params
- bool good = bprb_batch_process_manager::instance()->init_process("bvplPlanePropagateProcess");
- good = good && bprb_batch_process_manager::instance()->set_input(0, v0);
- good = good && bprb_batch_process_manager::instance()->set_input(1, v1);
- good = good && bprb_batch_process_manager::instance()->set_input(2, v2);
- good = good && bprb_batch_process_manager::instance()->set_input(3, v3);
- good = good && bprb_batch_process_manager::instance()->run_process();
-
- unsigned id;
- good = good && bprb_batch_process_manager::instance()->commit_output(0, id);
- TEST("process commits output", good, true);
-
- // check if the results are in DB
- brdb_query_aptr Q = brdb_query_comp_new("id", brdb_query::EQ, id);
- brdb_selection_sptr S = DATABASE->select("boxm_scene_base_sptr_data", std::move(Q));
- if (S->size()!=1){
- std::cout << "in bprb_batch_process_manager::set_input_from_db(.) -"
- << " no selections\n";
- }
- brdb_value_sptr value;
- if (!S->get_value(std::string("value"), value)) {
- std::cout << "in bprb_batch_process_manager::set_input_from_db(.) -"
- << " didn't get value\n";
- }
- bool non_null = (value != nullptr);
- TEST("the output scene non-null", non_null, true);
-
- auto* result=static_cast<brdb_value_t<boxm_scene_base_sptr>* >(value.ptr());
- boxm_scene_base_sptr scene_sptr = result->value();
-
- // get the new scene with updated cells
- auto *scene2 = static_cast<scene_type *>(scene_sptr.as_pointer());
- boxm_block_iterator<boct_tree<short,data_type > > iter2(scene2);
-
- bool obs_num_ok=true;
- while (!iter2.end())
- {
- scene2->load_block(iter2.index().x(),iter2.index().y(),iter2.index().z());
- boxm_block<tree_type > * block=scene2->get_active_block();
- tree_type * tree= block->get_tree();
-
- // get the leaf nodes and insert one plane to each
- std::vector<boct_tree_cell<short,data_type >*> nodes=tree->leaf_cells();
- for (auto & node : nodes) {
- unsigned num=node->data().num_obs();
- // each node has 8 neighbors in the 3x3 neighborhood including itself
- if (num != 8)
- obs_num_ok = false;
- }
- iter2++;
- }
- TEST("The number of expected observations at each cell", obs_num_ok, true);
-}
-
-TESTMAIN(test_bvpl_plane_propagation_process);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_driver.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_driver.cxx
deleted file mode 100644
index 9fae26da90..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_driver.cxx
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <testlib/testlib_register.h>
-
-DECLARE( test_bvpl_plane_propagation_process );
-
-void register_tests()
-{
- REGISTER( test_bvpl_plane_propagation_process );
-}
-
-DEFINE_MAIN;
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_include.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_include.cxx
deleted file mode 100644
index 407d98e94a..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/pro/tests/test_include.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <bvpl/bvpl_octree/pro/bvpl_octree_processes.h>
-#include <bvpl/bvpl_octree/pro/bvpl_octree_register.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/readme.txt b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/readme.txt
deleted file mode 100644
index 79b3a2bcb4..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/readme.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Each of the subfolders contains scripts for different experiments:
-
-reconstruction error: Finds the reconstruction error using PCA kernels of a scene. The error is computed for a fixed fraction of training samples and varying number of dimensions.
-
-training error: Finds the reconstruction error using PCA kernels of a scene. The error is computed for a fixed dimension and varying number of training samples
-
-Note: *.sh calls the python scripts with appropriate inputs. You only need to adjust *.sh for your system
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/add_pca_error.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/add_pca_error.py
deleted file mode 100644
index 133a5822ed..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/add_pca_error.py
+++ /dev/null
@@ -1,193 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-Created on Mon Feb 21, 2011
-
-@author:Isabel Restrepo
-
-Adds the error of a portion of voxels. Each block is processed in a separate thread.
-This script assumes that the reconstruction error at each voxel has been computed
-"""
-import os
-import multiprocessing
-import Queue
-import time
-import random
-import optparse
-
-import brl_init
-import bvpl_octree_batch as batch
-dbvalue = brl_init.register_batch(batch)
-
-
-class pca_error_job():
-
- def __init__(self, pca_scenes, dim, fraction, block_i, block_j, block_k):
- self.pca_scenes = pca_scenes
- self.dim = dim
- self.fraction = fraction
- self.block_i = block_i
- self.block_j = block_j
- self.block_k = block_k
-
-
-def execute_jobs(jobs, num_procs=4):
- # load up work queue
- work_queue = multiprocessing.Queue()
- for job in jobs:
- work_queue.put(job)
-
- # create a queue to pass to workers to store the results
- result_queue = multiprocessing.Queue()
-
- # spawn workers
- for i in range(num_procs):
- worker = pca_error_worker(work_queue, result_queue)
- worker.start()
- print("worker with name ", worker.name, " started!")
-
- # collect the results off the queue
- # all_results=[];
-# results = []
-# while len(results) < len(jobs):
-# result = result_queue.get()
-# results.append(result)
-# all_results[job.dim].append(result);
-#
-# return all_results;
-
- # collect the results off the queue
- results = []
- while len(results) < len(jobs):
- result = result_queue.get()
- results.append(result)
-
- return results
-
-
-class pca_error_worker(multiprocessing.Process):
-
- def __init__(self, work_queue, result_queue):
- # base class initialization
- multiprocessing.Process.__init__(self)
- # job management stuff
- self.work_queue = work_queue
- self.result_queue = result_queue
- self.kill_received = False
-
- def run(self):
- while not self.kill_received:
- # get a task
- try:
- job = self.work_queue.get_nowait()
- except Queue.Empty:
- break
-
- start_time = time.time()
-
- print("Adding Errors")
- batch.init_process("bvplAddPCAErrorsProcess")
- batch.set_input_from_db(0, job.pca_scenes)
- batch.set_input_unsigned(1, job.dim)
- batch.set_input_double(2, job.fraction)
- batch.set_input_int(3, job.block_i)
- batch.set_input_int(4, job.block_j)
- batch.set_input_int(5, job.block_k)
- batch.run_process()
- (id, type) = batch.commit_output(0)
- error_val = dbvalue(id, type)
- error = batch.get_output_double(id)
-
- self.result_queue.put(error)
-
- print("Runing time for worker:", self.name)
- print(time.time() - start_time)
-
-
-#***************** The Main Algorithm ************************#
-
-if __name__ == "__main__":
-
- batch.register_processes()
- batch.register_datatypes()
-
- # Parse inputs
- parser = optparse.OptionParser(description='Compute PCA Error Scene')
-
- parser.add_option('--model_dir', action="store", dest="model_dir")
- parser.add_option('--pca_dir', action="store", dest="pca_dir")
- parser.add_option('--num_cores', action="store",
- dest="num_cores", type="int", default=4)
- parser.add_option('--fraction', action="store",
- dest="fraction", type="float", default=0.0)
- parser.add_option('--nblocks_x', action="store",
- dest="nblocks_x", type="int")
- parser.add_option('--nblocks_y', action="store",
- dest="nblocks_y", type="int")
- parser.add_option('--nblocks_z', action="store",
- dest="nblocks_z", type="int")
- parser.add_option('--dimension', action="store",
- dest="dimension", type="int")
-
- options, args = parser.parse_args()
-
- model_dir = options.model_dir
- pca_dir = options.pca_dir
- fraction = options.fraction
- nblocks_x = options.nblocks_x
- nblocks_y = options.nblocks_y
- nblocks_z = options.nblocks_z
- num_cores = options.num_cores
- dimension = options.dimension
-
- if not os.path.isdir(model_dir + "/"):
- print "Invalid Model Dir"
- sys.exit(-1)
-
- if not os.path.isdir(pca_dir + "/"):
- print "Invalid PCA Dir"
- sys.exit(-1)
-
- print("Loading Data Scene")
- batch.init_process("boxmCreateSceneProcess")
- batch.set_input_string(0, model_dir + "/mean_color_scene.xml")
- batch.run_process()
- (scene_id, scene_type) = batch.commit_output(0)
- data_scene = dbvalue(scene_id, scene_type)
-
- # Load PCA scenes
- pca_feature_dim = 125
- print("Loading PCA Error Scenes")
- batch.init_process("bvplLoadPCAErrorSceneProcess")
- batch.set_input_from_db(0, data_scene)
- batch.set_input_string(1, pca_dir)
- batch.set_input_unsigned(
- 2, pca_feature_dim) # dimension pca feature
- batch.run_process()
- (id, type) = batch.commit_output(0)
- pca_scenes = dbvalue(id, type)
-
- # Begin multiprocessing
- # Enqueue jobs
- job_list = []
- # for dim in range(0, pca_feature_dim):
- for block_i in range(0, nblocks_x):
- for block_j in range(0, nblocks_y):
- for block_k in range(0, nblocks_z):
- current_job = pca_error_job(
- pca_scenes, dimension, fraction, block_i, block_j, block_k)
- job_list.append(current_job)
-
- # run
- results = execute_jobs(job_list, num_cores)
-
- # dump results
- total_error = 0
- for r in results:
- total_error = total_error + r
-
- int_frac = int(fraction * 100)
- error_file = pca_dir + "/error_" + str(dimension) + "/error.txt"
- fd = open(error_file, "w")
- print >>fd, total_error / len(results)
- print >>fd, results
- fd.close()
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/compute_pca_error_scene.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/compute_pca_error_scene.py
deleted file mode 100644
index c8ede20327..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/compute_pca_error_scene.py
+++ /dev/null
@@ -1,164 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-Created on Mon Feb 14, 2011
-
-@author:Isabel Restrepo
-
-Compuets PCA reconstruction error. Each block is processed in a separate thread.
-This script assumes that the pca basis has been computed as gone by extract_pca_kernels.py
-"""
-import os
-import multiprocessing
-import Queue
-import time
-import random
-import optparse
-import sys
-
-import brl_init
-import bvpl_octree_batch as batch
-dbvalue = brl_init.register_batch(batch)
-
-
-class pca_error_job():
-
- def __init__(self, pca_info, pca_error_scenes, block_i, block_j, block_k, dim):
- self.pca_info = pca_info
- self.pca_error_scenes = pca_error_scenes
- self.block_i = block_i
- self.block_j = block_j
- self.block_k = block_k
- self.dim = dim
-
-
-def execute_jobs(jobs, num_procs=4):
- work_queue = multiprocessing.Queue()
- result_queue = multiprocessing.Queue()
- for job in jobs:
- work_queue.put(job)
-
- for i in range(num_procs):
- worker = pca_error_worker(work_queue, result_queue)
- worker.start()
- print("worker with name ", worker.name, " started!")
-
-
-class pca_error_worker(multiprocessing.Process):
-
- def __init__(self, work_queue, result_queue):
- # base class initialization
- multiprocessing.Process.__init__(self)
- # job management stuff
- self.work_queue = work_queue
- self.result_queue = result_queue
- self.kill_received = False
-
- def run(self):
- while not self.kill_received:
- # get a task
- try:
- job = self.work_queue.get_nowait()
- except Queue.Empty:
- break
-
- start_time = time.time()
-
- print("Computing Error Scene")
- batch.init_process("bvplComputePCAErrorBlockProcess")
- batch.set_input_from_db(0, job.pca_info)
- batch.set_input_from_db(1, job.pca_error_scenes)
- batch.set_input_int(2, job.block_i)
- batch.set_input_int(3, job.block_j)
- batch.set_input_int(4, job.block_k)
- batch.set_input_unsigned(5, job.dim)
- batch.run_process()
-
- print("Runing time for worker:", self.name)
- print(time.time() - start_time)
-
-#*******************The Main Algorithm ************************#
-if __name__ == "__main__":
- batch.register_processes()
- batch.register_datatypes()
-
- # Parse inputs
- parser = optparse.OptionParser(description='Compute PCA Error Scene')
-
- parser.add_option('--model_dir', action="store", dest="model_dir")
- parser.add_option('--pca_dir', action="store", dest="pca_dir")
- parser.add_option('--num_cores', action="store",
- dest="num_cores", type="int", default=4)
- parser.add_option('--nblocks_x', action="store",
- dest="nblocks_x", type="int")
- parser.add_option('--nblocks_y', action="store",
- dest="nblocks_y", type="int")
- parser.add_option('--nblocks_z', action="store",
- dest="nblocks_z", type="int")
- parser.add_option('--dimension', action="store",
- dest="dimension", type="int")
-
- options, args = parser.parse_args()
-
- model_dir = options.model_dir
- pca_dir = options.pca_dir
- nblocks_x = options.nblocks_x
- nblocks_y = options.nblocks_y
- nblocks_z = options.nblocks_z
- num_cores = options.num_cores
- dimension = options.dimension
-
- if not os.path.isdir(model_dir + "/"):
- print "Invalid Model Dir"
- sys.exit(-1)
-
- if not os.path.isdir(pca_dir + "/"):
- print "Invalid PCA Dir"
- sys.exit(-1)
-
- print("Loading Data Scene")
- batch.init_process("boxmCreateSceneProcess")
- batch.set_input_string(0, model_dir + "/mean_color_scene.xml")
- batch.run_process()
- (scene_id, scene_type) = batch.commit_output(0)
- data_scene = dbvalue(scene_id, scene_type)
-
- # Load pca scenes
- pca_feature_dim = 125
- print("Loading PCA Error Scenes")
- batch.init_process("bvplLoadPCAErrorSceneProcess")
- batch.set_input_from_db(0, data_scene)
- batch.set_input_string(1, pca_dir)
- batch.set_input_unsigned(
- 2, pca_feature_dim) # dimension pca feature
- batch.run_process()
- (id, type) = batch.commit_output(0)
- pca_scenes = dbvalue(id, type)
-
- print("Loading PCA Info")
- batch.init_process("bvplLoadPCAInfoProcess")
- batch.set_input_string(0, pca_dir)
- batch.run_process()
- (id, type) = batch.commit_output(0)
- pca_info = dbvalue(id, type)
-
- # Begin multiprocessing
- work_queue = multiprocessing.Queue()
- job_list = []
-
- # Enqueue jobs
- all_indices = []
- for block_i in range(0, nblocks_x):
- for block_j in range(0, nblocks_y):
- for block_k in range(0, nblocks_z):
- idx = [block_i, block_j, block_k]
- all_indices.append(idx)
-
- random.shuffle(all_indices)
-
- for i in range(0, len(all_indices)):
- idx = all_indices[i]
- current_job = pca_error_job(pca_info, pca_scenes, idx[
- 0], idx[1], idx[2], dimension)
- job_list.append(current_job)
-
- execute_jobs(job_list, num_cores)
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/extract_pca_kernels.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/extract_pca_kernels.py
deleted file mode 100644
index 5d8b2b7910..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/extract_pca_kernels.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# Computes the gaussian gradients on a boxm_alpha_scene
-
-import os
-import optparse
-import time
-
-import brl_init
-import bvpl_octree_batch as batch
-dbvalue = brl_init.register_batch(batch)
-
-if __name__ == "__main__":
-
- batch.register_processes()
- batch.register_datatypes()
-
- # Parse inputs
- parser = optparse.OptionParser(description='Compute PCA basis')
-
- parser.add_option('--model_dir', action="store", dest="model_dir")
- parser.add_option('--pca_dir', action="store", dest="pca_dir")
- parser.add_option('--train_fraction', action="store",
- dest="train_fraction", type="float", default=0.0)
- options, args = parser.parse_args()
-
- model_dir = options.model_dir
- pca_dir = options.pca_dir
- train_fraction = options.train_fraction
-
- if not os.path.isdir(model_dir + "/"):
- print "Invalid Model Dir"
- sys.exit(-1)
-
- if not os.path.isdir(pca_dir + "/"):
- os.makedirs(pca_dir + "/")
-
- print("Extracting Principal Components patches")
-
- print("Creating a Scene")
- batch.init_process("boxmCreateSceneProcess")
- batch.set_input_string(0, model_dir + "/mean_color_scene.xml")
- batch.run_process()
- (scene_id, scene_type) = batch.commit_output(0)
- scene = dbvalue(scene_id, scene_type)
-
- start_time = time.time()
-
- print("Extract PC")
- batch.init_process("bvplDiscoverPCAFeaturesProcess")
- batch.set_input_from_db(0, scene)
- batch.set_input_string(1, pca_dir)
- batch.set_input_double(2, train_fraction)
- batch.set_input_int(3, -2) # min and max points of the kernel
- batch.set_input_int(4, -2)
- batch.set_input_int(5, -2)
- batch.set_input_int(6, 2)
- batch.set_input_int(7, 2)
- batch.set_input_int(8, 2)
- batch.run_process()
-
- print("Runing time forbvplDiscoverPCAFeaturesProcess:")
- print(time.time() - start_time)
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/pca.sh b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/pca.sh
deleted file mode 100755
index 61f3346338..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/pca.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/bash
-"""
-Created on Mon Feb 14, 2011
-
-@author:Isabel Restrepo
-
-A script that encapsulates all steps needed to computer pca reconstruction error as a function of number of components used
-"""
-
-if [ $1 = "-r" ] ; then
- export PYTHONPATH=/Projects/vxl/bin/release/lib
-else
- if [ $1 = "-d" ] ; then
- export PYTHONPATH=/Projects/vxl/bin/Debug/lib
- else
- echo "Need a flag, either -d or -r";
- fi
-fi
-
-echo "PYTHONPATH=" $PYTHONPATH
-
-#model_dir="/Users/isa/Experiments/CapitolBOXMSmall";
-#pca_dir="/Users/isa/Experiments/PCA/CapitolBOXMSmall/10";
-#nblocks_x=1;
-#nblocks_y=1;
-#nblocks_z=1;
-
-
-#model_dir="/Users/isa/Experiments/CapitolBOXM_6_4_4";
-#model_name="capitol_scene";
-#pca_dir="/Users/isa/Experiments/PCA/CapitolBOXM_6_4_4/10";
-#nblocks_x=6;
-#nblocks_y=4;
-#nblocks_z=4;
-
-
-model_dir="/Users/isa/Experiments/DowntownBOXM_3_3_1";
-model_name="downtown_scene";
-pca_dir="/Users/isa/Experiments/PCA/DowntownBOXM_3_3_1/10";
-nblocks_x=3;
-nblocks_y=3;
-nblocks_z=1;
-
-train_fraction=0.1;
-test_fraction=1.0;
-num_cores=5;
-
-
-##************Compute Expected Color Scene
-#python /Projects/voxels-at-lems/scripts/boxm/compute_expected_color_scene.py --model_dir $model_dir --model_name $model_name
-
-#Compute PCA basis
-#python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/PCA/release/reconstruction_error/extract_pca_kernels.py --model_dir $model_dir --pca_dir $pca_dir --train_fraction $train_fraction
-
-#Compute reconstruction at each voxel in the scene
-for ((dim = 45; dim <125; dim++))
-do
- python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/PCA/release/reconstruction_error/compute_pca_error_scene.py --model_dir $model_dir --pca_dir $pca_dir --num_cores $num_cores --nblocks_x $nblocks_x --nblocks_y $nblocks_y --nblocks_z $nblocks_z --dimension $dim
-
- #Add error of fraction of voxels
-
- python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/PCA/release/reconstruction_error/add_pca_error.py --model_dir $model_dir --pca_dir $pca_dir --num_cores $num_cores --nblocks_x $nblocks_x --nblocks_y $nblocks_y --nblocks_z $nblocks_z --fraction $test_fraction --dimension $dim
-done
-
-# #Save all scenes to drishti raw file
-#python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/PCA/release/reconstruction_error/save_pca_raw.py --pca_dir $pca_dir --num_cores $num_cores
-
-#python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/taylor/release/reconstruction_error/explore_histogram.py --pca_dir $pca_dir --num_cores $num_cores
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/save_pca_raw.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/save_pca_raw.py
deleted file mode 100644
index 15d23e5ebf..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/reconstruction_error/save_pca_raw.py
+++ /dev/null
@@ -1,108 +0,0 @@
-import multiprocessing
-import Queue
-import time
-import os
-import optparse
-
-import brl_init
-import bvpl_octree_batch as batch
-dbvalue = brl_init.register_batch(batch)
-
-
-class save_scene_job():
-
- def __init__(self, input_scene_path, output_scene_path):
- self.input_scene_path = input_scene_path
- self.output_scene_path = output_scene_path
-
-
-def execute_jobs(jobs, num_procs=5):
- work_queue = multiprocessing.Queue()
- result_queue = multiprocessing.Queue()
- for job in jobs:
- work_queue.put(job)
-
- for i in range(num_procs):
- worker = save_scene_worker(work_queue, result_queue)
- worker.start()
- print("worker with name ", worker.name, " started!")
-
-
-class save_scene_worker(multiprocessing.Process):
-
- def __init__(self, work_queue, result_queue):
- # base class initialization
- multiprocessing.Process.__init__(self)
- # job management stuff
- self.work_queue = work_queue
- self.result_queue = result_queue
- self.kill_received = False
-
- def run(self):
- while not self.kill_received:
- # get a task
- try:
- job = self.work_queue.get_nowait()
- except Queue.Empty:
- break
-
- start_time = time.time()
-
- print("Creating a Scene")
- batch.init_process("boxmCreateSceneProcess")
- batch.set_input_string(0, job.input_scene_path)
- batch.run_process()
- (scene_id, scene_type) = batch.commit_output(0)
- scene = dbvalue(scene_id, scene_type)
-
- print("Save Scene")
- batch.init_process("boxmSaveSceneRawProcess")
- batch.set_input_from_db(0, scene)
- batch.set_input_string(1, job.output_scene_path)
- batch.set_input_unsigned(2, 0)
- batch.set_input_unsigned(3, 1)
- batch.run_process()
-
- print ("Runing time for worker:", self.name)
- print(time.time() - start_time)
-
-
-#*********************The Main Algorithm ****************************#
-if __name__ == "__main__":
-
- batch.register_processes()
- batch.register_datatypes()
-
- parser = optparse.OptionParser(
- description='Save taylor responses to raw file')
-
- parser.add_option('--pca_dir', action="store", dest="pca_dir")
- parser.add_option('--num_cores', action="store",
- dest="num_cores", type="int", default=4)
-
- options, args = parser.parse_args()
-
- pca_dir = options.pca_dir
- num_cores = options.num_cores
-
- if not os.path.isdir(pca_dir + "/"):
- print "Invalid Taylor Dir"
- sys.exit(-1)
-
- # Begin multiprocessing
- t1 = time.time()
- work_queue = multiprocessing.Queue()
- job_list = []
-
- # Enqueue jobs
- pca_feature_dim = 125
- for dim in range(0, pca_feature_dim):
-
- scene_in_path = pca_dir + "/error_" + str(dim) + "/error_scene.xml"
- scene_out_path = pca_dir + "/error_" + str(dim) + "/error_scene"
-
- current_job = save_scene_job(scene_in_path, scene_out_path)
-
- job_list.append(current_job)
-
- execute_jobs(job_list, num_cores)
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/extract_pca_kernels.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/extract_pca_kernels.py
deleted file mode 100644
index 1616b7850a..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/extract_pca_kernels.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# Computes the gaussian gradients on a boxm_alpha_scene
-
-import os
-import optparse
-import time
-import sys
-
-import brl_init
-import bvpl_octree_batch as batch
-dbvalue = brl_init.register_batch(batch)
-
-if __name__ == "__main__":
-
- batch.register_processes()
- batch.register_datatypes()
-
- # Parse inputs
- parser = optparse.OptionParser(description='Compute PCA basis')
-
- parser.add_option('--model_dir', action="store", dest="model_dir")
- parser.add_option('--pca_dir', action="store", dest="pca_dir")
- parser.add_option('--train_fraction', action="store",
- dest="train_fraction", type="float", default=0.0)
- options, args = parser.parse_args()
-
- model_dir = options.model_dir
- pca_dir = options.pca_dir
- train_fraction = (options.train_fraction) / 10
-
- if not os.path.isdir(model_dir + "/"):
- print "Invalid Model Dir"
- sys.exit(-1)
-
- if not os.path.isdir(pca_dir + "/"):
- os.makedirs(pca_dir + "/")
-
- pca_dir = pca_dir + "/" + str(int(train_fraction * 100))
- if not os.path.isdir(pca_dir + "/"):
- os.makedirs(pca_dir + "/")
-
- print("Extracting Principal Components patches")
-
- print("Creating a Scene")
- batch.init_process("boxmCreateSceneProcess")
- batch.set_input_string(0, model_dir + "/mean_color_scene.xml")
- batch.run_process()
- (scene_id, scene_type) = batch.commit_output(0)
- scene = dbvalue(scene_id, scene_type)
-
- start_time = time.time()
-
- print("Extract PC")
- batch.init_process("bvplDiscoverPCAFeaturesProcess")
- batch.set_input_from_db(0, scene)
- batch.set_input_string(1, pca_dir)
- batch.set_input_double(2, train_fraction)
- batch.set_input_int(3, -2) # min and max points of the kernel
- batch.set_input_int(4, -2)
- batch.set_input_int(5, -2)
- batch.set_input_int(6, 2)
- batch.set_input_int(7, 2)
- batch.set_input_int(8, 2)
- batch.run_process()
-
- print ("Runing time for bvplDiscoverPCAFeaturesProcess:")
- print(time.time() - start_time)
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/normalized_training_error.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/normalized_training_error.py
deleted file mode 100644
index e151f95144..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/normalized_training_error.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# Computes normalized pca training error
-
-import os
-import optparse
-import time
-import sys
-
-import brl_init
-import bvpl_octree_batch as batch
-dbvalue = brl_init.register_batch(batch)
-
-if __name__ == "__main__":
-
- batch.register_processes()
- batch.register_datatypes()
-
- # Parse inputs
- parser = optparse.OptionParser(description='Compute PCA basis')
-
- parser.add_option('--pca_dir', action="store", dest="pca_dir")
- parser.add_option('--train_fraction', action="store",
- dest="train_fraction", type="float", default=0.0)
- options, args = parser.parse_args()
-
- pca_dir = options.pca_dir
- train_fraction = (options.train_fraction) / 10
-
- if not os.path.isdir(pca_dir + "/"):
- os.makedirs(pca_dir + "/")
-
- pca_dir = pca_dir + "/" + str(int(train_fraction * 100))
- if not os.path.isdir(pca_dir + "/"):
- os.makedirs(pca_dir + "/")
-
- start_time = time.time()
-
- batch.init_process("bvplNormalizePCATrainingErrorProcess")
- batch.set_input_string(0, pca_dir)
- batch.run_process()
-
- print ("Runing time for bvplNormalizePCATrainingErrorProcess:")
- print(time.time() - start_time)
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/pca.sh b/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/pca.sh
deleted file mode 100755
index 82b0a516d8..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/pca/training_error/pca.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/bash
-"""
-Created on Mon Feb 14, 2011
-
-@author:Isabel Restrepo
-
-A script that encapsulates all steps needed to computer pca training error as a the number of training samples varies
-"""
-
-if [ $1 = "-r" ] ; then
- export PYTHONPATH=/projects/vxl/bin/release/lib
-else
- if [ $1 = "-d" ] ; then
- export PYTHONPATH=/projects/vxl/bin/Debug/lib
- else
- echo "Need a flag, either -d or -r";
- fi
-fi
-
-echo "PYTHONPATH=" $PYTHONPATH
-
-#model_dir="/Users/isa/Experiments/CapitolBOXMSmall";
-#pca_dir="/Users/isa/Experiments/PCA/CapitolBOXMSmall";
-
-model_dir="/homelocal/isa/Experiments/CapitolBOXM_6_4_4";
-pca_dir="/homelocal/isa/Experiments/PCA/CapitolBOXM_6_4_4";
-
-
-#model_dir="/Users/isa/Experiments/DowntownBOXM_3_3_1";
-#pca_dir="/Users/isa/Experiments/PCA/DowntownBOXM_3_3_1";
-
-
-##Compute Expected Color Scene
-#python /Projects/voxels-at-lems/scripts/boxm/compute_expected_color_scene.py --model_dir $model_dir --model_name $model_name
-
-#Compute reconstruction at each voxel in the scene
-for ((dim = 2; dim <11; dim++))
-do
- #Compute PCA basis
- python extract_pca_kernels.py --model_dir $model_dir --pca_dir $pca_dir --train_fraction $dim
-done
-
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/readme.txt b/contrib/brl/bseg/bvpl/bvpl_octree/python/readme.txt
deleted file mode 100644
index 5030ca4508..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/readme.txt
+++ /dev/null
@@ -1 +0,0 @@
-This folder contains Python scripts that use the main processes of bvpl_octree
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/add_taylor_error.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/add_taylor_error.py
deleted file mode 100644
index a7084e3cbe..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/add_taylor_error.py
+++ /dev/null
@@ -1,183 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-Created on Mon Feb 14, 2011
-
-@author:Isabel Restrepo
-
-Adds the error of a portion of voxels. Each block is processed in a separate thread.
-This script assumes that the reconstruction error at each voxel has been computed
-"""
-import os
-import multiprocessing
-import Queue
-import time
-import random
-import optparse
-
-import brl_init
-import bvpl_octree_batch as batch
-dbvalue = brl_init.register_batch(batch)
-
-
-class taylor_error_job():
-
- def __init__(self, error_scene, fraction, block_i, block_j, block_k):
- self.error_scene = error_scene
- self.fraction = fraction
- self.block_i = block_i
- self.block_j = block_j
- self.block_k = block_k
-
-
-def execute_jobs(jobs, num_procs=4):
- # load up work queue
- work_queue = multiprocessing.Queue()
- for job in jobs:
- work_queue.put(job)
-
- # create a queue to pass to workers to store the results
- result_queue = multiprocessing.Queue()
-
- # spawn workers
- for i in range(num_procs):
- worker = taylor_error_worker(work_queue, result_queue)
- worker.start()
- print("worker with name ", worker.name, " started!")
-
- # collect the results off the queue
- results = []
- while len(results) < len(jobs):
- result = result_queue.get()
- results.append(result)
-
- return results
-
-
-class taylor_error_worker(multiprocessing.Process):
-
- def __init__(self, work_queue, result_queue):
- # base class initialization
- multiprocessing.Process.__init__(self)
- # job management stuff
- self.work_queue = work_queue
- self.result_queue = result_queue
- self.kill_received = False
-
- def run(self):
- while not self.kill_received:
- # get a task
- try:
- job = self.work_queue.get_nowait()
- except Queue.Empty:
- break
-
- start_time = time.time()
-
- print("Adding Errors")
- batch.init_process("bvplAddTaylorErrorsProcess")
- batch.set_input_from_db(0, job.error_scene)
- batch.set_input_double(1, job.fraction)
- batch.set_input_int(2, job.block_i)
- batch.set_input_int(3, job.block_j)
- batch.set_input_int(4, job.block_k)
- batch.run_process()
- (id, type) = batch.commit_output(0)
- error_val = dbvalue(id, type)
- error = batch.get_output_double(id)
-
- self.result_queue.put(error)
-
- print("error")
- print(error)
-
- print("Runing time for worker:", self.name)
- print(time.time() - start_time)
-
-
-#***************** The Main Algorithm ************************#
-
-if __name__ == "__main__":
-
- batch.register_processes()
- batch.register_datatypes()
-
- # Parse inputs
- parser = optparse.OptionParser(description='Add Taylor Errors in a Scene')
-
- parser.add_option('--model_dir', action="store", dest="model_dir")
- parser.add_option('--taylor_dir', action="store", dest="taylor_dir")
- parser.add_option('--fraction', action="store",
- dest="fraction", type="float", default=0.0)
- parser.add_option('--num_cores', action="store",
- dest="num_cores", type="int", default=4)
- parser.add_option('--nblocks_x', action="store",
- dest="nblocks_x", type="int", default=1)
- parser.add_option('--nblocks_y', action="store",
- dest="nblocks_y", type="int", default=1)
- parser.add_option('--nblocks_z', action="store",
- dest="nblocks_z", type="int", default=1)
-
- options, args = parser.parse_args()
-
- model_dir = options.model_dir
- taylor_dir = options.taylor_dir
- nblocks_x = options.nblocks_x
- nblocks_y = options.nblocks_y
- nblocks_z = options.nblocks_z
- num_cores = options.num_cores
- fraction = options.fraction
-
- if not os.path.isdir(model_dir + "/"):
- print "Invalid Model Dir"
- sys.exit(-1)
-
- if not os.path.isdir(taylor_dir + "/"):
- print "Invalid Taylor Dir"
- sys.exit(-1)
-
- print("Loading Error Scene")
- batch.init_process("boxmCreateSceneProcess")
- batch.set_input_string(0, taylor_dir + "/error_scene.xml")
- batch.run_process()
- (scene_id, scene_type) = batch.commit_output(0)
- error_scene = dbvalue(scene_id, scene_type)
-
- # Begin multiprocessing
- work_queue = multiprocessing.Queue()
- job_list = []
-
- blocks_x = [i for i in range(0, nblocks_x)]
- blocks_y = [i for i in range(0, nblocks_y)]
- blocks_z = [i for i in range(0, nblocks_z)]
-
- random.shuffle(blocks_x)
- random.shuffle(blocks_y)
- random.shuffle(blocks_y)
-
- # Enqueue jobs
- for i in range(0, len(blocks_x)):
- for j in range(0, len(blocks_y)):
- for k in range(0, len(blocks_z)):
- block_i = blocks_x[i]
- block_j = blocks_y[j]
- block_k = blocks_z[k]
- current_job = taylor_error_job(
- error_scene, fraction, block_i, block_j, block_k)
- job_list.append(current_job)
-
- # run
- results = execute_jobs(job_list, num_cores)
-
- # dump results
- total_error = 0
- for r in results:
- print(r)
- total_error = total_error + r
-
- # write schedule file
- int_frac = int(fraction * 100)
- error_file = taylor_dir + "/error_" + str(int_frac) + ".txt"
- fd = open(error_file, "w")
- print >>fd, total_error / len(results)
- print >>fd, results
- fd.close()
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/compute_taylor_error_scene.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/compute_taylor_error_scene.py
deleted file mode 100644
index 11386b774c..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/compute_taylor_error_scene.py
+++ /dev/null
@@ -1,156 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-Created on Mon Feb 14, 2011
-
-@author:Isabel Restrepo
-
-Compuets Taylor reconstruction error. Each block is processed in a separate thread.
-This script assumes that the taylor kernels have been run on the data scene as done in run_taylor_kernels.py
-"""
-import os
-import multiprocessing
-import Queue
-import time
-import random
-import optparse
-
-import brl_init
-import bvpl_octree_batch as batch
-dbvalue = brl_init.register_batch(batch)
-
-
-class taylor_error_job():
-
- def __init__(self, data_scene, taylor_scenes, block_i, block_j, block_k):
- self.data_scene = data_scene
- self.taylor_scenes = taylor_scenes
- self.block_i = block_i
- self.block_j = block_j
- self.block_k = block_k
-
-
-def execute_jobs(jobs, num_procs=4):
- work_queue = multiprocessing.Queue()
- result_queue = multiprocessing.Queue()
- for job in jobs:
- work_queue.put(job)
-
- for i in range(num_procs):
- worker = taylor_error_worker(work_queue, result_queue)
- worker.start()
- print("worker with name ", worker.name, " started!")
-
-
-class taylor_error_worker(multiprocessing.Process):
-
- def __init__(self, work_queue, result_queue):
- # base class initialization
- multiprocessing.Process.__init__(self)
- # job management stuff
- self.work_queue = work_queue
- self.result_queue = result_queue
- self.kill_received = False
-
- def run(self):
- while not self.kill_received:
- # get a task
- try:
- job = self.work_queue.get_nowait()
- except Queue.Empty:
- break
-
- start_time = time.time()
-
- print("Computing Error Scene")
- batch.init_process("bvplComputeTaylorErrorProcess")
- batch.set_input_from_db(0, job.data_scene)
- batch.set_input_from_db(1, job.taylor_scenes)
- batch.set_input_int(2, job.block_i)
- batch.set_input_int(3, job.block_j)
- batch.set_input_int(4, job.block_k)
- batch.run_process()
-
- print("Runing time for worker:", self.name)
- print(time.time() - start_time)
-
-#*******************The Main Algorithm ************************#
-if __name__ == "__main__":
- batch.register_processes()
- batch.register_datatypes()
-
- # Parse inputs
- parser = optparse.OptionParser(description='Compute Taylor Error Scene')
-
- parser.add_option('--model_dir', action="store", dest="model_dir")
- parser.add_option('--taylor_dir', action="store", dest="taylor_dir")
- parser.add_option('--num_cores', action="store",
- dest="num_cores", type="int", default=4)
- parser.add_option('--nblocks_x', action="store",
- dest="nblocks_x", type="int")
- parser.add_option('--nblocks_y', action="store",
- dest="nblocks_y", type="int")
- parser.add_option('--nblocks_z', action="store",
- dest="nblocks_z", type="int")
-
- options, args = parser.parse_args()
-
- model_dir = options.model_dir
- taylor_dir = options.taylor_dir
- nblocks_x = options.nblocks_x
- nblocks_y = options.nblocks_y
- nblocks_z = options.nblocks_z
- num_cores = options.num_cores
-
- if not os.path.isdir(model_dir + "/"):
- print "Invalid Model Dir"
- sys.exit(-1)
-
- if not os.path.isdir(taylor_dir + "/"):
- print "Invalid Taylor Dir"
- sys.exit(-1)
-
- print("Loading Data Scene")
- batch.init_process("boxmCreateSceneProcess")
- batch.set_input_string(0, model_dir + "/mean_color_scene.xml")
- batch.run_process()
- (scene_id, scene_type) = batch.commit_output(0)
- data_scene = dbvalue(scene_id, scene_type)
-
- # Load taylor scenes
- print("Loading Taylor Scenes")
- batch.init_process("bvplLoadTaylorScenesProcess")
- batch.set_input_string(0, taylor_dir)
- batch.set_input_int(1, -2) # min and max points of the kernel
- batch.set_input_int(2, -2)
- batch.set_input_int(3, -2)
- batch.set_input_int(4, 2)
- batch.set_input_int(5, 2)
- batch.set_input_int(6, 2)
- batch.run_process()
- (id, type) = batch.commit_output(0)
- taylor_scenes = dbvalue(id, type)
-
- # Begin multiprocessing
- work_queue = multiprocessing.Queue()
- job_list = []
-
- blocks_x = [i for i in range(0, nblocks_x)]
- blocks_y = [i for i in range(0, nblocks_y)]
- blocks_z = [i for i in range(0, nblocks_z)]
-
- random.shuffle(blocks_x)
- random.shuffle(blocks_y)
- random.shuffle(blocks_y)
-
- # Enqueue jobs
- for i in range(0, len(blocks_x)):
- for j in range(0, len(blocks_y)):
- for k in range(0, len(blocks_z)):
- block_i = blocks_x[i]
- block_j = blocks_y[j]
- block_k = blocks_z[k]
- current_job = taylor_error_job(
- data_scene, taylor_scenes, block_i, block_j, block_k)
- job_list.append(current_job)
-
- execute_jobs(job_list, num_cores)
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/explore_histogram.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/explore_histogram.py
deleted file mode 100644
index 40fcac4910..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/explore_histogram.py
+++ /dev/null
@@ -1,113 +0,0 @@
-import os
-import multiprocessing
-import Queue
-import time
-import random
-import optparse
-
-import brl_init
-import bvpl_octree_batch as batch
-dbvalue = brl_init.register_batch(batch)
-
-
-class histogram_job():
-
- def __init__(self, scene_path):
- self.scene_path = scene_path
-
-
-def execute_jobs(jobs, num_procs=4):
- work_queue = multiprocessing.Queue()
- result_queue = multiprocessing.Queue()
- for job in jobs:
- work_queue.put(job)
-
- for i in range(num_procs):
- worker = histogram_worker(work_queue, result_queue)
- worker.start()
- print("worker with name ", worker.name, " started!")
-
-
-class histogram_worker(multiprocessing.Process):
-
- def __init__(self, work_queue, result_queue):
- # base class initialization
- multiprocessing.Process.__init__(self)
- # job management stuff
- self.work_queue = work_queue
- self.result_queue = result_queue
- self.kill_received = False
-
- def run(self):
- while not self.kill_received:
- # get a task
- try:
- job = self.work_queue.get_nowait()
- except Queue.Empty:
- break
-
- start_time = time.time()
-
- print("Creating a Scene")
- batch.init_process("boxmCreateSceneProcess")
- batch.set_input_string(0, job.scene_path)
- batch.run_process()
- (scene_id, scene_type) = batch.commit_output(0)
- scene = dbvalue(scene_id, scene_type)
-
- print("Explore Histogram")
- batch.init_process("bvplSceneHistorgramProcess")
- batch.set_input_from_db(0, scene)
- batch.run_process()
-
- print("Runing time for worker:", self.name)
- print(time.time() - start_time)
-
-#*******************The Main Algorithm ************************#
-
-if __name__ == "__main__":
-
- batch.register_processes()
- batch.register_datatypes()
-
- parser = optparse.OptionParser(description='Run Taylor Kernels')
-
- parser.add_option('--taylor_dir', action="store", dest="taylor_dir")
- parser.add_option('--num_cores', action="store",
- dest="num_cores", type="int", default=4)
-
- options, args = parser.parse_args()
-
- taylor_dir = options.taylor_dir
- num_cores = options.num_cores
-
- if not os.path.isdir(taylor_dir + "/"):
- print "Invalid Taylor Dir"
- sys.exit(-1)
-
- # Kernel names for 2-degree approximation
- kernel_list = []
- kernel_list.append("I0")
- kernel_list.append("Ix")
- kernel_list.append("Iy")
- kernel_list.append("Iz")
- kernel_list.append("Ixx")
- kernel_list.append("Iyy")
- kernel_list.append("Izz")
- kernel_list.append("Ixy")
- kernel_list.append("Ixz")
- kernel_list.append("Iyz")
-
- # Begin multiprocessing
- t1 = time.time()
- work_queue = multiprocessing.Queue()
- job_list = []
-
- # Enqueue jobs
- for curr_kernel in range(0, len(kernel_list)):
- scene_path = taylor_dir + "/" + \
- kernel_list[curr_kernel] + "/float_response_scene.xml"
- current_job = histogram_job(scene_path)
- job_list.append(current_job)
-
- execute_jobs(job_list, num_cores)
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/run_taylor_kernels.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/run_taylor_kernels.py
deleted file mode 100644
index 76a0beacab..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/run_taylor_kernels.py
+++ /dev/null
@@ -1,98 +0,0 @@
-import os
-from multiprocessing import Queue
-from taylor_kernel_threads import taylor_kernel_job, execute_jobs
-import time
-import optparse
-import random
-
-import brl_init
-import bvpl_octree_batch as batch
-dbvalue = brl_init.register_batch(batch)
-
-if __name__ == "__main__":
- parser = optparse.OptionParser(description='Run Taylor Kernels')
-
- parser.add_option('--model_dir', action="store", dest="model_dir")
- parser.add_option('--taylor_dir', action="store", dest="taylor_dir")
- parser.add_option('--kernel_path', action="store", dest="kernel_path")
- parser.add_option('--num_cores', action="store",
- dest="num_cores", type="int", default=4)
- parser.add_option('--nblocks_x', action="store",
- dest="nblocks_x", type="int")
- parser.add_option('--nblocks_y', action="store",
- dest="nblocks_y", type="int")
- parser.add_option('--nblocks_z', action="store",
- dest="nblocks_z", type="int")
-
- options, args = parser.parse_args()
-
- model_dir = options.model_dir
- taylor_dir = options.taylor_dir
- kernel_path = options.kernel_path
- nblocks_x = options.nblocks_x
- nblocks_y = options.nblocks_y
- nblocks_z = options.nblocks_z
- num_cores = options.num_cores
-
- if not os.path.isdir(model_dir + "/"):
- print "Invalid Model Dir"
- sys.exit(-1)
-
- if not os.path.isdir(model_dir + "/"):
- print "Invalid Kernel Path"
- sys.exit(-1)
-
- if not os.path.isdir(taylor_dir + "/"):
- os.mkdir(taylor_dir + "/")
-
- # Kernel names for 2-degree approximation
- kernel_list = []
- kernel_list.append("I0")
- kernel_list.append("Ix")
- kernel_list.append("Iy")
- kernel_list.append("Iz")
- kernel_list.append("Ixx")
- kernel_list.append("Iyy")
- kernel_list.append("Izz")
- kernel_list.append("Ixy")
- kernel_list.append("Ixz")
- kernel_list.append("Iyz")
-
- print("Creating a Scene")
- batch.init_process("boxmCreateSceneProcess")
- batch.set_input_string(0, model_dir + "/mean_color_scene.xml")
- batch.run_process()
- (scene_id, scene_type) = batch.commit_output(0)
- scene = dbvalue(scene_id, scene_type)
-
- # Begin multiprocessing
- t1 = time.time()
- work_queue = Queue()
- job_list = []
-
- blocks_x = [i for i in range(0, nblocks_x)]
- blocks_y = [i for i in range(0, nblocks_y)]
- blocks_z = [i for i in range(0, nblocks_z)]
-
- random.shuffle(blocks_x)
- random.shuffle(blocks_y)
- random.shuffle(blocks_y)
-
- # Enqueue jobs
- for curr_kernel in range(0, len(kernel_list)):
- for i in range(0, len(blocks_x)):
- for j in range(0, len(blocks_y)):
- for k in range(0, len(blocks_z)):
- block_i = blocks_x[i]
- block_j = blocks_y[j]
- block_k = blocks_z[k]
- curr_kernel_path = kernel_path + "/" + \
- kernel_list[curr_kernel] + ".txt"
- output_path = taylor_dir + "/" + kernel_list[curr_kernel]
- if not os.path.isdir(output_path + "/"):
- os.mkdir(output_path + "/")
- current_job = taylor_kernel_job(
- scene, curr_kernel_path, block_i, block_j, block_k, output_path)
- job_list.append(current_job)
-
- execute_jobs(job_list, num_cores)
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/save_taylor_raw.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/save_taylor_raw.py
deleted file mode 100644
index 1694729229..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/save_taylor_raw.py
+++ /dev/null
@@ -1,146 +0,0 @@
-import multiprocessing
-import Queue
-import time
-import os
-import optparse
-
-import brl_init
-import bvpl_octree_batch as batch
-dbvalue = brl_init.register_batch(batch)
-
-
-class save_scene_job():
-
- def __init__(self, input_scene_path, output_scene_path):
- self.input_scene_path = input_scene_path
- self.output_scene_path = output_scene_path
-
-
-def execute_jobs(jobs, num_procs=5):
- work_queue = multiprocessing.Queue()
- result_queue = multiprocessing.Queue()
- for job in jobs:
- work_queue.put(job)
-
- for i in range(num_procs):
- worker = save_scene_worker(work_queue, result_queue)
- worker.start()
- print("worker with name ", worker.name, " started!")
-
-
-class save_scene_worker(multiprocessing.Process):
-
- def __init__(self, work_queue, result_queue):
- # base class initialization
- multiprocessing.Process.__init__(self)
- # job management stuff
- self.work_queue = work_queue
- self.result_queue = result_queue
- self.kill_received = False
-
- def run(self):
- while not self.kill_received:
- # get a task
- try:
- job = self.work_queue.get_nowait()
- except Queue.Empty:
- break
-
- start_time = time.time()
-
- print("Creating a Scene")
- batch.init_process("boxmCreateSceneProcess")
- batch.set_input_string(0, job.input_scene_path)
- batch.run_process()
- (scene_id, scene_type) = batch.commit_output(0)
- scene = dbvalue(scene_id, scene_type)
-
- print("Save Scene")
- batch.init_process("boxmSaveSceneRawProcess")
- batch.set_input_from_db(0, scene)
- batch.set_input_string(
- 1, job.output_scene_path + "_float")
- batch.set_input_unsigned(2, 0)
- batch.set_input_unsigned(3, 1)
- batch.run_process()
-
-# resolution = 0;
-# enforce_level = 1;
-
-# print("Convert to regular grid");
-# batch.init_process("boxmSceneToBvxmGridProcess");
-# batch.set_input_from_db(0,scene);
-# batch.set_input_string(1, job.output_scene_path + ".vox");
-# batch.set_input_unsigned(2, resolution);
-# batch.set_input_bool(3, enforce_level);
-# batch.run_process();
-# (grid_id, grid_type) = batch.commit_output(0);
-# grid = dbvalue(grid_id, grid_type);
-#
-# print("Save Grid");
-# batch.init_process("bvxmSaveGridRawProcess");
-# batch.set_input_from_db(0,grid);
-# batch.set_input_string(1,job.output_scene_path + ".raw");
-# batch.run_process();
-
- print ("Runing time for worker:", self.name)
- print(time.time() - start_time)
-
-
-#*********************The Main Algorithm ****************************#
-if __name__ == "__main__":
-
- batch.register_processes()
- batch.register_datatypes()
-
- parser = optparse.OptionParser(
- description='Save taylor responses to raw file')
-
- parser.add_option('--taylor_dir', action="store", dest="taylor_dir")
- parser.add_option('--num_cores', action="store",
- dest="num_cores", type="int", default=4)
-
- options, args = parser.parse_args()
-
- taylor_dir = options.taylor_dir
- num_cores = options.num_cores
-
- if not os.path.isdir(taylor_dir + "/"):
- print "Invalid Taylor Dir"
- sys.exit(-1)
-
- kernel_list = []
-
- kernel_list.append("I0")
- kernel_list.append("Ix")
- kernel_list.append("Iy")
- kernel_list.append("Iz")
- kernel_list.append("Ixx")
- kernel_list.append("Iyy")
- kernel_list.append("Izz")
- kernel_list.append("Ixy")
- kernel_list.append("Ixz")
- kernel_list.append("Iyz")
-
- # Begin multiprocessing
- t1 = time.time()
- work_queue = multiprocessing.Queue()
- job_list = []
-
- # Enqueue jobs
-# for i in range(0, len(kernel_list)):
-#
-# scene_in_path = taylor_dir + "/" + kernel_list[i] + "/float_response_scene.xml";
-# scene_out_path = taylor_dir + "/" + kernel_list[i]+ "/float_response_scene";
-#
-# current_job = save_scene_job(scene_in_path, scene_out_path);
-#
-# job_list.append(current_job);
-
- # append error scene
- scene_in_path = taylor_dir + "/error_scene.xml"
- scene_out_path = taylor_dir + "/error_scene"
- current_job = save_scene_job(scene_in_path, scene_out_path)
- job_list.append(current_job)
-
- execute_jobs(job_list, num_cores)
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/taylor.sh b/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/taylor.sh
deleted file mode 100755
index db27ee1939..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/taylor.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/bash
-"""
-Created on Mon Feb 14, 2011
-
-@author:Isabel Restrepo
-
-A script that encapsulates all steps needed to computer taylor reconstruction error
-"""
-
-if [ $1 = "-r" ] ; then
- export PYTHONPATH=/Projects/vxl/bin/Release/lib
-else
- if [ $1 = "-d" ] ; then
- export PYTHONPATH=/Projects/vxl/bin/Debug/lib
- else
- echo "Need a flag, either -d or -r";
- fi
-fi
-
-echo "PYTHONPATH=" $PYTHONPATH
-
-#model_dir="/Users/isa/Experiments/CapitolBOXMSmall";
-#taylor_dir="/Users/isa/Experiments/Taylor/CapitolBOXMSmall_test";
-#kernel_path="/Projects/vxl/src/contrib/brl/bseg/bvpl/doc/taylor2_5_5_5";
-#nblocks_x=1;
-#nblocks_y=1;
-#nblocks_z=1;
-
-
-#model_dir="/Users/isa/Experiments/CapitolBOXM_6_4_4";
-#model_name="capitol_scene";
-#taylor_dir="/Users/isa/Experiments/Taylor/CapitolBOXM_6_4_4";
-#kernel_path="/Projects/vxl/src/contrib/brl/bseg/bvpl/doc/taylor2_5_5_5";
-#nblocks_x=6;
-#nblocks_y=4;
-#nblocks_z=4;
-
-
-model_dir="/Users/isa/Experiments/DowntownBOXM_12_12_4";
-model_name="downtown_scene";
-taylor_dir="/Users/isa/Experiments/Taylor/DowntownBOXM_12_12_4";
-kernel_path="/Projects/vxl/src/contrib/brl/bseg/bvpl/doc/taylor2_5_5_5";
-nblocks_x=12;
-nblocks_y=12;
-nblocks_z=4;
-
-fraction=1.0;
-num_cores=10;
-
-cd "/Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/taylor"
-
-# #Compute Expected Color Scene
-#python /Projects/voxels-at-lems/scripts/boxm/compute_expected_color_scene.py --model_dir $model_dir --model_name $model_name
-#
-# #Compute Responses to Taylor Kernels
-#python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/taylor/release/run_taylor_kernels.py --model_dir $model_dir --taylor_dir $taylor_dir --kernel_path $kernel_path --num_cores $num_cores --nblocks_x $nblocks_x --nblocks_y $nblocks_y --nblocks_z $nblocks_z
-#
-# #Compute reconstruction at each voxel in the scene
-#python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/taylor/release/compute_taylor_error_scene.py --model_dir $model_dir --taylor_dir $taylor_dir --num_cores $num_cores --nblocks_x $nblocks_x --nblocks_y $nblocks_y --nblocks_z $nblocks_z
-#
-# #Add error of fraction of voxels
-#python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/taylor/release/add_taylor_error.py --model_dir $model_dir --taylor_dir $taylor_dir --num_cores $num_cores --nblocks_x $nblocks_x --nblocks_y $nblocks_y --nblocks_z $nblocks_z --fraction $fraction
-#
-# #Save all scenes to drishti raw file
-python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/taylor/release/save_taylor_raw.py --taylor_dir $taylor_dir --num_cores $num_cores
-
-#python /Projects/voxels-at-lems/scripts/bvpl/bvpl_octree/taylor/release/explore_histogram.py --taylor_dir $taylor_dir --num_cores $num_cores
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/taylor_kernel_threads.py b/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/taylor_kernel_threads.py
deleted file mode 100644
index 029ce9315d..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/python/taylor/reconstruction_error/taylor_kernel_threads.py
+++ /dev/null
@@ -1,72 +0,0 @@
-import multiprocessing
-import Queue
-import time
-
-import brl_init
-import bvpl_octree_batch as batch
-dbvalue = brl_init.register_batch(batch)
-
-
-class taylor_kernel_job():
-
- def __init__(self, scene, kernel_path, block_i, block_j, block_k, output_path):
- self.scene = scene
- self.kernel_path = kernel_path
- self.block_i = block_i
- self.block_j = block_j
- self.block_k = block_k
- self.output_path = output_path
-
-
-def execute_jobs(jobs, num_procs=5):
- work_queue = multiprocessing.Queue()
- result_queue = multiprocessing.Queue()
- for job in jobs:
- work_queue.put(job)
-
- for i in range(num_procs):
- worker = taylor_kernel_worker(work_queue, result_queue)
- worker.start()
- print("worker with name ", worker.name, " started!")
-
-
-class taylor_kernel_worker(multiprocessing.Process):
-
- def __init__(self, work_queue, result_queue):
- # base class initialization
- multiprocessing.Process.__init__(self)
- # job management stuff
- self.work_queue = work_queue
- self.result_queue = result_queue
- self.kill_received = False
-
- def run(self):
- while not self.kill_received:
- # get a task
- try:
- job = self.work_queue.get_nowait()
- except Queue.Empty:
- break
-
- start_time = time.time()
-
- print("Creating taylor kernel")
- batch.init_process("bvplLoadTaylorKernelProcess")
- batch.set_input_string(0, job.kernel_path)
- batch.run_process()
- (kernel_id, kernel_type) = batch.commit_output(0)
- kernel = dbvalue(kernel_id, kernel_type)
-
- print("Running Kernel")
- batch.init_process("bvplBlockKernelOperatorProcess")
- batch.set_input_from_db(0, job.scene)
- batch.set_input_from_db(1, kernel)
- batch.set_input_int(2, job.block_i)
- batch.set_input_int(3, job.block_j)
- batch.set_input_int(4, job.block_k)
- batch.set_input_string(5, "algebraic")
- batch.set_input_string(6, job.output_path)
- batch.run_process()
-
- print ("Runing time for worker:", self.name)
- print(time.time() - start_time)
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/sample/CMakeLists.txt
deleted file mode 100644
index 0784ff8eea..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# contrib/brl/bseg/bvpl/bvpl_octree/sample/CMakeLists.txt
-
-set(bvpl_octree_sample_sources
- bvpl_octree_sample.h bvpl_octree_sample.hxx
- bvpl_taylor_basis_sample.h bvpl_taylor_basis_sample.cxx
- bvpl_pca_basis_sample.h bvpl_pca_basis_sample.hxx
- )
-
-aux_source_directory(Templates bvpl_octree_sample_sources)
-
-vxl_add_library(LIBRARY_NAME bvpl_octree_sample LIBRARY_SOURCES ${bvpl_octree_sample_sources})
-target_link_libraries(bvpl_octree_sample ${VXL_LIB_PREFIX}vnl_io ${VXL_LIB_PREFIX}vnl)
-
-if( BUILD_TESTING )
- add_subdirectory(tests)
-endif()
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bsta_gaussian_sphere+float.1-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bsta_gaussian_sphere+float.1-.cxx
deleted file mode 100644
index 8cdbd4476b..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bsta_gaussian_sphere+float.1-.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <bsta/bsta_gaussian_sphere.hxx>
-
-BSTA_GAUSSIAN_SPHERE_INSTANTIATE(float, 1);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1--.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1--.cxx
deleted file mode 100644
index da403deee4..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_octree_sample+bsta_num_obs+bsta_gauss_sf1--.cxx
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.hxx>
-#include <bsta/bsta_gauss_sf1.h>
-#include <bsta/io/bsta_io_attributes.h>
-#include <bsta/io/bsta_io_gaussian_sphere.h>
-
-typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
-BVPL_OCTREE_SAMPLE_INSTANTIATE(gauss_type);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_octree_sample+float-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_octree_sample+float-.cxx
deleted file mode 100644
index f88db3342c..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_octree_sample+float-.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.hxx>
-
-BVPL_OCTREE_SAMPLE_INSTANTIATE(float);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_pca_basis_sample+10-.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_pca_basis_sample+10-.cxx
deleted file mode 100644
index fcaa1db057..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/Templates/bvpl_pca_basis_sample+10-.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.hxx>
-
-BVPL_PCA_BASIS_SAMPLE_INSTANTIATE(10);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.h b/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.h
deleted file mode 100644
index 8f1cc33b1f..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// This is brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.h
-#ifndef bvpl_octree_sample_h
-#define bvpl_octree_sample_h
-//:
-// \file
-// \brief A data structure to contain bvpl_kernel response, and id corresponding to axis of rotations and rotation around axis
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date December 9, 2009
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vsl/vsl_binary_io.h>
-
-template<class T_data>
-class bvpl_octree_sample
-{
- public:
- //: Default Constructor. Be careful when using default constructor, the value of response may be nonsense
- // This is indicated by the negative id.
- bvpl_octree_sample():response_(),id_(-1){}
-
- //: Constructor from response and id
- bvpl_octree_sample(const T_data& response, const int& id):
- response_(response),id_(id){}
-
- short version_no() const{ return 1; }
-
- void print(std::ostream& os) const;
-
- //Member variables
- T_data response_;
- int id_;
-};
-
-
-template<class T_data>
-void vsl_b_write(vsl_b_ostream & os, bvpl_octree_sample<T_data> const &sample);
-
-template<class T_data>
-void vsl_b_write(vsl_b_ostream & os, bvpl_octree_sample<T_data> const * &sample);
-
-template<class T_data>
-void vsl_b_read(vsl_b_istream & is, bvpl_octree_sample<T_data> &sample);
-
-template<class T_data>
-void vsl_b_read(vsl_b_istream & is, bvpl_octree_sample<T_data> *&sample);
-
-template<class T_data>
-std::ostream& operator << (std::ostream& os, const bvpl_octree_sample<T_data>& sample);
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.hxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.hxx
deleted file mode 100644
index fdc4d34d4a..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_octree_sample.hxx
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef bvpl_octree_sample_hxx_
-#define bvpl_octree_sample_hxx_
-
-#include "bvpl_octree_sample.h"
-
-
-template<class T_data>
-void vsl_b_write(vsl_b_ostream & os, bvpl_octree_sample<T_data> const &sample)
-{
- vsl_b_write(os, sample.version_no());
- vsl_b_write(os, sample.response_);
-}
-
-template<class T_data>
-void vsl_b_write(vsl_b_ostream & os, bvpl_octree_sample<T_data> const * &sample)
-{
- if (sample) {
- vsl_b_write(os, *sample);
- }
-}
-
-template<class T_data>
-void vsl_b_read(vsl_b_istream & is, bvpl_octree_sample<T_data> &sample)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case 1:
- vsl_b_read(is, sample.response_);
- break;
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_sample<T>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- break;
- }
-}
-
-template<class T_data>
-void vsl_b_read(vsl_b_istream & is, bvpl_octree_sample<T_data> *&sample)
-{
- vsl_b_read(is, *sample);
-}
-
-
-template<class T_data>
-void bvpl_octree_sample<T_data>::print(std::ostream& os) const
-{
- os << "(response=" << response_ << " id=" << id_ <<')';
-}
-
-template<class T_data>
-std::ostream& operator << (std::ostream& os, const bvpl_octree_sample<T_data>& sample)
-{
- sample.print(os);
- return os;
-}
-
-#define BVPL_OCTREE_SAMPLE_INSTANTIATE(T) \
-template class bvpl_octree_sample<T >; \
-template std::ostream& operator << (std::ostream&, const bvpl_octree_sample<T >&); \
-template void vsl_b_write(vsl_b_ostream &, bvpl_octree_sample<T > const &); \
-template void vsl_b_write(vsl_b_ostream &, bvpl_octree_sample<T > const *&); \
-template void vsl_b_read(vsl_b_istream &, bvpl_octree_sample<T > &); \
-template void vsl_b_read(vsl_b_istream &, bvpl_octree_sample<T > *&)
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.h b/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.h
deleted file mode 100644
index 64e29dd1fd..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// This is bvpl_pca_basis_sample.h
-#ifndef bvpl_pca_basis_sample_h
-#define bvpl_pca_basis_sample_h
-
-//:
-// \file
-// \brief A data structure that contains the vector of projections on pca space
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 28-Feb-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <vnl/vnl_vector_fixed.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vsl/vsl_binary_io.h>
-
-template <unsigned dim>
-class bvpl_pca_basis_sample{
-
-public:
- bvpl_pca_basis_sample(){
- pca_projections_.fill(0);
- }
-
- bvpl_pca_basis_sample(vnl_vector_fixed<double,dim> pp){
- pca_projections_ = pp;
- }
- inline short version_no() const{ return 1; }
-
- //: Vector of projections on pca space
- vnl_vector_fixed<double,dim> pca_projections_;
-
-};
-
-
-template <unsigned dim>
-std::ostream& operator << (std::ostream& os, const bvpl_pca_basis_sample<dim>& sample);
-
-template <unsigned dim>
-void vsl_b_write(vsl_b_ostream & os, bvpl_pca_basis_sample<dim> const &sample);
-
-template <unsigned dim>
-void vsl_b_write(vsl_b_ostream & os, bvpl_pca_basis_sample<dim> const * &sample);
-
-template <unsigned dim>
-void vsl_b_read(vsl_b_istream & is, bvpl_pca_basis_sample<dim> &sample);
-
-template <unsigned dim>
-void vsl_b_read(vsl_b_istream & is, bvpl_pca_basis_sample<dim> *&sample);
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.hxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.hxx
deleted file mode 100644
index 93769db3f7..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.hxx
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifndef bvpl_pca_basis_sample_hxx_
-#define bvpl_pca_basis_sample_hxx_
-//:
-// \file
-// \author Isabel Restrepo
-// \date 28-Feb-2011
-
-#include "bvpl_pca_basis_sample.h"
-
-#include <vnl/io/vnl_io_vector_fixed.h>
-#include <vsl/vsl_binary_io.h>
-
-
-template <unsigned dim>
-std::ostream& operator << (std::ostream& os, const bvpl_pca_basis_sample<dim>& sample)
-{
- os << "PCA projection = " << sample.pca_projections_ << std::endl;
- return os;
-}
-
-//I/O
-template <unsigned dim>
-void vsl_b_write(vsl_b_ostream & os, bvpl_pca_basis_sample<dim> const &sample)
-{
- vsl_b_write(os, sample.version_no());
- vsl_b_write(os, sample.pca_projections_);
-}
-
-template <unsigned dim>
-void vsl_b_write(vsl_b_ostream & os, bvpl_pca_basis_sample<dim> const * &sample)
-{
- if (sample) {
- vsl_b_write(os, *sample);
- }
-}
-
-template <unsigned dim>
-void vsl_b_read(vsl_b_istream & is, bvpl_pca_basis_sample<dim> &sample)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case 1:
- vsl_b_read(is, sample.pca_projections_);
- break;
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_sample<T>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- break;
- }
-}
-
-template <unsigned dim>
-void vsl_b_read(vsl_b_istream & is, bvpl_pca_basis_sample<dim> *&sample)
-{
- vsl_b_read(is, *sample);
-}
-
-
-#define BVPL_PCA_BASIS_SAMPLE_INSTANTIATE(T) \
-template class bvpl_pca_basis_sample<T >; \
-template std::ostream& operator << (std::ostream&, const bvpl_pca_basis_sample<T >&); \
-template void vsl_b_write(vsl_b_ostream &, bvpl_pca_basis_sample<T > const &); \
-template void vsl_b_write(vsl_b_ostream &, bvpl_pca_basis_sample<T > const *&); \
-template void vsl_b_read(vsl_b_istream &, bvpl_pca_basis_sample<T > &); \
-template void vsl_b_read(vsl_b_istream &, bvpl_pca_basis_sample<T > *&)
-
-#endif // bvpl_pca_basis_sample_hxx_
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.cxx
deleted file mode 100644
index f2d0372181..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.cxx
+++ /dev/null
@@ -1,58 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 10-Feb-2011
-
-#include "bvpl_taylor_basis_sample.h"
-#include <vnl/io/vnl_io_matrix_fixed.h>
-#include <vnl/io/vnl_io_vector_fixed.h>
-
-std::ostream& operator << (std::ostream& os, const bvpl_taylor_basis2_sample& sample)
-{
- os << "I0 = " << sample.I0 << ", G= " <<sample.G<< ", H=" << sample.H << std::endl;
- return os;
-}
-
-//I/O
-void vsl_b_write(vsl_b_ostream & os, bvpl_taylor_basis2_sample const &sample)
-{
- vsl_b_write(os, sample.version_no());
- vsl_b_write(os, sample.I0);
- vsl_b_write(os, sample.G);
- vsl_b_write(os, sample.H);
-
-}
-
-void vsl_b_write(vsl_b_ostream & os, bvpl_taylor_basis2_sample const * &sample)
-{
- if (sample) {
- vsl_b_write(os, *sample);
- }
-}
-
-void vsl_b_read(vsl_b_istream & is, bvpl_taylor_basis2_sample &sample)
-{
- if (!is) return;
-
- short version;
- vsl_b_read(is,version);
- switch (version)
- {
- case 1:
- vsl_b_read(is, sample.I0);
- vsl_b_read(is, sample.G);
- vsl_b_read(is, sample.H);
- break;
- default:
- std::cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, boxm_sample<T>&)\n"
- << " Unknown version number "<< version << '\n';
- is.is().clear(std::ios::badbit); // Set an unrecoverable IO error on stream
- break;
- }
-
-}
-
-void vsl_b_read(vsl_b_istream & is, bvpl_taylor_basis2_sample *&sample)
-{
- vsl_b_read(is, *sample);
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.h b/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.h
deleted file mode 100644
index a10ece861f..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// This is bvpl_taylor_basis_sample.h
-#ifndef bvpl_taylor_basis_sample_h
-#define bvpl_taylor_basis_sample_h
-
-//:
-// \file
-// \brief A data structure that contains vectors and matrices needed for taylor approximation
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date 10-Feb-2011.
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <vnl/vnl_double_3.h>
-#include <vnl/vnl_double_3x3.h>
-
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vsl/vsl_binary_io.h>
-
-
-//: Data structure needed for 2-degree taylor approximation of 3-dimesional volumes
-class bvpl_taylor_basis2_sample
-{
-public:
- bvpl_taylor_basis2_sample()
- {
- I0 = 0.0f;
- //empty - to save space
- G = vnl_double_3(0.0,0.0,0.0);
- H = vnl_double_3x3(0.0);
- }
-
- bvpl_taylor_basis2_sample(double zeroth_dev, vnl_double_3 grad, vnl_double_3x3 hess): I0(zeroth_dev), G(grad), H(hess){}
-
- short version_no() const{ return 1; }
- //: Approximation to zeroth derivative
- double I0;
- //: Approximation to the Gradient Vector
- vnl_double_3 G;
- //: Approximation to the Hessian
- vnl_double_3x3 H;
-};
-
-std::ostream& operator << (std::ostream& os, const bvpl_taylor_basis2_sample& sample);
-
-void vsl_b_write(vsl_b_ostream & os, bvpl_taylor_basis2_sample const &sample);
-
-void vsl_b_write(vsl_b_ostream & os, bvpl_taylor_basis2_sample const * &sample);
-
-void vsl_b_read(vsl_b_istream & is, bvpl_taylor_basis2_sample &sample);
-
-void vsl_b_read(vsl_b_istream & is, bvpl_taylor_basis2_sample *&sample);
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/CMakeLists.txt
deleted file mode 100644
index a5ca7c7bdf..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-add_executable( bvpl_octree_sample_test_include test_include.cxx )
-target_link_libraries( bvpl_octree_sample_test_include bvpl_octree_sample)
-add_executable( bvpl_octree_sample_test_template_include test_template_include.cxx )
-target_link_libraries( bvpl_octree_sample_test_template_include bvpl_octree_sample)
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/test_include.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/test_include.cxx
deleted file mode 100644
index df8d03d364..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/test_include.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.h>
-#include <bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.h>
-#include <bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/test_template_include.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/test_template_include.cxx
deleted file mode 100644
index 075d4723fb..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/sample/tests/test_template_include.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <bvpl/bvpl_octree/sample/bvpl_octree_sample.hxx>
-#include <bvpl/bvpl_octree/sample/bvpl_pca_basis_sample.hxx>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/CMakeLists.txt b/contrib/brl/bseg/bvpl/bvpl_octree/tests/CMakeLists.txt
deleted file mode 100644
index 5781fd45ca..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-include_directories( ${MUL_INCLUDE_DIR} )
-
-add_executable( bvpl_octree_test_all
- test_driver.cxx
- test_octree_kernel_operator.cxx
- test_octree_neighbors.cxx
-#Test EXHIBITS PATH ERRORS -- FIX_ME
-# test_pca_kernels.cxx
-#Test FAILS -- FIX_ME
-# test_taylor_basis.cxx
-# Test FAILS FIX_ME
-# test_gauss3D_steerable_filters.cxx
- )
-
-set(bvpl_octree_test_all_sources
- test_utils.h test_utils.cxx
- )
-
-vxl_add_library(LIBRARY_NAME bvpl_octree_tests_util LIBRARY_SOURCES ${bvpl_octree_test_all_sources})
-
-target_link_libraries( bvpl_octree_tests_util bvpl_octree_io bvpl_octree bvpl boct boxm ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vul)
-target_link_libraries( bvpl_octree_test_all bvpl_octree_tests_util bvpl_octree_io bvpl_octree bvpl boct boxm ${VXL_LIB_PREFIX}testlib ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vul)
-
-add_test( NAME bvpl_octree_test_kernel_operator COMMAND $<TARGET_FILE:bvpl_octree_test_all> test_octree_kernel_operator )
-add_test( NAME bvpl_octree_test_neighbors COMMAND $<TARGET_FILE:bvpl_octree_test_all> test_octree_neighbors )
-#add_test( NAME bvpl_octree_test_pca COMMAND $<TARGET_FILE:bvpl_octree_test_all> test_pca_kernels )
-#add_test( NAME bvpl_octree_test_taylor_basis COMMAND $<TARGET_FILE:bvpl_octree_test_all> test_taylor_basis )
-#add_test( NAME test_gauss3D_steerable_filters COMMAND $<TARGET_FILE:bvpl_octree_test_all> test_gauss3D_steerable_filters )
-
-add_executable( bvpl_octree_test_include test_include.cxx )
-target_link_libraries( bvpl_octree_test_include bvpl_octree)
-
-add_executable( bvpl_octree_test_template_include test_template_include.cxx )
-target_link_libraries( bvpl_octree_test_template_include bvpl_octree)
-
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_driver.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_driver.cxx
deleted file mode 100644
index b1b39e0bed..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_driver.cxx
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <testlib/testlib_register.h>
-
-DECLARE( test_octree_kernel_operator );
-DECLARE( test_octree_neighbors );
-//DECLARE( test_pca_kernels );//TEST EXHIBITS PATH ERRORS
-//DECLARE( test_taylor_basis );//TEST FAILS FIX_ME
-//DECLARE( test_gauss3D_steerable_filters );//TEST FAILS FIX_ME
-
-void register_tests()
-{
- REGISTER( test_octree_kernel_operator );
- REGISTER( test_octree_neighbors );
- // REGISTER( test_pca_kernels );
- // REGISTER( test_taylor_basis );
- // REGISTER( test_gauss3D_steerable_filters );
-}
-
-
-DEFINE_MAIN;
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_gauss3D_steerable_filters.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_gauss3D_steerable_filters.cxx
deleted file mode 100644
index 47ec04a8ef..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_gauss3D_steerable_filters.cxx
+++ /dev/null
@@ -1,127 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 24-Aug-2011
-
-#include <testlib/testlib_test.h>
-
-#include "test_utils.h"
-
-#include <bvpl_octree/bvpl_gauss3D_steerable_filters.h>
-
-void test_gauss3D_steerable_filters()
-{
- typedef boct_tree<short, float> float_tree_type;
- typedef boct_tree<short, vnl_vector_fixed< float,10 > > out_tree_type;
-
- clean_up();
-
- //create scene
- boxm_scene<boct_tree<short, float > > *mean_scene = create_scene(2,2,2);
-
- //Explore mean scene
- std::cout << "Exploring mean scene \n";
- {
- boxm_cell_iterator<boct_tree<short,float > > iterator = mean_scene->cell_iterator(&boxm_scene<boct_tree<short, float > >::load_block);
- iterator.begin();
-
- while (!iterator.end()) {
- boct_tree_cell<short,float > *cell = *iterator;
- //if(cell->data().mean() > 0.6)
- {
- boct_loc_code<short> code =cell->get_code();
- std::cout << " Code: " <<code<< std::endl;
- std::cout << " At cell located at: " << iterator.global_origin() << " Data: " << cell->data() << std::endl;
-
- }
- ++iterator;
- }
- }
-
- //create the output scenes
- boxm_scene<out_tree_type> *scene_out =
- new boxm_scene<out_tree_type>(mean_scene->lvcs(), mean_scene->origin(), mean_scene->block_dim(), mean_scene->world_dim(), mean_scene->max_level(), mean_scene->init_level());
- scene_out->set_paths(".", "steerable_gauss_3d_scene");
- scene_out->set_appearance_model(VNL_FLOAT_10);
- scene_out->write_scene("steerable_gauss_3d_scene.xml");
- mean_scene->clone_blocks_to_vector<10>(*scene_out);
-
- //Explore Initial Response scene
- std::cout << "Exploring initial response scene \n";
- {
- boxm_cell_iterator<out_tree_type > iterator = scene_out->cell_iterator(&boxm_scene<out_tree_type>::load_block);
- iterator.begin();
-
- while (!iterator.end()) {
- boct_tree_cell<short, vnl_vector_fixed<float,10> > *cell = *iterator;
- //if(cell->data().mean() > 0.6)
- {
- boct_loc_code<short> code =cell->get_code();
- std::cout << " Code: " <<code<< std::endl;
- std::cout << " At cell located at: " << iterator.global_origin() << " Data: " << cell->data() << std::endl;
-
- }
- ++iterator;
- }
- }
-
- boxm_scene<boct_tree<short, bool> > *valid_scene =
- new boxm_scene<boct_tree<short, bool> >(mean_scene->lvcs(), mean_scene->origin(), mean_scene->block_dim(), mean_scene->world_dim(), mean_scene->max_level(), mean_scene->init_level());
- valid_scene->set_paths(".", "valid_scene");
- valid_scene->set_appearance_model(BOXM_BOOL);
- valid_scene->write_scene("valid_scene.xml");
-
- //operate on scene
- double cell_length = scene_out->finest_cell_length();
- bvpl_gauss3D_steerable_filters sf;
-
- sf.basis_response_at_leaves(scene_out, valid_scene, cell_length);
-
-
- //Explore Response scene
- std::cout << "Exploring response scene \n";
- {
- boxm_cell_iterator<out_tree_type > iterator = scene_out->cell_iterator(&boxm_scene<out_tree_type>::load_block);
- iterator.begin();
-
- while (!iterator.end()) {
- boct_tree_cell<short, vnl_vector_fixed<float,10> > *cell = *iterator;
- //if(cell->data().mean() > 0.6)
- {
- boct_loc_code<short> code =cell->get_code();
- std::cout << " Code: " <<code<< std::endl;
- std::cout << " At cell located at: " << iterator.global_origin() << " Data: " << cell->data() << std::endl;
-
- }
- ++iterator;
- }
- }
-
- //rotate features according to gradient
- sf.rotation_invariant_interpolation(scene_out, valid_scene);
-
- //Explore Invariant Response scene
- std::cout << "Exploring rotation invariant response scene \n";
- {
- boxm_cell_iterator<out_tree_type > iterator = scene_out->cell_iterator(&boxm_scene<out_tree_type>::load_block);
- iterator.begin();
-
- while (!iterator.end()) {
- boct_tree_cell<short, vnl_vector_fixed<float,10> > *cell = *iterator;
- //if(cell->data().mean() > 0.6)
- {
- boct_loc_code<short> code =cell->get_code();
- std::cout << " Code: " <<code<< std::endl;
- std::cout << " At cell located at: " << iterator.global_origin() << " Data: " << cell->data() << std::endl;
-
- }
- ++iterator;
- }
- }
-
- bool result = true;
- TEST("Valid Test", result, true);
-}
-
-
-TESTMAIN(test_gauss3D_steerable_filters);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_include.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_include.cxx
deleted file mode 100644
index a3b8a060e7..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_include.cxx
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <bvpl/bvpl_octree/bvpl_block_kernel_operator.h>
-#include <bvpl/bvpl_octree/bvpl_block_vector_operator.h>
-#include <bvpl/bvpl_octree/bvpl_cell_data_traits.h>
-#include <bvpl/bvpl_octree/bvpl_corner_detector.h>
-#include <bvpl/bvpl_octree/bvpl_corner_functors.h>
-#include <bvpl/bvpl_octree/bvpl_discover_pca_kernels.h>
-#include <bvpl/bvpl_octree/bvpl_gauss3D_steerable_filters.h>
-#include <bvpl/bvpl_octree/bvpl_global_corners.h>
-#include <bvpl/bvpl_octree/bvpl_global_pca.h>
-#include <bvpl/bvpl_octree/bvpl_global_taylor.h>
-#include <bvpl/bvpl_octree/bvpl_octree_kernel_operator.h>
-#include <bvpl/bvpl_octree/bvpl_octree_neighbors.h>
-#include <bvpl/bvpl_octree/bvpl_octree_vector_operator.h>
-#include <bvpl/bvpl_octree/bvpl_octree_vector_operator_impl.h>
-#include <bvpl/bvpl_octree/bvpl_octree_vrml_util.h>
-#include <bvpl/bvpl_octree/bvpl_pca_error_scenes.h>
-#include <bvpl/bvpl_octree/bvpl_scene_kernel_operator.h>
-#include <bvpl/bvpl_octree/bvpl_scene_neighborhood_operator.h>
-#include <bvpl/bvpl_octree/bvpl_scene_statistics.h>
-#include <bvpl/bvpl_octree/bvpl_scene_vector_operator.h>
-#include <bvpl/bvpl_octree/bvpl_taylor_basis.h>
-#include <bvpl/bvpl_octree/bvpl_taylor_scenes_map.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_octree_kernel_operator.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_octree_kernel_operator.cxx
deleted file mode 100644
index 73b0ddef0f..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_octree_kernel_operator.cxx
+++ /dev/null
@@ -1,352 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date Nov. 16, 2009.
-
-#include <testlib/testlib_test.h>
-
-#include "../bvpl_octree_kernel_operator.h"
-#include "../bvpl_scene_kernel_operator.h"
-#include "../bvpl_octree_vector_operator_impl.h"
-#include "../bvpl_scene_vector_operator.h"
-#include <bvpl/functors/bvpl_edge_geometric_mean_functor.h>
-#include <bvpl/kernels/bvpl_edge3d_kernel_factory.h>
-#include <bvpl/kernels/bvpl_create_directions.h>
-
-#include <boct/boct_loc_code.h>
-#include <vul/vul_file.h>
-#include <vul/vul_file_iterator.h>
-#include <vpl/vpl.h>
-
-static bool debug = false;
-typedef boct_tree<short, float> tree_type;
-typedef boct_tree_cell<short, float> cell_type;
-
-
-void fill_sample_octree(boct_tree<short,float>* tree)
-{
- std::cout << "Creating Octree" << std::endl;
-
- //Create tree
- tree->split();
-
- {
- std::vector<boct_tree_cell<short,float>*> leaves = tree->leaf_cells();
- tree->init_cells(0.1f);
- leaves[1]->set_data(0.5);
- if (debug)
- for (auto & leave : leaves) {
- std::cout<< leave->get_code().x_loc_ << ','
- << leave->get_code().y_loc_ << ','
- << leave->get_code().z_loc_ << ','
- << leave->data() << std::endl;
- }
-
- leaves[1]->split();
- //leaves[1]->set_data(0.6);
- }
-
-#if 0
- {
- std::vector<boct_tree_cell<short,float>*> leaves = tree->cells_at_level((short)0);
- for (unsigned i=0; i<leaves.size(); i++) {
- std::cout<< leaves[i]->get_code().x_loc_ << ','
- << leaves[i]->get_code().y_loc_ << ','
- << leaves[i]->get_code().z_loc_ << ','
- << tree->local_origin(leaves[i]) << ','
- << leaves[i]->get_code().level << ','
- << tree->cell_size(leaves[i]) << ','
- << leaves[i]->data() << std::endl;
- }
- }
-#endif
-}
-
-void fill_edge3d_tree(boct_tree<short,float>* tree)
-{
- tree-> split();
- std::vector<boct_tree_cell<short,float>*> leaves = tree->leaf_cells();
- for (unsigned i= 0; i<4; i++)
- {
- leaves[i]->set_data(0.2f);
- leaves[i]->split();
- {
- boct_tree_cell<short,float>* cc =leaves[i]->children();
- for (unsigned j1=0; j1<8; j1++)
- cc[j1].split();
- }
- leaves[i+4]->set_data(0.9f);
- leaves[i+4]->split();
- {
- boct_tree_cell<short,float>* cc =leaves[i+4]->children();
- for (unsigned j1=0; j1<8; j1++)
- cc[j1].split();
- }
- //split children
- std::vector<boct_tree_cell<short,float>*> leaves = tree->leaf_cells();
- }
-}
-
-void octree_kernel()
-{
- //Create kernel
- bvpl_edge3d_kernel_factory edge_factory(-1,1,-1,0,-1,0);
- bvpl_kernel_sptr kernel = new bvpl_kernel(edge_factory.create());
-#ifdef DEBUG
- kernel->print();
-#endif
- //Create functor
- bvpl_edge_geometric_mean_functor<float> functor;
-
- //Create the octree
- auto *tree = new boct_tree<short,float>(3);
- fill_sample_octree(tree);
-
- //operate kernel on octree
- bvpl_octree_kernel_operator<float> oper(tree);
-
- boct_tree<short,float> *tree_out = tree->clone();
-#ifdef DEBUG
- tree_out->print();
-#endif
- oper.operate(functor, kernel, tree_out, 1, 0.5);
-#ifdef DEBUG
- tree_out->print();
-#endif
-
- TEST("Octree kernel", true, true);
- delete tree;
- delete tree_out;
-}
-
-void scene_kernel_operator()
-{
- //Create kernel
- bvpl_edge3d_kernel_factory edge_factory(-1,0,-1,0,-1,0);
- bvpl_kernel_sptr kernel = new bvpl_kernel(edge_factory.create());
-
- //kernel->print();
-
- //Create functor
- bvpl_edge_geometric_mean_functor<float> functor;
-
-
- /***********Part1 operate on tree*******************/
-
- //Create tree
- typedef boct_tree<short,float > tree_type;
- auto *tree = new boct_tree<short,float>(3);
-
- fill_sample_octree(tree);
-
- //operate on octree
- bvpl_octree_kernel_operator<float> oper(tree);
-
-
- //Create output trees
- boct_tree<short,float > *tree_out = tree->clone();
- tree_out->init_cells(0.0f);
- short level = 0;
- double cell_length = 1.0/(double)(1<<(tree->root_level() -level));
-
- // void operate(F functor, bvpl_kernel_sptr kernel, tree_type* out_tree, short level, double cell_length)
- oper.operate(functor,kernel, tree_out, level, cell_length);
-
-
- /***********Part2 operate on scene*******************/
-
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(10,10,20);
-
- //world coordinate dimensions of a block
- vgl_vector_3d<double> block_dim(1,1,1);
-
- //number of blocks in a scene
- vgl_vector_3d<unsigned> world_dim(1,1,1);
- boxm_scene<tree_type> scene(lvcs, origin, block_dim, world_dim);
- std::string scene_path="./";
- scene.set_paths(scene_path, "in_block");
-
- boxm_block_iterator<tree_type> iter =scene.iterator();
- iter.begin();
- for (; !iter.end(); iter++) {
- scene.load_block(iter.index());
- boxm_block<tree_type> *block = scene.get_active_block();
- block->init_tree(tree->clone());
- scene.write_active_block();
- }
-
- //Create the output scenes
- boxm_scene<boct_tree<short,float> > scene_out(lvcs, origin, block_dim, world_dim);
- scene_out.set_paths(scene_path, "response_scene");
-
- //operate on scene
- bvpl_scene_kernel_operator scene_oper;
- scene_oper.operate(scene,functor, kernel, scene_out);
-
- //compare blocks of scene with single tree, result should be the same
- std::vector<boct_tree_cell<short,float>* > leaves_out = tree_out->leaf_cells();
- boxm_block_iterator<tree_type> iter2 =scene_out.iterator();
- bool eq=true;
- iter2.begin();
- for (; !iter2.end(); iter2++) {
- scene_out.load_block(iter2.index());
- boxm_block<tree_type> *block = scene_out.get_active_block();
- tree_type *temp_tree = block->get_tree();
- std::vector<boct_tree_cell<short,float>* > temp_leaves = temp_tree->leaf_cells();
- // compare tree values
- for (unsigned i=0; i<temp_leaves.size(); i++) {
- if (!((temp_leaves[i]->data() == leaves_out[i]->data())))
- {
- std::cout << "scene data: " << temp_leaves[i]->data() << " grid data: " << leaves_out[i]->data() << std::endl;
- eq = false;
- }
- }
- }
- TEST("tree operator == scene operator", eq, true);
- //clean temporary files
- vul_file_iterator file_it("./*.bin");
- for (; file_it; ++file_it)
- {
- vpl_unlink(file_it());//file_it() is deleted here
- // vul_file::delete_file_glob(file_it());
- }
-}
-
-void octree_vector_operator()
-{
- //Create the vector of kernels
- bvpl_edge3d_kernel_factory kernels_3d(-3,2, -3,2,-3,2);
- bvpl_create_directions_a dir;
- bvpl_kernel_vector_sptr kernel_vec = kernels_3d.create_kernel_vector(dir);
-
- //Create functor
- bvpl_edge_geometric_mean_functor<float> functor;
-
- //Create tree. this tree is initialized with 4 leves as a regular grid
- auto *tree = new boct_tree<short,float>(4);
-
- fill_edge3d_tree(tree);
-
- boct_tree<short,bvpl_octree_sample<float> > *tree_out = tree->clone_to_type<bvpl_octree_sample<float> >();
- tree_out->init_cells(bvpl_octree_sample<float>(0.0f, -1));
- short level = 0;
- double cell_length = 1.0/(double)(1<<(3 -level));
-
- bvpl_max_vector_operator<float> vector_op;
-
- vector_op.operate(tree, functor, kernel_vec, tree_out, level, cell_length);
-
- //test response at the center is correct
- boct_loc_code<short> loc_code;
-
- bool result = true;
- for (short x=3; x<5; x++)
- for (short y=3; y<5; y++)
- for (short z=3; z<5; z++)
- {
- loc_code.set_code(x,y,z);
- loc_code.set_level(0);
- result = result && tree_out->get_cell(loc_code)->data().id_ == 0;
- }
- TEST("Octree vector operator", result, true);
-}
-
-void scene_vector_operator()
-{
- //Create the vector of kernels
- bvpl_edge3d_kernel_factory kernels_3d(-3,2,-3,2,-3,2);
- bvpl_create_directions_a dir;
- bvpl_kernel_vector_sptr kernel_vec = kernels_3d.create_kernel_vector(dir);
-
- //Create functor
- bvpl_edge_geometric_mean_functor<float> functor;
-
- /***********Part1 operate on tree*******************/
-
- //Create tree. this tree is initialized with 4 leves as a regular grid
- auto *tree = new boct_tree<short,float>(4);
- fill_edge3d_tree(tree);
-
- //Create output trees
- boct_tree<short,bvpl_octree_sample<float> > *tree_out = tree->clone_to_type<bvpl_octree_sample<float> >();
- tree_out->init_cells(bvpl_octree_sample<float>(0.0f, -1));
- short level = 0;
- double cell_length = 1.0/(double)(1<<(3 -level));
-
- //operate vector on tree
- bvpl_max_vector_operator<float> vector_op;
-
- vector_op.operate(tree, functor, kernel_vec, tree_out, level, cell_length);
-
- /***********Part2 operate on scene*******************/
-
- //Crete the input scene
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(10,10,20);
-
- vgl_vector_3d<double> block_dim(1,1,1); //world coordinate dimensions of a block
- vgl_vector_3d<unsigned> world_dim(2,2,2); //number of blocks in a scene
-
- boxm_scene<tree_type> scene(lvcs, origin, block_dim, world_dim);
- std::string scene_path("./");
- scene.set_paths(scene_path, "scene_in");
-
- boxm_block_iterator<tree_type> iter =scene.iterator();
- iter.begin();
- for (; !iter.end(); iter++) {
- scene.load_block(iter.index());
- boxm_block<tree_type> *block = scene.get_active_block();
- block->init_tree(tree->clone());
- scene.write_active_block();
- }
-
- //Create the output scenes
- boxm_scene<boct_tree<short,bvpl_octree_sample<float> > > scene_out(lvcs, origin, block_dim, world_dim);
- scene_out.set_paths(scene_path, "response_scene");
-
- //operate on scene
- bvpl_scene_vector_operator scene_oper;
- scene_oper.operate(scene, functor, kernel_vec, scene_out);
-
- //compare blocks of scene with single tree, result should be the same
- std::vector<boct_tree_cell<short,bvpl_octree_sample<float> >* > leaves_out = tree_out->leaf_cells();
- boxm_block_iterator<boct_tree<short,bvpl_octree_sample<float> > > iter2 =scene_out.iterator();
- bool eq = true;
- iter2.begin();
- for (; !iter2.end(); iter2++) {
- scene_out.load_block(iter2.index());
- boxm_block<boct_tree<short,bvpl_octree_sample<float> > > *block = scene_out.get_active_block();
- boct_tree<short,bvpl_octree_sample<float> > *temp_tree = block->get_tree();
- std::vector<boct_tree_cell<short,bvpl_octree_sample<float> >* > temp_leaves = temp_tree->leaf_cells();
- // compare tree values
- for (unsigned i=0; i<temp_leaves.size(); i++)
- if (!((temp_leaves[i]->data().response_ == leaves_out[i]->data().response_)||
- (temp_leaves[i]->data().id_ == leaves_out[i]->data().id_)))
- {
- std::cout << "scene data: " << temp_leaves[i]->data() << " grid data: " << leaves_out[i]->data() << std::endl;
- eq = false;
- }
- }
-
- TEST("tree operator == scene operator", eq, true);
-
- //clean temporary files
- vul_file_iterator file_it("./*.bin");
- for (; file_it; ++file_it)
- {
- vpl_unlink(file_it());//Already deletes file_it()
- // vul_file::delete_file_glob(file_it());
- }
-}
-
-
-static void test_octree_kernel_operator()
-{
- octree_kernel();
- // octree_vector_operator(); //TEST FAIL FIX_ME
- // scene_kernel_operator();
- // scene_vector_operator();
- }
-
-TESTMAIN(test_octree_kernel_operator);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_octree_neighbors.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_octree_neighbors.cxx
deleted file mode 100644
index 20a062b9f9..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_octree_neighbors.cxx
+++ /dev/null
@@ -1,92 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date Nov. 16, 2009.
-
-#include <testlib/testlib_test.h>
-
-#include "../bvpl_octree_neighbors.h"
-#include "../bvpl_scene_kernel_operator.h"
-#include "../bvpl_octree_vector_operator_impl.h"
-#include "../bvpl_scene_vector_operator.h"
-#include <bvpl/functors/bvpl_edge_geometric_mean_functor.h>
-#include <bvpl/kernels/bvpl_edge3d_kernel_factory.h>
-#include <bvpl/kernels/bvpl_create_directions.h>
-
-#include <boct/boct_loc_code.h>
-
-static bool debug = false;
-typedef boct_tree<short, float> tree_type;
-typedef boct_tree_cell<short, float> cell_type;
-
-
-void fill_octree(boct_tree<short,float>* tree)
-{
- std::cout << "Creating Octree" << std::endl;
-
- //Create tree
- //tree->split();
-
- {
- std::vector<boct_tree_cell<short,float>*> leaves = tree->leaf_cells();
- tree->init_cells(0.1f);
- leaves[1]->set_data(0.5);
- if (debug)
- for (auto & leave : leaves) {
- std::cout<< leave->get_code().x_loc_ << ','
- << leave->get_code().y_loc_ << ','
- << leave->get_code().z_loc_ << ','
- << leave->data() << std::endl;
- }
-
- leaves[0]->split();
- //leaves[1]->set_data(0.6);
- }
-
-#if 0
- {
- std::vector<boct_tree_cell<short,float>*> leaves = tree->cells_at_level((short)0);
- for (unsigned i=0; i<leaves.size(); i++) {
- std::cout<< leaves[i]->get_code().x_loc_ << ','
- << leaves[i]->get_code().y_loc_ << ','
- << leaves[i]->get_code().z_loc_ << ','
- << tree->local_origin(leaves[i]) << ','
- << leaves[i]->get_code().level << ','
- << tree->cell_size(leaves[i]) << ','
- << leaves[i]->data() << std::endl;
- }
- }
-#endif
-}
-
-static void test_octree_neighbors()
-{
- auto* tree = new boct_tree<short,float>(4,3);
- fill_octree(tree);
- bvpl_kernel_iterator iter;
- vgl_point_3d<int> min_pt(-1,-1,-1);
- vgl_point_3d<int> max_pt(1,1,1);
- for (int i=min_pt.x(); i<=max_pt.x(); i++) {
- for (int j=min_pt.y(); j<=max_pt.y(); j++) {
- for (int k=min_pt.z(); k<=max_pt.z(); k++) {
- iter.insert(vgl_point_3d<int>(i,j,k),bvpl_kernel_dispatch(1.0f));
- }
- }
- }
- bvpl_kernel_sptr kernel= new bvpl_kernel(iter, vnl_float_3(0,0,1), vnl_float_3(0,1,0),0.0f, vgl_vector_3d<int>(3,3,3), min_pt,max_pt);
-
- std::vector<boct_tree_cell<short,float>*> leaves = tree->leaf_cells();
- bvpl_octree_neighbors<float> neighb(tree);
- for (auto cell : leaves) {
- std::cout << cell->code_
- << "THIS " << tree->local_origin(cell) << std::endl;
- std::vector<boct_tree_cell<short,float> *> neighb_cells;
- neighb.neighbors(kernel, cell, neighb_cells);
- std::cout << "Number of neighbors: " << neighb_cells.size() << std::endl;
- for (auto & neighb_cell : neighb_cells) {
- std::cout << " " << tree->local_origin(neighb_cell) << std::endl;
- }
- }
-}
-
-TESTMAIN(test_octree_neighbors);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_pca_kernels.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_pca_kernels.cxx
deleted file mode 100644
index 602b9b14c6..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_pca_kernels.cxx
+++ /dev/null
@@ -1,304 +0,0 @@
-//:
-// \file
-// \brief : Tests bvpl/PCA operations
-// \author Isabel Restrepo
-// \date 17-Nov-2010
-
-#include <testlib/testlib_test.h>
-
-#include <bvpl/bvpl_octree/bvpl_discover_pca_kernels.h>
-#include <bvpl/bvpl_octree/bvpl_global_pca.h>
-#include "test_utils.h"
-
-#include <vnl/vnl_vector.h>
-#include <vnl/vnl_vector_fixed.h>
-#include <vnl/vnl_matrix.h>
-#include <vnl/vnl_matrix_fixed.h>
-
-#include <vul/vul_file.h>
-#include <vpl/vpl.h>
-
-void test_kernel_set_up()
-{
- bool result=true;;
- //create scene
- boxm_scene<boct_tree<short, float> > *scene = create_scene(4,4,4);
- //neighborhood box for volume "patches" 3x3x3
- vgl_box_3d<int> neighborhood(vgl_point_3d<int>(-1,-1,-1), vgl_point_3d<int>(1,1,1));
- //number of samples - 10% of total number of leaf-cells
- unsigned long nsamples = (unsigned long)((double)scene->size() * 0.1);
-
- clean_up("./evd", "*.txt");
- vpl_mkdir("./evd",0777);
- clean_up("./svd", "*.txt");
- vpl_mkdir("./svd",0777);
-
- bvpl_discover_pca_kernels pca_extractor(neighborhood, nsamples, scene, "./evd");
- bvpl_discover_pca_kernels pca_extractor_svd(neighborhood, nsamples, scene, "./svd", false);
-
-
- //XML write
- pca_extractor.xml_write();
- pca_extractor_svd.xml_write();
-
- //training errorr
- vnl_vector<double> verror;
- vnl_vector<double> t_verror;
- vnl_vector<double> testing_error;
- pca_extractor.compute_training_error(verror);
- pca_extractor.theoretical_training_error(t_verror);
- pca_extractor.compute_testing_error(testing_error);
-
-#ifdef DEBUG_LEAKS
- std::cerr << "Leaks at test_pca_kernels - 1 " << boct_tree_cell<short, float >::nleaks() << '\n';
-#endif
-
- result = verror[verror.size()-1] < 1.0e-7;
- TEST("Test training error:", result, true);
-
- bvpl_discover_pca_kernels pca_extractor2("./evd");
- vnl_vector<double> verror2;
- pca_extractor2.compute_training_error(verror2);
- vnl_vector<double> test_error2;
- pca_extractor2.compute_testing_error(test_error2);
-
- //Load from XML file - and check that clases are the same
- result = pca_extractor.principal_comps().is_equal(pca_extractor2.principal_comps(), 1.0e-9);
- TEST("Test xml_write PC:", result, true);
-
- result = pca_extractor.weights().is_equal(pca_extractor2.weights(), 1.0e-9);
- TEST("Test xml_write weights:", result, true);
-
- result = pca_extractor.mean().is_equal(pca_extractor2.mean(), 1.0e-9);
- TEST("Test xml_write mean:", result, true);
-
- result = pca_extractor.feature_dim()== pca_extractor2.feature_dim();
- TEST("Test xml_write feature dim:", result, true);
-
- result = pca_extractor.nsamples()== pca_extractor2.nsamples();
- TEST("Test xml_write nsamples :", result, true);
-
- result = verror.is_equal(t_verror, 1.0e-9);
- TEST("Test training errors agrees with theoretical value:", result, true);
-
- result = testing_error.squared_magnitude() > t_verror.squared_magnitude();
- TEST("Test testing error > training error:", result, true);
-
- result = testing_error.is_equal(test_error2, 1.0e-9);
- TEST("Testing errors are equal:", result, true);
-
-#ifdef DEBUG_LEAKS
- std::cerr << "Leaks at test_pca_kernels - 2 " << boct_tree_cell<short, float >::nleaks() << '\n';
-#endif
-
-#if 0
- std::cout<< "error : " << verror << '\n'
- << "t_error : " << t_verror << '\n'
- << "weights : " << pca_extractor.weights() << '\n'
-
- << "error 1: " << verror << '\n'
- << "error 2: " << verror2 << '\n'
-
- << "mean 1: " << pca_extractor.mean() << '\n'
- << "mean 2: " << pca_extractor2.mean() << '\n'
-
- << "path 1: " << pca_extractor.scene_path() << '\n'
- << "path 2: " << pca_extractor2.scene_path() << std::endl;
-#endif
-}
-
-void test_global()
-{
- //create scene
- boxm_scene<boct_tree<short, float> > *scene = create_scene(3,3,3);
- //neighborhood box for volume "patches" 5x5x5
- vgl_box_3d<int> neighborhood(vgl_point_3d<int>(-2,-2,-2), vgl_point_3d<int>(2,2,2));
- //number of samples - 10% of total number of leaf-cells
- double training_fraction = 1.0;
- unsigned long nsamples = (unsigned long)((double)scene->size() * training_fraction);
- double finest_cell_length = scene->finest_cell_length();
-
- clean_up("./pca_info", "*.txt");
- vpl_mkdir("./pca_info",0777);
- clean_up("./pca_global_info", "*.txt");
- vpl_mkdir("./pca_global_info",0777);
-
- bvpl_discover_pca_kernels pca_info(neighborhood, nsamples, scene, "./pca_info");
- pca_info.xml_write();
-
- std::vector<std::string> scenes;
- std::vector<std::string> aux_paths;
- std::vector<double> cell_lengths;
- scenes.push_back("./test_scene.xml");
- aux_paths.push_back(".");
- cell_lengths.push_back(finest_cell_length);
-
- boxm_scene<boct_tree<short, int> > *aux_scene =
- new boxm_scene<boct_tree<short, int> >(scene->lvcs(), scene->origin(), scene->block_dim(), scene->world_dim(), scene->max_level(), scene->init_level());
- aux_scene->set_appearance_model(BOXM_INT);
-
- std::string scene_name = "test_aux_scene";
- std::string scene_path(vul_file::get_cwd());
- aux_scene->set_paths(scene_path, scene_name);
- aux_scene->write_scene("./test_aux_scene.xml");
-
- bvpl_global_pca<125> pca_global_info(scenes, aux_paths,cell_lengths, neighborhood,training_fraction, "./pca_global_info");
- pca_global_info.xml_write();
-
- vnl_matrix<double> s1 = pca_info.compute_scatter_matrix(scene);
-
- unsigned file =0;
- for (unsigned i = 0; i < 3; i++)
- for (unsigned j = 0; j < 3; j++)
- for (unsigned k = 0; k < 3; k++) {
- vnl_matrix_fixed<double, 125, 125> S;
- vnl_vector_fixed<double, 125> mean;
- unsigned long nfeature =0L;
- pca_global_info.sample_statistics(0, i, j, k, S, mean, nfeature);
-
- std::stringstream scatter_ss;
- scatter_ss << pca_global_info.path_out() << "/S_" << 0 << '_' <<file<< ".txt";
- std::ofstream scatter_ofs(scatter_ss.str().c_str());
- scatter_ofs.precision(15);
- scatter_ofs << S;
-
- std::stringstream mean_ss;
- mean_ss << pca_global_info.path_out() << "/mean_" << 0 << '_' <<file << ".txt";
- std::ofstream mean_ofs ( mean_ss.str().c_str() );
- mean_ofs.precision(15);
- mean_ofs << nfeature << '\n' << mean;
- file++;
- }
-
- //read pairwise
-
- unsigned nrepeat = 0; // will become ceil(log_2(file)) after this iteration
- unsigned orig_file = file;
- for (unsigned pow_of_2 = 1; pow_of_2 < orig_file; pow_of_2*=2,++nrepeat) // i.e.: ceil(log_2(file)) iterations
- {
- unsigned file_p = 0;
- unsigned nfiles = 0;
- for (; file_p < file; file_p+=2, ++nfiles)
- {
- vnl_matrix_fixed<double, 125, 125> S1(0.0);
- vnl_vector_fixed<double, 125> mean1(0.0);
- unsigned long nfeatures1 =0;
-
- {
- std::stringstream scatter_ss;
- scatter_ss <<pca_global_info.path_out() << "/S_" << nrepeat << '_' << file_p << ".txt";
- std::ifstream scatter_ifs(scatter_ss.str().c_str());
- scatter_ifs >> S1;
- std::stringstream mean_ss;
- mean_ss << pca_global_info.path_out() << "/mean_" << nrepeat << '_' << file_p << ".txt";
- std::ifstream mean_ifs ( mean_ss.str().c_str() );
- mean_ifs >> nfeatures1;
- mean_ifs >> mean1;
-#if 0
- vul_file::delete(scatter_ss.str());
- vul_file::delete(mean_ss.str());
-#endif
- }
-
- vnl_matrix_fixed<double, 125, 125> S2(0.0);
- vnl_vector_fixed<double, 125> mean2(0.0);
- unsigned long nfeatures2 =0;
-
- {
- std::stringstream scatter_ss;
- scatter_ss <<pca_global_info.path_out() << "/S_" << nrepeat << '_' << file_p + 1 << ".txt";
- std::ifstream scatter_ifs(scatter_ss.str().c_str());
- scatter_ifs >> S2;
- std::stringstream mean_ss;
- mean_ss << pca_global_info.path_out() << "/mean_" << nrepeat << '_' << file_p + 1 << ".txt";
- std::ifstream mean_ifs ( mean_ss.str().c_str() );
- mean_ifs >> nfeatures2;
- mean_ifs >> mean2;
- }
-
- vnl_matrix_fixed<double, 125, 125> S_out(0.0);
- vnl_vector_fixed<double, 125> mean_out(0.0);
- double nfeatures_out =0.0;
- bvpl_global_pca<125>::combine_pairwise_statistics(mean1, S1, (double)nfeatures1, mean2, S2, (double)nfeatures2, mean_out, S_out, nfeatures_out);
-
- std::stringstream scatter_ss;
- scatter_ss <<pca_global_info.path_out() << "/S_" << (nrepeat+1) << '_' << file_p/2 << ".txt";
- std::ofstream scatter_ofs(scatter_ss.str().c_str());
- scatter_ofs.precision(15);
- scatter_ofs << S_out;
-
- std::stringstream mean_ss;
- mean_ss << pca_global_info.path_out() << "/mean_" << (nrepeat+1) << '_' << file_p/2<< ".txt";
- std::ofstream mean_ofs ( mean_ss.str().c_str() );
- mean_ofs.precision(15);
- mean_ofs << nfeatures_out << '\n' << mean_out;
- }
- file = nfiles;
- }
-
- //load final mean and scatter
- vnl_matrix_fixed<double, 125, 125> S_total(0.0);
- vnl_vector_fixed<double, 125> mean_total(0.0);
- unsigned long nfeatures_total =0;
-
-
- std::stringstream scatter_ss;
- scatter_ss <<pca_global_info.path_out() << "/S_" << nrepeat<< '_' << 0 << ".txt";
- std::ifstream scatter_ifs(scatter_ss.str().c_str());
- scatter_ifs >> S_total;
- std::stringstream mean_ss;
- mean_ss << pca_global_info.path_out() << "/mean_" << nrepeat << '_' << 0 << ".txt";
- std::ifstream mean_ifs ( mean_ss.str().c_str() );
- mean_ifs >> nfeatures_total;
- mean_ifs >> mean_total;
-
-
- std::cout << "Scatter diff:\n " << ((s1 - S_total).array_two_norm()) << '\n'
- << "Mean diff:\n " << (pca_info.mean() - mean_total).two_norm() << '\n';
-
- clean_up("./pca_info", "*.txt");
- clean_up("./pca_global_info", "*.txt");
-#if 0
- pca_global_info.compute_statistics();
-#endif
- //compare results
-}
-
-
-void test_pca_kernels()
-{
- clean_up();
-
- //make up a matrix
- vnl_matrix<double> data(2, 10);
- unsigned i =0;
- data.set_column(i++, vnl_vector_fixed<double, 2>(0.69f, 0.49f));
- data.set_column(i++, vnl_vector_fixed<double, 2>(-1.31f, -1.21f));
- data.set_column(i++, vnl_vector_fixed<double, 2>(0.39, 0.99));
- data.set_column(i++, vnl_vector_fixed<double, 2>(0.09, 0.29));
- data.set_column(i++, vnl_vector_fixed<double, 2>(1.29, 1.09));
- data.set_column(i++, vnl_vector_fixed<double, 2>(0.49, 0.79));
- data.set_column(i++, vnl_vector_fixed<double, 2>(0.19, -0.31));
- data.set_column(i++, vnl_vector_fixed<double, 2>(-0.81, -0.81));
- data.set_column(i++, vnl_vector_fixed<double, 2>(-0.31, -0.31));
- data.set_column(i++, vnl_vector_fixed<double, 2>(-0.71, -1.01));
-
- bvpl_discover_pca_kernels pca_extractor(data);
-
- vnl_matrix<double> pc = pca_extractor.principal_comps();
-
- vnl_matrix<double> true_pc(2,2);
- i =0;
- true_pc.set_row(i++, vnl_vector_fixed<double, 2>(-0.677873, -0.735179));
- true_pc.set_row(i++, vnl_vector_fixed<double, 2>(-0.735179, 0.677873));
-
- bool result = true_pc.is_equal(pc, 0.001);
- TEST("Test pc equals true_pc", result, true);
-
- test_kernel_set_up();
- test_global();
- clean_up();
-}
-
-
-TESTMAIN(test_pca_kernels);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_taylor_basis.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_taylor_basis.cxx
deleted file mode 100644
index 4e5a30d980..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_taylor_basis.cxx
+++ /dev/null
@@ -1,143 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date 11-Feb-2011
-
-#include <iostream>
-#include <map>
-#include <testlib/testlib_test.h>
-
-#include "test_utils.h"
-
-#include <bvpl/kernels/bvpl_taylor_basis_factory.h>
-#include <bvpl/bvpl_octree/bvpl_taylor_basis.h>
-#include <bvpl/bvpl_octree/sample/bvpl_taylor_basis_sample.h>
-
-#include <vul/vul_file.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <vnl/vnl_sym_matrix.h>
-
-void create_basis(std::string test_dir, std::map<std::string, float> &values)
-{
- //generate basis paths
- if (!vul_file::is_directory(test_dir))
- vul_file::make_directory(test_dir);
-
- vul_file::change_directory(test_dir);
-
- bvpl_taylor_basis_loader loader(test_dir);
-
- std::vector<std::string> basis_names;
- loader.files(basis_names);
-
- //make the basis directories
- for (unsigned i= 0; i<basis_names.size(); i++)
- {
- std::string basis_dir = vul_file::get_cwd()+ "/" + basis_names[i];
- if (!vul_file::is_directory(basis_dir))
- vul_file::make_directory(basis_dir);
-
- vul_file::change_directory(basis_dir);
-
- create_scene(1,1,1, true, float(i), "float_response_scene");
-
- vul_file::change_directory("..");
-
- values.insert(std::pair<std::string, float>(basis_names[i], float(i)));
- }
-}
-
-void test_assemble_basis(bvpl_taylor_scenes_map_sptr taylor_scenes, std::map<std::string, float> &values)
-{
- bvpl_taylor_basis::assemble_basis(taylor_scenes, 0, 0, 0);
-
- //retieve the basis seen and check vectors and matrices
- double I0 = values["I0"];
-
- vnl_vector<double> G(3);
- G[0] = values["Ix"];
- G[1] = values["Iy"];
- G[2] = values["Iz"];
-
- double H_as_vector[6];
- H_as_vector[0] = values["Ixx"];
- H_as_vector[1] = values["Ixy"];
- H_as_vector[2] = values["Iyy"];
- H_as_vector[3] = values["Ixz"];
- H_as_vector[4] = values["Iyz"];
- H_as_vector[5] = values["Izz"];
- vnl_sym_matrix<double> H(H_as_vector, 3);
-
- std::cout << "IO: " << I0 << "\nG: " << G <<"\nH: " << H.as_matrix() << std::endl;
-
- boxm_scene<boct_tree<short, bvpl_taylor_basis2_sample > >* basis_scene = dynamic_cast<boxm_scene<boct_tree<short, bvpl_taylor_basis2_sample > >* > (taylor_scenes->get_scene("basis").as_pointer());
- basis_scene->load_block(0, 0, 0);
-
- std::vector<boct_tree_cell<short, bvpl_taylor_basis2_sample >* > basis_leaves = basis_scene->get_block(0, 0, 0)->get_tree()->leaf_cells();
-
- std::vector<boct_tree_cell<short, bvpl_taylor_basis2_sample >* >::iterator it = basis_leaves.begin();
- bool result = true;
- for (; it!= basis_leaves.end(); it++)
- {
- bvpl_taylor_basis2_sample sample = (*it)->data();
- if (sample.I0!=I0){
- result = false;
- std::cout << sample << std::endl;
- }
-
- if (!((sample.G.as_vector()).is_equal(G, 1e-7))){
- result = false;
- std::cout << sample << std::endl;
- }
-
- if (!((sample.H.as_matrix()).is_equal(H.as_matrix(), 1e-7))){
- result = false;
- std::cout << sample << std::endl;
- }
- }
-
- TEST("Test assemble basis", result, true);
-}
-
-
-void test_taylor_basis()
-{
- //generate basis
- std::string basis_dir = "./taylor_basis";
- std::map<std::string, float> values;
- create_basis(basis_dir, values);
-
- //load map of scenes into memory
- bvpl_taylor_basis_loader loader(vul_file::get_cwd());
- std::cout << vul_file::get_cwd() << std::endl;
- bvpl_taylor_scenes_map_sptr taylor_scenes = new bvpl_taylor_scenes_map(loader);
-
-
- //test assembling
- test_assemble_basis(taylor_scenes, values);
-
- //test computing error
- boxm_scene<boct_tree<short, float> >* data_scene = create_scene(2,2,2, true, 1.0f, "data_scene");
- boxm_scene<boct_tree<short, float> >* error_scene = dynamic_cast<boxm_scene<boct_tree<short, float> >*> (taylor_scenes->get_scene("error").as_pointer());
- double cell_length = data_scene->finest_cell_length();
- bvpl_taylor_basis::compute_approximation_error(data_scene, taylor_scenes->get_scene("basis"),error_scene,loader,0,0,0, cell_length);
-
- error_scene->load_block(0,0,0);
- std::cout.precision(15);
- error_scene->get_block(0,0,0)->get_tree()->print();
-
- unsigned long tree_ncells = error_scene->get_block(0,0,0)->get_tree()->size();
- unsigned long scene_ncells = error_scene->size();
- unsigned long nsamples = scene_ncells*100L;
-
- //number of samples - 10% of total number of leaf cells
- unsigned long tree_nsamples = (unsigned long)(float(tree_ncells)/scene_ncells*nsamples);
- double error = bvpl_taylor_basis::sum_errors(error_scene,0,0,0, tree_nsamples);
-
- TEST_NEAR("Test average error", error, 131737.5, 1e-7);
-}
-
-
-TESTMAIN(test_taylor_basis);
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_template_include.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_template_include.cxx
deleted file mode 100644
index 2932c2a301..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_template_include.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <bvpl/bvpl_octree/bvpl_global_pca.hxx>
-#include <bvpl/bvpl_octree/bvpl_global_taylor.hxx>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_utils.cxx b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_utils.cxx
deleted file mode 100644
index 39bffed911..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_utils.cxx
+++ /dev/null
@@ -1,94 +0,0 @@
-#include "test_utils.h"
-//:
-// \file
-// \author Isabel Restrepo
-// \date 15-Aug-2010
-
-#include <vul/vul_file.h>
-#include <vul/vul_file_iterator.h>
-#include <vpl/vpl.h>
-
-void init_tree(boct_tree<short,float> *tree, unsigned i, float init_val)
-{
- tree-> split(); //now we have 8 cells
- std::vector<boct_tree_cell<short,float>*> leaves = tree->leaf_cells();
- leaves[i]->set_data(init_val);
- leaves[i]->split();
-
- boct_loc_code<short> code = leaves[i]->get_code() ;
- std::cerr<< "Create Scene Code: " << code << std::endl;
-}
-
-boxm_scene<boct_tree<short, float> >* create_scene(unsigned world_dimx,unsigned world_dimy,unsigned world_dimz,
- bool uniform, float val, const std::string& scene_prefix)
-{
- float init_val = 0.5f;
-
- if (uniform)
- init_val = val;
-
- //crete the input scene
- unsigned int max_tree_level = 3;
- unsigned int init_level = 1;
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(0,0,0);
-
- vgl_vector_3d<double> block_dim(10, 10, 10); //world coordinate dimensions of a block
-
- vgl_vector_3d<unsigned> world_dim(world_dimx,world_dimy,world_dimz); //number of blocks in a scene
-
- auto *scene = new boxm_scene<boct_tree<short, float> >(lvcs, origin, block_dim, world_dim, max_tree_level, init_level );
- std::string scene_path(vul_file::get_cwd());
- scene->set_paths(scene_path, scene_prefix);
- scene->set_appearance_model(BOXM_FLOAT);
- scene->write_scene(scene_prefix + ".xml");
- unsigned cell_index = 7;
- boxm_block_iterator<boct_tree<short, float> > iter=scene->iterator();
- iter.begin();
- while (!iter.end())
- {
- scene->load_block(iter.index());
- boxm_block<boct_tree<short, float> > *block = scene->get_active_block();
- // Construct an empty tree with 3 maximum levels 1 levele initialized to 0.0
- auto *tree = new boct_tree<short,float>(init_val, 3, 1);
- //tree->print();
- if (uniform)
- init_tree(tree, cell_index, init_val);
- else
- init_tree(tree, cell_index);
- //tree->print();
- block->init_tree(tree);
- scene->write_active_block();
- if (cell_index == 0) cell_index = 7;
- cell_index--;
- ++iter;
- }
-
-#ifdef DEBUG_LEAKS
- std::cerr << "Leaks Created by create_scene() : " << boct_tree_cell<short,float>::nleaks() << std::endl;
-#endif
- return scene;
-}
-
-
-void clean_up()
-{
- //clean temporary files
- vul_file_iterator file_it("./*.bin");
- for (; file_it; ++file_it)
- {
- vpl_unlink(file_it());// this deletes the file at file_it()
- // vul_file::delete_file_glob(file_it());
- }
-}
-
-void clean_up(const std::string& dir, const std::string& ext)
-{
- //clean temporary files
- vul_file_iterator file_it(dir+"/"+ext);
- for (; file_it; ++file_it)
- {
- vpl_unlink(file_it());
- vul_file::delete_file_glob(file_it());
- }
-}
diff --git a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_utils.h b/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_utils.h
deleted file mode 100644
index f2c915a5cb..0000000000
--- a/contrib/brl/bseg/bvpl/bvpl_octree/tests/test_utils.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef bvpl_octree_test_utils_h_
-#define bvpl_octree_test_utils_h_
-//:
-// \file
-// \brief A file containing utility functions for other tests
-// \author Isabel Restrepo
-// \date 13-Aug-2010
-
-#include <boxm/boxm_scene.h>
-
-void init_tree(boct_tree<short,float> *tree, unsigned i, float init_val = 0.8);
-
-boxm_scene<boct_tree<short, float> >* create_scene(unsigned world_dimx = 2,unsigned world_dimy = 2,unsigned world_dimz = 2,
- bool uniform = false, float val = 0.5, const std::string& scene_prefix = "test_scene");
-
-void clean_up();
-
-void clean_up(const std::string& dir, const std::string& ext);
-
-#endif
diff --git a/contrib/brl/bseg/bvpl/kernels/pro/CMakeLists.txt b/contrib/brl/bseg/bvpl/kernels/pro/CMakeLists.txt
index 4279f1e47d..3e7108103d 100644
--- a/contrib/brl/bseg/bvpl/kernels/pro/CMakeLists.txt
+++ b/contrib/brl/bseg/bvpl/kernels/pro/CMakeLists.txt
@@ -19,7 +19,7 @@ if(EXPAT_FOUND)
vxl_add_library(LIBRARY_NAME bvpl_kernels_pro LIBRARY_SOURCES ${bvpl_kernels_pro_sources})
- target_link_libraries(bvpl_kernels_pro bvpl_kernels bvpl_kernels_io bvpl_octree bvpl_octree_io bsta bprb brdb bvpl ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl_io)
+ target_link_libraries(bvpl_kernels_pro bvpl_kernels bvpl_kernels_io bsta bprb brdb bvpl ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl_io)
if( BUILD_TESTING )
add_subdirectory(tests)
diff --git a/contrib/brl/bseg/bvpl/kernels/pro/Templates/brdb_value_t+bvpl_taylor_scenes_map_sptr-.cxx b/contrib/brl/bseg/bvpl/kernels/pro/Templates/brdb_value_t+bvpl_taylor_scenes_map_sptr-.cxx
deleted file mode 100644
index ee1188aea5..0000000000
--- a/contrib/brl/bseg/bvpl/kernels/pro/Templates/brdb_value_t+bvpl_taylor_scenes_map_sptr-.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <brdb/brdb_value.hxx>
-
-#include <vbl/io/vbl_io_smart_ptr.h>
-#include <bvpl/bvpl_octree/bvpl_taylor_basis.h>
-
-BRDB_VALUE_INSTANTIATE(bvpl_taylor_scenes_map_sptr, "bvpl_taylor_scenes_map_sptr");
diff --git a/contrib/brl/bseg/bvpl/kernels/pro/Templates/vbl_io_smart_ptr+bvpl_taylor_scenes_map-.cxx b/contrib/brl/bseg/bvpl/kernels/pro/Templates/vbl_io_smart_ptr+bvpl_taylor_scenes_map-.cxx
deleted file mode 100644
index 25a60ca12c..0000000000
--- a/contrib/brl/bseg/bvpl/kernels/pro/Templates/vbl_io_smart_ptr+bvpl_taylor_scenes_map-.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <bvpl/bvpl_octree/io/bvpl_io_taylor_scenes_map.h>
-#include <vbl/io/vbl_io_smart_ptr.hxx>
-
-VBL_IO_SMART_PTR_INSTANTIATE(bvpl_taylor_scenes_map);
diff --git a/contrib/brl/bseg/bvpl/kernels/pro/bvpl_kernels_register.cxx b/contrib/brl/bseg/bvpl/kernels/pro/bvpl_kernels_register.cxx
index 71a463d5d7..cb9febce0d 100644
--- a/contrib/brl/bseg/bvpl/kernels/pro/bvpl_kernels_register.cxx
+++ b/contrib/brl/bseg/bvpl/kernels/pro/bvpl_kernels_register.cxx
@@ -25,7 +25,6 @@ void bvpl_kernels_register::register_process()
REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_create_corner2d_kernel_process, "bvplCreateCorner2dKernelProcess");
REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_create_gauss3d_xx_kernel_vector_process, "bvplCreateGauss3dXXKernelVectorProcess");
REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_create_wc_kernel_vector_process, "bvplCreateWCKernelVectorProcess");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvpl_load_taylor_kernel_process, "bvplLoadTaylorKernelProcess");
REG_PROCESS_FUNC_CONS2(bvpl_create_gauss3d_kernel_process);
REG_PROCESS_FUNC_CONS2(bvpl_create_generic_kernel_vector_process);
REG_PROCESS_FUNC_CONS2(bvpl_write_generic_kernel_vector_process);
diff --git a/contrib/brl/bseg/bvpl/kernels/pro/processes/bvpl_load_taylor_responses_process.cxx b/contrib/brl/bseg/bvpl/kernels/pro/processes/bvpl_load_taylor_responses_process.cxx
deleted file mode 100644
index c56d9cdb15..0000000000
--- a/contrib/brl/bseg/bvpl/kernels/pro/processes/bvpl_load_taylor_responses_process.cxx
+++ /dev/null
@@ -1,53 +0,0 @@
-//:
-// \file
-// \brief A process to load taylor response scenes into memory
-// \author Isabel Restrepo
-// \date 9-Feb-2011
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-
-#include <brdb/brdb_value.h>
-
-#include <bvpl/kernels/bvpl_taylor_basis_factory.h>
-#include <bvpl/bvpl_octree/bvpl_taylor_basis.h>
-
-//:global variables
-namespace bvpl_load_taylor_responses_process_globals
-{
- constexpr unsigned n_inputs_ = 1;
- constexpr unsigned n_outputs_ = 1;
-}
-
-
-//:sets input and output types
-bool bvpl_load_taylor_responses_process_cons(bprb_func_process& pro)
-{
- using namespace bvpl_load_taylor_responses_process_globals ;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "vcl_string"; //parent dir of responses
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "bvpl_taylor_scenes_map_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-
-//:the process
-bool bvpl_load_taylor_responses_process(bprb_func_process& pro)
-{
- using namespace bvpl_load_taylor_responses_process_globals;
-
- //get inputs
- std::string parent_dir = pro.get_input<std::string>(0);
-
- bvpl_taylor_basis_loader loader(parent_dir);
- bvpl_taylor_scenes_map_sptr taylor_scenes = new bvpl_taylor_scenes_map(loader);
-
- //store output
- pro.set_output_val<bvpl_taylor_scenes_map_sptr>(0, taylor_scenes);
-
- return true;
-}
diff --git a/contrib/brl/bseg/bvpl_octree_batch/CMakeLists.txt b/contrib/brl/bseg/bvpl_octree_batch/CMakeLists.txt
deleted file mode 100644
index 3bf956ba6c..0000000000
--- a/contrib/brl/bseg/bvpl_octree_batch/CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# contrib/brl/bseg/bvpl_octree_batch/CMakeLists.txt
-include( ${VXL_CMAKE_DIR}/NewCMake/FindPython.cmake )
-if( PYTHON_FOUND )
- FIND_PACKAGE(EXPAT REQUIRED)
-FIND_PACKAGE(EXPATPP REQUIRED)
- if( EXPAT_FOUND )
- include_directories( ${PYTHON_INCLUDE_DIRS} )
- include_directories( ${BRL_INCLUDE_DIR} )
- include_directories( ${BRL_INCLUDE_DIR}/bpro )
- include_directories( ${BRL_INCLUDE_DIR}/bpro/core )
- include_directories( ${BRL_INCLUDE_DIR}/bseg/bvpl/bvpl_octree)
- include_directories( ${BRL_INCLUDE_DIR}/bseg/brec )
-
- set(bvpl_octree_batch_sources
- reg_bvpl_octree.h reg_bvpl_octree.cxx
- )
- if(NOT VXL_BUILD_POSITION_DEPENDENT_CODE)
- vxl_add_library(LIBRARY_NAME bvpl_octree_batch LIBRARY_SOURCES SHARED ${bvpl_octree_batch_sources})
-
- #In windows, library has to have different name depending on debug or release version.
- if(WIN32)
- set_target_properties(bvpl_octree_batch PROPERTIES OUTPUT_NAME bvpl_octree_batch DEBUG_POSTFIX _d SUFFIX .pyd)
- endif()
- if(APPLE) #This is because python only looks for .so
- set_target_properties(bvpl_octree_batch PROPERTIES OUTPUT_NAME bvpl_octree_batch SUFFIX .so)
- endif()
- set_target_properties(bvpl_octree_batch PROPERTIES PREFIX "")
-
- target_link_libraries(bvpl_octree_batch bvpl_octree_pro bvpl_kernels_pro bpro_batch boxm_pro boxm_algo_pro ${VXL_LIB_PREFIX}vpgl_io vpgl_pro ${VXL_LIB_PREFIX}vil_io vil_pro)
-
- if(PYTHON_DEBUG_LIBRARIES)
- target_link_libraries( bvpl_octree_batch debug ${PYTHON_DEBUG_LIBRARY})
- endif()
-
- if(PYTHON_LIBRARIES)
- target_link_libraries( bvpl_octree_batch optimized ${PYTHON_LIBRARY})
- endif()
-
- if( BUILD_TESTING )
- add_subdirectory(tests)
- endif()
- endif()
- endif()
-endif()
diff --git a/contrib/brl/bseg/bvpl_octree_batch/reg_bvpl_octree.cxx b/contrib/brl/bseg/bvpl_octree_batch/reg_bvpl_octree.cxx
deleted file mode 100644
index d2df8b6752..0000000000
--- a/contrib/brl/bseg/bvpl_octree_batch/reg_bvpl_octree.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "reg_bvpl_octree.h"
-#include <bprb/bprb_macros.h>
-#include <bprb/bprb_batch_process_manager.h>
-
-// processes
-#include <bvpl/kernels/pro/bvpl_kernels_register.h>
-#include <bvpl/bvpl_octree/pro/bvpl_octree_register.h>
-#include <boxm/pro/boxm_register.h>
-#include <boxm/algo/pro/boxm_algo_register.h>
-#include <vpgl_pro/vpgl_register.h>
-
-PyObject *
-register_processes(PyObject *self, PyObject *args)
-{
- bvpl_kernels_register::register_process();
- bvpl_octree_register::register_process();
- boxm_register::register_process();
- boxm_algo_register::register_process();
- vpgl_register::register_process();
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-PyObject *
-register_datatypes(PyObject *self, PyObject *args)
-{
- register_basic_datatypes();
- bvpl_kernels_register::register_datatype();
- bvpl_octree_register::register_datatype();
- boxm_register::register_datatype();
- boxm_algo_register::register_datatype();
- vpgl_register::register_datatype();
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-PyMODINIT_FUNC
-initbvpl_octree_batch(void)
-{
- PyMethodDef reg_pro;
- reg_pro.ml_name = "register_processes";
- reg_pro.ml_meth = register_processes;
- reg_pro.ml_doc = "register_processes() create instances of each defined process";
- reg_pro.ml_flags = METH_VARARGS;
-
-
- PyMethodDef reg_data;
- reg_data.ml_name = "register_datatypes";
- reg_data.ml_meth = register_datatypes;
- reg_data.ml_doc = "register_datatypes() insert tables in the database for each type";
- reg_data.ml_flags = METH_VARARGS;
-
- bvpl_octree_batch_methods[0]=reg_pro;
- bvpl_octree_batch_methods[1]=reg_data;
-
- for (int i=0; i<METHOD_NUM; ++i) {
- bvpl_octree_batch_methods[i+2]=batch_methods[i];
- }
-
- Py_InitModule("bvpl_octree_batch", bvpl_octree_batch_methods);
-}
diff --git a/contrib/brl/bseg/bvpl_octree_batch/reg_bvpl_octree.h b/contrib/brl/bseg/bvpl_octree_batch/reg_bvpl_octree.h
deleted file mode 100644
index 4aad2e3dcb..0000000000
--- a/contrib/brl/bseg/bvpl_octree_batch/reg_bvpl_octree.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef reg_bvpl_octree_h_
-#define reg_bvpl_octree_h_
-
-#include <bpro/bpro_batch/bpro_batch.h>
-
-static PyObject *register_processes(PyObject *self, PyObject *args);
-static PyObject *register_datatypes(PyObject *self, PyObject *args);
-static PyMethodDef bvpl_octree_batch_methods[METHOD_NUM+2];
-
-#endif
diff --git a/contrib/brl/bseg/bvpl_octree_batch/tests/CMakeLists.txt b/contrib/brl/bseg/bvpl_octree_batch/tests/CMakeLists.txt
deleted file mode 100644
index 1cc8664ce3..0000000000
--- a/contrib/brl/bseg/bvpl_octree_batch/tests/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-add_executable( bvpl_octree_batch_test_include test_include.cxx )
-target_link_libraries( bvpl_octree_batch_test_include bvpl_octree_batch)
diff --git a/contrib/brl/bseg/bvpl_octree_batch/tests/test_include.cxx b/contrib/brl/bseg/bvpl_octree_batch/tests/test_include.cxx
deleted file mode 100644
index 292774691a..0000000000
--- a/contrib/brl/bseg/bvpl_octree_batch/tests/test_include.cxx
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <bvpl_octree_batch/reg_bvpl_octree.h>
-
-int main() { return 0; }
diff --git a/contrib/brl/bseg/bvxm/algo/CMakeLists.txt b/contrib/brl/bseg/bvxm/algo/CMakeLists.txt
index a387778a0c..0505293103 100644
--- a/contrib/brl/bseg/bvxm/algo/CMakeLists.txt
+++ b/contrib/brl/bseg/bvxm/algo/CMakeLists.txt
@@ -5,14 +5,13 @@ include_directories( ${BRL_INCLUDE_DIR}/bseg/bvxm )
set(bvxm_algo_sources
bvxm_merge_mog.h bvxm_merge_mog.cxx
bvxm_mog_norm.h bvxm_mog_norm.hxx
- bvxm_boxm_convert.h
)
aux_source_directory(Templates bvxm_algo_sources)
vxl_add_library(LIBRARY_NAME bvxm_algo LIBRARY_SOURCES ${bvxm_algo_sources})
-target_link_libraries( bvxm_algo bsta bvxm_grid_io boxm_util ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl)
+target_link_libraries( bvxm_algo bsta ${VXL_LIB_PREFIX}vnl ${VXL_LIB_PREFIX}vgl)
add_subdirectory(pro)
diff --git a/contrib/brl/bseg/bvxm/algo/bvxm_boxm_convert.h b/contrib/brl/bseg/bvxm/algo/bvxm_boxm_convert.h
deleted file mode 100644
index d2b4e815e6..0000000000
--- a/contrib/brl/bseg/bvxm/algo/bvxm_boxm_convert.h
+++ /dev/null
@@ -1,152 +0,0 @@
-// This is brl/bseg/bvxm/algo/bvxm_boxm_convert.h
-#ifndef bvxm_boxm_convert_h
-#define bvxm_boxm_convert_h
-//:
-// \file
-// \brief Set of functions that convert a boxm_scene to a bvxm grid
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date Jan 15, 2009
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <iostream>
-#include <boxm/boxm_scene.h>
-#include <bvxm/grid/bvxm_voxel_grid.h>
-#include <bvxm/grid/bvxm_voxel_grid_basic_ops.h>
-#ifdef _MSC_VER
-# include <vcl_msvc_warnings.h>
-#endif
-#include <boxm/util/boxm_cell_data_traits.h>
-
-template <class T_loc, class T_data>
-bvxm_voxel_grid<T_data>* boxm_scene_to_bvxm_grid(boxm_scene<boct_tree<T_loc, T_data > > &scene,
- std::string input_path,
- unsigned int resolution_level,
- bool enforce_level = false )
-{
- //Print a little reminder that no inter/extra-polation happens in this function
- std::cout << "Convertion boxm_scene to bvxm_grid\n"
- << "Current resolution level: " << resolution_level << '\n'
- << "Enforcing only level cells ? " << enforce_level << '\n'
- << "Is grid saving internal nodes? " <<scene.save_internal_nodes() << std::endl;
-
- typedef boct_tree<T_loc, T_data > tree_type;
-
- // create an array for each block, and save in a binary file
- boxm_block_iterator<tree_type> iter(&scene);
-
- unsigned int finest_level=100000;
- // find the finest levels in the blocks
- while (!iter.end()) {
- vgl_point_3d<int> idx = iter.index();
- scene.load_block(idx);
- boxm_block<tree_type>* block = scene.get_block(idx);
- tree_type* tree = block->get_tree();
- if (tree->finest_level() < int(finest_level)) {
- finest_level = tree->finest_level();
- }
- ++iter;
- }
-
- // do not make the resolution smaller than finest level
- if (resolution_level < finest_level)
- resolution_level=finest_level;
-
-
- // make sure the resolution level for all trees is the same
- iter.begin();
- short root_level = 0;
- {
- vgl_point_3d<int> idx = iter.index();
- scene.load_block(idx);
- boxm_block<tree_type>* block = scene.get_block(idx);
- tree_type* tree = block->get_tree();
- root_level = tree->root_level();
- }
-
- // make sure root level is the same for all the trees
- while (!iter.end()) {
- vgl_point_3d<int> idx = iter.index();
- scene.load_block(idx);
- boxm_block<tree_type>* block = scene.get_block(idx);
- tree_type* tree = block->get_tree();
- if (tree->root_level() != root_level)
- {
- std::cerr << "Error converting boxm_scene to bvxm_grid: blocks have different root level\n";
- }
- iter++;
- }
-
- // number of cells for each block should be the same, because they have the
- // same tree max_level definitions
- unsigned int ncells = 1 << (root_level - (int)resolution_level);
-
- std::cout << "Number of cells per grid side: " << ncells << '\n';
-
- //create the regular grid
- vgl_vector_3d<unsigned> dim = scene.world_dim(); //number of blocks in the scene
- unsigned dimx = dim.x()*ncells; // total number of cells in the scene x-dim
- unsigned dimy = dim.y()*ncells;
- unsigned dimz = dim.z()*ncells;
- bvxm_voxel_grid<T_data> *grid = new bvxm_voxel_grid<T_data>(input_path,vgl_vector_3d<unsigned>(dimx,dimy,dimz));
- T_data data_init(boxm_zero_val<T_loc, T_data>());
- grid->initialize_data(data_init);
-
- std::cout << "Grid Size: " << vgl_vector_3d<unsigned>(dimx,dimy,dimz) << '\n'
- << "In boxm_scene_to_bxm_grid, default voxel value for the grid is: " << data_init << std::endl;
-
- //iterate through grid, locate corresponding position in the octree
- typename bvxm_voxel_grid<T_data>::iterator grid_it=grid->begin();
-
- //locate point in the tree, for now assume ONLY ONE BLOCK
- iter.begin();
- vgl_point_3d<int> idx = iter.index();
- scene.load_block(idx);
- boxm_block<tree_type>* block = scene.get_block(idx);
- tree_type* tree = block->get_tree();
-#if 0
- vgl_box_3d<double> block_bb = block->bounding_box();
- // assume that bounding box is a cube
- const double step_len = ((block_bb.max_x() - block_bb.min_x())/double(ncells));
-#endif
-
- for (unsigned z=0; z<dimz; ++grid_it, ++z)
- {
- bvxm_voxel_slab<T_data> slab = (*grid_it);
- std::cout << '.' <<std::flush ;
- for (unsigned y=0; y<dimy;++y)
- {
- for (unsigned x=0; x<dimx; ++x)
- {
- vgl_point_3d<double> p(((double)x/(double)dimx), ((double)y/(double)dimy), (0.99 - (double)z/(double)dimz));
- //locate the cell containing the point closest to the specified level
- boct_tree_cell<T_loc,T_data>* this_cell = tree->locate_point_at_level(p, resolution_level,true);
-
- if (!this_cell) {
- std::cerr << "In boxm_scene_to_bvxm_grid: cell out of bounds\n";
- continue;
- }
-
- unsigned int level = this_cell->get_code().level;
- T_data cell_val = this_cell->data();
-
- if (level < resolution_level)
- std::cerr << "In boxm_scene_to_bvxm_grid: current level smaller than target level\n";
-
- //if enfoce level is true, there is no iter/extrapolation
- if ((enforce_level)&& (level != resolution_level))
- continue;
-
- // just copy value to output grid
- slab(x,y) = cell_val;
- }
- }
- }
- std::cout << '\n';
- return grid;
-}
-
-#endif
diff --git a/contrib/brl/bseg/bvxm/algo/pro/CMakeLists.txt b/contrib/brl/bseg/bvxm/algo/pro/CMakeLists.txt
index 4917b6eb59..3a0824d257 100644
--- a/contrib/brl/bseg/bvxm/algo/pro/CMakeLists.txt
+++ b/contrib/brl/bseg/bvxm/algo/pro/CMakeLists.txt
@@ -18,7 +18,8 @@ FIND_PACKAGE(EXPATPP REQUIRED)
aux_source_directory(processes bvxm_algo_pro_sources)
vxl_add_library(LIBRARY_NAME bvxm_algo_pro LIBRARY_SOURCES ${bvxm_algo_pro_sources} )
- target_link_libraries(bvxm_algo_pro bvxm_algo bvxm_grid_pro boxm boct bprb brdb ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl)
+ #target_link_libraries(bvxm_algo_pro bvxm_algo bvxm_grid_pro boxm boct bprb brdb ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl)
+ target_link_libraries(bvxm_algo_pro bvxm_algo bvxm_grid_pro boct bprb brdb ${VXL_LIB_PREFIX}vul ${VXL_LIB_PREFIX}vbl)
if( BUILD_TESTING )
add_subdirectory(tests)
diff --git a/contrib/brl/bseg/bvxm/algo/pro/bvxm_algo_processes.h b/contrib/brl/bseg/bvxm/algo/pro/bvxm_algo_processes.h
index 69e97478e7..8b9ad6d7f6 100644
--- a/contrib/brl/bseg/bvxm/algo/pro/bvxm_algo_processes.h
+++ b/contrib/brl/bseg/bvxm/algo/pro/bvxm_algo_processes.h
@@ -8,6 +8,6 @@
DECLARE_FUNC_CONS(bvxm_merge_mog_process);
DECLARE_FUNC_CONS(bvxm_mog_to_mpm_process);
DECLARE_FUNC_CONS(bvxm_mog_l2_distance);
-DECLARE_FUNC_CONS(boxm_scene_to_bvxm_grid_process);
+//DECLARE_FUNC_CONS(boxm_scene_to_bvxm_grid_process);
#endif
diff --git a/contrib/brl/bseg/bvxm/algo/pro/bvxm_algo_register.cxx b/contrib/brl/bseg/bvxm/algo/pro/bvxm_algo_register.cxx
index a7b2141026..a4f1e49d9d 100644
--- a/contrib/brl/bseg/bvxm/algo/pro/bvxm_algo_register.cxx
+++ b/contrib/brl/bseg/bvxm/algo/pro/bvxm_algo_register.cxx
@@ -19,5 +19,5 @@ void bvxm_algo_register::register_process()
REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvxm_merge_mog_process, "bvxmMergeMogProcess");
REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvxm_mog_to_mpm_process, "bvxmMogToMpmProcess");
// REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, bvxm_mog_l2_process, "bvxmMogL2Process");
- REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_scene_to_bvxm_grid_process, "boxmSceneToBvxmGridProcess");
+ // REG_PROCESS_FUNC_CONS(bprb_func_process, bprb_batch_process_manager, boxm_scene_to_bvxm_grid_process, "boxmSceneToBvxmGridProcess");
}
diff --git a/contrib/brl/bseg/bvxm/algo/pro/processes/boxm_scene_to_bvxm_grid_process.cxx b/contrib/brl/bseg/bvxm/algo/pro/processes/boxm_scene_to_bvxm_grid_process.cxx
deleted file mode 100644
index cfc6175b03..0000000000
--- a/contrib/brl/bseg/bvxm/algo/pro/processes/boxm_scene_to_bvxm_grid_process.cxx
+++ /dev/null
@@ -1,129 +0,0 @@
-// This is brl/bseg/bvxm/algo/pro/processes/boxm_scene_to_bvxm_grid_process.cxx
-#include <bvxm/algo/bvxm_boxm_convert.h>
-//:
-// \file
-// \brief Process to convert a boxm_scene to a bvxm_voxel_grid
-// \author Isabel Restrepo mir@lems.brown.edu
-// \date Jan 19, 2010
-//
-// \verbatim
-// Modifications
-// <none yet>
-// \endverbatim
-
-#include <bprb/bprb_func_process.h>
-#include <bprb/bprb_parameters.h>
-#include <brdb/brdb_value.h>
-
-
-#include <bsta/bsta_attributes.h>
-#include <bsta/bsta_mixture_fixed.h>
-#include <bsta/bsta_gauss_sf1.h>
-#include <bsta/bsta_gauss_if3.h>
-
-
-namespace boxm_scene_to_bvxm_grid_process_globals
-{
- constexpr unsigned n_inputs_ = 4;
- constexpr unsigned n_outputs_ = 1;
-}
-
-//: process takes 4 inputs and 1 output.
-// input[0]: The scene
-// input[1]: Path to output grid
-// input[2]: Resolution level
-// input[3]: Bool: Enforce only cells at the resolution leve?
-// If true, there is no interpolation
-// output[0]: The output grid
-
-bool boxm_scene_to_bvxm_grid_process_cons(bprb_func_process& pro)
-{
- using namespace boxm_scene_to_bvxm_grid_process_globals;
-
- std::vector<std::string> input_types_(n_inputs_);
- input_types_[0] = "boxm_scene_base_sptr";
- input_types_[1] = "vcl_string";
- input_types_[2] = "unsigned";
- input_types_[3] = "bool";
-
- std::vector<std::string> output_types_(n_outputs_);
- output_types_[0] = "bvxm_voxel_grid_base_sptr";
-
- return pro.set_input_types(input_types_) && pro.set_output_types(output_types_);
-}
-
-bool boxm_scene_to_bvxm_grid_process(bprb_func_process& pro)
-{
- using namespace boxm_scene_to_bvxm_grid_process_globals;
-
- if (pro.n_inputs() != n_inputs_)
- {
- std::cerr << pro.name() << ": the input number should be " << n_inputs_
- << " but instead it is " << pro.n_inputs() << std::endl;
- return false;
- }
-
- //get inputs:
- boxm_scene_base_sptr scene_base = pro.get_input<boxm_scene_base_sptr>(0);
- std::string filepath = pro.get_input<std::string>(1);
- unsigned resolution_level = pro.get_input<short>(2);
- bool enforce_level = pro.get_input<bool>(3);
-
- static const unsigned int n_gaussian_modes_ = 3;
- typedef bsta_num_obs<bsta_gauss_sf1> gauss_type_sf1;
- typedef bsta_num_obs<bsta_mixture_fixed<gauss_type_sf1, n_gaussian_modes_> > mix_gauss_sf1_type;
-
- //check input's validity
- if (!scene_base.ptr())
- {
- std::cerr << pro.name() << ": -- Input scene is not valid!\n";
- return false;
- }
-
- if ( auto *scene= dynamic_cast<boxm_scene< boct_tree<short, float > > * >(scene_base.as_pointer()))
- {
- bvxm_voxel_grid<float> *grid = boxm_scene_to_bvxm_grid(*scene, filepath, resolution_level,enforce_level);
- pro.set_output_val<bvxm_voxel_grid_base_sptr>(0, grid);
- return true;
- }
- else if ( auto *scene= dynamic_cast<boxm_scene< boct_tree<short, bsta_num_obs<bsta_gauss_sf1> > > * >(scene_base.as_pointer()))
- {
- bvxm_voxel_grid<bsta_num_obs<bsta_gauss_sf1> > *grid = boxm_scene_to_bvxm_grid(*scene, filepath, resolution_level, enforce_level);
- pro.set_output_val<bvxm_voxel_grid_base_sptr>(0, grid);
- return true;
- }
- else if ( auto *scene =
- dynamic_cast<boxm_scene< boct_tree<short, mix_gauss_sf1_type > > * >(scene_base.as_pointer()))
- {
- bvxm_voxel_grid<mix_gauss_sf1_type > *grid = boxm_scene_to_bvxm_grid(*scene, filepath, resolution_level, enforce_level);
- pro.set_output_val<bvxm_voxel_grid_base_sptr>(0, grid);
- return true;
- }
- else
- {
- std::cerr << "It's not possible to convert input scene to a bvxm grid\n";
- return false;
- }
-}
-
-#include <boxm/boxm_scene.hxx>
-#include <boxm/boxm_block.hxx>
-#include <boct/boct_tree.hxx>
-#include <boct/boct_tree_cell.hxx>
-#include <vbl/vbl_array_3d.hxx>
-
-typedef bsta_num_obs<bsta_gauss_sf1> gauss_type;
-typedef bsta_num_obs<bsta_mixture_fixed<gauss_type,3> > mixture_type;
-typedef boct_tree<short,mixture_type> tree_type;
-typedef boxm_block<tree_type> block_type;
-
-BOCT_TREE_INSTANTIATE(short,mixture_type);
-BOCT_TREE_CELL_INSTANTIATE(short,mixture_type);
-BOXM_SCENE_INSTANTIATE(tree_type);
-BOXM_BLOCK_INSTANTIATE(tree_type);
-VBL_ARRAY_3D_INSTANTIATE(block_type);
-
-void vsl_b_write(vsl_b_ostream&, bsta_mixture_fixed<bsta_num_obs<bsta_gaussian_sphere<float,1> >,3>&) {}
-void vsl_b_read(vsl_b_istream&, bsta_mixture_fixed<bsta_num_obs<bsta_gaussian_sphere<float,1> >,3>&) {}
-void vsl_b_read(vsl_b_istream&, bsta_gaussian_sphere<float,1>&) {}
-//bool operator==(block_type const&, block_type const&) { return false; }
diff --git a/contrib/brl/bseg/bvxm/algo/tests/CMakeLists.txt b/contrib/brl/bseg/bvxm/algo/tests/CMakeLists.txt
index 1110054d05..d9d1c54305 100644
--- a/contrib/brl/bseg/bvxm/algo/tests/CMakeLists.txt
+++ b/contrib/brl/bseg/bvxm/algo/tests/CMakeLists.txt
@@ -2,15 +2,12 @@ add_executable( bvxm_algo_test_all
test_driver.cxx
test_merge_mog.cxx
test_mog_norm.cxx
-# causes memory allocation errors (FIX_ME)
-# test_boxm_scene_to_bvxm_grid.cxx
)
target_link_libraries( bvxm_algo_test_all bvxm_algo bvxm_grid ${VXL_LIB_PREFIX}testlib bsta)
add_test( NAME bvxm_algo_test_merge_mog COMMAND $<TARGET_FILE:bvxm_algo_test_all> test_merge_mog )
add_test( NAME bvxm_algo_test_mog_norm COMMAND $<TARGET_FILE:bvxm_algo_test_all> test_mog_norm )
-#add_test( NAME bvxm_algo_test_boxm_scene_to_bvxm_grid COMMAND $<TARGET_FILE:bvxm_algo_test_all> test_boxm_scene_to_bvxm_grid)
add_executable( bvxm_algo_test_include test_include.cxx )
target_link_libraries( bvxm_algo_test_include bvxm_algo)
diff --git a/contrib/brl/bseg/bvxm/algo/tests/test_boxm_scene_to_bvxm_grid.cxx b/contrib/brl/bseg/bvxm/algo/tests/test_boxm_scene_to_bvxm_grid.cxx
deleted file mode 100644
index cf5dfe2b40..0000000000
--- a/contrib/brl/bseg/bvxm/algo/tests/test_boxm_scene_to_bvxm_grid.cxx
+++ /dev/null
@@ -1,111 +0,0 @@
-//:
-// \file
-// \author Isabel Restrepo
-// \date Jan 19, 2010.
-
-#include <testlib/testlib_test.h>
-#include <bvxm/algo/bvxm_boxm_convert.h>
-#include <boxm/boxm_apm_traits.h>
-
-const bool debug = true;
-
-void fill_octree(boct_tree<short,float>* tree)
-{
- std::cout << "Creating Octree" << std::endl;
-
- //Create tree
- tree->init_cells(0.1f);
- tree->split();
- std::cout << "Level 1" << std::endl;
-
- {
- std::vector<boct_tree_cell<short,float>*> leaves = tree->leaf_cells();
- tree->init_cells(0.1f);
- leaves[1]->set_data(0.5f);
- if (debug)
- for (unsigned i=0; i<leaves.size(); i++) {
- std::cout << leaves[i]->get_code().x_loc_ << ','
- << leaves[i]->get_code().y_loc_ << ','
- << leaves[i]->get_code().z_loc_ << ','
- << leaves[i]->data() << std::endl;
- }
-
- leaves[1]->split();
- }
-
- if (debug)
- {
- std::cout << "Level 0" << std::endl;
- std::vector<boct_tree_cell<short,float>*> leaves = tree->cells_at_level((short)0);
- for (unsigned i=0; i<leaves.size(); i++) {
- leaves[i]->set_data(0.9f);
- std::cout << leaves[i]->get_code().x_loc_ << ','
- << leaves[i]->get_code().y_loc_ << ','
- << leaves[i]->get_code().z_loc_ << ','
- << leaves[i]->get_code().level << ','
- << leaves[i]->data() << std::endl;
- }
- }
-
- if (debug)
- {
- std::cout << "All Levels" << std::endl;
- std::vector<boct_tree_cell<short,float>*> leaves = tree->all_cells();
- for (unsigned i=0; i<leaves.size(); i++) {
- std::cout << leaves[i]->get_code().x_loc_ << ','
- << leaves[i]->get_code().y_loc_ << ','
- << leaves[i]->get_code().z_loc_ << ','
- << leaves[i]->get_code().level << ','
- << leaves[i]->data() << std::endl;
- }
- }
-}
-
-static void test_boxm_scene_to_bvxm_grid()
-{
- //Create a dummy scene
- typedef boct_tree<short,float > tree_type;
- boct_tree<short,float> *tree = new boct_tree<short,float>(3);
- fill_octree(tree);
-
- vpgl_lvcs lvcs(33.33,44.44,10.0, vpgl_lvcs::wgs84, vpgl_lvcs::DEG, vpgl_lvcs::METERS);
- vgl_point_3d<double> origin(0.0,0.0,0.0);
-
- //world coordinate dimensions of a block
- vgl_vector_3d<double> block_dim(10.0,10.0,10.0);
-
- //number of blocks in a scene
- vgl_vector_3d<unsigned> world_dim(1,1,1);
-
- boxm_scene<tree_type> *scene= new boxm_scene<tree_type>(lvcs, origin, block_dim, world_dim,true);
- std::string scene_path=".";
- scene->set_paths(scene_path, "in_block");
- scene->set_appearance_model(BOXM_FLOAT);
- scene->clean_scene();
-
- boxm_block_iterator<tree_type > iter =scene->iterator();
- iter.begin();
- scene->load_block(iter.index());
- boxm_block<tree_type> *block = scene->get_active_block();
- block->init_tree(tree);
- scene->write_active_block();
- std::string input_path("scene_to_grid.vox");
-
- bvxm_voxel_grid<float> *grid = boxm_scene_to_bvxm_grid(*scene,input_path, 0);
-
- //Check the grid
- bvxm_voxel_grid<float>::iterator grid_it = grid->slab_iterator(0, grid->grid_size().z());
-
- for (unsigned z = 0; z<grid->grid_size().z(); ++z)
- for (unsigned y = 0; y<grid->grid_size().y(); ++y)
- for (unsigned x= 0; x<grid->grid_size().x(); ++x)
- {
- std::cout << "Value at " << '(' << x << ',' << y <<',' <<z << ")= " << (*grid_it)(x,y,z) << std::endl;
- }
-
- // TEST("Valid cropped tree", result, true);
-
- scene->clean_scene();
-}
-
-TESTMAIN(test_boxm_scene_to_bvxm_grid);
diff --git a/contrib/brl/bseg/bvxm/algo/tests/test_driver.cxx b/contrib/brl/bseg/bvxm/algo/tests/test_driver.cxx
index 73e5836b26..cdb72c7ec2 100644
--- a/contrib/brl/bseg/bvxm/algo/tests/test_driver.cxx
+++ b/contrib/brl/bseg/bvxm/algo/tests/test_driver.cxx
@@ -2,15 +2,13 @@
DECLARE( test_merge_mog );
DECLARE( test_mog_norm );
-//DECLARE( test_boxm_scene_to_bvxm_grid);
+
void register_tests()
{
REGISTER( test_merge_mog );
REGISTER( test_mog_norm );
- // test causing memory allocation errors on dashboard build
- //REGISTER( test_boxm_scene_to_bvxm_grid );
}
diff --git a/contrib/brl/bseg/bvxm/algo/tests/test_include.cxx b/contrib/brl/bseg/bvxm/algo/tests/test_include.cxx
index b109456239..2c0b205311 100644
--- a/contrib/brl/bseg/bvxm/algo/tests/test_include.cxx
+++ b/contrib/brl/bseg/bvxm/algo/tests/test_include.cxx
@@ -1,4 +1,3 @@
-#include <bvxm/algo/bvxm_boxm_convert.h>
#include <bvxm/algo/bvxm_merge_mog.h>
#include <bvxm/algo/bvxm_mog_norm.h>
--
2.21.0