00001 // This is core/vcsl/vcsl_scale.h 00002 #ifndef vcsl_scale_h_ 00003 #define vcsl_scale_h_ 00004 //: 00005 // \file 00006 // \brief Scale transformation 00007 // \author François BERTEL 00008 // 00009 // \verbatim 00010 // Modifications 00011 // 2000/07/19 François BERTEL Creation. 00012 // 2001/04/10 Ian Scott (Manchester) Converted perceps header to doxygen 00013 // 2002/01/22 Peter Vanroose - return type of execute() and inverse() changed to non-ptr 00014 // 2002/01/28 Peter Vanroose - vcl_vector member scale_ changed to non-ptr 00015 // 2004/09/17 Peter Vanroose - made scale() non-virtual - it just returns a member and should not be overloaded 00016 // \endverbatim 00017 00018 #include <vcsl/vcsl_spatial_transformation.h> 00019 #include <vcsl/vcsl_scale_sptr.h> 00020 00021 //: Scale transformation 00022 class vcsl_scale 00023 : public vcsl_spatial_transformation 00024 { 00025 public: 00026 //*************************************************************************** 00027 // Constructors/Destructor 00028 //*************************************************************************** 00029 00030 // Default constructor 00031 vcsl_scale() {} 00032 00033 // Destructor 00034 virtual ~vcsl_scale() {} 00035 00036 //*************************************************************************** 00037 // Status report 00038 //*************************************************************************** 00039 00040 //: Is `this' invertible at time `time'? 00041 // REQUIRE: valid_time(time) 00042 // Pure virtual function of vcsl_spatial_transformation 00043 virtual bool is_invertible(double time) const; 00044 00045 //: Is `this' correctly set ? 00046 // Virtual function of vcsl_spatial_transformation 00047 virtual bool is_valid() const 00048 { return vcsl_spatial_transformation::is_valid() && 00049 ((this->duration()==0&&scale_.size()==1) || 00050 this->duration()==scale_.size()); } 00051 00052 //*************************************************************************** 00053 // Transformation parameters 00054 //*************************************************************************** 00055 00056 //: Set the scale value of a static scale 00057 void set_static(double new_scale); 00058 00059 //: Set the scale variation along the time 00060 void set_scale(vcl_vector<double> const& new_scale) { scale_=new_scale; } 00061 00062 //: Return the scale variation along the time 00063 vcl_vector<double> scale() const { return scale_; } 00064 00065 //*************************************************************************** 00066 // Basic operations 00067 //*************************************************************************** 00068 00069 //: Image of `v' by `this' 00070 // REQUIRE: is_valid() 00071 // Pure virtual function of vcsl_spatial_transformation 00072 virtual vnl_vector<double> execute(const vnl_vector<double> &v, 00073 double time) const; 00074 00075 //: Image of `v' by the inverse of `this' 00076 // REQUIRE: is_valid() 00077 // REQUIRE: is_invertible(time) 00078 // Pure virtual function of vcsl_spatial_transformation 00079 virtual vnl_vector<double> inverse(const vnl_vector<double> &v, 00080 double time) const; 00081 00082 protected: 00083 00084 //: Compute the value of the parameter at time `time' 00085 double scale_value(double time) const; 00086 00087 //: Scale variation along the time 00088 vcl_vector<double> scale_; 00089 }; 00090 00091 #endif // vcsl_scale_h_