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
00134 virtual void GenerateOutputInformation(void);
00135
00141 virtual void EnlargeOutputRequestedRegion(DataObject *output);
00142
00144 DictionaryArrayRawPointer GetMetaDataDictionaryArray() const;
00145
00147 itkSetMacro(UseStreaming,bool);
00148 itkGetConstReferenceMacro(UseStreaming,bool);
00149 itkBooleanMacro(UseStreaming);
00151
00152 protected:
00153 ImageSeriesReader() : m_ImageIO(0), m_ReverseOrder(false), m_UseStreaming(true) {};
00154 ~ImageSeriesReader();
00155 void PrintSelf(std::ostream& os, Indent indent) const;
00156
00158 virtual void GenerateData();
00159
00161 ImageIOBase::Pointer m_ImageIO;
00162
00164 bool m_ReverseOrder;
00165
00167 FileNamesContainer m_FileNames;
00168
00174 int m_NumberOfDimensionsInImage;
00175
00178 DictionaryArrayType m_MetaDataDictionaryArray;
00179
00180 bool m_UseStreaming;
00181
00182 private:
00183 ImageSeriesReader(const Self&);
00184 void operator=(const Self&);
00185
00186 typedef ImageFileReader<TOutputImage> ReaderType;
00187
00188 int ComputeMovingDimensionIndex( ReaderType * reader );
00189 };
00190
00191 }
00192
00193 #ifndef ITK_MANUAL_INSTANTIATION
00194 #include "itkImageSeriesReader.txx"
00195 #endif
00196
00197 #endif // __itkImageSeriesReader_h
00198