ITK  5.2.0
Insight Toolkit
itkRegularExpressionSeriesFileNames.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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_MOVE(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> &
115  GetFileNames();
116 
117 protected:
119  : m_Directory(".")
120  , m_RegularExpression(".*\\.([0-9]+)")
121  {}
122  ~RegularExpressionSeriesFileNames() override = default;
123  void
124  PrintSelf(std::ostream & os, Indent indent) const override;
125 
126 private:
127  std::string m_Directory;
128  unsigned int m_SubMatch{ 1 };
129  bool m_NumericSort{ false };
130  std::string m_RegularExpression;
131 
132  std::vector<std::string> m_FileNames;
133 };
134 } // namespace itk
135 
136 #endif // itkRegularExpressionSeriesFileNames_h
itkObjectFactory.h
itk::RegularExpressionSeriesFileNames
Generate an ordered sequence of filenames that match a regular expression.
Definition: itkRegularExpressionSeriesFileNames.h:71
itk::RegularExpressionSeriesFileNames::m_RegularExpression
std::string m_RegularExpression
Definition: itkRegularExpressionSeriesFileNames.h:130
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itkMacro.h
itk::RegularExpressionSeriesFileNames::m_Directory
std::string m_Directory
Definition: itkRegularExpressionSeriesFileNames.h:127
itk::Directory
Portable directory/filename traversal.
Definition: itkDirectory.h:39
itkObject.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::RegularExpressionSeriesFileNames::m_FileNames
std::vector< std::string > m_FileNames
Definition: itkRegularExpressionSeriesFileNames.h:132
itk::RegularExpressionSeriesFileNames::RegularExpressionSeriesFileNames
RegularExpressionSeriesFileNames()
Definition: itkRegularExpressionSeriesFileNames.h:118