NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Public Types | Public Member Functions | List of all members
mitk::TimeStampsContainer Class Reference

Helper class that contains a vector of timestamps, that are assumed to be strictly increasing. More...

Public Types

typedef unsigned long long TimeStamp
 

Public Member Functions

void Clear ()
 Empties the list. More...
 
void Sort ()
 Sorts the list. More...
 
void Insert (const TimeStamp &timeStamp)
 Simply adds a TimeStamp to the list. More...
 
bool Remove (const TimeStamp &timeStamp)
 Removes a TimeStamp to the list. More...
 
TimeStamp GetTimeStamp (std::vector< TimeStampsContainer::TimeStamp >::size_type frameNumber) const
 Returns the time stamp at a given frameNumber. More...
 
std::vector
< TimeStampsContainer::TimeStamp >
::size_type 
GetSize () const
 Gets the number of timestamps. More...
 
std::vector
< TimeStampsContainer::TimeStamp >
::size_type 
GetFrameNumber (const TimeStamp &timeStamp) const
 Given a timeStamp in nanoseconds, will search the list for the corresponding array index, returning -1 if not found. More...
 
bool GetBoundingTimeStamps (const TimeStamp &timeStamp, TimeStamp &before, TimeStamp &after, double &proportion) const
 Retrieves the timestamps before and after a given point. More...
 
TimeStamp GetNearestTimeStamp (const TimeStamp &timeStamp, long long *delta=NULL) const
 Retrieves the closest timestamp, and if delta is non-null, will populate with the error. More...
 

Detailed Description

Helper class that contains a vector of timestamps, that are assumed to be strictly increasing.

See also mitkTimeStampsContainerTest.cxx.

Member Typedef Documentation

typedef unsigned long long mitk::TimeStampsContainer::TimeStamp

Member Function Documentation

void mitk::TimeStampsContainer::Clear ( void  )

Empties the list.

bool mitk::TimeStampsContainer::GetBoundingTimeStamps ( const TimeStamp timeStamp,
TimeStamp before,
TimeStamp after,
double &  proportion 
) const

Retrieves the timestamps before and after a given point.

Parameters
[in]timeStampin nano-seconds since Unix Epoch (UTC).
[out]beforetimestamp in nano-seconds since Unix Epoch (UTC).
[out]aftertimestamp in nano-seconds since Unix Epoch (UTC).
[out]proportionthe fraction from [0 to 1] of what proportion the input timestamp is of the interval between before and after.
Returns
true if valid bounding interval and false otherwise.

Additional Spec:

  • If no timestamps, before = 0, after = 0, proportion = 0, return false.
  • If input > all items in list, before = last item in list (i.e. nearest lower bound), after = 0, (i.e. invalid), proportion = 0, return false.
  • If input < all items in list, after = first item in list (i.e. nearest upper bound), before = 0, (i.e invalid), proportion = 0, return false.
  • If input exactly matches item in list, before = input, after = input, proportion = 0, return true;
  • Otherwise, before is timestamp just before, after is timestamp just after the given input, proportion is linear interpolation between timestamps, return true;
std::vector< TimeStampsContainer::TimeStamp >::size_type mitk::TimeStampsContainer::GetFrameNumber ( const TimeStamp timeStamp) const

Given a timeStamp in nanoseconds, will search the list for the corresponding array index, returning -1 if not found.

Parameters
[in]timeStampin nano-seconds since Unix Epoch (UTC).
Returns
vector index number or -1 if not found.
unsigned long long mitk::TimeStampsContainer::GetNearestTimeStamp ( const TimeStamp timeStamp,
long long *  delta = NULL 
) const

Retrieves the closest timestamp, and if delta is non-null, will populate with the error.

Parameters
[in]timeStampin nano-seconds since Unix Epoch (UTC).
[out]deltai.e. the number of nanoseconds between the requested timestamp, and the returned timestamp.
Returns
nearest timestamp

Additional Spec:

  • If no timestamps, return 0, delta = 0 if provided
std::vector< TimeStampsContainer::TimeStamp >::size_type mitk::TimeStampsContainer::GetSize ( ) const

Gets the number of timestamps.

TimeStampsContainer::TimeStamp mitk::TimeStampsContainer::GetTimeStamp ( std::vector< TimeStampsContainer::TimeStamp >::size_type  frameNumber) const

Returns the time stamp at a given frameNumber.

void mitk::TimeStampsContainer::Insert ( const TimeStamp timeStamp)

Simply adds a TimeStamp to the list.

bool mitk::TimeStampsContainer::Remove ( const TimeStamp timeStamp)

Removes a TimeStamp to the list.

Returns
false of timestamp not found in the list
void mitk::TimeStampsContainer::Sort ( )

Sorts the list.


The documentation for this class was generated from the following files: