contrib/rpl/rgrl/rgrl_initializer_prior.cxx
Go to the documentation of this file.
00001 //:
00002 // \file
00003 // \author Chuck Stewart
00004 
00005 #include "rgrl_initializer_prior.h"
00006 #include "rgrl_view.h"
00007 #include "rgrl_transformation.h"
00008 
00009 rgrl_initializer_prior::
00010 rgrl_initializer_prior( rgrl_view_sptr           prior_view,
00011                         rgrl_scale_sptr          prior_scale )
00012   : init_view_( prior_view ),
00013     prior_scale_( prior_scale ),
00014     xform_index_( 0 )
00015 {
00016   views_.push_back( prior_view );
00017 }
00018 
00019 rgrl_initializer_prior::
00020 rgrl_initializer_prior( rgrl_mask_sptr             const& from_image_roi,
00021                         rgrl_mask_sptr             const& to_image_roi,
00022                         rgrl_mask_box              const& initial_from_image_roi,
00023                         rgrl_estimator_sptr        xform_estimator,
00024                         rgrl_transformation_sptr   xform_estimate,
00025                         unsigned                   initial_resolution,
00026                         rgrl_scale_sptr            prior_scale )
00027   : prior_scale_( prior_scale ),
00028     xform_index_( 0 )
00029 {
00030   rgrl_mask_box global_region( from_image_roi->bounding_box() );
00031   init_view_ = new rgrl_view( from_image_roi, to_image_roi,
00032                               initial_from_image_roi,
00033                               global_region, xform_estimator,
00034                               xform_estimate,
00035                               initial_resolution );
00036   views_.push_back( init_view_ );
00037 }
00038 
00039 rgrl_initializer_prior::
00040 rgrl_initializer_prior( rgrl_mask_sptr             const& from_image_roi,
00041                         rgrl_mask_sptr             const& to_image_roi,
00042                         rgrl_estimator_sptr        xform_estimator,
00043                         rgrl_transformation_sptr   xform_estimate,
00044                         unsigned                   initial_resolution,
00045                         rgrl_scale_sptr            prior_scale )
00046   : prior_scale_( prior_scale ),
00047     xform_index_( 0 )
00048 {
00049   rgrl_mask_box global_region( from_image_roi->bounding_box() );
00050   init_view_ = new rgrl_view( from_image_roi, to_image_roi, 
00051                               global_region, global_region,
00052                               xform_estimator, xform_estimate,
00053                               initial_resolution );
00054   views_.push_back( init_view_ );
00055 }
00056 
00057 rgrl_initializer_prior::
00058 rgrl_initializer_prior( rgrl_mask_sptr             const& from_image_roi,
00059                         rgrl_estimator_sptr        xform_estimator,
00060                         rgrl_transformation_sptr   xform_estimate,
00061                         unsigned                   initial_resolution,
00062                         rgrl_scale_sptr            prior_scale )
00063   : prior_scale_( prior_scale ),
00064     xform_index_( 0 )
00065 {
00066   rgrl_mask_box global_region( from_image_roi->bounding_box() );
00067   init_view_ = new rgrl_view( from_image_roi, from_image_roi, 
00068                               global_region, global_region, xform_estimator, xform_estimate,
00069                               initial_resolution );
00070   views_.push_back( init_view_ );
00071 }
00072 
00073 void
00074 rgrl_initializer_prior::add_prior_xform( rgrl_transformation_sptr   xform_estimate )
00075 {
00076 
00077   rgrl_view_sptr view = new rgrl_view( init_view_->from_image_roi(),
00078                         init_view_->to_image_roi(),
00079                         init_view_->region(),
00080                         init_view_->global_region(),
00081                         init_view_->xform_estimator(),
00082                         xform_estimate,
00083                         init_view_->resolution() );
00084   views_.push_back( view );
00085 }
00086 
00087 bool
00088 rgrl_initializer_prior::
00089 next_initial( rgrl_view_sptr           & view,
00090               rgrl_scale_sptr          & prior_scale )
00091 {
00092   if ( xform_index_ >= views_.size())
00093     return false;
00094 
00095   view = views_[xform_index_];
00096   prior_scale = this->prior_scale_;
00097   xform_index_++;
00098 
00099   return true;
00100 }