CLAM::Segmentation Class Reference

#include <Segmentation.hxx>

List of all members.

Classes

class  InsertedOutOfBounds

Public Types

typedef std::vector< double > TimePositions

Public Member Functions

 Segmentation ()
 Segmentation (double maxPosition)
virtual ~Segmentation ()
virtual unsigned insert (double timePosition)=0
 Inserts a new border at timePosition.
virtual void remove (unsigned segment)=0
 Removes the specified segment.
virtual unsigned pickOffset (double timePosition, double tolerance) const =0
 Returns the index of the segment whose offset is nearest to the given time position, and within the tolerance.
virtual unsigned pickOnset (double timePosition, double tolerance) const =0
 Returns the index of the segment whose onset is nearest to the given time position, and within the tolerance.
virtual unsigned pickSegmentBody (double timePosition) const =0
 Returns the index of the segment which body is on timePosition.
virtual void dragOnset (unsigned segment, double newTimePosition)=0
 Performs a dragging movement for the Onset of the given segment in order to move it to the newTimePosition.
virtual void dragOffset (unsigned segment, double newTimePosition)=0
 Performs a dragging movement for the Offset of the given segment in order to move it to the newTimePosition.
virtual void fillArray (DataArray &segmentation) const =0
virtual void takeArray (const TData *begin, const TData *end)=0
 take data from an array.
const char * GetClassName () const
 Return the class name.
void StoreOn (Storage &storage) const
 Stores component's subitems on the given Storage.
void LoadFrom (Storage &storage)
 Loads component's subitems from the given Storage.
void select (unsigned segment)
void deselect (unsigned segment)
void clearSelection ()
std::string boundsAsString () const
 Testing method for the unit tests.
const TimePositionsonsets () const
 Returns a vector of time position of the segment onsets.
const TimePositionsoffsets () const
 Returns a vector of time position of the segment offsets.
const std::vector< std::string > & labels () const
 Returns a vector of segment labels.
void setLabel (unsigned segment, std::string label)
 Sets the label for a particular segment.
const std::vector< bool > & selections () const
 Returns a vector of time position of the segment selections.
unsigned current () const
 Returns the current segmentation.
void current (unsigned index)
 Changes teh current segmentation.
double maxPosition () const
virtual void maxPosition (double maxPosition)
void xUnits (const std::string &units)
const std::string & xUnits () const

Protected Attributes

TimePositions _onsets
TimePositions _offsets
std::vector< std::string > _labels
std::vector< bool > _selection
unsigned _current
double _maxPosition
std::string _xUnits

Detailed Description

Definition at line 14 of file Segmentation.hxx.


Member Typedef Documentation

typedef std::vector<double> CLAM::Segmentation::TimePositions

Constructor & Destructor Documentation

CLAM::Segmentation::Segmentation (  )  [inline]

Definition at line 24 of file Segmentation.hxx.

CLAM::Segmentation::Segmentation ( double  maxPosition  )  [inline]

Definition at line 29 of file Segmentation.hxx.

CLAM::Segmentation::~Segmentation (  )  [virtual]

Definition at line 6 of file Segmentation.cxx.


Member Function Documentation

std::string CLAM::Segmentation::boundsAsString (  )  const [inline]

Testing method for the unit tests.

Definition at line 131 of file Segmentation.hxx.

References _offsets, _onsets, and _selection.

void CLAM::Segmentation::clearSelection (  )  [inline]

Definition at line 122 of file Segmentation.hxx.

References _selection.

void CLAM::Segmentation::current ( unsigned  index  )  [inline]

Changes teh current segmentation.

Definition at line 188 of file Segmentation.hxx.

References _current, and _onsets.

unsigned CLAM::Segmentation::current (  )  const [inline]

Returns the current segmentation.

Definition at line 181 of file Segmentation.hxx.

References _current.

void CLAM::Segmentation::deselect ( unsigned  segment  )  [inline]

Definition at line 118 of file Segmentation.hxx.

References _selection.

virtual void CLAM::Segmentation::dragOffset ( unsigned  segment,
double  newTimePosition 
) [pure virtual]

Performs a dragging movement for the Offset of the given segment in order to move it to the newTimePosition.

Constraints for the segmentation mode are applied.

Implemented in CLAM::ContiguousSegmentation, CLAM::DiscontinuousSegmentation, and CLAM::UnsizedSegmentation.

virtual void CLAM::Segmentation::dragOnset ( unsigned  segment,
double  newTimePosition 
) [pure virtual]

Performs a dragging movement for the Onset of the given segment in order to move it to the newTimePosition.

Constraints for the segmentation mode are applied.

Implemented in CLAM::ContiguousSegmentation, CLAM::DiscontinuousSegmentation, and CLAM::UnsizedSegmentation.

virtual void CLAM::Segmentation::fillArray ( DataArray segmentation  )  const [pure virtual]
const char* CLAM::Segmentation::GetClassName (  )  const [inline, virtual]

Return the class name.

Implements CLAM::Component.

Reimplemented in CLAM::ContiguousSegmentation, CLAM::DiscontinuousSegmentation, and CLAM::UnsizedSegmentation.

Definition at line 83 of file Segmentation.hxx.

virtual unsigned CLAM::Segmentation::insert ( double  timePosition  )  [pure virtual]

Inserts a new border at timePosition.

Implemented in CLAM::ContiguousSegmentation, CLAM::DiscontinuousSegmentation, and CLAM::UnsizedSegmentation.

const std::vector<std::string>& CLAM::Segmentation::labels (  )  const [inline]

Returns a vector of segment labels.

Definition at line 159 of file Segmentation.hxx.

References _labels.

void CLAM::Segmentation::LoadFrom ( Storage storage  )  [inline, virtual]

Loads component's subitems from the given Storage.

Parameters:
storage The given storage where the subitem will be loaded from
See also:
Storage

Implements CLAM::Component.

Definition at line 94 of file Segmentation.hxx.

References CLAM::Array< T >::GetPtr(), CLAM::Storage::Load(), CLAM::Array< T >::LoadFrom(), maxPosition(), CLAM::Array< T >::Size(), and takeArray().

virtual void CLAM::Segmentation::maxPosition ( double  maxPosition  )  [inline, virtual]

Reimplemented in CLAM::ContiguousSegmentation.

Definition at line 197 of file Segmentation.hxx.

References _maxPosition.

double CLAM::Segmentation::maxPosition (  )  const [inline]
const TimePositions& CLAM::Segmentation::offsets (  )  const [inline]

Returns a vector of time position of the segment offsets.

Definition at line 152 of file Segmentation.hxx.

References _offsets.

Referenced by Simac::ChordSegmentator::changeChordIfSegmentTooSmall(), and Simac::ChordSegmentator::mergeSegmentIfIdenticalChordInPreviousSegment().

const TimePositions& CLAM::Segmentation::onsets (  )  const [inline]
virtual unsigned CLAM::Segmentation::pickOffset ( double  timePosition,
double  tolerance 
) const [pure virtual]

Returns the index of the segment whose offset is nearest to the given time position, and within the tolerance.

If no end of segment within the tolerance range an invalid segment is returned (nSegments)

Implemented in CLAM::ContiguousSegmentation, CLAM::DiscontinuousSegmentation, and CLAM::UnsizedSegmentation.

virtual unsigned CLAM::Segmentation::pickOnset ( double  timePosition,
double  tolerance 
) const [pure virtual]

Returns the index of the segment whose onset is nearest to the given time position, and within the tolerance.

If no end of segment within the tolerance range an invalid segment is returned (nSegments)

Implemented in CLAM::ContiguousSegmentation, CLAM::DiscontinuousSegmentation, and CLAM::UnsizedSegmentation.

virtual unsigned CLAM::Segmentation::pickSegmentBody ( double  timePosition  )  const [pure virtual]

Returns the index of the segment which body is on timePosition.

Implemented in CLAM::ContiguousSegmentation, CLAM::DiscontinuousSegmentation, and CLAM::UnsizedSegmentation.

virtual void CLAM::Segmentation::remove ( unsigned  segment  )  [pure virtual]

Removes the specified segment.

The previous segment is expanded to cover the region. When removing the first segment, the next segment is the one expanded to start at 0. When just a single element, no efect at all.

Implemented in CLAM::ContiguousSegmentation, CLAM::DiscontinuousSegmentation, and CLAM::UnsizedSegmentation.

void CLAM::Segmentation::select ( unsigned  segment  )  [inline]

Definition at line 114 of file Segmentation.hxx.

References _selection.

const std::vector<bool>& CLAM::Segmentation::selections (  )  const [inline]

Returns a vector of time position of the segment selections.

Definition at line 174 of file Segmentation.hxx.

References _selection.

void CLAM::Segmentation::setLabel ( unsigned  segment,
std::string  label 
) [inline]

Sets the label for a particular segment.

Definition at line 166 of file Segmentation.hxx.

References _labels.

Referenced by CLAM::DiscontinuousSegmentation::insert().

void CLAM::Segmentation::StoreOn ( Storage storage  )  const [inline, virtual]

Stores component's subitems on the given Storage.

Parameters:
storage The given storage where the subitem will be stored
See also:
Storage

Implements CLAM::Component.

Definition at line 85 of file Segmentation.hxx.

References _maxPosition, fillArray(), CLAM::Storage::Store(), and CLAM::Array< T >::StoreOn().

virtual void CLAM::Segmentation::takeArray ( const TData begin,
const TData end 
) [pure virtual]

take data from an array.

Implemented in CLAM::ContiguousSegmentation, CLAM::DiscontinuousSegmentation, and CLAM::UnsizedSegmentation.

Referenced by LoadFrom().

const std::string& CLAM::Segmentation::xUnits (  )  const [inline]

Definition at line 205 of file Segmentation.hxx.

References _xUnits.

void CLAM::Segmentation::xUnits ( const std::string &  units  )  [inline]

Definition at line 201 of file Segmentation.hxx.

References _xUnits.


Member Data Documentation

std::vector<std::string> CLAM::Segmentation::_labels [protected]
std::vector<bool> CLAM::Segmentation::_selection [protected]
std::string CLAM::Segmentation::_xUnits [protected]

Definition at line 216 of file Segmentation.hxx.

Referenced by xUnits().


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.3