ChannelBase Class Reference

ChannelBase represents the various computational modules in VisualCortex. More...

#include <Channels/ChannelBase.H>

Inheritance diagram for ChannelBase:
Inheritance graph
[legend]
Collaboration diagram for ChannelBase:
Collaboration graph
[legend]

List of all members.

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 std::string getSubmapNameShort (const uint index) const =0
 Get the name/description of the feature map at the given index, short version.
virtual void getFeatures (const Point2D< int > &locn, std::vector< float > &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 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)

Detailed Description

ChannelBase represents the various computational modules in VisualCortex.

Definition at line 63 of file ChannelBase.H.


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 ModelComponent::init().

ChannelBase::~ChannelBase (  )  [virtual]

Virtual destructor ensures proper destruction of derived classes.

Definition at line 68 of file ChannelBase.C.


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 ChannelVisitor::visitChannelBase().

Referenced by setSubmapAlgorithmBiased().

virtual void ChannelBase::doInput ( const InputFrame inframe  )  [protected, pure virtual]
Dims ChannelBase::getInputDims (  )  const
virtual Dims ChannelBase::getMapDims (  )  const [pure virtual]
virtual Image<float> ChannelBase::getOutput (  )  [pure virtual]
virtual Image<float> ChannelBase::getRawCSmap ( const uint  idx  )  const [inline, virtual]
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, ForegroundDetectionChannel, 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, ForegroundDetectionChannel, HueChannel, IntegerComplexChannel, IntegerSimpleChannel, ObjDetChannel, SingleChannel, SingleSvChannel, SpectralResidualChannel, and ZeroChannel.

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

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

Implemented in ComplexChannel, ContourChannel, IntegerComplexChannel, IntegerSimpleChannel, ObjDetChannel, SingleChannel, SingleSvChannel, 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 Dims::isNonEmpty().

Referenced by ObjDetChannel::getMapDims(), ZeroChannel::getMapDims(), ForegroundDetectionChannel::getMapDims(), SingleChannel::getOutput(), and DescriptorVec::setFovea().

void ChannelBase::input ( const InputFrame inframe  ) 
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.

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 167 of file ChannelBase.C.

Referenced by input(), readFrom(), and reset1().

virtual uint ChannelBase::numSubmaps (  )  const [pure virtual]
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, DirectionOpticalFlowChannel, DummyChannel, EntropyChannel, ForegroundDetectionChannel, InformationChannel, IntegerComplexChannel, IntegerSimpleChannel, MichelsonChannel, ObjDetChannel, PN03contrastChannel, ScorrChannel, SIFTChannel, SingleChannel, SobelChannel, SpectralResidualChannel, TcorrChannel, VarianceChannel, and ZeroChannel.

Referenced by ChannelMaps::ChannelMaps().

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

Kill our caches.

Reimplemented from ModelComponent.

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

Definition at line 74 of file ChannelBase.C.

References killCaches().

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, IntegerRawVisualCortex, IntegerSimpleChannel, RawVisualCortex, SingleChannel, and SpectralResidualChannel.

Definition at line 160 of file ChannelBase.C.

VisualFeature ChannelBase::visualFeature (  )  const
void ChannelBase::writeTo ( ParamMap pmap  )  const [virtual]

The documentation for this class was generated from the following files:
Generated on Sun May 8 08:43:10 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3