ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkRegularExpressionSeriesFileNames.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkRegularExpressionSeriesFileNames_h
19 #define itkRegularExpressionSeriesFileNames_h
20 #include "ITKIOImageBaseExport.h"
21 
22 
23 #include "itkObject.h"
24 #include "itkObjectFactory.h"
25 #include "itkMacro.h"
26 #include <vector>
27 
28 namespace itk
29 {
71 class ITKIOImageBase_EXPORT RegularExpressionSeriesFileNames:public Object
72 {
73 public:
74  ITK_DISALLOW_COPY_AND_ASSIGN(RegularExpressionSeriesFileNames);
75 
78  using Superclass = Object;
80 
82  itkNewMacro(Self);
83 
86 
87  /* -------- Define the API for RegularExpressionSeriesFileNames ---------- */
89  itkSetStringMacro(Directory);
90  itkGetStringMacro(Directory);
92 
94  itkSetStringMacro(RegularExpression);
95  itkGetStringMacro(RegularExpression);
97 
100  itkSetMacro(SubMatch, unsigned int);
101  itkGetConstMacro(SubMatch, unsigned int);
103 
107  itkSetMacro(NumericSort, bool);
108  itkGetConstMacro(NumericSort, bool);
109  itkBooleanMacro(NumericSort);
111 
114  const std::vector< std::string > & GetFileNames();
115 
116 protected:
118  m_Directory("."),
119  m_RegularExpression(".*\\.([0-9]+)")
120  {}
121  ~RegularExpressionSeriesFileNames() override = default;
122  void PrintSelf(std::ostream & os, Indent indent) const override;
123 
124 private:
125  std::string m_Directory;
126  unsigned int m_SubMatch{1};
127  bool m_NumericSort{false};
128  std::string m_RegularExpression;
129 
130  std::vector< std::string > m_FileNames;
131 };
132 } //namespace ITK
133 
134 #endif // itkRegularExpressionSeriesFileNames_h
Light weight base class for most itk classes.
Portable directory/filename traversal.
Definition: itkDirectory.h:39
Generate an ordered sequence of filenames that match a regular expression.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:60