#include <Segmentation.hxx>
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 TimePositions & | onsets () const |
Returns a vector of time position of the segment onsets. | |
const TimePositions & | offsets () 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 |
Definition at line 14 of file Segmentation.hxx.
typedef std::vector<double> CLAM::Segmentation::TimePositions |
Reimplemented in CLAM::ContiguousSegmentation, CLAM::DiscontinuousSegmentation, and CLAM::UnsizedSegmentation.
Definition at line 22 of file Segmentation.hxx.
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.
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.
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] |
Implemented in CLAM::ContiguousSegmentation, CLAM::DiscontinuousSegmentation, and CLAM::UnsizedSegmentation.
Referenced by StoreOn().
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.
storage | The given storage where the subitem will be loaded from |
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] |
Definition at line 193 of file Segmentation.hxx.
References _maxPosition.
Referenced by Simac::ChordSegmentator::closeLastSegment(), Simac::ChordSegmentator::doIt(), CLAM::UnsizedSegmentation::dragOffset(), Simac::ChordSegmentator::eraseAllSegments(), CLAM::UnsizedSegmentation::insert(), and LoadFrom().
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] |
Returns a vector of time position of the segment onsets.
Definition at line 145 of file Segmentation.hxx.
References _onsets.
Referenced by Simac::ChordSegmentator::changeChordIfSegmentTooSmall(), Simac::ChordSegmentator::changeChordsForSmallSegments(), Simac::ChordSegmentator::eraseAllSegments(), Simac::ChordSegmentator::joinSegmentsWithIdenticalChords(), and Simac::ChordSegmentator::mergeSegmentIfIdenticalChordInPreviousSegment().
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.
storage | The given storage where the subitem will be stored |
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.
unsigned CLAM::Segmentation::_current [protected] |
Definition at line 214 of file Segmentation.hxx.
Referenced by current(), CLAM::UnsizedSegmentation::insert(), CLAM::DiscontinuousSegmentation::insert(), CLAM::ContiguousSegmentation::insert(), CLAM::UnsizedSegmentation::remove(), and CLAM::DiscontinuousSegmentation::remove().
std::vector<std::string> CLAM::Segmentation::_labels [protected] |
Definition at line 212 of file Segmentation.hxx.
Referenced by CLAM::DiscontinuousSegmentation::insert(), labels(), CLAM::DiscontinuousSegmentation::remove(), setLabel(), and CLAM::DiscontinuousSegmentation::takeArray().
double CLAM::Segmentation::_maxPosition [protected] |
Definition at line 215 of file Segmentation.hxx.
Referenced by CLAM::DiscontinuousSegmentation::dragOffset(), CLAM::DiscontinuousSegmentation::insert(), maxPosition(), StoreOn(), and CLAM::DiscontinuousSegmentation::takeArray().
TimePositions CLAM::Segmentation::_offsets [protected] |
Definition at line 211 of file Segmentation.hxx.
Referenced by boundsAsString(), CLAM::UnsizedSegmentation::dragOffset(), CLAM::DiscontinuousSegmentation::dragOffset(), CLAM::DiscontinuousSegmentation::dragOnset(), CLAM::DiscontinuousSegmentation::fillArray(), CLAM::UnsizedSegmentation::insert(), CLAM::DiscontinuousSegmentation::insert(), CLAM::ContiguousSegmentation::insert(), offsets(), CLAM::UnsizedSegmentation::pickOffset(), CLAM::DiscontinuousSegmentation::pickOffset(), CLAM::UnsizedSegmentation::pickSegmentBody(), CLAM::DiscontinuousSegmentation::pickSegmentBody(), CLAM::UnsizedSegmentation::remove(), CLAM::DiscontinuousSegmentation::remove(), and CLAM::DiscontinuousSegmentation::takeArray().
TimePositions CLAM::Segmentation::_onsets [protected] |
Definition at line 210 of file Segmentation.hxx.
Referenced by boundsAsString(), current(), CLAM::UnsizedSegmentation::dragOffset(), CLAM::DiscontinuousSegmentation::dragOffset(), CLAM::DiscontinuousSegmentation::dragOnset(), CLAM::UnsizedSegmentation::fillArray(), CLAM::DiscontinuousSegmentation::fillArray(), CLAM::UnsizedSegmentation::insert(), CLAM::DiscontinuousSegmentation::insert(), CLAM::ContiguousSegmentation::insert(), onsets(), CLAM::UnsizedSegmentation::pickOnset(), CLAM::DiscontinuousSegmentation::pickOnset(), CLAM::DiscontinuousSegmentation::pickSegmentBody(), CLAM::UnsizedSegmentation::remove(), CLAM::DiscontinuousSegmentation::remove(), and CLAM::DiscontinuousSegmentation::takeArray().
std::vector<bool> CLAM::Segmentation::_selection [protected] |
Definition at line 213 of file Segmentation.hxx.
Referenced by boundsAsString(), clearSelection(), deselect(), CLAM::UnsizedSegmentation::insert(), CLAM::DiscontinuousSegmentation::insert(), CLAM::ContiguousSegmentation::insert(), CLAM::UnsizedSegmentation::remove(), CLAM::DiscontinuousSegmentation::remove(), select(), selections(), and CLAM::DiscontinuousSegmentation::takeArray().
std::string CLAM::Segmentation::_xUnits [protected] |
Definition at line 216 of file Segmentation.hxx.
Referenced by xUnits().