Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkNavigationDataReaderXML.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 
18 #ifndef MITKNavigationDataReaderXML_H_HEADER_INCLUDED_
19 #define MITKNavigationDataReaderXML_H_HEADER_INCLUDED_
20 
21 #include <mitkAbstractFileReader.h>
22 #include <mitkNavigationDataSet.h>
23 // includes for exceptions
24 #include <mitkIGTException.h>
25 #include <mitkIGTIOException.h>
26 
27 class TiXmlElement;
28 class TiXmlNode;
29 
30 namespace mitk {
31 
33  {
34  public:
36  virtual ~NavigationDataReaderXML();
37 
39  virtual std::vector<itk::SmartPointer<BaseData>> Read() override;
40 
41  protected:
42 
44  virtual mitk::NavigationDataReaderXML* Clone() const override;
45 
47 
55 
56  std::string m_FileName;
57 
58  TiXmlElement* m_parentElement;
59  TiXmlNode* m_currentNode;
60 
63 
64  // -- deprecated | begin
65  //std::istream* m_Stream; ///< stores a pointer to the input stream
66  bool m_StreamEnd;
68  std::string m_ErrorMessage;
69 
77  //void CreateStreamFromFilename();
78 
84  unsigned int GetFileVersion(std::istream* stream);
85 
91  unsigned int GetNumberOfNavigationDatas(std::istream* stream);
92 
99  void StreamInvalid(std::string message);
100  // -- deprecated | end
101  private:
102  NavigationDataSet::Pointer Read(std::istream* stream);
103  NavigationDataSet::Pointer Read(std::string fileName);
104  };
105 
106 } // namespace mitk
107 
108 #endif // MITKNavigationDataReaderXML_H_HEADER_INCLUDED_
virtual std::vector< itk::SmartPointer< BaseData > > Read() override
Reads a path or stream and creates a list of BaseData objects.
itk::SmartPointer< Self > Pointer
unsigned int GetNumberOfNavigationDatas(std::istream *stream)
Returns the number of tracked tools out of the XML document.
mitk::NavigationData::Pointer ReadVersion1()
This method reads one line of the XML document and returns the data as a NavigationData object If the...
DataCollection - Class to facilitate loading/accessing structured data.
int m_FileVersion
indicates which XML encoding is used
virtual std::vector< itk::SmartPointer< BaseData > > Read() override=0
Reads a path or stream and creates a list of BaseData objects.
void StreamInvalid(std::string message)
This is a helping method which gives an error message and throws an exception with the given message...
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
NavigationDataSet::Pointer ReadNavigationDataSet()
mitk::NavigationData::Pointer ReadNavigationData(TiXmlElement *elem)
virtual mitk::NavigationDataReaderXML * Clone() const override
Base class for creating mitk::BaseData objects from files or streams.
int m_NumberOfOutputs
stores the number of outputs known from the XML document
bool m_StreamEnd
stores if the input stream arrived at end
unsigned int GetFileVersion(std::istream *stream)
Creates a stream out of the filename given by the variable m_FileName. The stream is then set to m_St...