// ----------------------------------------------------------------------------- // ******************************** MeanRegisC ********************************* // ----------------------------------------------------------------------------- // //! file="amma/Surf3d/Regis/MeanRegis.hh" //! author = "Simon Cunnington" //! date = "03/09/98" //! userlevel = Normal //! lib=Regis //! rcsid = "$Id: MeanRegis.hh,v 1.6 2000/02/16 14:13:05 ees1cg Exp $" //! docentry = "3D Surface.Registration" // Synopsis : Registers N point sets, using Pennec's method of mean shape. // ----------------------------------------------------------------------------- // // Authors : Simon Cunnington // // Current Details : // // $RCSfile: MeanRegis.hh,v $ // $Revision: 1.6 $ // $Author: ees1cg $ modified this file on $Date: 2000/02/16 14:13:05 $ // // // Copyright (C) 1998-1999 University of Surrey, UK. All Rights Reserved. // // The copyright to the computer program(s) herein is the property of the // University of Surrey, UK. The program(s) may be used and/or copied only // with the written permission of the University of Surrey or in accordance // with the terms and conditions stipulated in the agreement/contract under // which the program(s) have been supplied. This copyright notice must not be // removed. // #ifndef MEANREGIS_HH #define MEANREGIS_HH #include "amma/CorrSet.hh" #include "amma/SArray1d.hh" #include "amma/ReSArr1.hh" #include "amma/VecSet.hh" #include "amma/Boolean.hh" // ----------------------------------------------------------------------------- // ********** MeanRegisC ******************************************************* // ----------------------------------------------------------------------------- // //: MeanRegisC registers N point sets, using Pennec's method of mean shape. // //

// MeanRegisC registers N point sets, using Pennec's method of mean shape. //

// There is a mean surface, a concatenated 2d array of correspondence sets // of size nptsM (nptsM being the sum of points from all correspondence sets). //

// The lookup table, setposM, of size nsets, identifies where each set starts // in the mean surface (concatenated 2d array). //

// Algorithm
//   - While not converged do:
//        -> Build mean surface.
//        -> Register each view to the surface.
// 

// The constructor allows guesses to be passed which will then be used to // initialise the elements of rtsM. Each element being associated with a view. //

// The expected rigid transforms can be passed via the function SetExpectedRTs, // which is only used for the calculation of delta theta. //

// class MeanRegisC { /* MEMBER FUNCTIONS */ /* ---------------- */ public: /* Constructor & Destructor */ /* ------------------------ */ MeanRegisC(CorrSetC corrset, SArray1dC rtguesses, double rmsthresh = 0.99, int trace=0, int miniter=-1, int maxiter=1000); //: Constructor. The Guesses that are passed are used to setup rtsM. //: They are not applied to each view. // // The expected RTs are to be set by using SetExpectedRTs. // However they are defaulted to Null Transforms! ~MeanRegisC(); //: Destructor. /* Expected RTs */ /* ------------ */ void SetExpectedRTs(SArray1dC expectedrts); //: Used to set the expected RTs. /* Main Function */ /* ------------- */ SArray1dC Solve(void); //: The main function which determines the optimal Rigid Transforms //: for each view. protected : void BuildMeanSurface(void); //: Creates Mean Surface. RTs are applied during construction to each view. void RegToMean(void); //: Registers each view to the Mean Surface. double CalcMSE(void); //: Calculates MSE BooleanT Converged(int iteration); //: Determines whether convergence has occured. /* MEMBER DATA */ /* ----------- */ protected: /* Correspondence Sets Info */ /* ------------------------ */ int nviewsM; // The total number of views. int ncsetsM; // The total number of correspondence sets. CorrSetC corrsetM; // Correspondence sets, with member functions // which for example can apply an RT per view SArray1dC csetsM; // Handle to correspondence sets, // ie. csetsM = corrsetM.csetsM; /* Variables Used In Conjunction With Mean Surface */ /* ----------------------------------------------- */ SArray1dC setposM; // Lookup table. Gives index entry into // mean surface for each view. So the // 1st view will have index entry 0. The // 2nd view will have the index entry of // 0 + (no. points of 1st view). And so on. int nptsM; // Total no. of points in all corr sets. VectorSetC meanSurfaceM; // Mean surface. /* Rigid Transforms */ /* ---------------- */ SArray1dC rtsM; // Transforms associated with each view SArray1dC rtsexpectedM; // RTs expected (inverses of guesses) /* Constants */ /* --------- */ /* Options */ const double RmsThreshM; // Used in convergence test const int traceM; // Trace: 0->no trace, 1->basic, 2->full const int minIterationsM; // Termination criteria is not used until the // minimum number of iterations has been done. const int maxIterationsM; // Maximum number of iterations allowed. const double NearZeroM; // Used for equal to zero tests }; #endif