00001 /*!@file Channels/XJunctionChannel.C */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00005 // by the University of Southern California (USC) and the iLab at USC. // 00006 // See http://iLab.usc.edu for information about this project. // 00007 // //////////////////////////////////////////////////////////////////// // 00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00010 // in Visual Environments, and Applications'' by Christof Koch and // 00011 // Laurent Itti, California Institute of Technology, 2001 (patent // 00012 // pending; application number 09/912,225 filed July 23, 2001; see // 00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00014 // //////////////////////////////////////////////////////////////////// // 00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00016 // // 00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00018 // redistribute it and/or modify it under the terms of the GNU General // 00019 // Public License as published by the Free Software Foundation; either // 00020 // version 2 of the License, or (at your option) any later version. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00025 // PURPOSE. See the GNU General Public License for more details. // 00026 // // 00027 // You should have received a copy of the GNU General Public License // 00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00030 // Boston, MA 02111-1307 USA. // 00031 // //////////////////////////////////////////////////////////////////// // 00032 // 00033 // Primary maintainer for this file: 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Channels/XJunctionChannel.C $ 00035 // $Id: XJunctionChannel.C 9504 2008-03-19 23:23:43Z rjpeters $ 00036 // 00037 00038 #ifndef XJUNCTIONCHANNEL_C_DEFINED 00039 #define XJUNCTIONCHANNEL_C_DEFINED 00040 00041 #include "Channels/XJunctionChannel.H" 00042 00043 #include "Channels/ChannelOpts.H" 00044 #include "Channels/JunctionChannel.H" 00045 #include "Channels/OrientationChannel.H" 00046 #include "Component/OptionManager.H" 00047 #include "rutz/trace.h" 00048 00049 // ###################################################################### 00050 // X Junction Channel member definitions: 00051 // ###################################################################### 00052 XJunctionChannel::XJunctionChannel(OptionManager& mgr, 00053 nub::soft_ref<OrientationChannel> oc) 00054 : 00055 ComplexChannel(mgr, "XJunction", "x-junction", XJUNCTION), 00056 itsNumOrients(&OPT_NumXOrients, this), // see Channels/ChannelOpts.{H,C} 00057 itsOriChan(oc) 00058 { 00059 GVX_TRACE(__PRETTY_FUNCTION__); 00060 // let's build our channels 00061 buildSubChans(); 00062 } 00063 00064 // ###################################################################### 00065 XJunctionChannel::~XJunctionChannel() 00066 { 00067 GVX_TRACE(__PRETTY_FUNCTION__); 00068 } 00069 00070 // ###################################################################### 00071 void XJunctionChannel::buildSubChans() 00072 { 00073 GVX_TRACE(__PRETTY_FUNCTION__); 00074 // kill any subchans we may have had... 00075 this->removeAllSubChans(); 00076 00077 LINFO("Using %d orientations spanning [0..90]deg", itsNumOrients.getVal()); 00078 if (itsNumOrients.getVal() >= 1) 00079 addSubChan(makeSharedComp 00080 (new JunctionChannel(getManager(), itsOriChan, 00081 visualFeature(), 00082 1,0,1,0,1,0,1,0)), 00083 "", 1.0, /* exportOpts = */ true); 00084 00085 if (itsNumOrients.getVal() >= 2) 00086 addSubChan(makeSharedComp 00087 (new JunctionChannel(getManager(), itsOriChan, 00088 visualFeature(), 00089 0,1,0,1,0,1,0,1)), 00090 "", 1.0, /* exportOpts = */ true); 00091 } 00092 00093 // ###################################################################### 00094 void XJunctionChannel::paramChanged(ModelParamBase* const param, 00095 const bool valueChanged, 00096 ParamClient::ChangeStatus* status) 00097 { 00098 GVX_TRACE(__PRETTY_FUNCTION__); 00099 ComplexChannel::paramChanged(param, valueChanged, status); 00100 00101 // if the param is our number of orientations and it has become 00102 // different from our number of channels, let's reconfigure: 00103 if (param == &itsNumOrients && 00104 numChans() != itsNumOrients.getVal()) 00105 { 00106 if (itsNumOrients.getVal() != 1 && itsNumOrients.getVal() != 2) 00107 { 00108 LERROR("%s must be 1 or 2", itsNumOrients.getName().c_str()); 00109 *status = ParamClient::CHANGE_REJECTED; 00110 } 00111 else 00112 buildSubChans(); 00113 } 00114 } 00115 00116 // ###################################################################### 00117 void XJunctionChannel::doInput(const InputFrame& inframe) 00118 { 00119 GVX_TRACE(__PRETTY_FUNCTION__); 00120 for (uint i = 0; i < numChans(); ++i) 00121 { 00122 subChan(i)->input(inframe); 00123 LINFO("XJunction pyramid (%d/%d) ok.", i+1, numChans()); 00124 } 00125 } 00126 00127 // ###################################################################### 00128 /* So things look consistent in everyone's emacs... */ 00129 /* Local Variables: */ 00130 /* indent-tabs-mode: nil */ 00131 /* End: */ 00132 00133 #endif // XJUNCTIONCHANNEL_C_DEFINED