freESPopulation.txx

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   F.R.E.E. - flexible registration evaluation engine
00004   Version:   v.1.0.0
00005   Date:      $Date: 2006/09/01 12:00:00 $
00006   Module:    $RCSfile: freESPopulation.txx,v $
00007   Language:  C++
00008 
00009 
00010 
00011   Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics,
00012   Institute for Medical Biometry and Informatics, University of Heidelberg,
00013   Germany). All rights reserved.
00014   See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm
00015   for details.
00016 
00017      This software is distributed WITHOUT ANY WARRANTY; without even 
00018      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00019      PURPOSE.  See the above copyright notices for more information.
00020 
00021 =========================================================================*/
00022 #ifndef __freESPopulation_txx
00023 #define __freESPopulation_txx
00024 
00025 #include "freESPopulation.h"
00026 
00027 namespace FREE
00028 {
00029   namespace ES
00030   {
00031 
00032     template <class TIndividual>
00033     Population<TIndividual> ::
00034     Population(): m_UniqueID(0), m_GenerationID(0)
00035     {
00036       m_StrategicParameters = StrategicParametersType::New();
00037       m_BestIndividualEver = NULL;
00038       m_BestIndividual = NULL;
00039     }
00040 
00041     template <class TIndividual>
00042     void
00043     Population<TIndividual> ::
00044     PrintSelf(std::ostream& os, itk::Indent indent) const
00045     {
00046       os << indent << "GID: " << this->GetGenerationID() << std::endl;
00047       os << indent << "last unique IID: " << this->m_UniqueID << std::endl;
00048       os << indent << "Individuals: " << std::endl;
00049 
00050       typename Self::const_iterator pos;
00051       for (pos = this->begin(); pos!=this->end(); ++pos)
00052       {
00053         (*pos)->Print(os, indent.GetNextIndent());
00054         os << std::endl;
00055       }
00056     };
00057 
00058     template <class TIndividual>
00059     typename Population<TIndividual>::IndividualType*
00060     Population<TIndividual> ::
00061     GetIndividualByUniqueID(IndividualIDType iID)
00062     {
00063       typename Self::iterator pos;
00064       for (pos = this->begin(); pos!=this->end(); ++pos)
00065       {
00066         if ((*pos)->GetIndividualID()== iID) return (*pos).GetPointer();
00067       }
00068       return 0;
00069     };
00070 
00071     template <class TIndividual>
00072     typename Population<TIndividual>::Pointer
00073     Population<TIndividual> ::
00074     Clone() const
00075     {
00076       Pointer newPopulation = Self::New();
00077       *(newPopulation.GetPointer()) = *this;
00078       return newPopulation;
00079     };
00080 
00081     template <class TIndividual>
00082     void
00083     Population<TIndividual> ::
00084     operator=(Self const& population)
00085     {
00086       m_UniqueID = population.GetLastUniqueIndividualID();
00087       m_GenerationID = population.GetGenerationID();
00088 
00089       this->clear();
00090 
00091       for (typename Self::const_iterator pos = population.begin(); pos!=population.end(); ++pos)
00092       {
00093         IndividualPointer indi = (*pos)->Clone();
00094         InsertElement(indi->GetIndividualID(), indi);
00095       }
00096     };
00097 
00098   } // End namespace ES
00099 } // End namespace FREE
00100 
00101 
00102 #endif // __freESPopulation_txx

Generated at Sat Oct 13 15:53:45 2007 for f.r.e.e. - Flexible Registration and Evaluation Engine by doxygen 1.5.3 written by Dimitri van Heesch, © 1997-2000