1 #ifndef rgrl_feature_region_h_
2 #define rgrl_feature_region_h_
3 //:
4 // \file
5 // \brief Base class for feature associated with a region
6 // \author Gehua yang
7 // \date 21 Oct. 2004
8 
9 #include <iostream>
10 #include <vector>
11 #ifdef _MSC_VER
12 #  include <vcl_msvc_warnings.h>
13 #endif
14 #include <vnl/vnl_vector.h>
15 
16 class rgrl_transformation;
17 
18 //: Represents a feature ("data point") used by the registration algorithms.
19 //
20 class rgrl_feature_region
21 {
22  public:
23   // default ctor
24    rgrl_feature_region() = default;
25 
26    // destructor
27    virtual ~rgrl_feature_region() = default;
28 
29 #if 0
30   // Defines type-related functions
31   rgrl_type_macro( rgrl_feature_region, rgrl_feature );
32 #endif // 0
33 
34   virtual const std::vector< vnl_vector<int> >&
35   pixel_coordinates();
36 
37   //: get pixels coordinates within the region
38   virtual const std::vector< vnl_vector<int> >&
39   pixel_coordinates_ratio( vnl_vector< double > const& spacing_ratio );
40 
41   //: generate pixels coordinates within the region
42   virtual void
43   generate_pixel_coordinates( vnl_vector< double > const& spacing_ratio ) = 0;
44 
45  protected:
46   //  The pixel coordinates in the image are computed the first time
47   //  they are needed and then cached.  This is safe the location of
48   //  the feature does not change.
49    bool pixel_coordinates_cached_{false};
50    std::vector<vnl_vector<int>> pixel_coordinates_;
51    vnl_vector<double> spacing_ratio_;
52 };
53 
54 #endif
55