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

OutputFrameSeries Class Reference

#include <Media/FrameSeries.H>

Inheritance diagram for OutputFrameSeries:

Inheritance graph
[legend]
Collaboration diagram for OutputFrameSeries:

Collaboration graph
[legend]
List of all members.

Detailed Description

A FrameSeries with additional facilities for writing output frames.

OutputFrameSeries implements a number of helper functions to facilitate writing frames in a standardized manner, with possible on-the-fly rescaling and visualization.

SEE ADDITIONAL DOCUMENTATION in InputFrameSeries.

Definition at line 305 of file FrameSeries.H.

Public Member Functions

 OutputFrameSeries (OptionManager &mgr, const std::string &descrName="Frame Series", const std::string &tagName="FrameSeries")
 Constructor.
virtual ~OutputFrameSeries ()
 Destructor.
virtual void reset1 ()
 resets this FrameSeries to its state after construction
virtual void paramChanged (ModelParamBase *const param, const bool valueChanged, ParamClient::ChangeStatus *status)
 Override the base version so that we can trap --out options.
FrameState update (const SimTime &stime, bool new_event)
 Update internal state and return corresponding FrameState.
FrameState updateNext ()
 Update by moving to the next frame and not worrying about time counts.
bool shouldWait () const
 Have we displayed frames and need to wait for a user keypress?
virtual void writeFrame (const GenericFrame &frame, const std::string &shortname, const FrameInfo &auxinfo=FrameOstream::defaultInfo)
 Write a frame to all frame destinations.
virtual bool isVoid () const
 Check if we have no output destinations (e.g., user gave --out=none).
bool becameVoid () const
 Check if we have become void after starting out non-void.
virtual void closeStream (const std::string &shortname)
 Call closeStream(shortname) on all of our substreams.
void addFrameDest (const std::string &source)
 Add a frame destination; same as doing --out=source on the command line.
int frame () const
 Get the current frame number.
size_t getNumFrameDests () const
 Get the number of frame destinations that we have.
nub::ref< FrameOstreamgetFrameDest (size_t n) const
 Get a reference to the n-th frame destination.
template<class T>
nub::soft_ref< T > findFrameDestType () const
 Try to return a frame destination matching type T, if any.

Classes

struct  Impl


Constructor & Destructor Documentation

OutputFrameSeries::OutputFrameSeries OptionManager mgr,
const std::string descrName = "Frame Series",
const std::string tagName = "FrameSeries"
 

Constructor.

Definition at line 931 of file FrameSeries.C.

References init_manager, istream_init(), istream_init_once, ostream_init(), and ostream_init_once.

OutputFrameSeries::~OutputFrameSeries  )  [virtual]
 

Destructor.

Definition at line 955 of file FrameSeries.C.


Member Function Documentation

void OutputFrameSeries::addFrameDest const std::string source  ) 
 

Add a frame destination; same as doing --out=source on the command line.

Definition at line 1088 of file FrameSeries.C.

References ModelComponent::addSubComponent(), OutputFrameSeries::Impl::explicitNone, ModelComponent::getManager(), makeFrameOstream(), MC_RECURSE, ModelComponent::removeSubComponent(), and OutputFrameSeries::Impl::vec.

Referenced by paramChanged().

bool OutputFrameSeries::becameVoid  )  const
 

Check if we have become void after starting out non-void.

This is useful to test in main loops to know whether some substream has gotten closed (e.g. the user pressing the close button on an open window).

Definition at line 1075 of file FrameSeries.C.

References isVoid(), and OutputFrameSeries::Impl::wasNonvoidAtStart.

void OutputFrameSeries::closeStream const std::string shortname  )  [virtual]
 

Call closeStream(shortname) on all of our substreams.

Implements FrameOstream.

Definition at line 1081 of file FrameSeries.C.

References i, and OutputFrameSeries::Impl::vec.

Referenced by Nv2UiJob::run().

template<class T>
nub::soft_ref<T> OutputFrameSeries::findFrameDestType  )  const [inline]
 

Try to return a frame destination matching type T, if any.

Definition at line 379 of file FrameSeries.H.

References getFrameDest(), getNumFrameDests(), i, and nub::soft_ref< T >::is_valid().

Referenced by Nv2UiJob::run().

int OutputFrameSeries::frame  )  const
 

Get the current frame number.

Definition at line 1148 of file FrameSeries.C.

References OutputFrameSeries::Impl::counter, FrameCounter::currentFrame(), and OModelParam< T >::getVal().

nub::ref< FrameOstream > OutputFrameSeries::getFrameDest size_t  n  )  const
 

Get a reference to the n-th frame destination.

Definition at line 1124 of file FrameSeries.C.

References ASSERT, and OutputFrameSeries::Impl::vec.

Referenced by findFrameDestType().

size_t OutputFrameSeries::getNumFrameDests  )  const
 

Get the number of frame destinations that we have.

Definition at line 1118 of file FrameSeries.C.

References OutputFrameSeries::Impl::vec.

Referenced by findFrameDestType().

bool OutputFrameSeries::isVoid  )  const [virtual]
 

Check if we have no output destinations (e.g., user gave --out=none).

Clients can test isVoid() before they generate potentially expensive output images. This is just a performance optimization -- even if isVoid() is true, it's still safe to call writeRGB(), writeGray(), etc., but those calls will do nothing, and so any time spent computing the image will have been wasted.

Reimplemented from FrameOstream.

Definition at line 1063 of file FrameSeries.C.

References i, and OutputFrameSeries::Impl::vec.

Referenced by becameVoid(), Context::testFrame(), and Context::trainingFrame().

void OutputFrameSeries::paramChanged ModelParamBase *const   param,
const bool  valueChanged,
ParamClient::ChangeStatus status
[virtual]
 

Override the base version so that we can trap --out options.

Reimplemented from ModelComponent.

Definition at line 975 of file FrameSeries.C.

References addFrameDest(), OutputFrameSeries::Impl::counter, OModelParam< T >::getVal(), ModelComponent::paramChanged(), and FrameCounter::reset().

void OutputFrameSeries::reset1  )  [virtual]
 

resets this FrameSeries to its state after construction

Reimplemented from ModelComponent.

Definition at line 961 of file FrameSeries.C.

References OutputFrameSeries::Impl::counter, OutputFrameSeries::Impl::explicitNone, OModelParam< T >::getVal(), FrameCounter::reset(), ModelComponent::reset1(), and OutputFrameSeries::Impl::vec.

bool OutputFrameSeries::shouldWait  )  const
 

Have we displayed frames and need to wait for a user keypress?

This is reset to false on each call to update(), and becomes true if (1) any frames were written AND (2) itsWaitForUser is true (which the use can control with --wait/--nowait). You can check it in order to decide whether you should pause and wait for the user after each series of displays at a given time step).

Definition at line 1026 of file FrameSeries.C.

References OModelParam< T >::getVal().

Referenced by Outputframeseries_Init().

FrameState OutputFrameSeries::update const SimTime stime,
bool  new_event
 

Update internal state and return corresponding FrameState.

Parameters:
stime current time in seconds
sdelay time step in seconds
new_event whether a new application-defined event has occurred

Definition at line 996 of file FrameSeries.C.

References OutputFrameSeries::Impl::counter, FrameCounter::currentFrame(), OModelParam< T >::getVal(), LDEBUG, SimTime::msecs(), sformat(), ModelComponent::tagName(), textLog(), and FrameCounter::update().

Referenced by Outputframeseries_Init().

FrameState OutputFrameSeries::updateNext  ) 
 

Update by moving to the next frame and not worrying about time counts.

Definition at line 1020 of file FrameSeries.C.

References OutputFrameSeries::Impl::counter, and FrameCounter::updateNext().

Referenced by Outputframeseries_Init(), and Nv2UiJob::run().

void OutputFrameSeries::writeFrame const GenericFrame frame,
const std::string shortname,
const FrameInfo auxinfo = FrameOstream::defaultInfo
[virtual]
 

Write a frame to all frame destinations.

Implements FrameOstream.

Definition at line 1034 of file FrameSeries.C.

References ASSERT, OutputFrameSeries::Impl::counter, FrameCounter::currentFrame(), doResizeFrame(), OutputFrameSeries::Impl::explicitNone, OModelParam< T >::getVal(), i, and OutputFrameSeries::Impl::vec.


The documentation for this class was generated from the following files:
Generated on Sun Nov 22 13:46:08 2009 for iLab Neuromorphic Vision Toolkit by  doxygen 1.4.4