ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkImageSeriesReader.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 itkImageSeriesReader_h
19 #define itkImageSeriesReader_h
20 #include "ITKIOImageBaseExport.h"
21 
22 #include "itkSize.h"
23 #include <vector>
24 #include <string>
25 #include "itkMetaDataDictionary.h"
26 #include "itkImageFileReader.h"
27 
28 namespace itk
29 {
44 template< typename TOutputImage >
45 class ITK_TEMPLATE_EXPORT ImageSeriesReader:public ImageSource< TOutputImage >
46 {
47 public:
48  ITK_DISALLOW_COPY_AND_ASSIGN(ImageSeriesReader);
49 
54 
56  itkNewMacro(Self);
57 
59  itkTypeMacro(ImageSeriesReader, ImageSource);
60 
62  using SizeType = typename TOutputImage::SizeType;
63 
66 
69 
71  using OutputImagePixelType = typename TOutputImage::PixelType;
72 
76  using DictionaryArrayType = std::vector< DictionaryRawPointer >;
78 
79  using FileNamesContainer = std::vector< std::string >;
80 
83  void SetFileNames(const FileNamesContainer & name)
84  {
85  if ( m_FileNames != name )
86  {
87  m_FileNames = name;
88  this->Modified();
89  }
90  }
92 
94  {
95  return m_FileNames;
96  }
97 
100  void SetFileName(std::string const & name)
101  {
102  m_FileNames.clear();
103  m_FileNames.push_back(name);
104  this->Modified();
105  }
107 
109  void AddFileName(std::string const & name)
110  {
111  m_FileNames.push_back(name);
112  this->Modified();
113  }
115 
118  itkSetMacro(ReverseOrder, bool);
119  itkGetConstMacro(ReverseOrder, bool);
120  itkBooleanMacro(ReverseOrder);
122 
125  itkSetMacro( ForceOrthogonalDirection, bool );
126  itkGetConstMacro( ForceOrthogonalDirection, bool );
127  itkBooleanMacro( ForceOrthogonalDirection );
129 
134  itkSetObjectMacro(ImageIO, ImageIOBase);
135  itkGetModifiableObjectMacro(ImageIO, ImageIOBase);
137 
147  itkSetMacro(MetaDataDictionaryArrayUpdate, bool);
148  itkGetConstMacro(MetaDataDictionaryArrayUpdate, bool);
149  itkBooleanMacro(MetaDataDictionaryArrayUpdate);
150 
153  void GenerateOutputInformation() override;
154 
160  void EnlargeOutputRequestedRegion(DataObject *output) override;
161 
164  DictionaryArrayRawPointer GetMetaDataDictionaryArray() const;
165 
167  itkSetMacro(UseStreaming, bool);
168  itkGetConstReferenceMacro(UseStreaming, bool);
169  itkBooleanMacro(UseStreaming);
171 
172 protected:
174  m_ImageIO(nullptr)
175 
176  {}
177  ~ImageSeriesReader() override;
178  void PrintSelf(std::ostream & os, Indent indent) const override;
179 
181  void GenerateData() override;
182 
185 
187  bool m_ReverseOrder{false};
188 
190  bool m_ForceOrthogonalDirection{true};
191 
194 
200  unsigned int m_NumberOfDimensionsInImage{0};
201 
205 
206  bool m_UseStreaming{true};
207 
208 private:
210 
211  int ComputeMovingDimensionIndex(ReaderType *reader);
212 
215 
217  bool m_MetaDataDictionaryArrayUpdate{true};
218 };
219 } //namespace ITK
220 
221 #ifndef ITK_MANUAL_INSTANTIATION
222 #include "itkImageSeriesReader.hxx"
223 #endif
224 
225 #endif // itkImageSeriesReader_h
FileNamesContainer m_FileNames
typename TOutputImage::RegionType ImageRegionType
DictionaryArrayType m_MetaDataDictionaryArray
Abstract superclass defines image IO interface.
typename TOutputImage::SizeType SizeType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
void AddFileName(std::string const &name)
void SetFileNames(const FileNamesContainer &name)
typename OutputImageType::PixelType OutputImagePixelType
Provides a mechanism for storing a collection of arbitrary data types.
typename TOutputImage::IndexType IndexType
std::vector< DictionaryRawPointer > DictionaryArrayType
Generate a unique, increasing time value.
Definition: itkTimeStamp.h:60
std::vector< std::string > FileNamesContainer
const DictionaryArrayType * DictionaryArrayRawPointer
ImageIOBase::Pointer m_ImageIO
Data source that reads image data from a single file.
const FileNamesContainer & GetFileNames() const
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Data source that reads image data from a series of disk files.
void SetFileName(std::string const &name)
Base class for all data objects in ITK.