itkImageSeriesReader.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkImageSeriesReader_h
00018 #define __itkImageSeriesReader_h
00019
00020 #include "itkImageSource.h"
00021 #include "itkImageIOBase.h"
00022 #include "itkExceptionObject.h"
00023 #include "itkSize.h"
00024 #include "itkImageRegion.h"
00025 #include <vector>
00026 #include <string>
00027 #include "itkMetaDataDictionary.h"
00028 #include "itkImageFileReader.h"
00029
00030 namespace itk
00031 {
00032
00047 template <class TOutputImage>
00048 class ITK_EXPORT ImageSeriesReader : public ImageSource<TOutputImage>
00049 {
00050 public:
00052 typedef ImageSeriesReader Self;
00053 typedef ImageSource<TOutputImage> Superclass;
00054 typedef SmartPointer<Self> Pointer;
00055
00057 itkNewMacro(Self);
00058
00060 itkTypeMacro(ImageSeriesReader, ImageSource);
00061
00063 typedef typename TOutputImage::SizeType SizeType;
00064
00066 typedef typename TOutputImage::IndexType IndexType;
00067
00069 typedef typename TOutputImage::RegionType ImageRegionType;
00070
00072 typedef typename TOutputImage::PixelType OutputImagePixelType;
00073
00075 typedef MetaDataDictionary DictionaryType;
00076 typedef MetaDataDictionary * DictionaryRawPointer;
00077 typedef std::vector< DictionaryRawPointer > DictionaryArrayType;
00078 typedef const DictionaryArrayType * DictionaryArrayRawPointer;
00079
00080 typedef std::vector<std::string> FileNamesContainer;
00081
00084 void SetFileNames (const FileNamesContainer &name)
00085 {
00086 if ( m_FileNames != name)
00087 {
00088 m_FileNames = name;
00089 this->Modified();
00090 }
00091 }
00092 const FileNamesContainer & GetFileNames() const
00093 {
00094 return m_FileNames;
00095 }
00097
00100 void SetFileName (std::string const &name)
00101 {
00102 m_FileNames.clear();
00103 m_FileNames.push_back(name);
00104 this->Modified();
00105 }
00107
00110 void AddFileName (std::string const &name)
00111 {
00112 m_FileNames.push_back(name);
00113 this->Modified();
00114 }
00116
00119 itkSetMacro(ReverseOrder,bool);
00120 itkGetConstMacro(ReverseOrder,bool);
00121 itkBooleanMacro(ReverseOrder);
00123
00128 itkSetObjectMacro(ImageIO,ImageIOBase);
00129 itkGetObjectMacro(ImageIO,ImageIOBase);
00131
00141 itkSetMacro(MetaDataDictionaryArrayUpdate,bool);
00142 itkGetConstMacro(MetaDataDictionaryArrayUpdate,bool);
00143 itkBooleanMacro(MetaDataDictionaryArrayUpdate);
00144
00147 virtual void GenerateOutputInformation(void);
00148
00154 virtual void EnlargeOutputRequestedRegion(DataObject *output);
00155
00158 DictionaryArrayRawPointer GetMetaDataDictionaryArray() const;
00159
00161 itkSetMacro(UseStreaming,bool);
00162 itkGetConstReferenceMacro(UseStreaming,bool);
00163 itkBooleanMacro(UseStreaming);
00165
00166 protected:
00167 ImageSeriesReader() : m_ImageIO(0), m_ReverseOrder(false),
00168 m_UseStreaming(true), m_MetaDataDictionaryArrayUpdate(true) {};
00169 ~ImageSeriesReader();
00170 void PrintSelf(std::ostream& os, Indent indent) const;
00171
00173 virtual void GenerateData();
00174
00176 ImageIOBase::Pointer m_ImageIO;
00177
00179 bool m_ReverseOrder;
00180
00182 FileNamesContainer m_FileNames;
00183
00189 int m_NumberOfDimensionsInImage;
00190
00193 DictionaryArrayType m_MetaDataDictionaryArray;
00194
00195 bool m_UseStreaming;
00196
00197 private:
00198 ImageSeriesReader(const Self&);
00199 void operator=(const Self&);
00200
00201 typedef ImageFileReader<TOutputImage> ReaderType;
00202
00203 int ComputeMovingDimensionIndex( ReaderType * reader );
00204
00205
00206
00208 TimeStamp m_MetaDataDictionaryArrayMTime;
00209
00211 bool m_MetaDataDictionaryArrayUpdate;
00212 };
00213
00214 }
00215
00216 #ifndef ITK_MANUAL_INSTANTIATION
00217 #include "itkImageSeriesReader.txx"
00218 #endif
00219
00220 #endif // __itkImageSeriesReader_h
00221