ITK  4.13.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 ITKIOImageBase_HIDDEN ImageSeriesReader:public ImageSource< TOutputImage >
46 {
47 public:
52 
54  itkNewMacro(Self);
55 
58 
60  typedef typename TOutputImage::SizeType SizeType;
61 
64 
66  typedef typename TOutputImage::RegionType ImageRegionType;
67 
69  typedef typename TOutputImage::PixelType OutputImagePixelType;
70 
74  typedef std::vector< DictionaryRawPointer > DictionaryArrayType;
76 
77  typedef std::vector< std::string > FileNamesContainer;
78 
81  void SetFileNames(const FileNamesContainer & name)
82  {
83  if ( m_FileNames != name )
84  {
85  m_FileNames = name;
86  this->Modified();
87  }
88  }
90 
92  {
93  return m_FileNames;
94  }
95 
98  void SetFileName(std::string const & name)
99  {
100  m_FileNames.clear();
101  m_FileNames.push_back(name);
102  this->Modified();
103  }
105 
107  void AddFileName(std::string const & name)
108  {
109  m_FileNames.push_back(name);
110  this->Modified();
111  }
113 
116  itkSetMacro(ReverseOrder, bool);
117  itkGetConstMacro(ReverseOrder, bool);
118  itkBooleanMacro(ReverseOrder);
120 
125  itkSetObjectMacro(ImageIO, ImageIOBase);
126  itkGetModifiableObjectMacro(ImageIO, ImageIOBase);
128 
138  itkSetMacro(MetaDataDictionaryArrayUpdate, bool);
139  itkGetConstMacro(MetaDataDictionaryArrayUpdate, bool);
140  itkBooleanMacro(MetaDataDictionaryArrayUpdate);
141 
144  virtual void GenerateOutputInformation(void) ITK_OVERRIDE;
145 
151  virtual void EnlargeOutputRequestedRegion(DataObject *output) ITK_OVERRIDE;
152 
155  DictionaryArrayRawPointer GetMetaDataDictionaryArray() const;
156 
158  itkSetMacro(UseStreaming, bool);
159  itkGetConstReferenceMacro(UseStreaming, bool);
160  itkBooleanMacro(UseStreaming);
162 
163 protected:
165  m_ImageIO(ITK_NULLPTR),
166  m_ReverseOrder(false),
167  m_NumberOfDimensionsInImage(0),
168  m_UseStreaming(true),
169  m_MetaDataDictionaryArrayUpdate(true)
170  {}
171  ~ImageSeriesReader() ITK_OVERRIDE;
172  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
173 
175  virtual void GenerateData() ITK_OVERRIDE;
176 
178  ImageIOBase::Pointer m_ImageIO;
179 
181  bool m_ReverseOrder;
182 
184  FileNamesContainer m_FileNames;
185 
191  unsigned int m_NumberOfDimensionsInImage;
192 
195  DictionaryArrayType m_MetaDataDictionaryArray;
196 
197  bool m_UseStreaming;
198 
199 private:
200  ITK_DISALLOW_COPY_AND_ASSIGN(ImageSeriesReader);
201 
202  typedef ImageFileReader< TOutputImage > ReaderType;
203 
204  int ComputeMovingDimensionIndex(ReaderType *reader);
205 
207  TimeStamp m_MetaDataDictionaryArrayMTime;
208 
210  bool m_MetaDataDictionaryArrayUpdate;
211 };
212 } //namespace ITK
213 
214 #ifndef ITK_MANUAL_INSTANTIATION
215 #include "itkImageSeriesReader.hxx"
216 #endif
217 
218 #endif // itkImageSeriesReader_h
SmartPointer< Self > Pointer
Abstract superclass defines image IO interface.
ImageSource< TOutputImage > Superclass
const DictionaryArrayType * DictionaryArrayRawPointer
TOutputImage::PixelType OutputImagePixelType
MetaDataDictionary * DictionaryRawPointer
Base class for all process objects that output image data.
void AddFileName(std::string const &name)
void SetFileNames(const FileNamesContainer &name)
std::vector< std::string > FileNamesContainer
Provides a mechanism for storing a collection of arbitrary data types.
Generate a unique, increasing time value.
Definition: itkTimeStamp.h:59
MetaDataDictionary DictionaryType
TOutputImage::RegionType ImageRegionType
TOutputImage::SizeType SizeType
std::vector< DictionaryRawPointer > DictionaryArrayType
Data source that reads image data from a single file.
const FileNamesContainer & GetFileNames() const
TOutputImage::IndexType IndexType
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.