Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ChannelBase Class Reference

#include <Channels/ChannelBase.H>

Inheritance diagram for ChannelBase:

Inheritance graph
[legend]
Collaboration diagram for ChannelBase:

Collaboration graph
[legend]
List of all members.

Detailed Description

ChannelBase represents the various computational modules in VisualCortex.

Definition at line 63 of file ChannelBase.H.

Public Member Functions

 ChannelBase (OptionManager &mgr, const std::string &descrName, const std::string &tagName, const VisualFeature vs)
 Default constructor. See ModelComponent.H.
virtual ~ChannelBase ()
 Virtual destructor ensures proper destruction of derived classes.
virtual void reset1 ()
 Kill our caches.
virtual void accept (ChannelVisitor &v)
 Default version calls visitChannelBase() on the ChannelVisitor.
VisualFeature functions
VisualFeature visualFeature () const
 Get the visual feature.
virtual bool isHomogeneous () const
 Is the channel homogeneous?
ParamMap functions
Subclasses should be sure to call ChannelBase's version of these functions within their own implementations, so that ChannelBase's parameters (such as its weights) are properly handled.

This interface is different from that provided by ModelComponent, as here we only save a subset of all of the Channel's parameters, that are useful, e.g., for object recognition or feature-based attention biasing. Some of the values saved here may not even be ModelParam parameters.

virtual void readFrom (const ParamMap &pmap)
 Read params from the ParamMap.
virtual void writeTo (ParamMap &pmap) const
 Write params to the ParamMap.
Input functions
See documentation on InputFrame for multiple ways in which an InputFrame can be constructed.

void input (const InputFrame &inframe)
 Send a full-blown InputFrame to the channel.
Access functions
virtual bool outputAvailable () const =0
 Query whether the channel is ready to give yield valid output.
virtual Dims getMapDims () const =0
 Return the dimensions of the output image.
bool hasInput () const
 Check if we've received any input images yet.
Dims getInputDims () const
 Return the dimensions of the most recent input image.
virtual uint numSubmaps () const =0
 Return the number of feature maps represented by this channel.
virtual Image< float > getSubmap (const uint index) const =0
 Get the feature map at the given index.
virtual Image< float > getRawCSmap (const uint idx) const
 get raw CS map; part of getSubmap()
virtual std::string getSubmapName (const uint index) const =0
 Get the name/description of the feature map at the given index.
virtual void getFeatures (const Point2D< int > &locn, std::vector< double > &mean) const =0
virtual void getFeaturesBatch (std::vector< Point2D< int > * > *locn, std::vector< std::vector< float > > *mean, int *count) const =0
virtual Image< float > getOutput ()=0
 The output will be the size of the feature map level in the pyramid.
virtual void drawResults (Image< PixRGB< byte > > &traj, const Rectangle &foa)
 Draws something channel-specific in the trajectory image.
virtual void saveResults (const nub::ref< FrameOstream > &ofs)
 Save our various maps using a FrameOstream.
virtual void killCaches ()
 Subclasses override this to clear any caches they may maintain.

Protected Member Functions

virtual void doInput (const InputFrame &inframe)=0
 Subclasses override this implementation of the input() function.
void setInputDims (const Dims &dims)


Constructor & Destructor Documentation

ChannelBase::ChannelBase OptionManager mgr,
const std::string descrName,
const std::string tagName,
const VisualFeature  vs
 

Default constructor. See ModelComponent.H.

Parameters:
mgr our ModelManager (see ModelManager.H)
descrName descriptive name for human usage
tagName name for ParamMap usage
vs The VisualFeature implemented by the channel

Definition at line 57 of file ChannelBase.C.

References GVX_TRACE, and ModelComponent::init().

ChannelBase::~ChannelBase  )  [virtual]
 

Virtual destructor ensures proper destruction of derived classes.

Definition at line 68 of file ChannelBase.C.

References GVX_TRACE.


Member Function Documentation

void ChannelBase::accept ChannelVisitor v  )  [virtual]
 

Default version calls visitChannelBase() on the ChannelVisitor.

Reimplemented in ComplexChannel, SingleChannel, and SpectralResidualChannel.

Definition at line 83 of file ChannelBase.C.

References GVX_TRACE, and ChannelVisitor::visitChannelBase().

Referenced by setSubmapAlgorithmBiased().

virtual void ChannelBase::doInput const InputFrame inframe  )  [protected, pure virtual]
 

Subclasses override this implementation of the input() function.

This will be called by one of the input() methods. For efficiency reasons (e.g. network bandwidth in parallel code), it is possible that the color or luminance input may be null, although the code should be wired up properly so that given subclasses do not receive a null input that they in fact need. Subclasses should be sure to ASSERT that any used inputs are non-null.

Implemented in ColorChannel, CompositeColorChannel, ContourChannel, DepthChannel, DirectFeedChannel, MultiDirectFeedChannel, DisparityChannel, DummyChannel, EndPointChannel, EntropyChannel, FlickerChannel, H2SVChannel, HueChannel, InformationChannel, IntensityBandChannel, JunctionChannel, LJunctionChannel, MotionChannel, MultiColorBandChannel, MultiConvolveChannel, MultiSpectralResidualChannel, ObjDetChannel, OrientationChannel, PN03contrastChannel, RGBConvolveChannel, ScorrChannel, SIFTChannel, SingleChannel, SobelChannel, SOColorChannel, SoxChannel, SpectralResidualChannel, StereoChannel, TcorrChannel, TJunctionChannel, VarianceChannel, XJunctionChannel, ZeroChannel, VisualCortex, and VisualCortexEyeMvt.

Referenced by input().

void ChannelBase::drawResults Image< PixRGB< byte > > &  traj,
const Rectangle foa
[virtual]
 

Draws something channel-specific in the trajectory image.

The default implementation is a no-op; subclasses can override to do something interesting (see for example TemplateMatchChannel).

Parameters:
traj image in which to draw the channel-specific results
foa current focus-of-attention region

Reimplemented in ComplexChannel, IntegerComplexChannel, SpectralResidualChannel, and TemplateMatchChannel.

Definition at line 160 of file ChannelBase.C.

References GVX_TRACE.

Dims ChannelBase::getInputDims  )  const
 

Return the dimensions of the most recent input image.

Will LFATAL() if hasInput() is false.

Definition at line 150 of file ChannelBase.C.

References CLFATAL, GVX_TRACE, and Dims::isEmpty().

Referenced by VisualCortex::combineOutputs(), IntegerVisualCortex::combineOutputsInt(), TemplateMatchChannel::findBestMatch(), SingleOpponentChannel::getFeatures(), SingleChannel::getFeatures(), SingleOpponentChannel::getFeaturesBatch(), SingleChannel::getFeaturesBatch(), ZeroChannel::getMapDims(), SingleChannel::getMapDims(), ObjDetChannel::getMapDims(), IntegerSimpleChannel::getMapDims(), ContourChannel::getMapDims(), SoxChannel::getNonlinearResponse(), and getRaoJetMap().

virtual Dims ChannelBase::getMapDims  )  const [pure virtual]
 

Return the dimensions of the output image.

Implemented in ComplexChannel, ContourChannel, DirectFeedChannel, DummyChannel, IntegerComplexChannel, IntegerSimpleChannel, ObjDetChannel, SingleChannel, SpectralResidualChannel, and ZeroChannel.

virtual Image<float> ChannelBase::getOutput  )  [pure virtual]
 

The output will be the size of the feature map level in the pyramid.

(I.e., the size of the output is given by getMapDims().

Implemented in ComplexChannel, ContourChannel, DirectFeedChannel, EntropyChannel, InformationChannel, IntegerComplexChannel, IntegerSimpleChannel, ObjDetChannel, OrientationChannel, PN03contrastChannel, ScorrChannel, SIFTChannel, SingleChannel, SobelChannel, SpectralResidualChannel, TcorrChannel, VarianceChannel, ZeroChannel, and VisualCortexEyeMvt.

Referenced by compareChannels().

virtual Image<float> ChannelBase::getRawCSmap const uint  idx  )  const [inline, virtual]
 

get raw CS map; part of getSubmap()

Reimplemented in ComplexChannel, IntegerComplexChannel, IntegerSimpleChannel, and SingleChannel.

Definition at line 161 of file ChannelBase.H.

References LFATAL.

virtual Image<float> ChannelBase::getSubmap const uint  index  )  const [pure virtual]
 

Get the feature map at the given index.

This function is intended to be implemented by subclasses so that it recurses into any nested channels, mapping nested submaps into a linear sequence of indices.

Implemented in ComplexChannel, ContourChannel, DirectFeedChannel, HueChannel, IntegerComplexChannel, IntegerSimpleChannel, ObjDetChannel, SingleChannel, SpectralResidualChannel, and ZeroChannel.

virtual std::string ChannelBase::getSubmapName const uint  index  )  const [pure virtual]
 

Get the name/description of the feature map at the given index.

This function is intended to be implemented by subclasses so that it recurses into any nested channels, mapping nested submaps into a linear sequence of indices. The output of this function is intended only to be human-readable (e.g. for labeling image displays), and does not have to follow any particular parseable syntax.

Implemented in ComplexChannel, ContourChannel, DirectFeedChannel, HueChannel, IntegerComplexChannel, IntegerSimpleChannel, ObjDetChannel, SingleChannel, SpectralResidualChannel, and ZeroChannel.

bool ChannelBase::hasInput  )  const
 

Check if we've received any input images yet.

Definition at line 143 of file ChannelBase.C.

References GVX_TRACE, and Dims::isNonEmpty().

Referenced by SceneUnderstandingForm::getDescriptor(), BiasImageForm::getDescriptor(), and DescriptorVec::setFovea().

void ChannelBase::input const InputFrame inframe  ) 
 

Send a full-blown InputFrame to the channel.

Definition at line 131 of file ChannelBase.C.

References doInput(), InputFrame::getDims(), GVX_ERR_CONTEXT, GVX_TRACE, killCaches(), and rutz::sfmt().

Referenced by OrientationChannel::doInput(), MultiDirectFeedChannel::doInput(), VisualCortex::evolve(), and VisualCortex::getVCOutput().

bool ChannelBase::isHomogeneous  )  const [virtual]
 

Is the channel homogeneous?

A homogeneous channel is one whose subchannels (and their subs) have identical VisualFeatures, and those are also identical to our VisualFeature. Default implementation returns true.

Reimplemented in ComplexChannel, IntegerComplexChannel, and SpectralResidualChannel.

Definition at line 97 of file ChannelBase.C.

References GVX_TRACE.

void ChannelBase::killCaches  )  [virtual]
 

Subclasses override this to clear any caches they may maintain.

Subclasses must be sure to explicitly call their base class's version of this function!. This function will be called by ChannelBase when a new input image is received, or when new parameters are read from a ParamMap, etc. Subclasses may also call this function when they know that caches may have become invalid. Calling this explicitly after you have obtained the output from a channel may save you some memory.

Reimplemented in ComplexChannel, ContourChannel, DirectFeedChannel, IntegerComplexChannel, IntegerSimpleChannel, SingleChannel, SoxChannel, and SpectralResidualChannel.

Definition at line 176 of file ChannelBase.C.

References GVX_TRACE.

Referenced by input(), IntegerChannel::inputInt(), SingleChannel::killCaches(), IntegerSimpleChannel::killCaches(), IntegerComplexChannel::killCaches(), ContourChannel::killCaches(), ComplexChannel::killCaches(), readFrom(), and reset1().

virtual uint ChannelBase::numSubmaps  )  const [pure virtual]
 

Return the number of feature maps represented by this channel.

Implemented in ComplexChannel, ContourChannel, DirectFeedChannel, HueChannel, IntegerComplexChannel, IntegerSimpleChannel, ObjDetChannel, SingleChannel, SpectralResidualChannel, and ZeroChannel.

Referenced by IntegerVisualCortex::getChannelOutputMap().

virtual bool ChannelBase::outputAvailable  )  const [pure virtual]
 

Query whether the channel is ready to give yield valid output.

In some cases (e.g. with motion channels), it may take several input frames before the channel is fully initialized.

Implemented in ComplexChannel, ContourChannel, DirectFeedChannel, DummyChannel, EntropyChannel, InformationChannel, IntegerComplexChannel, IntegerSimpleChannel, ObjDetChannel, PN03contrastChannel, ScorrChannel, SIFTChannel, SingleChannel, SobelChannel, SpectralResidualChannel, TcorrChannel, VarianceChannel, and ZeroChannel.

void ChannelBase::readFrom const ParamMap pmap  )  [virtual]
 

Read params from the ParamMap.

Reimplemented in ComplexChannel, DirectFeedChannel, GaborChannel, IntegerComplexChannel, IntegerSimpleChannel, SingleChannel, and SpectralResidualChannel.

Definition at line 106 of file ChannelBase.C.

References ModelComponent::descriptiveName(), ParamMap::getStringParam(), GVX_TRACE, ParamMap::hasParam(), killCaches(), and LFATAL.

Referenced by SpectralResidualChannel::readFrom(), SingleChannel::readFrom(), IntegerSimpleChannel::readFrom(), IntegerComplexChannel::readFrom(), DirectFeedChannel::readFrom(), and ComplexChannel::readFrom().

void ChannelBase::reset1  )  [virtual]
 

Kill our caches.

Reimplemented from ModelComponent.

Reimplemented in DirectFeedChannel, FlickerChannel, IntegerFlickerChannel, IntegerSimpleChannel, SingleChannel, and SingleOpponentChannel.

Definition at line 74 of file ChannelBase.C.

References GVX_TRACE, killCaches(), and ModelComponent::reset1().

Referenced by SingleChannel::reset1(), IntegerSimpleChannel::reset1(), and DirectFeedChannel::reset1().

void ChannelBase::saveResults const nub::ref< FrameOstream > &  ofs  )  [virtual]
 

Save our various maps using a FrameOstream.

The default implementation is a no-op; subclasses can override to do something interesting

Reimplemented in ComplexChannel, ContourChannel, IntegerComplexChannel, IntegerSimpleChannel, SingleChannel, SpectralResidualChannel, IntegerVisualCortex, VisualCortex, and VisualCortexEyeMvt.

Definition at line 169 of file ChannelBase.C.

References GVX_TRACE.

VisualFeature ChannelBase::visualFeature  )  const
 

Get the visual feature.

Definition at line 90 of file ChannelBase.C.

References NModelParam< T >::getVal(), and GVX_TRACE.

Referenced by XJunctionChannel::buildSubChans(), TJunctionChannel::buildSubChans(), LJunctionChannel::buildSubChans(), EndPointChannel::buildSubChans(), SingleChannelBeo::handleInput(), IntegerComplexChannel::isHomogeneous(), ComplexChannel::isHomogeneous(), JetSpecFiller::visitComplexChannel(), JetSpecFiller::visitSingleChannel(), and JetFiller::visitSingleChannel().

void ChannelBase::writeTo ParamMap pmap  )  const [virtual]
 

Write params to the ParamMap.

Reimplemented in ComplexChannel, DirectFeedChannel, GaborChannel, IntegerComplexChannel, IntegerSimpleChannel, SingleChannel, and SpectralResidualChannel.

Definition at line 123 of file ChannelBase.C.

References ModelComponent::descriptiveName(), GVX_TRACE, and ParamMap::putStringParam().

Referenced by SpectralResidualChannel::writeTo(), SingleChannel::writeTo(), IntegerSimpleChannel::writeTo(), IntegerComplexChannel::writeTo(), DirectFeedChannel::writeTo(), and ComplexChannel::writeTo().


The documentation for this class was generated from the following files:
Generated on Sun Oct 12 10:28:55 2008 for iLab Neuromorphic Vision Toolkit by  doxygen 1.4.4