diff --git a/Modules/IGTUI/Qmitk/QmitkIGTPlayerWidget.cpp b/Modules/IGTUI/Qmitk/QmitkIGTPlayerWidget.cpp index d511b02490..e0e66c4750 100644 --- a/Modules/IGTUI/Qmitk/QmitkIGTPlayerWidget.cpp +++ b/Modules/IGTUI/Qmitk/QmitkIGTPlayerWidget.cpp @@ -1,387 +1,547 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-12 19:14:45 +0200 (Di, 12 Mai 2009) $ Version: $Revision: 1.12 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "QmitkIGTPlayerWidget.h" //mitk headers #include "mitkTrackingTypes.h" #include #include #include #include #include #include #include //qt headers #include #include #include QmitkIGTPlayerWidget::QmitkIGTPlayerWidget(QWidget* parent, Qt::WindowFlags f) -: QWidget(parent, f), m_Player(NULL), m_StartTime(-1.0) +: QWidget(parent, f) +,m_RealTimePlayer(NULL) +,m_SequentialPlayer(NULL) +,m_StartTime(-1.0) +,m_CurrentSequentialPointNumber(0) { m_Controls = NULL; CreateQtPartControl(this); CreateConnections(); this->ResetLCDNumbers(); // reset lcd numbers at start } QmitkIGTPlayerWidget::~QmitkIGTPlayerWidget() { m_PlayingTimer->stop(); - m_Player = NULL; + m_RealTimePlayer = NULL; m_PlayingTimer = NULL; } void QmitkIGTPlayerWidget::CreateQtPartControl(QWidget *parent) { if (!m_Controls) { // create GUI widgets m_Controls = new Ui::QmitkIGTPlayerWidgetControls; m_Controls->setupUi(parent); m_PlayingTimer = new QTimer(this); // initialize update timer - } } void QmitkIGTPlayerWidget::CreateConnections() { if ( m_Controls ) { connect( (QObject*)(m_Controls->selectPushButton), SIGNAL(clicked()), this, SLOT(OnSelectPressed()) ); // open file dialog connect( (QObject*)(m_Controls->playPushButton), SIGNAL(clicked(bool)), this, SLOT(OnPlayButtonClicked(bool)) ); // play button connect( (QObject*)(m_PlayingTimer), SIGNAL(timeout()), this, SLOT(OnPlaying()) ); // update timer connect( (QObject*) (m_Controls->beginPushButton), SIGNAL(clicked()), this, SLOT(OnGoToBegin()) ); // reset player and go to begin connect( (QObject*) (m_Controls->stopPushButton), SIGNAL(clicked()), this, SLOT(OnGoToEnd()) ); // reset player // pass this widgets protected combobox signal to public signal connect( (QObject*) (m_Controls->trajectorySelectComboBox), SIGNAL(currentIndexChanged(int)), this, SIGNAL(SignalCurrentTrajectoryChanged(int)) ); // pass this widgets protected checkbox signal to public signal connect( m_Controls->splineModeCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(SignalSplineModeToggled(bool)) ); + connect( m_Controls->sequencialModeCheckBox, SIGNAL(toggled(bool)), this, SLOT(OnSequencialModeToggled(bool)) ); + + connect( m_Controls->samplePositionHorizontalSlider, SIGNAL(sliderPressed()), this, SLOT(OnSliderPressed()) ); + connect( m_Controls->samplePositionHorizontalSlider, SIGNAL(sliderReleased()), this, SLOT(OnSliderReleased()) ); + } } bool QmitkIGTPlayerWidget::IsTrajectoryInSplineMode() { return m_Controls->splineModeCheckBox->isChecked(); } bool QmitkIGTPlayerWidget::CheckInputFileValid() { QFile file(m_CmpFilename); // check if file exists if(!file.exists()) { QMessageBox::warning(NULL, "IGTPlayer: Error", "No valid input file was loaded. Please load input file first!"); return false; } return true; } unsigned int QmitkIGTPlayerWidget::GetNumberOfTools() { unsigned int result = 0; - // at the moment this works only if player is initialized - if(m_Player.IsNotNull()) - result = m_Player->GetNumberOfOutputs(); + if(this->GetCurrentPlaybackMode() == RealTimeMode) + { + if(m_RealTimePlayer.IsNotNull()) + result = m_RealTimePlayer->GetNumberOfOutputs(); + } + else if(this->GetCurrentPlaybackMode() == SequentialMode) + { + if(m_SequentialPlayer.IsNotNull()) + result = m_SequentialPlayer->GetNumberOfOutputs(); + } + + // at the moment this works only if player is initialized return result; } void QmitkIGTPlayerWidget::SetUpdateRate(unsigned int msecs) { m_PlayingTimer->setInterval((int) msecs); // set update timer update rate } void QmitkIGTPlayerWidget::OnPlayButtonClicked(bool checked) { + + if(CheckInputFileValid()) // no playing possible without valid input file { + PlaybackMode currentMode = this->GetCurrentPlaybackMode(); + bool isRealTimeMode = currentMode == RealTimeMode; + bool isSequentialMode = currentMode == SequentialMode; + if(checked) // play { - if(m_Player.IsNull()) // start play + if( (isRealTimeMode && m_RealTimePlayer.IsNull()) || (isSequentialMode && m_SequentialPlayer.IsNull())) // start play { - m_Player = mitk::NavigationDataPlayer::New(); - m_Player->SetFileName(m_CmpFilename.toStdString()); + if(isRealTimeMode) + { + m_RealTimePlayer = mitk::NavigationDataPlayer::New(); + m_RealTimePlayer->SetFileName(m_CmpFilename.toStdString()); + m_RealTimePlayer->StartPlaying(); + } + else if(isSequentialMode) + { + m_SequentialPlayer = mitk::NavigationDataSequentialPlayer::New(); + m_SequentialPlayer->SetFileName(m_CmpFilename.toStdString()); + + m_Controls->samplePositionHorizontalSlider->setMinimum(0); + m_Controls->samplePositionHorizontalSlider->setMaximum(m_SequentialPlayer->GetNumberOfSnapshots()); + m_Controls->samplePositionHorizontalSlider->setEnabled(true); + } - m_Player->StartPlaying(); m_PlayingTimer->start(100); emit SignalPlayingStarted(); } else // resume play { - m_Player->Resume(); + if(isRealTimeMode) + m_RealTimePlayer->Resume(); + m_PlayingTimer->start(100); emit SignalPlayingResumed(); } } else // pause { - m_Player->Pause(); + if(isRealTimeMode) + m_RealTimePlayer->Pause(); + m_PlayingTimer->stop(); emit SignalPlayingPaused(); } } else m_Controls->playPushButton->setChecked(false); // uncheck play button if file unvalid } + +QmitkIGTPlayerWidget::PlaybackMode QmitkIGTPlayerWidget::GetCurrentPlaybackMode() +{ + if(m_Controls->sequencialModeCheckBox->isChecked()) + return SequentialMode; + else + return RealTimeMode; +} + QTimer* QmitkIGTPlayerWidget::GetPlayingTimer() { return m_PlayingTimer; } void QmitkIGTPlayerWidget::OnStopPlaying() { this->StopPlaying(); } void QmitkIGTPlayerWidget::StopPlaying() { m_PlayingTimer->stop(); emit SignalPlayingStopped(); - if(m_Player.IsNotNull()) - m_Player->StopPlaying(); - m_Player = NULL; + + if(m_RealTimePlayer.IsNotNull()) + m_RealTimePlayer->StopPlaying(); + + m_RealTimePlayer = NULL; + m_SequentialPlayer = NULL; + m_StartTime = -1; // set starttime back + m_CurrentSequentialPointNumber = 0; + m_Controls->samplePositionHorizontalSlider->setSliderPosition(m_CurrentSequentialPointNumber); + m_Controls->sampleLCDNumber->display(static_cast(m_CurrentSequentialPointNumber)); + this->ResetLCDNumbers(); m_Controls->playPushButton->setChecked(false); // set play button unchecked - } void QmitkIGTPlayerWidget::OnPlaying() { - if(m_Player.IsNull()) + PlaybackMode currentMode = this->GetCurrentPlaybackMode(); + bool isRealTimeMode = currentMode == RealTimeMode; + bool isSequentialMode = currentMode == SequentialMode; + + if(isRealTimeMode && m_RealTimePlayer.IsNull()) + return; + + else if(isSequentialMode && m_SequentialPlayer.IsNull()) return; - if(m_StartTime < 0) - m_StartTime = m_Player->GetOutput()->GetTimeStamp(); // get playback start time + if(isRealTimeMode && m_StartTime < 0) + m_StartTime = m_RealTimePlayer->GetOutput()->GetTimeStamp(); // get playback start time + + - if(!m_Player->IsAtEnd()) + if(isRealTimeMode && !m_RealTimePlayer->IsAtEnd()) { - m_Player->Update(); // update player + m_RealTimePlayer->Update(); // update player - int msc = (int) (m_Player->GetOutput()->GetTimeStamp() - m_StartTime); + int msc = (int) (m_RealTimePlayer->GetOutput()->GetTimeStamp() - m_StartTime); // calculation for playing time display int ms = msc % 1000; msc = (msc - ms) / 1000; int s = msc % 60; int min = (msc-s) / 60; // set lcd numbers m_Controls->msecLCDNumber->display(ms); m_Controls->secLCDNumber->display(s); m_Controls->minLCDNumber->display(min); emit SignalPlayerUpdated(); // player successfully updated } + else if(isSequentialMode && (m_CurrentSequentialPointNumber < m_SequentialPlayer->GetNumberOfSnapshots())) + { + m_SequentialPlayer->Update(); // update sequential player + + m_Controls->samplePositionHorizontalSlider->setSliderPosition(m_CurrentSequentialPointNumber++); // refresh slider position + m_Controls->sampleLCDNumber->display(static_cast(m_CurrentSequentialPointNumber)); + + //for debugging purposes + //std::cout << "Sample: " << m_CurrentSequentialPointNumber << " X: " << m_SequentialPlayer->GetOutput(0)->GetPosition()[0] << " Y: " << m_SequentialPlayer->GetOutput(0)->GetPosition()[1] << " Y: " << m_SequentialPlayer->GetOutput(0)->GetPosition()[2] << std::endl; + + emit SignalPlayerUpdated(); // player successfully updated + + } else this->StopPlaying(); // if player is at EOF } const std::vector QmitkIGTPlayerWidget::GetNavigationDatas() { std::vector navDatas; - if(m_Player.IsNotNull()) + if(this->GetCurrentPlaybackMode() == RealTimeMode && m_RealTimePlayer.IsNotNull()) { - for(unsigned int i=0; i < m_Player->GetNumberOfOutputs(); ++i) + for(unsigned int i=0; i < m_RealTimePlayer->GetNumberOfOutputs(); ++i) { - navDatas.push_back(m_Player->GetOutput(i)); // push back current navigation data for each tool + navDatas.push_back(m_RealTimePlayer->GetOutput(i)); // push back current navigation data for each tool } } + + else if(this->GetCurrentPlaybackMode() == SequentialMode && m_SequentialPlayer.IsNotNull()) + { + for(unsigned int i=0; i < m_SequentialPlayer->GetNumberOfOutputs(); ++i) + { + navDatas.push_back(m_SequentialPlayer->GetOutput(i)); // push back current navigation data for each tool + } + } return navDatas; } const mitk::PointSet::Pointer QmitkIGTPlayerWidget::GetNavigationDatasPointSet() { mitk::PointSet::Pointer result = mitk::PointSet::New(); mitk::PointSet::PointType pointType; - if(m_Player.IsNotNull()) + PlaybackMode currentMode = this->GetCurrentPlaybackMode(); + bool isRealTimeMode = currentMode == RealTimeMode; + bool isSequentialMode = currentMode == SequentialMode; + + + if( (isRealTimeMode && m_RealTimePlayer.IsNotNull()) || (isSequentialMode && m_SequentialPlayer.IsNotNull())) { - for(unsigned int i=0; i < m_Player->GetNumberOfOutputs(); ++i) + int numberOfOutputs = 0; + + if(isRealTimeMode) + numberOfOutputs = m_RealTimePlayer->GetNumberOfOutputs(); + else if(isSequentialMode) + numberOfOutputs = m_SequentialPlayer->GetNumberOfOutputs(); + + for(unsigned int i=0; i < m_RealTimePlayer->GetNumberOfOutputs(); ++i) { - mitk::NavigationData::PositionType position = m_Player->GetOutput(i)->GetPosition(); + mitk::NavigationData::PositionType position; + + if(isRealTimeMode) + position = m_RealTimePlayer->GetOutput(i)->GetPosition(); + else if(isSequentialMode) + position = m_SequentialPlayer->GetOutput(i)->GetPosition(); pointType[0] = position[0]; pointType[1] = position[1]; pointType[2] = position[2]; result->InsertPoint(i,pointType); // insert current ND as Pointtype in PointSet for return } } return result; } const mitk::PointSet::PointType QmitkIGTPlayerWidget::GetNavigationDataPoint(unsigned int index) { if( index > this->GetNumberOfTools() || index < 0 ) throw std::out_of_range("Tool Index out of range!"); + PlaybackMode currentMode = this->GetCurrentPlaybackMode(); + bool isRealTimeMode = currentMode == RealTimeMode; + bool isSequentialMode = currentMode == SequentialMode; + + // create return PointType from current ND for tool index mitk::PointSet::PointType result; - if(m_Player.IsNotNull()) + if( (isRealTimeMode && m_RealTimePlayer.IsNotNull()) || (isSequentialMode && m_SequentialPlayer.IsNotNull())) { - // create return PointType from current ND for tool index - mitk::NavigationData::PositionType position = m_Player->GetOutput(index)->GetPosition(); + mitk::NavigationData::PositionType position; + + if(isRealTimeMode) + position = m_RealTimePlayer->GetOutput(index)->GetPosition(); + else if(isSequentialMode) + position = m_SequentialPlayer->GetOutput(index)->GetPosition(); + result[0] = position[0]; result[1] = position[1]; result[2] = position[2]; } return result; } void QmitkIGTPlayerWidget::SetInputFileName(const QString& inputFileName) { this->OnGoToEnd(); /// stops playing and resets lcd numbers QString oldName = m_CmpFilename; m_CmpFilename.clear(); m_CmpFilename = inputFileName; QFile file(m_CmpFilename); if(m_CmpFilename.isEmpty() || !file.exists()) { QMessageBox::warning(NULL, "Warning", QString("Please enter valid path! Using previous path again.")); m_CmpFilename=oldName; m_Controls->inputFileLineEdit->setText(m_CmpFilename); } } -void QmitkIGTPlayerWidget::SetPlayer( mitk::NavigationDataPlayer::Pointer player ) +void QmitkIGTPlayerWidget::SetRealTimePlayer( mitk::NavigationDataPlayer::Pointer player ) +{ + if(player.IsNotNull()) + m_RealTimePlayer = player; +} + +void QmitkIGTPlayerWidget::SetSequentialPlayer( mitk::NavigationDataSequentialPlayer::Pointer player ) { if(player.IsNotNull()) - m_Player = player; + m_SequentialPlayer = player; } + + void QmitkIGTPlayerWidget::OnSelectPressed() { QString oldName = m_CmpFilename; m_CmpFilename.clear(); m_CmpFilename = QFileDialog::getOpenFileName(this, "Load tracking data", QDir::currentPath(),"XML files (*.xml)"); if (m_CmpFilename.isEmpty())//if something went wrong or user pressed cancel in the save dialog m_CmpFilename=oldName; else { this->OnGoToEnd(); /// stops playing and resets lcd numbers emit SignalInputFileChanged(); } m_Controls->inputFileLineEdit->setText(m_CmpFilename); } void QmitkIGTPlayerWidget::OnGoToEnd() { this->StopPlaying(); // reset lcd numbers this->ResetLCDNumbers(); } void QmitkIGTPlayerWidget::OnGoToBegin() { // stop player manual so no PlayingStopped() m_PlayingTimer->stop(); - if(m_Player.IsNotNull()) - m_Player->StopPlaying(); - m_Player = NULL; // set player to NULL so it can be initialized again if playback is called afterwards + + if(this->GetCurrentPlaybackMode() == RealTimeMode && m_RealTimePlayer.IsNotNull()) + { + m_RealTimePlayer->StopPlaying(); + m_RealTimePlayer = NULL; // set player to NULL so it can be initialized again if playback is called afterwards + } + m_StartTime = -1; // set starttime back //reset view elements m_Controls->playPushButton->setChecked(false); this->ResetLCDNumbers(); - } void QmitkIGTPlayerWidget::ResetLCDNumbers() { m_Controls->minLCDNumber->display(QString("00")); m_Controls->secLCDNumber->display(QString("00")); m_Controls->msecLCDNumber->display(QString("000")); } void QmitkIGTPlayerWidget::SetTrajectoryNames(const QStringList toolNames) { QComboBox* cBox = m_Controls->trajectorySelectComboBox; if(cBox->count() > 0) this->ClearTrajectorySelectCombobox(); // before making changed to QComboBox it is recommended to disconnet it's SIGNALS and SLOTS disconnect( (QObject*) (m_Controls->trajectorySelectComboBox), SIGNAL(currentIndexChanged(int)), this, SIGNAL(SignalCurrentTrajectoryChanged(int)) ); if(!toolNames.isEmpty()) m_Controls->trajectorySelectComboBox->insertItems(0, toolNames); // adding current tool names to combobox // reconnect after performed changes connect( (QObject*) (m_Controls->trajectorySelectComboBox), SIGNAL(currentIndexChanged(int)), this, SIGNAL(SignalCurrentTrajectoryChanged(int)) ); } int QmitkIGTPlayerWidget::GetResolution() { - return m_Controls->resolutionSpinBox->value(); + return m_Controls->resolutionSpinBox->value(); // return currently selected trajectory resolution } void QmitkIGTPlayerWidget::ClearTrajectorySelectCombobox() { // before making changed to QComboBox it is recommended to disconnet it's SIGNALS and SLOTS disconnect( (QObject*) (m_Controls->trajectorySelectComboBox), SIGNAL(currentIndexChanged(int)), this, SIGNAL(SignalCurrentTrajectoryChanged(int)) ); m_Controls->trajectorySelectComboBox->clear(); // reconnect after performed changes connect( (QObject*) (m_Controls->trajectorySelectComboBox), SIGNAL(currentIndexChanged(int)), this, SIGNAL(SignalCurrentTrajectoryChanged(int)) ); } + +void QmitkIGTPlayerWidget::OnSequencialModeToggled(bool toggled) +{ + this->StopPlaying(); // stop playing when mode is changed + + if(toggled) + { + m_Controls->samplePositionHorizontalSlider->setEnabled(true); // enable slider if sequential mode + } + else if(!toggled) + { + m_Controls->samplePositionHorizontalSlider->setSliderPosition(0); // set back and disable slider + m_Controls->samplePositionHorizontalSlider->setDisabled(true); + } + + +} + +void QmitkIGTPlayerWidget::OnSliderReleased() +{ + int currentSliderValue = m_Controls->samplePositionHorizontalSlider->value(); // current slider value selected through user movement + + if(currentSliderValue > m_CurrentSequentialPointNumber) // at the moment only forward scrolling is possible + { + m_SequentialPlayer->GoToSnapshot(currentSliderValue); // move player to selected snapshot + m_CurrentSequentialPointNumber = currentSliderValue; + m_Controls->sampleLCDNumber->display(currentSliderValue); // update lcdnumber in widget + } + else + m_Controls->samplePositionHorizontalSlider->setValue(m_CurrentSequentialPointNumber); +} + +void QmitkIGTPlayerWidget::OnSliderPressed() +{ + if(m_Controls->playPushButton->isChecked()) // check if widget is playing + m_Controls->playPushButton->click(); // perform click to pause the play +} \ No newline at end of file diff --git a/Modules/IGTUI/Qmitk/QmitkIGTPlayerWidget.h b/Modules/IGTUI/Qmitk/QmitkIGTPlayerWidget.h index 932f125d7a..f8fa8dd4b7 100644 --- a/Modules/IGTUI/Qmitk/QmitkIGTPlayerWidget.h +++ b/Modules/IGTUI/Qmitk/QmitkIGTPlayerWidget.h @@ -1,235 +1,262 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-12 19:14:45 +0200 (Di, 12 Mai 2009) $ Version: $Revision: 1.12 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef QmitkIGTPlayerWidget_H #define QmitkIGTPlayerWidget_H //QT headers #include //mitk headers #include "MitkIGTUIExports.h" #include "mitkNavigationTool.h" #include "mitkNavigationDataPlayer.h" +#include "mitkNavigationDataSequentialPlayer.h" #include #include //ui header #include "ui_QmitkIGTPlayerWidgetControls.h" /** Documentation: * \brief GUI to access the IGT Player. * User must specify the file name where the input xml-file is located. The NavigationDatas from the xml-file can be * played in normal mode or in PointSet mode. * * In normal mode the player updates the NavigationDatas every 100ms (can be changed in SetUpdateRate()) and returns * them when GetNavigationDatas() is called. * In PointSet mode the player generates a PointSet with all NavigationDatas from the xml-file. So the playback is * performed on this ND PointSet. * * \ingroup IGTUI */ class MitkIGTUI_EXPORT QmitkIGTPlayerWidget : public QWidget { Q_OBJECT public: static const std::string VIEW_ID; /*! \brief default constructor */ QmitkIGTPlayerWidget(QWidget* parent = 0, Qt::WindowFlags f = 0); /*! \brief default deconstructor */ ~QmitkIGTPlayerWidget(); /*! - \brief Sets the player for this player widget + \brief Sets the real time player for this player widget */ - void SetPlayer(mitk::NavigationDataPlayer::Pointer player); + void SetRealTimePlayer(mitk::NavigationDataPlayer::Pointer player); + + /*! + \brief Sets the sequential player for this player widget + */ + void SetSequentialPlayer(mitk::NavigationDataSequentialPlayer::Pointer player); /*! \brief Returns the playing timer of this widget */ QTimer* GetPlayingTimer(); /*! \brief Returns the current playback NavigationDatas from the xml-file */ const std::vector GetNavigationDatas(); /*! \brief Returns a PointSet of the current NavigationDatas for all recorded tools. */ const mitk::PointSet::Pointer GetNavigationDatasPointSet(); /*! \brief Returns a PointType of the current NavigationData for a specific tool with the given index. */ const mitk::PointSet::PointType GetNavigationDataPoint(unsigned int index); /*! \brief Sets the update rate of this widget's playing timer */ void SetUpdateRate(unsigned int msecs); /*! \brief Returns the number of different tools from the current playing stream. * * Retuns 0 if playback file is invalid. */ unsigned int GetNumberOfTools(); /*! \brief Stops the playback */ void StopPlaying(); /*! \brief Sets the given tool names list to the trajectory select combobox. */ void SetTrajectoryNames(const QStringList toolNames); /*! \brief Returns the current resolution value from the resolution spinbox. */ int GetResolution(); /*! \brief Clears all items in the trajectory selection combobox. */ void ClearTrajectorySelectCombobox(); /*! \brief Returns whether spline mode checkbox is selected. */ bool IsTrajectoryInSplineMode(); + + enum PlaybackMode { ///< playback mode enum + RealTimeMode = 1, + SequentialMode = 2 + }; + + + PlaybackMode GetCurrentPlaybackMode(); + signals: /*! \brief This signal is emitted when the player starts the playback. */ void SignalPlayingStarted(); /*! \brief This signal is emitted when the player resumes after a pause. */ void SignalPlayingResumed(); /*! \brief This signal is emitted when the player stops. */ void SignalPlayingStopped(); /*! \brief This signal is emitted when the player is paused. */ void SignalPlayingPaused(); /*! \brief This signal is emitted when the player reaches the end of the playback. */ void SignalPlayingEnded(); /*! \brief This signal is emitted every time the player updated the NavigationDatas. */ void SignalPlayerUpdated(); /*! \brief This signal is emitted if the input file for the replay was changed. */ void SignalInputFileChanged(); /*! \brief This signal is emitted if the index of the current selected trajectory select combobox item changes. */ void SignalCurrentTrajectoryChanged(int index); /*! \brief This signal is emitted if the spline mode checkbox is toggled or untoggled. */ - void SignalSplineModeToggled(bool checked); - - + void SignalSplineModeToggled(bool toggled); protected slots: /*! \brief Starts or pauses the playback */ void OnPlayButtonClicked(bool toggled); /*! \brief Updates the playback data */ void OnPlaying(); /*! \brief Stops the playback */ void OnStopPlaying(); /*! \brief Updates the input filename */ void SetInputFileName(const QString& inputFileName); /*! \brief Opens file open dialog for searching the input file */ void OnSelectPressed(); /*! \brief Stops the playback */ void OnGoToEnd(); /*! \brief Stops the playback and resets the player to the beginning */ void OnGoToBegin(); + /*! + \brief Switches widget between realtime and sequential mode + */ + void OnSequencialModeToggled(bool toggled); + /*! + \brief Pauses playback when slider is pressed by user + */ + void OnSliderPressed(); + /*! + \brief Moves player position to the position selected with the slider + */ + void OnSliderReleased(); + protected: /// \brief Creation of the connections virtual void CreateConnections(); - + /// \brief Creation of the Qt control virtual void CreateQtPartControl(QWidget *parent); /*! \brief Checks if an imput file with the set filename exists */ bool CheckInputFileValid(); /*! \brief Sets all LCD numbers to 0 */ void ResetLCDNumbers(); Ui::QmitkIGTPlayerWidgetControls* m_Controls; - mitk::NavigationDataPlayer::Pointer m_Player; ///< plays NDs from a XML file - + mitk::NavigationDataPlayer::Pointer m_RealTimePlayer; ///< plays NDs from a XML file + mitk::NavigationDataSequentialPlayer::Pointer m_SequentialPlayer; + QString m_CmpFilename; ///< filename of the input file QTimer* m_PlayingTimer; ///< update timer mitk::NavigationData::TimeStampType m_StartTime; ///< start time of playback needed for time display - + unsigned int m_CurrentSequentialPointNumber; ///< current point number }; #endif \ No newline at end of file diff --git a/Modules/IGTUI/Qmitk/QmitkIGTPlayerWidgetControls.ui b/Modules/IGTUI/Qmitk/QmitkIGTPlayerWidgetControls.ui index 14d04a5314..d5a6a5fa2d 100644 --- a/Modules/IGTUI/Qmitk/QmitkIGTPlayerWidgetControls.ui +++ b/Modules/IGTUI/Qmitk/QmitkIGTPlayerWidgetControls.ui @@ -1,405 +1,414 @@ QmitkIGTPlayerWidgetControls 0 0 - 398 + 416 689 Form Settings true false - - + + - - 2 + + 0 0 Input File - + - 8 + 2 0 150 0 true - - + + - - 2 + + 0 0 - - - 90 - 16777215 - - - - - 50 - false - - - Select - - - false + Trajectory - - - - - - + + - - 1 + + 4 0 - - Trajectory - - - + + - 7 + 0 0 - - - - - - Qt::Horizontal + + 1 - - - 40 - 20 - + + 25 - + - + - 2 + 0 0 - Resolution 1 : + Res.: 1: - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + - 1 + 0 0 - - 1 + + Qt::LeftToRight - - 25 + + Splines - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - + + - + 0 0 - - Qt::LeftToRight + + + 90 + 16777215 + + + + + 50 + false + - Spline Trajectory + Select + + + false Player true - - + + background-color: rgb(60, 60, 60); color: rgb(250, 250, 250); + + QFrame::Raised + 3 QLCDNumber::Flat 0 - - + + min - + background-color: rgb(60, 60, 60); color: rgb(250, 250, 250); 2 QLCDNumber::Flat 0 - - + + sec - + background-color: rgb(60, 60, 60); color: rgb(250, 250, 250); 3 QLCDNumber::Flat 0 - - + + msec - + Qt::Horizontal 40 20 + + + + Sample + + + + + + + + 0 + 0 + + + + false + + + background-color: rgb(60,60,60) + + + 10 + + + QLCDNumber::Outline + + + + + + + + + + + false + + + Qt::Horizontal + + + Qt::LeftToRight Sequential Mode 1 0 :/IGTUI/firstframe.png:/IGTUI/firstframe.png 4 0 Play at normal speed :/IGTUI/play.png :/IGTUI/pause.png:/IGTUI/play.png 16 16 true false 1 0 :/IGTUI/stop.png:/IGTUI/stop.png Qt::Vertical 20 40