diff --git a/Modules/IGTBase/autoload/IO/mitkNavigationDataReaderCSV.h b/Modules/IGTBase/autoload/IO/mitkNavigationDataReaderCSV.h index 06e02b54b1..bcd5873a15 100644 --- a/Modules/IGTBase/autoload/IO/mitkNavigationDataReaderCSV.h +++ b/Modules/IGTBase/autoload/IO/mitkNavigationDataReaderCSV.h @@ -1,82 +1,84 @@ /*=================================================================== 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 MITKNavigationDataReaderCSV_H_HEADER_INCLUDED_ #define MITKNavigationDataReaderCSV_H_HEADER_INCLUDED_ +#include + #include #include namespace mitk { /** This class reads csv logged navigation datas from the hard disc and returns * the navigation data set. * * Caution: at the moment only one navigation data is supported which means that only * the data of the first navigation tool in the file is read! */ - class NavigationDataReaderCSV : public AbstractFileReader + class MITKIGTIO_EXPORT NavigationDataReaderCSV : public AbstractFileReader { public: NavigationDataReaderCSV(); virtual ~NavigationDataReaderCSV(); /** @return Returns the NavigationDataSet of the first tool in the given file. * Returns an empty NavigationDataSet if the file could not be read. */ using AbstractFileReader::Read; virtual std::vector> Read() override; protected: /** * /brief Creates a NavigationData Pointer based on the given Input. */ mitk::NavigationData::Pointer CreateNd(std::string timestamp, std::string valid, std::string X, std::string Y, std::string Z, std::string QX, std::string QY, std::string QZ, std::string QR); /** * /brief Presents File Content line by line */ std::vector GetFileContentLineByLine(std::string filename); /** * /brief Calculates the Number of Tools based on the number of colums per line. */ int getNumberOfToolsInLine(std::string line); /** * /brief Converts string to double returns zero if failing */ std::vector parseLine(std::string line, int NumOfTools); /** * /brief Converts string to double returns zero if failing */ double StringToDouble( const std::string& s ); /** * /brief Split line in elemens based on a given delim */ std::vector splitLine(std::string line); NavigationDataReaderCSV(const NavigationDataReaderCSV& other); virtual mitk::NavigationDataReaderCSV* Clone() const override; }; } #endif // MITKNavigationDataReaderCSV_H_HEADER_INCLUDED_ diff --git a/Modules/IGTBase/autoload/IO/mitkNavigationDataReaderXML.h b/Modules/IGTBase/autoload/IO/mitkNavigationDataReaderXML.h index 3d34a5150b..c0ead88d04 100644 --- a/Modules/IGTBase/autoload/IO/mitkNavigationDataReaderXML.h +++ b/Modules/IGTBase/autoload/IO/mitkNavigationDataReaderXML.h @@ -1,108 +1,110 @@ /*=================================================================== 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 MITKNavigationDataReaderXML_H_HEADER_INCLUDED_ #define MITKNavigationDataReaderXML_H_HEADER_INCLUDED_ +#include + #include #include // includes for exceptions #include #include class TiXmlElement; class TiXmlNode; namespace mitk { - class NavigationDataReaderXML : public AbstractFileReader + class MITKIGTIO_EXPORT NavigationDataReaderXML : public AbstractFileReader { public: NavigationDataReaderXML(); virtual ~NavigationDataReaderXML(); using AbstractFileReader::Read; virtual std::vector> Read() override; protected: NavigationDataReaderXML(const NavigationDataReaderXML& other); virtual mitk::NavigationDataReaderXML* Clone() const override; NavigationDataSet::Pointer ReadNavigationDataSet(); /** * \brief This method reads one line of the XML document and returns the data as a NavigationData object * If there is a new file version another method must be added which reads this data. * @throw mitk::IGTException Throws an exceptions if file is damaged. */ mitk::NavigationData::Pointer ReadVersion1(); mitk::NavigationData::Pointer ReadNavigationData(TiXmlElement* elem); std::string m_FileName; TiXmlElement* m_parentElement; TiXmlNode* m_currentNode; int m_FileVersion; ///< indicates which XML encoding is used int m_NumberOfOutputs; ///< stores the number of outputs known from the XML document // -- deprecated | begin //std::istream* m_Stream; ///< stores a pointer to the input stream bool m_StreamEnd; ///< stores if the input stream arrived at end bool m_StreamValid; ///< stores if the input stream is valid or not std::string m_ErrorMessage; ///< stores the error message if the stream is invalid /** * \brief Creates a stream out of the filename given by the variable m_FileName. * The stream is then set to m_Stream. * * @throw mitk::IGTIOException Throws an exception if file does not exist * @throw mitk::IGTException Throws an exception if the stream is NULL */ //void CreateStreamFromFilename(); /** * \brief Returns the file version out of the XML document. * @throw mitk::IGTException Throws an mitk::IGTException an exception if stream is NULL or not good. * @throw mitk::IGTIOException Throws an mitk::IGTIOException if the stream has an incompatible XML format. */ unsigned int GetFileVersion(std::istream* stream); /** * \brief Returns the number of tracked tools out of the XML document. * @throw Throws an exception if stream is NULL. * @throw Throws an exception if the input stream has an XML incompatible format. */ unsigned int GetNumberOfNavigationDatas(std::istream* stream); /** * @brief This is a helping method which gives an error message and throws an exception with the given message. * It can be used if a stream is found to be invalid. * * @throw mitk::IGTIOException Always throws an exception. */ void StreamInvalid(std::string message); ///< help method which sets the stream invalid and displays an error // -- deprecated | end private: NavigationDataSet::Pointer Read(std::istream* stream); NavigationDataSet::Pointer Read(std::string fileName); }; } // namespace mitk #endif // MITKNavigationDataReaderXML_H_HEADER_INCLUDED_ diff --git a/Modules/IGTBase/autoload/IO/mitkNavigationDataSetWriterCSV.h b/Modules/IGTBase/autoload/IO/mitkNavigationDataSetWriterCSV.h index c3c4092c87..cf5b5392d3 100644 --- a/Modules/IGTBase/autoload/IO/mitkNavigationDataSetWriterCSV.h +++ b/Modules/IGTBase/autoload/IO/mitkNavigationDataSetWriterCSV.h @@ -1,41 +1,43 @@ /*=================================================================== 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 MITKNavigationDataSetWriterCSV_H_HEADER_INCLUDED_ #define MITKNavigationDataSetWriterCSV_H_HEADER_INCLUDED_ +#include + #include #include namespace mitk { - class NavigationDataSetWriterCSV : public AbstractFileWriter + class MITKIGTIO_EXPORT NavigationDataSetWriterCSV : public AbstractFileWriter { public: NavigationDataSetWriterCSV(); virtual~NavigationDataSetWriterCSV(); using AbstractFileWriter::Write; virtual void Write() override; protected: NavigationDataSetWriterCSV(const NavigationDataSetWriterCSV& other); virtual mitk::NavigationDataSetWriterCSV* Clone() const override; }; } #endif // MITKNavigationDataSetWriterCSV_H_HEADER_INCLUDED_ diff --git a/Modules/IGTBase/autoload/IO/mitkNavigationDataSetWriterXML.h b/Modules/IGTBase/autoload/IO/mitkNavigationDataSetWriterXML.h index a4360a2250..d903c994ad 100644 --- a/Modules/IGTBase/autoload/IO/mitkNavigationDataSetWriterXML.h +++ b/Modules/IGTBase/autoload/IO/mitkNavigationDataSetWriterXML.h @@ -1,47 +1,49 @@ /*=================================================================== 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 MITKNavigationDataSetWriterXML_H_HEADER_INCLUDED_ #define MITKNavigationDataSetWriterXML_H_HEADER_INCLUDED_ +#include + #include #include namespace mitk { - class NavigationDataSetWriterXML : public AbstractFileWriter + class MITKIGTIO_EXPORT NavigationDataSetWriterXML : public AbstractFileWriter { public: NavigationDataSetWriterXML(); virtual ~NavigationDataSetWriterXML(); using AbstractFileWriter::Write; virtual void Write() override; protected: NavigationDataSetWriterXML(const NavigationDataSetWriterXML& other); virtual mitk::NavigationDataSetWriterXML* Clone() const override; virtual void StreamHeader (std::ostream* stream, mitk::NavigationDataSet::ConstPointer data); virtual void StreamData (std::ostream* stream, mitk::NavigationDataSet::ConstPointer data); virtual void StreamFooter (std::ostream* stream); }; } #endif // MITKNavigationDataSetWriterXML_H_HEADER_INCLUDED_