00001 /*!@file Channels/TJunctionChannel.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/TJunctionChannel.C $ 00035 // $Id: TJunctionChannel.C 9503 2008-03-19 23:10:33Z rjpeters $ 00036 // 00037 00038 #ifndef TJUNCTIONCHANNEL_C_DEFINED 00039 #define TJUNCTIONCHANNEL_C_DEFINED 00040 00041 #include "Channels/TJunctionChannel.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 // T Junction Channel member definitions: 00051 // ###################################################################### 00052 TJunctionChannel::TJunctionChannel(OptionManager& mgr, 00053 nub::soft_ref<OrientationChannel> oc) 00054 : 00055 ComplexChannel(mgr, "TJunction", "t-junction", TJUNCTION), 00056 itsNumOrients(&OPT_NumTOrients, 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 TJunctionChannel::~TJunctionChannel() 00066 { 00067 GVX_TRACE(__PRETTY_FUNCTION__); 00068 } 00069 00070 // ###################################################################### 00071 void TJunctionChannel::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..360]deg", itsNumOrients.getVal()); 00078 for (uint ori = 0; ori < 8; ) 00079 { 00080 switch (ori) 00081 { 00082 case 0: 00083 addSubChan(makeSharedComp 00084 (new JunctionChannel(getManager(), itsOriChan, 00085 visualFeature(), 00086 1,0,0,0,1,0,1,0 )), 00087 "", 1.0, /* exportOpts = */ true); 00088 break; 00089 case 1: 00090 addSubChan(makeSharedComp 00091 (new JunctionChannel(getManager(), itsOriChan, 00092 visualFeature(), 00093 0,1,0,0,0,1,0,1 )), 00094 "", 1.0, /* exportOpts = */ true); 00095 break; 00096 case 2: 00097 addSubChan(makeSharedComp 00098 (new JunctionChannel(getManager(), itsOriChan, 00099 visualFeature(), 00100 1,0,1,0,0,0,1,0 )), 00101 "", 1.0, /* exportOpts = */ true); 00102 break; 00103 case 3: 00104 addSubChan(makeSharedComp 00105 (new JunctionChannel(getManager(), itsOriChan, 00106 visualFeature(), 00107 0,1,0,1,0,0,0,1 )), 00108 "", 1.0, /* exportOpts = */ true); 00109 break; 00110 case 4: 00111 addSubChan(makeSharedComp 00112 (new JunctionChannel(getManager(), itsOriChan, 00113 visualFeature(), 00114 1,0,1,0,1,0,0,0 )), 00115 "", 1.0, /* exportOpts = */ true); 00116 break; 00117 case 5: 00118 addSubChan(makeSharedComp 00119 (new JunctionChannel(getManager(), itsOriChan, 00120 visualFeature(), 00121 0,1,0,1,0,1,0,0 )), 00122 "", 1.0, /* exportOpts = */ true); 00123 break; 00124 case 6: 00125 addSubChan(makeSharedComp 00126 (new JunctionChannel(getManager(), itsOriChan, 00127 visualFeature(), 00128 0,0,1,0,1,0,1,0 )), 00129 "", 1.0, /* exportOpts = */ true); 00130 break; 00131 case 7: 00132 addSubChan(makeSharedComp 00133 (new JunctionChannel(getManager(), itsOriChan, 00134 visualFeature(), 00135 0,0,0,1,0,1,0,1 )), 00136 "", 1.0, /* exportOpts = */ true); 00137 break; 00138 default: 00139 break; 00140 } 00141 ori += 8 / itsNumOrients.getVal(); 00142 } 00143 } 00144 00145 // ###################################################################### 00146 void TJunctionChannel::paramChanged(ModelParamBase* const param, 00147 const bool valueChanged, 00148 ParamClient::ChangeStatus* status) 00149 { 00150 GVX_TRACE(__PRETTY_FUNCTION__); 00151 ComplexChannel::paramChanged(param, valueChanged, status); 00152 00153 // if the param is our number of orientations and it has become 00154 // different from our number of channels, let's reconfigure: 00155 if (param == &itsNumOrients && 00156 numChans() != itsNumOrients.getVal()) 00157 buildSubChans(); 00158 } 00159 00160 // ###################################################################### 00161 void TJunctionChannel::doInput(const InputFrame& inframe) 00162 { 00163 GVX_TRACE(__PRETTY_FUNCTION__); 00164 for (uint i = 0; i < numChans(); ++i) 00165 { 00166 subChan(i)->input(inframe); 00167 LINFO("TJunction pyramid (%d/%d) ok.", i+1, numChans()); 00168 } 00169 } 00170 00171 // ###################################################################### 00172 /* So things look consistent in everyone's emacs... */ 00173 /* Local Variables: */ 00174 /* indent-tabs-mode: nil */ 00175 /* End: */ 00176 00177 #endif // TJUNCTIONCHANNEL_C_DEFINED