ComplexChannel Class Reference

A an abstract channel class that pools across several subchannels. More...

#include <Channels/ComplexChannel.H>

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

List of all members.

Classes

struct  Impl
struct  SubchanKey
 Refer to a subchannel by one of: its index, its tagname, its address. More...

Public Member Functions

 ComplexChannel (OptionManager &mgr, const std::string &descrName, const std::string &tagName, const VisualFeature vs)
 Constructor.
virtual ~ComplexChannel ()
 Virtual destructor.
virtual void accept (ChannelVisitor &v)
 Calls visitComplexChannel() on the ChannelVisitor.
virtual bool isHomogeneous () const
 Is the channel homogeneous?
uint numChans () const
 Get the number of subchannels.
nub::ref< ChannelBasesubChan (const uint idx) const
 Look up one of the subchannels by its integer index.
nub::ref< ChannelBasesubChan (const std::string &tagname) const
 Look up one of the subchannels by its tagname.
nub::ref< ChannelBasesubChanFromSubmapNum (const uint oldIdx, uint &newIdx) const
 Look up one of the subchannels by a submap number.
void addSubChan (nub::ref< ChannelBase > ch, const char *name=0, const double weight=1.0, bool exportOpts=false)
 Add a subchannel.
void removeSubChan (nub::ref< ChannelBase > ch)
 Remove a subchannel.
void removeAllSubChans ()
 Remove all of our subchannels.
bool hasSubChan (const char *name) const
 Check if we have a channel of given tagname.
void setSubchanVisitor (rutz::shared_ptr< ChannelVisitor > v)
 Install a visitor which will be applied to all newly-added subchannels.
void setSubchanTotalWeight (SubchanKey key, const double wt)
 Set the total weight allocated to the specified subchannel.
double getSubchanTotalWeight (SubchanKey key) const
 Return the total weight allocated to the specified subchannel.
void sortChannelsByNumSubmaps (bool dosort)
 Whether to sort subchannels by their number of submaps.
virtual void readFrom (const ParamMap &pmap)
 Read params from the ParamMap.
virtual void writeTo (ParamMap &pmap) const
 Write params to the ParamMap.
virtual bool outputAvailable () const
 Query whether the channel is ready to give yield valid output.
virtual Dims getMapDims () const
 Return the dimensions of the output image.
virtual uint numSubmaps () const
 Return the number of feature maps represented by this channel.
virtual Image< float > getSubmap (const uint index) const
 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
 Get the name/description of the feature map at the given index.
virtual std::string getSubmapNameShort (const uint index) const
 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
virtual void getFeaturesBatch (std::vector< Point2D< int > * > *locn, std::vector< std::vector< float > > *mean, int *count) const
virtual Image< float > getOutput ()
 Form output by combining output of subchannels.
virtual void saveResults (const nub::ref< FrameOstream > &ofs)
 Save our various maps using a FrameOstream.
virtual void killCaches ()
 Clears the output cache.

Protected Member Functions

virtual Image< float > combineOutputs ()
 Combines the outputs of subchannels.
virtual void start1 ()
 get started
virtual void start2 ()
 get started
virtual void stop2 ()
 stop

Protected Attributes

OModelParam< MaxNormTypeitsNormType
 Normalization; see fancynorm.H.
OModelParam< MapCombineTypeitsCombineType
 see Channels/MapCombineType.H
OModelParam< bool > itsSaveOutputMap
 Save our output map?
OModelParam< bool > itsUseOlderVersion
 use old version? see Visualcortex.H
NModelParam< bool > itsUseSpaceVariantBoundary
 check subchannels for this?
OModelParam< float > itsOutputRangeMin
 Set a fixed range of values for the raw output.
OModelParam< float > itsOutputRangeMax

Detailed Description

A an abstract channel class that pools across several subchannels.

Definition at line 50 of file ComplexChannel.H.


Constructor & Destructor Documentation

ComplexChannel::ComplexChannel ( OptionManager mgr,
const std::string descrName,
const std::string tagName,
const VisualFeature  vs 
)

Constructor.

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 172 of file ComplexChannel.C.

ComplexChannel::~ComplexChannel (  )  [virtual]

Virtual destructor.

Definition at line 190 of file ComplexChannel.C.


Member Function Documentation

void ComplexChannel::accept ( ChannelVisitor v  )  [virtual]

Calls visitComplexChannel() on the ChannelVisitor.

Reimplemented from ChannelBase.

Definition at line 244 of file ComplexChannel.C.

References ChannelVisitor::visitComplexChannel().

Referenced by SceneUnderstanding::biasFor().

void ComplexChannel::addSubChan ( nub::ref< ChannelBase ch,
const char *  name = 0,
const double  weight = 1.0,
bool  exportOpts = false 
)

Add a subchannel.

Parameters:
ch The channel to be added
name If not null, the channel's tagName will be set to this value
weight Equivalent to calling setSubchanTotalWeight() on the newly-added channel
exportOpts Whether to call exportOptions(MC_RECURSE) on the newly-added channel

The channel's tagName is used for associative lookup.

This is just a wrapper to ModelComponent::addSubComponent(), with some checking that the subcomponent indeed is a ChannelBase derivative, and some adjustment of our homogeneity (if the newly added subchannel has a different VisualFeature from ours, then be become heterogeneous).

Definition at line 456 of file ComplexChannel.C.

References ModelComponent::addSubComponent(), rutz::shared_ptr< T >::is_valid(), and MC_RECURSE.

Referenced by MultiColorBandChannel::buildSubChans(), IntensityBandChannel::buildSubChans(), DepthMotionChannel::buildSubChans(), EndPointChannel::buildSubChans(), FoeMSTChannel::buildSubChans(), LJunctionChannel::buildSubChans(), StereoChannel::buildSubChans(), SoxChannel::buildSubChans(), MotionSpatioTemporalChannel::buildSubChans(), XJunctionChannel::buildSubChans(), OrientationChannel::buildSubChans(), MotionOpticalFlowChannel::buildSubChans(), MotionChannel::buildSubChans(), TJunctionChannel::buildSubChans(), CIELabChannel::CIELabChannel(), ColorChannel::ColorChannel(), CompositeColorChannel::CompositeColorChannel(), DepthChannel::DepthChannel(), DKLcolorChannel::DKLcolorChannel(), H2SVChannel::H2SVChannel(), ImagizeColorChannel::ImagizeColorChannel(), MultiConvolveChannel::MultiConvolveChannel(), RawVisualCortex::paramChanged(), ColorChannel::paramChanged(), CIELabChannel::setA(), CIELabChannel::setB(), ColorChannel::setBY(), ColorChannel::setGR(), H2SVChannel::setH1(), H2SVChannel::setH2(), CIELabChannel::setL(), MultiDirectFeedChannel::setNumChans(), ColorChannel::setRG(), H2SVChannel::setS(), H2SVChannel::setV(), ColorChannel::setYB(), and SOColorChannel::SOColorChannel().

Image< float > ComplexChannel::combineOutputs (  )  [protected, virtual]
Dims ComplexChannel::getMapDims (  )  const [virtual]

Return the dimensions of the output image.

Implements ChannelBase.

Definition at line 363 of file ComplexChannel.C.

References subChan().

Referenced by combineOutputs(), MultiDirectFeedChannel::combineOutputs(), SoxChannel::combineOutputs(), and OptimalGainsFinder::visitComplexChannel().

Image< float > ComplexChannel::getOutput (  )  [virtual]

Form output by combining output of subchannels.

This function just provides a caching wrapper around combineOutputs(), where the real work is done. ComplexChannel provides a default implementation of combineOutputs() that sums the outputs of the subchannels and then optionally maxNormalize()'s the result.

Implements ChannelBase.

Reimplemented in MotionOpticalFlowChannel, MotionSpatioTemporalChannel, and OrientationChannel.

Definition at line 574 of file ComplexChannel.C.

References combineOutputs(), and Image< T >::initialized().

Referenced by DescriptorVec::buildRawDV(), RawVisualCortex::getVCOutput(), RawVisualCortex::saveResults(), saveResults(), and OptimalGainsFinder::visitComplexChannel().

Image< float > ComplexChannel::getRawCSmap ( const uint  idx  )  const [virtual]

get raw CS map; part of getSubmap()

Reimplemented from ChannelBase.

Definition at line 410 of file ComplexChannel.C.

References subChan().

Referenced by DescriptorVec::buildRawDV().

double ComplexChannel::getSubchanTotalWeight ( SubchanKey  key  )  const

Return the total weight allocated to the specified subchannel.

Definition at line 545 of file ComplexChannel.C.

Referenced by RawVisualCortex::getChannelOutputMap(), VisualCortexSurprise::postProcessOutputMap(), and WeightFinder::visitComplexChannel().

Image< float > ComplexChannel::getSubmap ( const uint  index  )  const [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.

Implements ChannelBase.

Definition at line 401 of file ComplexChannel.C.

References subChan().

Referenced by DescriptorVec::buildDV(), and DescriptorVec::buildRawDV().

std::string ComplexChannel::getSubmapName ( const uint  index  )  const [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.

Implements ChannelBase.

Definition at line 419 of file ComplexChannel.C.

References subChan().

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

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

Implements ChannelBase.

Definition at line 428 of file ComplexChannel.C.

References subChan().

bool ComplexChannel::hasSubChan ( const char *  name  )  const

Check if we have a channel of given tagname.

Definition at line 515 of file ComplexChannel.C.

Referenced by RawVisualCortex::paramChanged().

bool ComplexChannel::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 from ChannelBase.

Definition at line 251 of file ComplexChannel.C.

References numChans(), subChan(), and ChannelBase::visualFeature().

Referenced by JetFiller::visitComplexChannel(), and JetSpecFiller::visitComplexChannel().

void ComplexChannel::killCaches (  )  [virtual]

Clears the output cache.

Reimplemented from ChannelBase.

Reimplemented in SoxChannel.

Definition at line 561 of file ComplexChannel.C.

References Image< T >::freeMem(), numChans(), and subChan().

Referenced by setSubchanTotalWeight(), and OptimalGainsFinder::visitComplexChannel().

uint ComplexChannel::numChans (  )  const

Get the number of subchannels.

Definition at line 266 of file ComplexChannel.C.

Referenced by DescriptorVec::buildParticleCountDV(), combineOutputs(), RawVisualCortex::combineOutputs(), MultiDirectFeedChannel::combineOutputs(), SoxChannel::combineOutputs(), MultiDirectFeedChannel::directFeed(), MotionChannel::doInput(), DepthMotionChannel::doInput(), EndPointChannel::doInput(), CompositeColorChannel::doInput(), FoeMSTChannel::doInput(), TJunctionChannel::doInput(), OrientationChannel::doInput(), MotionOpticalFlowChannel::doInput(), RawVisualCortex::doInput(), MultiSpectralResidualChannel::doInput(), MultiConvolveChannel::doInput(), MultiDirectFeedChannel::doInput(), LJunctionChannel::doInput(), DepthChannel::doInput(), SoxChannel::doInput(), MotionSpatioTemporalChannel::doInput(), XJunctionChannel::doInput(), OrientationChannel::doInteractions(), SoxChannel::getNonlinearResponse(), MultiDirectFeedChannel::inputPyramid(), MultiDirectFeedChannel::inputPyramidVector(), isHomogeneous(), killCaches(), numSubmaps(), outputAvailable(), RawVisualCortex::paramChanged(), SoxChannel::paramChanged(), EndPointChannel::paramChanged(), StereoChannel::paramChanged(), MotionSpatioTemporalChannel::paramChanged(), TJunctionChannel::paramChanged(), MotionChannel::paramChanged(), IntensityBandChannel::paramChanged(), FoeMSTChannel::paramChanged(), XJunctionChannel::paramChanged(), DepthMotionChannel::paramChanged(), OrientationChannel::paramChanged(), MultiColorBandChannel::paramChanged(), MotionOpticalFlowChannel::paramChanged(), LJunctionChannel::paramChanged(), VisualCortexSurprise::postProcessOutputMap(), readFrom(), RawVisualCortex::saveResults(), saveResults(), MultiDirectFeedChannel::setNumChans(), setSubchanVisitor(), RawVisualCortex::start1(), start2(), GuidedSearchBiaser::visitComplexChannel(), BayesianBiaser::visitComplexChannel(), JetFiller::visitComplexChannel(), JetSpecFiller::visitComplexChannel(), MaskBiaser::visitComplexChannel(), FeatureBiaser::visitComplexChannel(), OptimalGainsFinder::visitComplexChannel(), WeightFinder::visitComplexChannel(), ChannelVisitorInstallFacet< CFS, CFC >::visitComplexChannel(), and writeTo().

uint ComplexChannel::numSubmaps (  )  const [virtual]

Return the number of feature maps represented by this channel.

Implements ChannelBase.

Definition at line 370 of file ComplexChannel.C.

References numChans(), subChan(), and sum().

Referenced by DescriptorVec::buildDV(), DescriptorVec::buildRawDV(), DescriptorVec::getFVSize(), RawVisualCortex::start1(), and subChanFromSubmapNum().

bool ComplexChannel::outputAvailable (  )  const [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.

Implements ChannelBase.

Definition at line 354 of file ComplexChannel.C.

References numChans(), and subChan().

void ComplexChannel::readFrom ( const ParamMap pmap  )  [virtual]

Read params from the ParamMap.

Reimplemented from ChannelBase.

Definition at line 311 of file ComplexChannel.C.

References ParamMap::getSubpmap(), ParamMap::hasParam(), ParamMap::MISSING, numChans(), ChannelFacetMap::readFacetsFrom(), and subChan().

void ComplexChannel::removeAllSubChans (  ) 
void ComplexChannel::removeSubChan ( nub::ref< ChannelBase ch  ) 
void ComplexChannel::saveResults ( const nub::ref< FrameOstream > &  ofs  )  [virtual]

Save our various maps using a FrameOstream.

By default, we save our output map (if itsSaveOutputMap is true) and propagate the call to our subchannels. Our output (conspicuity) map will be prefixed by "CO<tagname>-"

Reimplemented from ChannelBase.

Reimplemented in RawVisualCortex.

Definition at line 676 of file ComplexChannel.C.

References ModelComponent::descriptiveName(), FLOAT_NORM_0_255, getOutput(), OModelParam< T >::getVal(), itsSaveOutputMap, numChans(), sformat(), SRC_POS, subChan(), and ModelComponent::tagName().

void ComplexChannel::setSubchanTotalWeight ( SubchanKey  key,
const double  wt 
)

Set the total weight allocated to the specified subchannel.

This weight will be divided amongst any sub-subchannels managed by the specifed subchannel. So, for example, if the total weight is set to 2.0, and the subchannel has four sub-subchannels, then each sub-subchannel will get an effective weight of 0.5. The initial weight setting is 1.0. But, If you are handling b/w images, for instance, you may set the weight for the color channel to 0.0 and save computations.

Definition at line 538 of file ComplexChannel.C.

References killCaches().

Referenced by CompositeColorChannel::CompositeColorChannel(), SOColorChannel::SOColorChannel(), CompositeColorChannel::start1(), ImagizeColorChannel::start1(), DKLcolorChannel::start1(), and WeightFinder::visitComplexChannel().

void ComplexChannel::setSubchanVisitor ( rutz::shared_ptr< ChannelVisitor v  ) 

Install a visitor which will be applied to all newly-added subchannels.

Definition at line 526 of file ComplexChannel.C.

References rutz::shared_ptr< T >::is_valid(), numChans(), and subChan().

Referenced by setupVisualCortexBeo().

void ComplexChannel::sortChannelsByNumSubmaps ( bool  dosort  ) 

Whether to sort subchannels by their number of submaps.

If true, this may help in parallel-processing situations where we want to start the most CPU-intensive channels first.

Must be called before start().

Definition at line 551 of file ComplexChannel.C.

References ModelComponent::started().

Referenced by setupVisualCortexBeo().

void ComplexChannel::start1 (  )  [protected, virtual]

get started

Reimplemented from ModelComponent.

Reimplemented in CompositeColorChannel, DKLcolorChannel, ImagizeColorChannel, MultiConvolveChannel, RawVisualCortex, and StereoChannel.

Definition at line 197 of file ComplexChannel.C.

void ComplexChannel::start2 (  )  [protected, virtual]
void ComplexChannel::stop2 (  )  [protected, virtual]

stop

Reimplemented from ModelComponent.

Reimplemented in RawVisualCortex.

Definition at line 238 of file ComplexChannel.C.

nub::ref< ChannelBase > ComplexChannel::subChan ( const std::string tagname  )  const

Look up one of the subchannels by its tagname.

Definition at line 284 of file ComplexChannel.C.

nub::ref< ChannelBase > ComplexChannel::subChan ( const uint  idx  )  const

Look up one of the subchannels by its integer index.

Definition at line 273 of file ComplexChannel.C.

Referenced by IntensityBandChannel::band(), MultiColorBandChannel::band(), DescriptorVec::buildParticleCountDV(), combineOutputs(), RawVisualCortex::combineOutputs(), MotionChannel::dirChan(), DepthMotionChannel::dirChan(), MultiDirectFeedChannel::directFeed(), StereoChannel::dispChan(), MultiColorBandChannel::doInput(), MotionChannel::doInput(), DepthMotionChannel::doInput(), EndPointChannel::doInput(), CompositeColorChannel::doInput(), FoeMSTChannel::doInput(), TJunctionChannel::doInput(), MotionOpticalFlowChannel::doInput(), RawVisualCortex::doInput(), MultiSpectralResidualChannel::doInput(), MultiConvolveChannel::doInput(), LJunctionChannel::doInput(), IntensityBandChannel::doInput(), DepthChannel::doInput(), MotionSpatioTemporalChannel::doInput(), XJunctionChannel::doInput(), SoxChannel::gabor(), OrientationChannel::gabor(), RawVisualCortex::getChannelOutputMap(), getMapDims(), getRawCSmap(), getSubmap(), getSubmapName(), getSubmapNameShort(), isHomogeneous(), killCaches(), numSubmaps(), outputAvailable(), RawVisualCortex::paramChanged(), readFrom(), RawVisualCortex::saveResults(), saveResults(), setSubchanVisitor(), RawVisualCortex::start1(), MultiConvolveChannel::start1(), start2(), subChanFromSubmapNum(), GuidedSearchBiaser::visitComplexChannel(), BayesianBiaser::visitComplexChannel(), JetFiller::visitComplexChannel(), JetSpecFiller::visitComplexChannel(), MaskBiaser::visitComplexChannel(), FeatureBiaser::visitComplexChannel(), OptimalGainsFinder::visitComplexChannel(), WeightFinder::visitComplexChannel(), ChannelVisitorInstallFacet< CFS, CFC >::visitComplexChannel(), and writeTo().

nub::ref< ChannelBase > ComplexChannel::subChanFromSubmapNum ( const uint  oldIdx,
uint newIdx 
) const

Look up one of the subchannels by a submap number.

Parameters:
oldIdx - the submap index (in the ComplexChannel);
newIdx - return value: the number of the submap within the subchannel

Definition at line 299 of file ComplexChannel.C.

References ASSERT, numSubmaps(), and subChan().

void ComplexChannel::writeTo ( ParamMap pmap  )  const [virtual]

Write params to the ParamMap.

Reimplemented from ChannelBase.

Definition at line 336 of file ComplexChannel.C.

References numChans(), ParamMap::putSubpmap(), subChan(), ModelComponent::tagName(), and ChannelFacetMap::writeFacetsTo().


Member Data Documentation

see Channels/MapCombineType.H

Definition at line 209 of file ComplexChannel.H.

Referenced by combineOutputs().

Normalization; see fancynorm.H.

Reimplemented in RawVisualCortex.

Definition at line 208 of file ComplexChannel.H.

Referenced by combineOutputs(), MultiDirectFeedChannel::combineOutputs(), SoxChannel::combineOutputs(), and start2().

Set a fixed range of values for the raw output.

By default, the range is set to [MAXNORMMIN .. MAXNORMMAX] at construction. If non-zero values are provided here, in getOutput() we will cumulate our various submaps, apply the provided range, apply spatial competition for salience, apply our total weight, and return the result. If a range [0.0 .. 0.0] is provided here, only spatial competition and weights will be applied, but the first step of applying the range will be skipped. This must be called before start().

Definition at line 223 of file ComplexChannel.H.

Referenced by combineOutputs(), MultiDirectFeedChannel::combineOutputs(), and start2().

Save our output map?

Definition at line 210 of file ComplexChannel.H.

Referenced by saveResults().

use old version? see Visualcortex.H

Reimplemented in RawVisualCortex.

Definition at line 211 of file ComplexChannel.H.

Referenced by start2().

check subchannels for this?

Definition at line 212 of file ComplexChannel.H.

Referenced by RawVisualCortex::doInput(), and start2().


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