MbariResultViewer Class Reference

Class to facilitate displaying and saving of intermediate results. More...

#include <MBARI/MbariResultViewer.H>

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

List of all members.

Public Member Functions

 MbariResultViewer (ModelManager &mgr, nub::soft_ref< OutputMbariFrameSeries > ofs)
 Constructor - give a ModelManager and an OutputMbariFrameSeries.
 ~MbariResultViewer ()
 Destructor - destroy all the windows that may be present.
virtual void paramChanged (ModelParamBase *const param, const bool valueChanged, ParamClient::ChangeStatus *status)
 implements ModelComponent::paramChanged
virtual void reset1 ()
 destroy all the windows
template<class T >
void output (const Image< T > &img, const uint frameNum, const std::string &resultName, const int resNum=-1)
 save and/or display intermediate result
template<class T >
void display (const Image< T > &img, const uint frameNum, const std::string &resultName, const int resNum=-1)
 display intermediate result
void save (const Image< PixRGB< byte > > &img, const uint frameNum, const std::string &resultName, const int resNum=-1)
 save intermediate result
void save (const Image< byte > &img, const uint frameNum, const std::string &resultName, const int resNum=-1)
 save intermediate result
void save (const Image< float > &img, const uint frameNum, const std::string &resultName, const int resNum=-1)
 save intermediate result
void outputResultFrame (const Image< PixRGB< byte > > &resultImg, const std::string &frameStem, const uint frameNum, VisualEventSet &evts, PropertyVectorSet &pvs, const int circleRadius)
 save and possibly display an output frame
bool isLoadEventsNameSet () const
 check if the LoadEventsName is set
void loadVisualEventSet (VisualEventSet &ves) const
 load the VisualEventSet from the file LoadEventsName
bool isLoadPropertiesNameSet () const
 check if the LoadPropertiesName is set
void loadProperties (PropertyVectorSet &pvs) const
 load the PropertyVector from the file LoadPropertiesName
bool isSaveEventsNameSet () const
 check if the SaveEventsName is set
void saveVisualEventSet (const VisualEventSet &ves) const
 save the VisualEventSet to the file SaveEventsName
bool isSavePropertiesNameSet () const
 check if the SavePropertiesName is set
void saveProperties (const PropertyVectorSet &pvs) const
 save the PropertyVector to the file SavePropertiesName
bool isSavePositionsNameSet () const
 check if the SavePositionsName is set
void savePositions (const VisualEventSet &ves) const
 save the positions to the file SavePositionsName
bool needFrames () const
 determine whether the frames actually need to be loaded
uint getAvgCacheSize () const
 returns the size of the cache for running averages (from the command line)
bool isSaveEventClip () const
 determine whether we have to save any event clips
uint numSaveEventClips () const
 return the number of event clips we have to save
uint getSaveEventClipNum (uint idx) const
 returns the event number with idx to be saved as a clip
void saveSingleEventFrame (const Image< PixRGB< byte > > &img, int frameNum, const VisualEvent &event)
 save a cut-out piece of frame containing a single event

Protected Member Functions

void freeMem ()
 destroy windows and other internal variables
uint getNumFromString (const std::string &resultName)
 get an internal reference number from a resultName
std::string getLabel (const uint num, const uint frameNum, const int resNum=-1)
 make a label text from the reference number and the frame number
std::string getFileStem (const std::string &resultName, const int resNum=-1)
 make the file stem for saving files
template<class T >
XWinManageddisplayImage (const Image< T > &img, XWinManaged *win, const char *label)
 draw an image to a window, deal with creating and rescaling the window
void parseSaveEventNums (const std::string &value)
 parse the SaveEventNumString and store the numbers in itsSaveEventNums

Protected Attributes

OModelParam< bool > itsSaveResults
 whether intermediate results are saved
OModelParam< bool > itsDisplayResults
 whether intermediate results are displayed
OModelParam< BitObjectDrawModeitsMarkInteresting
 the way interesting events are marked
OModelParam< float > itsOpacity
 opacity of shape or outline markings of events
OModelParam< bool > itsMarkCandidate
 whether candidates for int. events are marked
OModelParam< bool > itsMarkPrediction
 whether predictions of event locations are marked
OModelParam< bool > itsMarkFOE
 whether the focus of expansion is marked
OModelParam< bool > itsSaveOutput
 whether the output frames are saved
OModelParam< bool > itsDisplayOutput
 whether the output frames are displayed
OModelParam< bool > itsShowEventLabels
 whether the event labels are written into output frames
OModelParam< DimsitsRescaleDisplay
 rescale intermediate results to this scale for display
OModelParam< uintitsSizeAvgCache
 the number of images used for running average
OModelParam< std::stringitsSaveEventsName
OModelParam< std::stringitsLoadEventsName
OModelParam< std::stringitsSavePropertiesName
OModelParam< std::stringitsLoadPropertiesName
OModelParam< std::stringitsSavePositionsName
OModelParam< std::stringitsSaveEventNumString

Detailed Description

Class to facilitate displaying and saving of intermediate results.

This class provides command lne options to control the saving and displaying of intermediate results as well as output frames for MBARI programs

Definition at line 86 of file MbariResultViewer.H.


Constructor & Destructor Documentation

MbariResultViewer::MbariResultViewer ( ModelManager mgr,
nub::soft_ref< OutputMbariFrameSeries ofs 
)

Constructor - give a ModelManager and an OutputMbariFrameSeries.

If the OutputMbariFrameSeries is not yet registered in the manager, it will be registered here

Definition at line 190 of file MbariResultViewer.C.

References ModelComponent::addSubComponent(), and ModelComponent::hasSubComponent().

MbariResultViewer::~MbariResultViewer (  ) 

Destructor - destroy all the windows that may be present.

Definition at line 224 of file MbariResultViewer.C.

References freeMem().


Member Function Documentation

template<class T >
void MbariResultViewer::display ( const Image< T > &  img,
const uint  frameNum,
const std::string resultName,
const int  resNum = -1 
) [inline]

display intermediate result

Parameters:
img the image containing the intermediate result
frameNum the frame number of the image
resultName a string that defines the kind of interemediate result - this is appended to the filestem for the file name and/or window title
resNum if there are several results of this type for each frame, the number of the resul

Definition at line 308 of file MbariResultViewer.C.

References displayImage(), getLabel(), and getNumFromString().

Referenced by output().

template<class T >
XWinManaged * MbariResultViewer::displayImage ( const Image< T > &  img,
XWinManaged win,
const char *  label 
) [inline, protected]

draw an image to a window, deal with creating and rescaling the window

Definition at line 519 of file MbariResultViewer.C.

References XWindow::drawImage(), XWindow::getDims(), Image< T >::getDims(), OModelParam< T >::getVal(), Dims::isEmpty(), itsRescaleDisplay, rescale(), and XWindow::setTitle().

Referenced by display(), and outputResultFrame().

void MbariResultViewer::freeMem (  )  [protected]

destroy windows and other internal variables

Definition at line 281 of file MbariResultViewer.C.

References OModelParam< T >::setVal().

Referenced by reset1(), and ~MbariResultViewer().

uint MbariResultViewer::getAvgCacheSize (  )  const

returns the size of the cache for running averages (from the command line)

Definition at line 456 of file MbariResultViewer.C.

References OModelParam< T >::getVal(), and itsSizeAvgCache.

std::string MbariResultViewer::getFileStem ( const std::string resultName,
const int  resNum = -1 
) [protected]

make the file stem for saving files

Definition at line 506 of file MbariResultViewer.C.

Referenced by getLabel(), and save().

std::string MbariResultViewer::getLabel ( const uint  num,
const uint  frameNum,
const int  resNum = -1 
) [protected]

make a label text from the reference number and the frame number

Definition at line 496 of file MbariResultViewer.C.

References ASSERT, and getFileStem().

Referenced by display().

uint MbariResultViewer::getNumFromString ( const std::string resultName  )  [protected]

get an internal reference number from a resultName

If this resultName is new, a new reference is created

Definition at line 481 of file MbariResultViewer.C.

Referenced by display().

uint MbariResultViewer::getSaveEventClipNum ( uint  idx  )  const

returns the event number with idx to be saved as a clip

Definition at line 474 of file MbariResultViewer.C.

References ASSERT.

bool MbariResultViewer::isLoadEventsNameSet (  )  const

check if the LoadEventsName is set

Definition at line 378 of file MbariResultViewer.C.

References OModelParam< T >::getVal().

Referenced by needFrames().

bool MbariResultViewer::isLoadPropertiesNameSet (  )  const

check if the LoadPropertiesName is set

Definition at line 392 of file MbariResultViewer.C.

References OModelParam< T >::getVal().

bool MbariResultViewer::isSaveEventClip (  )  const

determine whether we have to save any event clips

Definition at line 462 of file MbariResultViewer.C.

Referenced by needFrames().

bool MbariResultViewer::isSaveEventsNameSet (  )  const

check if the SaveEventsName is set

Definition at line 406 of file MbariResultViewer.C.

References OModelParam< T >::getVal().

bool MbariResultViewer::isSavePositionsNameSet (  )  const

check if the SavePositionsName is set

Definition at line 434 of file MbariResultViewer.C.

References OModelParam< T >::getVal().

bool MbariResultViewer::isSavePropertiesNameSet (  )  const

check if the SavePropertiesName is set

Definition at line 420 of file MbariResultViewer.C.

References OModelParam< T >::getVal().

void MbariResultViewer::loadProperties ( PropertyVectorSet pvs  )  const

load the PropertyVector from the file LoadPropertiesName

Definition at line 398 of file MbariResultViewer.C.

References OModelParam< T >::getVal(), and PropertyVectorSet::readFromStream().

void MbariResultViewer::loadVisualEventSet ( VisualEventSet ves  )  const

load the VisualEventSet from the file LoadEventsName

Definition at line 385 of file MbariResultViewer.C.

References OModelParam< T >::getVal(), and VisualEventSet::readFromStream().

bool MbariResultViewer::needFrames (  )  const

determine whether the frames actually need to be loaded

Definition at line 448 of file MbariResultViewer.C.

References OModelParam< T >::getVal(), isLoadEventsNameSet(), isSaveEventClip(), itsDisplayOutput, and itsSaveOutput.

uint MbariResultViewer::numSaveEventClips (  )  const

return the number of event clips we have to save

Definition at line 468 of file MbariResultViewer.C.

template<class T >
void MbariResultViewer::output ( const Image< T > &  img,
const uint  frameNum,
const std::string resultName,
const int  resNum = -1 
) [inline]

save and/or display intermediate result

whether the result image is saved and/or displayed is determined by the ModelParams

Parameters:
img the image containing the intermediate result
frameNum the frame number of the image
resultName a string that defines the kind of interemediate result - this is appended to the filestem for the file name and/or window title
resNum if there are several results of this type for each frame, the number of the result

Definition at line 299 of file MbariResultViewer.C.

References display(), OModelParam< T >::getVal(), itsDisplayResults, itsSaveResults, and save().

void MbariResultViewer::outputResultFrame ( const Image< PixRGB< byte > > &  resultImg,
const std::string frameStem,
const uint  frameNum,
VisualEventSet evts,
PropertyVectorSet pvs,
const int  circleRadius 
)

save and possibly display an output frame

Depending on the ModelParams, interesting events, candidates for interesting events and skipped event locations are marked in the frame, the frame is displayed (if desired) and saved.

Parameters:
resultImg the output image
frameNum the frame number of the output image
evts the event set to be used for drawing the events
circleRadius the radius of the circles used for marking

Definition at line 348 of file MbariResultViewer.C.

References displayImage(), VisualEventSet::drawTokens(), OModelParam< T >::getVal(), itsDisplayOutput, itsMarkInteresting, itsOpacity, itsSaveOutput, and itsShowEventLabels.

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

implements ModelComponent::paramChanged

intercepts setting of MRVmarkXXX variables and sets drawing colors accordingly

Reimplemented from ModelComponent.

Definition at line 231 of file MbariResultViewer.C.

References OModelParam< T >::getVal(), itsMarkCandidate, itsMarkFOE, itsMarkPrediction, and parseSaveEventNums().

void MbariResultViewer::parseSaveEventNums ( const std::string value  )  [protected]

parse the SaveEventNumString and store the numbers in itsSaveEventNums

Definition at line 596 of file MbariResultViewer.C.

Referenced by paramChanged().

void MbariResultViewer::reset1 (  )  [virtual]

destroy all the windows

Reimplemented from ModelComponent.

Definition at line 271 of file MbariResultViewer.C.

References freeMem().

void MbariResultViewer::save ( const Image< float > &  img,
const uint  frameNum,
const std::string resultName,
const int  resNum = -1 
)

save intermediate result

Parameters:
img the image containing the intermediate result
frameNum the frame number of the image
resultName a string that defines the kind of interemediate result - this is appended to the filestem for the file name and/or window title
resNum if there are several results of this type for each frame, the number of the resul

Definition at line 337 of file MbariResultViewer.C.

References FLOAT_NORM_0_255, and getFileStem().

void MbariResultViewer::save ( const Image< byte > &  img,
const uint  frameNum,
const std::string resultName,
const int  resNum = -1 
)

save intermediate result

Parameters:
img the image containing the intermediate result
frameNum the frame number of the image
resultName a string that defines the kind of interemediate result - this is appended to the filestem for the file name and/or window title
resNum if there are several results of this type for each frame, the number of the resul

Definition at line 327 of file MbariResultViewer.C.

References getFileStem().

void MbariResultViewer::save ( const Image< PixRGB< byte > > &  img,
const uint  frameNum,
const std::string resultName,
const int  resNum = -1 
)

save intermediate result

Parameters:
img the image containing the intermediate result
frameNum the frame number of the image
resultName a string that defines the kind of interemediate result - this is appended to the filestem for the file name and/or window title
resNum if there are several results of this type for each frame, the number of the resul

Definition at line 317 of file MbariResultViewer.C.

References getFileStem().

Referenced by output().

void MbariResultViewer::savePositions ( const VisualEventSet ves  )  const

save the positions to the file SavePositionsName

Definition at line 440 of file MbariResultViewer.C.

References OModelParam< T >::getVal(), and VisualEventSet::writePositions().

void MbariResultViewer::saveProperties ( const PropertyVectorSet pvs  )  const

save the PropertyVector to the file SavePropertiesName

Definition at line 426 of file MbariResultViewer.C.

References OModelParam< T >::getVal(), and PropertyVectorSet::writeToStream().

void MbariResultViewer::saveSingleEventFrame ( const Image< PixRGB< byte > > &  img,
int  frameNum,
const VisualEvent event 
)

save a cut-out piece of frame containing a single event

Definition at line 555 of file MbariResultViewer.C.

References ASSERT, VisualEvent::getEventNum(), Dims::h(), VisualEvent::isFrameOk(), Rectangle::tlbrI(), and Dims::w().

void MbariResultViewer::saveVisualEventSet ( const VisualEventSet ves  )  const

save the VisualEventSet to the file SaveEventsName

Definition at line 412 of file MbariResultViewer.C.

References OModelParam< T >::getVal(), and VisualEventSet::writeToStream().


Member Data Documentation

whether the output frames are displayed

Definition at line 262 of file MbariResultViewer.H.

Referenced by needFrames(), and outputResultFrame().

whether intermediate results are displayed

Definition at line 255 of file MbariResultViewer.H.

Referenced by output().

whether candidates for int. events are marked

Definition at line 258 of file MbariResultViewer.H.

Referenced by paramChanged().

whether the focus of expansion is marked

Definition at line 260 of file MbariResultViewer.H.

Referenced by paramChanged().

the way interesting events are marked

Definition at line 256 of file MbariResultViewer.H.

Referenced by outputResultFrame().

whether predictions of event locations are marked

Definition at line 259 of file MbariResultViewer.H.

Referenced by paramChanged().

opacity of shape or outline markings of events

Definition at line 257 of file MbariResultViewer.H.

Referenced by outputResultFrame().

rescale intermediate results to this scale for display

Definition at line 265 of file MbariResultViewer.H.

Referenced by displayImage().

whether the output frames are saved

Definition at line 261 of file MbariResultViewer.H.

Referenced by needFrames(), and outputResultFrame().

whether intermediate results are saved

Definition at line 254 of file MbariResultViewer.H.

Referenced by output().

whether the event labels are written into output frames

Definition at line 263 of file MbariResultViewer.H.

Referenced by outputResultFrame().

the number of images used for running average

Definition at line 267 of file MbariResultViewer.H.

Referenced by getAvgCacheSize().


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