vcsl_coordinate_system.h
Go to the documentation of this file.
1 // This is core/vcsl/vcsl_coordinate_system.h
2 #ifndef vcsl_coordinate_system_h_
3 #define vcsl_coordinate_system_h_
4 //:
5 // \file
6 // \brief Abstract coordinate system
7 // \author Francois BERTEL
8 //
9 // \verbatim
10 // Modifications
11 // 2000/06/28 Francois BERTEL Creation. Adapted from IUE
12 // 2002/01/22 Peter Vanroose - return type of from_cs_to_standard_units() and from_standard_units_to_cs() changed non-ptr
13 // 2004/09/10 Peter Vanroose - Added explicit copy constructor (ref_count !)
14 // 2004/09/17 Peter Vanroose - made dimensionality() non-virtual - it just returns a member and should not be overloaded
15 // \endverbatim
16 
17 #include <vector>
18 #include <vbl/vbl_ref_count.h>
20 #include <vcsl/vcsl_axis_sptr.h>
21 #ifdef _MSC_VER
22 # include <vcl_msvc_warnings.h>
23 #endif
24 #include <vnl/vnl_vector.h>
25 class vcsl_spatial;
26 
27 //: Abstract coordinate system
29  : public vbl_ref_count
30 {
31  //***************************************************************************
32  // Constructors/Destructor
33  //***************************************************************************
34 
35  protected:
36  // Default constructor
37  vcsl_coordinate_system() = default;
38 
39  public:
40  // Copy constructor
42  : vbl_ref_count(), axes_(c.axes_) {}
43 
44  // Destructor
45  ~vcsl_coordinate_system() override = default;
46 
47  //***************************************************************************
48  // Status report
49  //***************************************************************************
50 
51  //: Number of axes
52  int dimensionality() const { return int(axes_.size()); }
53 
54  //: Is `i' an index on an axis ?
55  bool valid_axis(unsigned int i) const { return i < axes_.size(); }
56 
57  //: Return the axis `i'
58  // REQUIRE: valid_axis(i)
59  vcsl_axis_sptr axis(int i) const;
60 
61  //***************************************************************************
62  // Because VXL does not necessarily use dynamic_cast<>
63  //***************************************************************************
64  virtual const vcsl_spatial *cast_to_spatial() const { return nullptr; }
65 
66  //***************************************************************************
67  // Conversion
68  //***************************************************************************
69 
70  //: Convert `v', expressed with cs units, to standard units
71  // REQUIRE: v.size()==dimensionality()
74 
75  //: Convert `v', expressed with standard units, to cs units
76  // REQUIRE: v.size()==dimensionality()
79 
80  protected:
81  //***************************************************************************
82  // Implementation
83  //***************************************************************************
84 
85  //: List of axes
86  std::vector<vcsl_axis_sptr> axes_;
87 };
88 
89 #endif // vcsl_coordinate_system_h_
int dimensionality() const
Number of axes.
Abstract coordinate system.
vnl_vector< double > from_standard_units_to_cs(const vnl_vector< double > &v) const
Convert ‘v’, expressed with standard units, to cs units.
A spatial coordinate system.
Definition: vcsl_spatial.h:41
~vcsl_coordinate_system() override=default
vnl_vector< double > from_cs_to_standard_units(const vnl_vector< double > &v) const
Convert ‘v’, expressed with cs units, to standard units.
vcsl_axis_sptr axis(int i) const
Return the axis ‘i’.
virtual const vcsl_spatial * cast_to_spatial() const
vcsl_coordinate_system()=default
std::vector< vcsl_axis_sptr > axes_
List of axes.
vcsl_coordinate_system(vcsl_coordinate_system const &c)
bool valid_axis(unsigned int i) const
Is ‘i’ an index on an axis ?.