ITK  4.3.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 
21 #include "itkSize.h"
22 #include <vector>
23 #include <string>
24 #include "itkMetaDataDictionary.h"
25 #include "itkImageFileReader.h"
26 
27 namespace itk
28 {
43 template< class TOutputImage >
44 class ITK_EXPORT ImageSeriesReader:public ImageSource< TOutputImage >
45 {
46 public:
51 
53  itkNewMacro(Self);
54 
57 
59  typedef typename TOutputImage::SizeType SizeType;
60 
62  typedef typename TOutputImage::IndexType IndexType;
63 
65  typedef typename TOutputImage::RegionType ImageRegionType;
66 
68  typedef typename TOutputImage::PixelType OutputImagePixelType;
69 
73  typedef std::vector< DictionaryRawPointer > DictionaryArrayType;
75 
76  typedef std::vector< std::string > FileNamesContainer;
77 
80  void SetFileNames(const FileNamesContainer & name)
81  {
82  if ( m_FileNames != name )
83  {
84  m_FileNames = name;
85  this->Modified();
86  }
87  }
89 
90  const FileNamesContainer & GetFileNames() const
91  {
92  return m_FileNames;
93  }
94 
97  void SetFileName(std::string const & name)
98  {
99  m_FileNames.clear();
100  m_FileNames.push_back(name);
101  this->Modified();
102  }
104 
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  itkGetObjectMacro(ImageIO, ImageIOBase);
128 
138  itkSetMacro(MetaDataDictionaryArrayUpdate, bool);
139  itkGetConstMacro(MetaDataDictionaryArrayUpdate, bool);
140  itkBooleanMacro(MetaDataDictionaryArrayUpdate);
141 
144  virtual void GenerateOutputInformation(void);
145 
151  virtual void EnlargeOutputRequestedRegion(DataObject *output);
152 
155  DictionaryArrayRawPointer GetMetaDataDictionaryArray() const;
156 
158  itkSetMacro(UseStreaming, bool);
159  itkGetConstReferenceMacro(UseStreaming, bool);
160  itkBooleanMacro(UseStreaming);
162 
163 protected:
164  ImageSeriesReader():m_ImageIO(0), m_ReverseOrder(false),
165  m_UseStreaming(true), m_MetaDataDictionaryArrayUpdate(true) {}
167  void PrintSelf(std::ostream & os, Indent indent) const;
168 
170  virtual void GenerateData();
171 
174 
177 
180 
187 
191 
193 
194 private:
195  ImageSeriesReader(const Self &); //purposely not implemented
196  void operator=(const Self &); //purposely not implemented
197 
199 
200  int ComputeMovingDimensionIndex(ReaderType *reader);
201 
204 
207 };
208 } //namespace ITK
209 
210 #ifndef ITK_MANUAL_INSTANTIATION
211 #include "itkImageSeriesReader.hxx"
212 #endif
213 
214 #endif // __itkImageSeriesReader_h
215