diff --git a/Modules/IGT/IGTFilters/mitkNavigationDataToPointSetPlayer.cpp b/Modules/IGT/IGTFilters/mitkNavigationDataToPointSetPlayer.cpp deleted file mode 100644 index 8e484d5a79..0000000000 --- a/Modules/IGT/IGTFilters/mitkNavigationDataToPointSetPlayer.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ - -#include "mitkNavigationDataToPointSetPlayer.h" - -//for the pause -#include -#include -#include - -#include - -mitk::NavigationDataToPointSetPlayer::NavigationDataToPointSetPlayer() - : m_Doc(new TiXmlDocument) - , m_DataElem(0) - , m_CurrentElem(0) - , m_Repeat(false) - , m_NumberOfSnapshots(0) - , m_LastGoTo(0) -{ -} - - -mitk::NavigationDataToPointSetPlayer::~NavigationDataToPointSetPlayer() -{ - delete m_Doc; -} - -void mitk::NavigationDataToPointSetPlayer::ReinitXML() -{ - m_NDPointSet.clear(); - m_PointSetFilter = mitk::NavigationDataToPointSetFilter::New(); - - m_DataElem = m_Doc->FirstChildElement("Data"); - int toolcount; - if(!m_DataElem) - MITK_WARN << "Data element not found"; - else - { - m_DataElem->QueryIntAttribute("ToolCount", &toolcount); - this->SetNumberOfOutputs(toolcount); - - mitk::NavigationData::Pointer emptyNd = mitk::NavigationData::New(); - mitk::NavigationData::PositionType position; - mitk::NavigationData::OrientationType orientation(0.0,0.0,0.0,0.0); - position.Fill(0.0); - - emptyNd->SetPosition(position); - emptyNd->SetOrientation(orientation); - emptyNd->SetDataValid(false); - - mitk::NavigationData::Pointer tmp; - for (unsigned int index = 0; index < this->GetNumberOfOutputs(); index++) - { - tmp = mitk::NavigationData::New(); - tmp->Graft(emptyNd); - this->SetNthOutput(index, tmp); - } - - // find out _NumberOfSnapshots - - NavigationData::Pointer nd; - - m_NumberOfSnapshots = 0; - TiXmlElement* nextND = m_DataElem->FirstChildElement("NavigationData"); - - while(nextND) - { - ++m_NumberOfSnapshots; - nextND = nextND->NextSiblingElement("NavigationData"); - } - - // e.g. 12 nd found and 2 tools used => number of snapshots is 12:2=6 - m_NumberOfSnapshots = m_NumberOfSnapshots/toolcount; - - /*NavigationData::TimeStampType recordedTime = (lastTimestamp-firstTimestamp) / 1000; - int frameRate = static_cast(floor(1000 / (float) (m_NumberOfSnapshots/recordedTime) + 0.5));*/ - - } -} - - - -void mitk::NavigationDataToPointSetPlayer:: - SetFileName(const std::string& _FileName) -{ - m_FileName = _FileName; - - if(!m_Doc->LoadFile(m_FileName)) - { - this->SetNumberOfOutputs(0); - std::ostringstream s; - s << "File " << _FileName << " could not be loaded"; - throw std::invalid_argument(s.str()); - } - else - { - this->ReinitXML(); - } - - this->Modified(); -} - - -void mitk::NavigationDataToPointSetPlayer::GenerateData() -{ - assert(m_DataElem); - - // very important: go through the tools (there could be more then one) - mitk::NavigationData::Pointer tmp; - for (unsigned int index = 0; index < this->GetNumberOfOutputs(); index++) - { - // go to the first element - if(!m_CurrentElem) - m_CurrentElem = m_DataElem->FirstChildElement("NavigationData"); - // go to the next element - else - m_CurrentElem = m_CurrentElem->NextSiblingElement(); - - // if repeat is on: go back to the first element (prior calls delivered NULL - // elem) - if(!m_CurrentElem && m_Repeat) - m_CurrentElem = m_DataElem->FirstChildElement("NavigationData"); - - mitk::NavigationData* output = this->GetOutput(index); - tmp = this->ReadVersion1(); - if(tmp.IsNotNull()) - output->Graft(tmp); - else // no valid output - output->SetDataValid(false); - } -} - - -void mitk::NavigationDataToPointSetPlayer::StartPlaying() -{ - //TODO -} - -void mitk::NavigationDataToPointSetPlayer::StopPlaying() -{ - //TODO -} - -void mitk::NavigationDataToPointSetPlayer::Pause() -{ - //TODO -} - -void mitk::NavigationDataToPointSetPlayer::Resume() -{ - //TODO -} - - -//TODO -const bool mitk::NavigationDataToPointSetPlayer::IsAtEnd() -{ - bool result = false; - return result; -} - -mitk::NavigationData::Pointer mitk::NavigationDataToPointSetPlayer::ReadVersion1() -{ - TiXmlElement* elem = m_CurrentElem; - - if(!elem) - return NULL; - - return this->ReadNavigationData(elem); -} - -void mitk::NavigationDataToPointSetPlayer::UpdateOutputInformation() -{ - this->Modified(); // make sure that we need to be updated - Superclass::UpdateOutputInformation(); -} diff --git a/Modules/IGT/IGTFilters/mitkNavigationDataToPointSetPlayer.h b/Modules/IGT/IGTFilters/mitkNavigationDataToPointSetPlayer.h deleted file mode 100644 index 2cead7b1de..0000000000 --- a/Modules/IGT/IGTFilters/mitkNavigationDataToPointSetPlayer.h +++ /dev/null @@ -1,158 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ - - -#ifndef MITKNavigationDataToPointSetPlayer_H_HEADER_INCLUDED_ -#define MITKNavigationDataToPointSetPlayer_H_HEADER_INCLUDED_ - -#include -#include -#include -#include "tinyxml.h" - - -namespace mitk -{ - - /**Documentation - * \brief This class is a slightly changed reimplementation of the - * NavigationDataPlayer which does not care about timestamps and just - * outputs the navigationdatas in their sequential order - * - * \ingroup IGT - */ - class MitkIGT_EXPORT NavigationDataToPointSetPlayer - : public NavigationDataPlayerBase - { - public: - mitkClassMacro(NavigationDataToPointSetPlayer, NavigationDataPlayerBase); - itkNewMacro(Self); - - /** - * \brief sets the file name and path (if XMLString is set, this is neglected) - */ - void SetFileName(const std::string& _FileName); - - /** - * \brief returns the file name and path - */ - itkGetStringMacro(FileName); - - /** - * \brief sets a xml string (by this, the xml string is not read from file) - */ - void SetXMLString(const std::string& _XMLString); - - /** - * \brief returns the current xml string - */ - itkGetStringMacro(XMLString); - - /// - /// set to true if the data player should repeat the outputs - /// - itkSetMacro(Repeat, bool); - /// - /// set if the data player should repeat the outputs - /// - itkGetMacro(Repeat, bool); - /// - /// \return the number of navigation data snapshots available in the file - /// - itkGetMacro(NumberOfSnapshots, unsigned int); - - /// - /// advance the output to the i-th snapshot - /// e.g. if you want to have the NavData of snapshot - /// 17 then you can call GoToSnapshot(17). index begins at 1! - /// you can then also go back to snapshot 1 with GoToSnapshot(1) - /// - void GoToSnapshot(int i); - - /** - * \brief Used for pipeline update just to tell the pipeline - * that we always have to update - */ - virtual void UpdateOutputInformation(); - - - - /** - * \brief This method starts the player. - * - * Before the stream has to be set. Either with a PlayingMode (SetStream(PlayerMode)) and FileName. Or - * with an own inputstream (SetStream(istream*)). - */ - void StartPlaying(); - - /** - * \brief Stops the player and closes the stream. After a call of StopPlaying() - * StartPlaying() must be called to get new output data - * - * \warning the output is generated in this method because we know first about the number of output after - * reading the first lines of the XML file. Therefore you should assign your output after the call of this method - */ - void StopPlaying(); - - /** - * \brief This method pauses the player. If you want to play again call Resume() - * - *\warning This method is not tested yet. It is not save to use! - */ - void Pause(); - - /** - * \brief This method resumes the player when it was paused. - * - *\warning This method is not tested yet. It is not save to use! - */ - void Resume(); - - - - - - - - const bool IsAtEnd(); - - protected: - NavigationDataToPointSetPlayer(); - virtual ~NavigationDataToPointSetPlayer(); - void ReinitXML(); - mitk::NavigationData::Pointer ReadVersion1(); - /// - /// do the work here - /// - virtual void GenerateData(); - - - NavigationDataToPointSetFilter::Pointer m_PointSetFilter; - - std::string m_FileName; - std::string m_XMLString; - TiXmlDocument* m_Doc; - TiXmlElement* m_DataElem; - TiXmlElement* m_CurrentElem; - bool m_Repeat; - unsigned int m_NumberOfSnapshots; - int m_LastGoTo; - - std::vector m_NDPointSet; - }; -} // namespace mitk - -#endif /* MITKNavigationDataToPointSetPlayer_H_HEADER_INCLUDED_ */