core/vcsl/vcsl_composition.h
Go to the documentation of this file.
00001 // This is core/vcsl/vcsl_composition.h
00002 #ifndef vcsl_composition_h_
00003 #define vcsl_composition_h_
00004 //:
00005 // \file
00006 // \brief Composition of transformations
00007 // \author François BERTEL
00008 //
00009 // \verbatim
00010 //  Modifications
00011 //   2000/06/28 François BERTEL Creation. Adapted from IUE
00012 //   2002/01/22 Peter Vanroose - return type of execute() and inverse() changed to non-ptr
00013 //   2002/01/28 Peter Vanroose - vcl_vector member transformations_ changed to non-ptr
00014 //   2004/09/17 Peter Vanroose - made composition() non-virtual - it just returns a member and should not be overloaded
00015 // \endverbatim
00016 
00017 #include <vcsl/vcsl_spatial_transformation.h>
00018 #include <vcsl/vcsl_composition_sptr.h>
00019 #include <vcl_vector.h>
00020 
00021 //: Composition of transformations
00022 // This transformation handles a composition of transformations, that is,
00023 // at a given time, all the transformations are applied on a given point
00024 class vcsl_composition
00025   :public vcsl_spatial_transformation
00026 {
00027  public:
00028   //***************************************************************************
00029   // Constructors/Destructor
00030   //***************************************************************************
00031 
00032   // Default constructor
00033   vcsl_composition() {}
00034 
00035   // Destructor
00036   virtual ~vcsl_composition() {}
00037 
00038   //***************************************************************************
00039   // Status report
00040   //***************************************************************************
00041 
00042   //: Is `this' invertible at time `time'?
00043   //  REQUIRE: valid_time(time)
00044   // Pure virtual function of vcsl_spatial_transformation
00045   virtual bool is_invertible(double time) const;
00046 
00047   //: Is `this' correctly set ?
00048   // Virtual function of vcsl_spatial_transformation
00049   virtual bool is_valid() const;
00050 
00051   //: Return the list of transformations
00052   vcl_vector<vcsl_spatial_transformation_sptr> composition() const { return transformations_; }
00053 
00054   //***************************************************************************
00055   // Status setting
00056   //***************************************************************************
00057 
00058   //: Set the list of transformations of the composition
00059   //  The transformations are performed in the order of the list
00060   void set_composition(vcl_vector<vcsl_spatial_transformation_sptr> const& t) { transformations_=t; }
00061 
00062   //***************************************************************************
00063   // Basic operations
00064   //***************************************************************************
00065 
00066   //: Image of `v' by `this'
00067   //  REQUIRE: is_valid()
00068   // Pure virtual function of vcsl_spatial_transformation
00069   virtual vnl_vector<double> execute(const vnl_vector<double> &v,
00070                                      double time) const;
00071 
00072   //: Image of `v' by the inverse of `this'
00073   //  REQUIRE: is_valid()
00074   //  REQUIRE: is_invertible(time)
00075   // Pure virtual function of vcsl_spatial_transformation
00076   virtual vnl_vector<double> inverse(const vnl_vector<double> &v,
00077                                      double time) const;
00078  protected:
00079   vcl_vector<vcsl_spatial_transformation_sptr> transformations_;
00080 };
00081 
00082 #endif // vcsl_composition_h_