Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkCollectionReader.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 #ifndef MITK_COLLECTION_READER_H
18 #define MITK_COLLECTION_READER_H
19 
20 #include "mitkCommon.h"
21 #include "mitkDataCollection.h"
22 #include <MitkDataCollectionExports.h>
23 
24 // VTK
25 #include <vtkXMLParser.h>
26 
27 namespace mitk {
28  class MITKDATACOLLECTION_EXPORT CollectionReader : public vtkXMLParser
29  {
30  public:
31 
32  typedef std::vector<std::vector<std::string> > FileListType;
33 
38  DataCollection::Pointer LoadCollection(const std::string& xmlFileName);
39 
40  void AddDataElementIds(std::vector<std::string> dataElemetIds);
41  void AddSubColIds(std::vector<std::string> subColIds);
42 
43  void SetDataItemNames(std::vector<std::string> itemNames);
44 
45  void ClearDataElementIds();
46  void ClearSubColIds();
47 
48  void Clear();
49 
54  static DataCollection::Pointer FolderToCollection(std::string folder, std::vector<std::string> suffixes,std::vector<std::string> seriesNames, bool allowGaps);
55 
68  static FileListType GenerateFileLists(std::string folder, std::vector<std::string> suffixes, bool allowGaps = false);
69 
76  static FileListType SanitizeFileList(FileListType list);
77 
80  protected:
81 
85  void StartElement (const char* elementName, const char **atts);
89  void EndElement (const char* elementName);
90 
91  private:
95  std::string ReadXMLStringAttribut( std::string name, const char** atts);
99  bool ReadXMLBooleanAttribut( std::string name, const char** atts );
103  int ReadXMLIntegerAttribut( std::string name, const char** atts );
104 
109  DataCollection::Pointer m_Collection;
110  DataCollection::Pointer m_SubCollection;
111  DataCollection::Pointer m_DataItemCollection;
112 
119  std::vector<std::string> m_SelectedSubColIds;
120 
121  std::vector<std::string> m_SelectedDataItemIds;
122 
128  std::vector<std::string> m_SelectedDataItemNames;
129 
135  bool m_ColIgnore;
136  bool m_ItemIgnore;
137 
143  std::string m_BaseDir;
144  };
145 } // namespace mitk
146 
147 #endif /* MITK_COLLECTION_READER_H */
DataCollection - Class to facilitate loading/accessing structured data.
std::vector< std::vector< std::string > > FileListType