ITK  4.9.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 
63  typedef typename TOutputImage::IndexType IndexType;
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  {}
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  ImageSeriesReader(const Self &) ITK_DELETE_FUNCTION;
201  void operator=(const Self &) ITK_DELETE_FUNCTION;
202 
203  typedef ImageFileReader< TOutputImage > ReaderType;
204 
205  int ComputeMovingDimensionIndex(ReaderType *reader);
206 
208  TimeStamp m_MetaDataDictionaryArrayMTime;
209 
211  bool m_MetaDataDictionaryArrayUpdate;
212 };
213 } //namespace ITK
214 
215 #ifndef ITK_MANUAL_INSTANTIATION
216 #include "itkImageSeriesReader.hxx"
217 #endif
218 
219 #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:58
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.