19 #include <itksys/SystemTools.hxx>
23 #include "mitkIGTException.h"
26 : m_CurPlayerState(PlayerStopped),
27 m_StartPlayingTimeStamp(0.0), m_PauseTimeStamp(0.0)
40 if ( m_NavigationDataSet->Size() == 0 )
42 MITK_WARN <<
"Cannot do anything with empty set of navigation datas.";
47 if (m_CurPlayerState != PlayerRunning)
50 this->GraftEmptyOutput();
60 TimeStampType timeStampSinceStartWithOffset = m_TimeStampSinceStart
61 + m_NavigationDataSet->Begin()->at(0)->GetIGTTimeStamp();
65 for (; m_NavigationDataSetIterator != m_NavigationDataSet->End(); ++m_NavigationDataSetIterator)
68 if ( m_NavigationDataSetIterator+1 == m_NavigationDataSet->End() ||
69 (m_NavigationDataSetIterator+1)->at(0)->GetIGTTimeStamp() > timeStampSinceStartWithOffset )
75 for (
unsigned int index = 0; index < GetNumberOfOutputs(); index++)
80 output->
Graft(m_NavigationDataSetIterator->at(index));
84 if (m_NavigationDataSetIterator+1 == m_NavigationDataSet->End())
89 if ( m_Repeat ) { this->StartPlaying(); }
96 Superclass::UpdateOutputInformation();
105 m_CurPlayerState = PlayerRunning;
106 m_NavigationDataSetIterator = m_NavigationDataSet->Begin();
109 m_PauseTimeStamp = 0;
110 m_TimeStampSinceStart = 0;
118 m_CurPlayerState = PlayerStopped;
124 if(m_CurPlayerState == PlayerRunning)
126 m_CurPlayerState = PlayerPaused;
131 MITK_ERROR <<
"Player is either not started or already is paused" << std::endl;
138 if(m_CurPlayerState == PlayerPaused)
140 m_CurPlayerState = PlayerRunning;
144 - (m_PauseTimeStamp - m_StartPlayingTimeStamp);
148 MITK_ERROR <<
"Player is not paused!" << std::endl;
154 return m_CurPlayerState;
159 return m_TimeStampSinceStart;
virtual ~NavigationDataPlayer()
void Resume()
This method resumes the player when it was paused.
void Pause()
This method pauses the player. If you want to play again call Resume()
double GetElapsed()
returns the time elapsed since calling Start() for the first time in milliseconds ...
mitk::NavigationData::TimeStampType TimeStampType
An object of this class represents an exception of the MITK-IGT module.
TimeStampType GetTimeStampSinceStart()
virtual void UpdateOutputInformation() override
Used for pipeline update just to tell the pipeline that we always have to update. ...
virtual void GenerateData() override
Set outputs to the navigation data object corresponding to current time.
void StartPlaying()
This method starts the player.
static IGTTimeStamp * GetInstance()
returns a pointer to the current instance of mitkTimeStamp
void Start(itk::Object::Pointer device)
starts the time-acquisition
PlayerState GetCurrentPlayerState()
void StopPlaying()
Stops the player and closes the stream. After a call of StopPlaying(), StartPlaying() must be called ...
#define mitkThrowException(classname)
virtual void Graft(const DataObject *data) override
Graft the data and information from one NavigationData to another.