Medical Imaging Interaction Toolkit  2023.04.00
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkCollectionReader_h
14 #define mitkCollectionReader_h
15 
16 #include "mitkCommon.h"
17 #include "mitkDataCollection.h"
19 
20 // VTK
21 #include <vtkXMLParser.h>
22 
23 namespace mitk {
24  class MITKDATACOLLECTION_EXPORT CollectionReader : public vtkXMLParser
25  {
26  public:
27 
28  typedef std::vector<std::vector<std::string> > FileListType;
29 
34  DataCollection::Pointer LoadCollection(const std::string& xmlFileName);
35 
36  void AddDataElementIds(std::vector<std::string> dataElemetIds);
37  void AddSubColIds(std::vector<std::string> subColIds);
38 
39  void SetDataItemNames(std::vector<std::string> itemNames);
40 
41  void ClearDataElementIds();
42  void ClearSubColIds();
43 
44  void Clear();
45 
50  static DataCollection::Pointer FolderToCollection(std::string folder, std::vector<std::string> suffixes,std::vector<std::string> seriesNames, bool allowGaps);
51 
64  static FileListType GenerateFileLists(std::string folder, std::vector<std::string> suffixes, bool allowGaps = false);
65 
72  static FileListType SanitizeFileList(FileListType list);
73 
75  ~CollectionReader() override;
76  protected:
77 
81  void StartElement (const char* elementName, const char **atts) override;
85  void EndElement (const char* elementName) override;
86 
87  private:
91  std::string ReadXMLStringAttribut( std::string name, const char** atts);
95  bool ReadXMLBooleanAttribut( std::string name, const char** atts );
99  int ReadXMLIntegerAttribut( std::string name, const char** atts );
100 
105  DataCollection::Pointer m_Collection;
106  DataCollection::Pointer m_SubCollection;
107  DataCollection::Pointer m_DataItemCollection;
108 
115  std::vector<std::string> m_SelectedSubColIds;
116 
117  std::vector<std::string> m_SelectedDataItemIds;
118 
124  std::vector<std::string> m_SelectedDataItemNames;
125 
131  bool m_ColIgnore;
132  bool m_ItemIgnore;
133 
139  std::string m_BaseDir;
140  };
141 } // namespace mitk
142 
143 #endif
mitk::CollectionReader
Definition: mitkCollectionReader.h:24
itk::SmartPointer< Self >
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitkDataCollection.h
mitk::CollectionReader::FileListType
std::vector< std::vector< std::string > > FileListType
Definition: mitkCollectionReader.h:28
mitkCommon.h
MitkDataCollectionExports.h
MITKDATACOLLECTION_EXPORT
#define MITKDATACOLLECTION_EXPORT
Definition: MitkDataCollectionExports.h:15