InferoTemporalConfigurator.C

Go to the documentation of this file.
00001 /*!@file Neuro/InferoTemporalConfigurator.C Class to select a InferoTemporal at
00002   runtime */
00003 
00004 // //////////////////////////////////////////////////////////////////// //
00005 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2003   //
00006 // by the University of Southern California (USC) and the iLab at USC.  //
00007 // See http://iLab.usc.edu for information about this project.          //
00008 // //////////////////////////////////////////////////////////////////// //
00009 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00010 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00011 // in Visual Environments, and Applications'' by Christof Koch and      //
00012 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00013 // pending; application number 09/912,225 filed July 23, 2001; see      //
00014 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00015 // //////////////////////////////////////////////////////////////////// //
00016 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00017 //                                                                      //
00018 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00019 // redistribute it and/or modify it under the terms of the GNU General  //
00020 // Public License as published by the Free Software Foundation; either  //
00021 // version 2 of the License, or (at your option) any later version.     //
00022 //                                                                      //
00023 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00024 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00025 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00026 // PURPOSE.  See the GNU General Public License for more details.       //
00027 //                                                                      //
00028 // You should have received a copy of the GNU General Public License    //
00029 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00030 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00031 // Boston, MA 02111-1307 USA.                                           //
00032 // //////////////////////////////////////////////////////////////////// //
00033 //
00034 // Primary maintainer for this file: James Bonaiuto <bonaiuto@usc.edu>
00035 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Neuro/InferoTemporalConfigurator.C $
00036 // $Id: InferoTemporalConfigurator.C 14286 2010-12-01 17:46:34Z sophie $
00037 //
00038 
00039 #include "Neuro/InferoTemporalConfigurator.H"
00040 #include "Component/OptionManager.H"
00041 #include "Neuro/InferoTemporal.H"
00042 #include "Neuro/InferoTemporalSalBayes.H"
00043 #include "Neuro/InferoTemporalHmax.H"
00044 #include "Neuro/InferoTemporalSIFT.H"
00045 #ifdef INVT_USE_CUDA
00046 #include "Neuro/InferoTemporalCudaHmax.H"
00047 #endif
00048 #include "Neuro/NeuroOpts.H"
00049 
00050 
00051 // ######################################################################
00052 InferoTemporalConfigurator::
00053 InferoTemporalConfigurator(OptionManager& mgr,
00054                            const std::string& descrName,
00055                            const std::string& tagName) :
00056   ModelComponent(mgr, descrName, tagName),
00057   itsITtype(&OPT_InferoTemporalType, this),
00058   itsIT(new InferoTemporalStub(mgr))
00059 {
00060   addSubComponent(itsIT);
00061 }
00062 
00063 // ######################################################################
00064 InferoTemporalConfigurator::~InferoTemporalConfigurator()
00065 {  }
00066 
00067 // ######################################################################
00068 nub::ref<InferoTemporal> InferoTemporalConfigurator::getIT() const
00069 { return itsIT; }
00070 
00071 // ######################################################################
00072 void InferoTemporalConfigurator::
00073 paramChanged(ModelParamBase* const param,
00074              const bool valueChanged,
00075              ParamClient::ChangeStatus* status)
00076 {
00077   ModelComponent::paramChanged(param, valueChanged, status);
00078 
00079   // was that a change of our baby's name?
00080   if (param == &itsITtype) {
00081     LINFO("Configuring IT of type %s", itsITtype.getVal().c_str());
00082 
00083     // if we had one, let's unregister it:
00084     LINFO("Resetting InferoTemporal...");
00085     removeSubComponent(*itsIT);
00086 
00087     // instantiate a IT of the appropriate type:
00088 
00089     // #################### No inferior temporal cortex:
00090     if (itsITtype.getVal().compare("None") == 0 ||
00091         itsITtype.getVal().compare("Stub") == 0)
00092       itsIT.reset(new InferoTemporalStub(getManager()));
00093 
00094     // #################### Standard inferior temporal cortex:
00095     else if (itsITtype.getVal().compare("Std") == 0)
00096       itsIT.reset(new InferoTemporalStd(getManager(),
00097                                         "Inferior Temporal Cortex",
00098                                         "InferoTemporal"));
00099     // #################### SalBayes inferior temporal cortex:
00100     else if (itsITtype.getVal().compare("SalBayes") == 0)
00101       itsIT.reset(new InferoTemporalSalBayes(getManager(),
00102                                         "Inferior Temporal Cortex",
00103                                         "InferoTemporal"));
00104     // #################### SIFT inferior temporal cortex:
00105     else if (itsITtype.getVal().compare("SIFT") == 0)
00106       itsIT.reset(new InferoTemporalSIFT(getManager(),
00107                                         "Inferior Temporal Cortex",
00108                                         "InferoTemporal"));
00109     // #################### Hmax inferior temporal cortex:
00110     else if (itsITtype.getVal().compare("HMAX") == 0)
00111       itsIT.reset(new InferoTemporalHmax(getManager(),
00112                                         "Inferior Temporal Cortex",
00113                                         "InferoTemporal"));
00114 #ifdef INVT_USE_CUDA
00115     // #################### CUDA Hmax inferior temporal cortex:
00116     else if (itsITtype.getVal().compare("CUDAHMAX") == 0)
00117       itsIT.reset(new InferoTemporalCudaHmax(getManager(),
00118                                         "Inferior Temporal Cortex",
00119                                         "InferoTemporal"));
00120 #endif
00121     // #################### Custom-defined:
00122     else
00123       itsIT.reset(new InferoTemporalStd(getManager(),
00124                                         "Inferior Temporal Cortex",
00125                                         "InferoTemporal"));
00126 
00127     // add our babies as a subcomponents of us so that they will
00128     // become linked to the manager through us (hopefully we are
00129     // registered with the manager), which in turn will allow them to
00130     // export their command-line options and get configured.
00131 
00132     addSubComponent(itsIT);
00133 
00134     // tell the controller to export its options:
00135     itsIT->exportOptions(MC_RECURSE);
00136   }
00137 }
00138 
00139 
00140 // ######################################################################
00141 /* So things look consistent in everyone's emacs... */
00142 /* Local Variables: */
00143 /* indent-tabs-mode: nil */
00144 /* End: */
Generated on Sun May 8 08:05:24 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3