1 //This is brl/bbas/volm/volm_spherical_region_index.h
2 #ifndef volm_spherical_region_index_h_
3 #define volm_spherical_region_index_h_
4 //:
5 // \file
6 // \brief A class to construct an segment an index based on axis-aligned boxes on the sphere
7 // Units are in meters
8 //
9 // \author Vishal Jain
10 // \date feb 22, 2013
11 // \verbatim
12 //  Modifications
13 // None
14 // \endverbatim
15 
16 #include <vector>
17 #include <iostream>
18 #include <map>
19 #include <string>
20 #ifdef _MSC_VER
21 #  include <vcl_msvc_warnings.h>
22 #endif
23 #include <volm/volm_camera_space.h>
24 #include <volm/volm_camera_space_sptr.h>
25 #include <bpgl/depth_map/depth_map_scene_sptr.h>
26 #include <volm/volm_spherical_container_sptr.h>
27 #include <volm/volm_spherical_shell_container_sptr.h>
28 #include <volm/volm_spherical_region.h>
29 
30 #include <vsph/vsph_unit_sphere_sptr.h>
31 #include <vsph/vsph_segment_sphere.h>
32 
33 class volm_spherical_region_index
34 {
35  public:
36   volm_spherical_region_index(std::map<std::string,std::string> & index_file_paths,
37                               const std::string& usph_file_path);
38   volm_spherical_region_index(std::map<std::string,std::vector<unsigned char> > & index_file_paths,
39                               vsph_unit_sphere_sptr & usph);
40   volm_spherical_region_index(float * boxes,int num_depth_regions, int num_orientation_regions, int num_nlcd_regions, int sky_regions);
41   volm_spherical_regions_layer index_regions();
42   void print(std::ostream& os) ;
43 
44   void write_binary(std::ofstream & oconfig,std::ofstream & odata);
45   ~volm_spherical_region_index();
seg()46   vsph_segment_sphere * seg() { return seg_; }
47  private:
48   void construct_spherical_regions();
49   void load_unitsphere(const std::string& usph_file_path);
50   volm_spherical_regions_layer  sph_regions_;
51   float check_phi_bounds(float  phi);
52   std::vector<double> data_;
53   vsph_unit_sphere_sptr usph_;
54   vsph_segment_sphere * seg_;
55 };
56 
57 #endif // volm_spherical_region_index_h_
58