00001 #ifndef rgrl_trans_mixed_spline_h_ 00002 #define rgrl_trans_mixed_spline_h_ 00003 //: 00004 // \file 00005 #include "rgrl_transformation.h" 00006 #include "rgrl_trans_spline.h" 00007 #include <vcl_vector.h> 00008 00009 class rgrl_trans_mixed_spline 00010 : public rgrl_transformation 00011 { 00012 public: 00013 //: Constructor 00014 rgrl_trans_mixed_spline( vcl_vector< rgrl_trans_spline > const& trans_splines ) 00015 : trans_splines_( trans_splines ){} 00016 00017 ~rgrl_trans_mixed_spline() {} 00018 00019 void add_trans( rgrl_trans_spline trans_spline ) 00020 { 00021 trans_splines_.push_back( trans_spline ); 00022 } 00023 00024 vnl_matrix<double> 00025 transfer_error_covar( vnl_vector<double> const& p ) const; 00026 00027 //: Compute jacobian w.r.t. location 00028 virtual void jacobian_wrt_loc( vnl_matrix<double>& jac, vnl_vector<double> const& from_loc ) const; 00029 00030 //: make a clone copy 00031 rgrl_transformation_sptr clone() const; 00032 00033 //: transform the transformation for images of different resolution 00034 rgrl_transformation_sptr scale_by( double scale ) const; 00035 00036 // Defines type-related functions 00037 rgrl_type_macro( rgrl_trans_mixed_spline, rgrl_transformation ); 00038 00039 protected: 00040 void map_loc( vnl_vector< double > const& from, 00041 vnl_vector< double > & to ) const; 00042 00043 void map_dir( vnl_vector< double > const& from_loc, 00044 vnl_vector< double > const& from_dir, 00045 vnl_vector< double > & to_dir ) const; 00046 00047 private: 00048 // each rgrl_trans_spline defines its own region transformation 00049 // the transformation is the sum of these rgrl_trans_spline 00050 vcl_vector< rgrl_trans_spline > trans_splines_; 00051 }; 00052 00053 #endif