IntegerComplexChannel Class Reference

Like ComplexChannel, but avoids floating-point arithmetic. More...

#include <Channels/IntegerComplexChannel.H>

Inheritance diagram for IntegerComplexChannel:
Inheritance graph
[legend]
Collaboration diagram for IntegerComplexChannel:
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

 IntegerComplexChannel (OptionManager &mgr, const std::string &descrName, const std::string &tagName, const VisualFeature vs, nub::ref< IntegerMathEngine > eng)
 Constructor.
virtual ~IntegerComplexChannel ()
 Virtual destructor.
virtual bool isHomogeneous () const
 Is the channel homogeneous?
uint numChans () const
 Get the number of subchannels.
nub::ref< IntegerChannelsubChan (const uint idx) const
 Look up one of the subchannels by its integer index.
nub::ref< IntegerChannelsubChan (const std::string &tagname) const
 Look up one of the subchannels by its tagname.
nub::ref< IntegerChannelsubChanFromSubmapNum (const uint oldIdx, uint &newIdx) const
 Look up one of the subchannels by a submap number.
void addSubChan (nub::ref< IntegerChannel > ch, const char *name=0)
 Add a subchannel.
void removeSubChan (nub::ref< IntegerChannel > 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< int > getSubmapInt (const uint index) const
virtual Image< float > getSubmap (const uint index) const
 Get the feature map at the given index.
virtual Image< int > getRawCSmapInt (const uint idx) const
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< int > getOutputInt ()
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< int > combineOutputsInt ()
 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< bool > itsSaveOutputMap
 Save our output map?
OModelParam< bool > itsUseOlderVersion
 use old version? see Visualcortex.H
OModelParam< int > itsOutputRangeMin
 Set a fixed range of values for the raw output.
OModelParam< int > itsOutputRangeMax

Detailed Description

Like ComplexChannel, but avoids floating-point arithmetic.

Definition at line 48 of file IntegerComplexChannel.H.


Constructor & Destructor Documentation

IntegerComplexChannel::IntegerComplexChannel ( OptionManager mgr,
const std::string descrName,
const std::string tagName,
const VisualFeature  vs,
nub::ref< IntegerMathEngine eng 
)

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 175 of file IntegerComplexChannel.C.

IntegerComplexChannel::~IntegerComplexChannel (  )  [virtual]

Virtual destructor.

Definition at line 193 of file IntegerComplexChannel.C.


Member Function Documentation

void IntegerComplexChannel::addSubChan ( nub::ref< IntegerChannel ch,
const char *  name = 0 
)

Add a subchannel.

Parameters:
ch The channel to be added
name If not null, the channel's tagName will be set to this value

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 IntegerChannel 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 438 of file IntegerComplexChannel.C.

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

Referenced by IntegerMotionChannel::buildSubChans(), IntegerOrientationChannel::buildSubChans(), IntegerColorChannel::IntegerColorChannel(), and IntegerRawVisualCortex::paramChanged().

Image< int > IntegerComplexChannel::combineOutputsInt (  )  [protected, virtual]

Combines the outputs of subchannels.

The default implementation just sums the outputs of the subchannels and then maxNormalize()'s if requested by itsNormType.

Reimplemented in IntegerRawVisualCortex.

Definition at line 559 of file IntegerComplexChannel.C.

References ASSERT, ModelComponent::descriptiveName(), getMapDims(), getMinMax(), OModelParam< T >::getVal(), Image< T >::initialized(), itsNormType, itsOutputRangeMin, maxNormTypeName(), MYLOGVERB, numChans(), subChan(), ModelComponent::tagName(), and ZEROS.

Dims IntegerComplexChannel::getMapDims (  )  const [virtual]

Return the dimensions of the output image.

Implements ChannelBase.

Definition at line 349 of file IntegerComplexChannel.C.

References subChan().

Referenced by combineOutputsInt().

virtual Image<float> IntegerComplexChannel::getOutput (  )  [inline, virtual]

Form output by combining output of subchannels.

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

Implements ChannelBase.

Reimplemented in IntegerRawVisualCortex.

Definition at line 195 of file IntegerComplexChannel.H.

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

get raw CS map; part of getSubmap()

Reimplemented from ChannelBase.

Definition at line 172 of file IntegerComplexChannel.H.

References getRawCSmap().

Referenced by getRawCSmap().

double IntegerComplexChannel::getSubchanTotalWeight ( SubchanKey  key  )  const

Return the total weight allocated to the specified subchannel.

Definition at line 522 of file IntegerComplexChannel.C.

Referenced by IntegerRawVisualCortex::combineOutputsInt(), and IntegerRawVisualCortex::getChannelOutputMap().

virtual Image<float> IntegerComplexChannel::getSubmap ( const uint  index  )  const [inline, 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 167 of file IntegerComplexChannel.H.

std::string IntegerComplexChannel::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 405 of file IntegerComplexChannel.C.

References subChan().

std::string IntegerComplexChannel::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 414 of file IntegerComplexChannel.C.

References subChan().

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

Check if we have a channel of given tagname.

Definition at line 492 of file IntegerComplexChannel.C.

bool IntegerComplexChannel::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 239 of file IntegerComplexChannel.C.

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

void IntegerComplexChannel::killCaches (  )  [virtual]

Clears the output cache.

Reimplemented from ChannelBase.

Definition at line 538 of file IntegerComplexChannel.C.

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

Referenced by setSubchanTotalWeight().

uint IntegerComplexChannel::numChans (  )  const
uint IntegerComplexChannel::numSubmaps (  )  const [virtual]

Return the number of feature maps represented by this channel.

Implements ChannelBase.

Definition at line 356 of file IntegerComplexChannel.C.

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

Referenced by subChanFromSubmapNum().

bool IntegerComplexChannel::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 340 of file IntegerComplexChannel.C.

References numChans(), and subChan().

void IntegerComplexChannel::readFrom ( const ParamMap pmap  )  [virtual]
void IntegerComplexChannel::removeAllSubChans (  ) 
void IntegerComplexChannel::removeSubChan ( nub::ref< IntegerChannel ch  ) 

Remove a subchannel.

Definition at line 459 of file IntegerComplexChannel.C.

References ModelComponent::removeSubComponent().

void IntegerComplexChannel::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 IntegerRawVisualCortex.

Definition at line 593 of file IntegerComplexChannel.C.

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

void IntegerComplexChannel::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 515 of file IntegerComplexChannel.C.

References killCaches().

Referenced by IntegerRawVisualCortex::paramChanged().

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

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

Definition at line 503 of file IntegerComplexChannel.C.

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

void IntegerComplexChannel::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 528 of file IntegerComplexChannel.C.

References ModelComponent::started().

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

get started

Reimplemented from ModelComponent.

Reimplemented in IntegerRawVisualCortex.

Definition at line 200 of file IntegerComplexChannel.C.

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

stop

Reimplemented from ModelComponent.

Reimplemented in IntegerRawVisualCortex.

Definition at line 233 of file IntegerComplexChannel.C.

nub::ref< IntegerChannel > IntegerComplexChannel::subChan ( const std::string tagname  )  const

Look up one of the subchannels by its tagname.

Definition at line 272 of file IntegerComplexChannel.C.

nub::ref< IntegerChannel > IntegerComplexChannel::subChan ( const uint  idx  )  const
nub::ref< IntegerChannel > IntegerComplexChannel::subChanFromSubmapNum ( const uint  oldIdx,
uint newIdx 
) const

Look up one of the subchannels by a submap number.

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

Definition at line 287 of file IntegerComplexChannel.C.

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

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

Write params to the ParamMap.

Reimplemented from ChannelBase.

Definition at line 324 of file IntegerComplexChannel.C.

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


Member Data Documentation

Normalization; see fancynorm.H.

Reimplemented in IntegerRawVisualCortex.

Definition at line 208 of file IntegerComplexChannel.H.

Referenced by combineOutputsInt(), 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 221 of file IntegerComplexChannel.H.

Referenced by combineOutputsInt(), and start2().

Save our output map?

Definition at line 209 of file IntegerComplexChannel.H.

Referenced by saveResults().

use old version? see Visualcortex.H

Reimplemented in IntegerRawVisualCortex.

Definition at line 210 of file IntegerComplexChannel.H.

Referenced by start2().


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