ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkImageSeriesReader_h 00019 #define __itkImageSeriesReader_h 00020 00021 #include "itkSize.h" 00022 #include <vector> 00023 #include <string> 00024 #include "itkMetaDataDictionary.h" 00025 #include "itkImageFileReader.h" 00026 00027 namespace itk 00028 { 00043 template< class TOutputImage > 00044 class ITK_EXPORT ImageSeriesReader:public ImageSource< TOutputImage > 00045 { 00046 public: 00048 typedef ImageSeriesReader Self; 00049 typedef ImageSource< TOutputImage > Superclass; 00050 typedef SmartPointer< Self > Pointer; 00051 00053 itkNewMacro(Self); 00054 00056 itkTypeMacro(ImageSeriesReader, ImageSource); 00057 00059 typedef typename TOutputImage::SizeType SizeType; 00060 00062 typedef typename TOutputImage::IndexType IndexType; 00063 00065 typedef typename TOutputImage::RegionType ImageRegionType; 00066 00068 typedef typename TOutputImage::PixelType OutputImagePixelType; 00069 00071 typedef MetaDataDictionary DictionaryType; 00072 typedef MetaDataDictionary * DictionaryRawPointer; 00073 typedef std::vector< DictionaryRawPointer > DictionaryArrayType; 00074 typedef const DictionaryArrayType * DictionaryArrayRawPointer; 00075 00076 typedef std::vector< std::string > FileNamesContainer; 00077 00080 void SetFileNames(const FileNamesContainer & name) 00081 { 00082 if ( m_FileNames != name ) 00083 { 00084 m_FileNames = name; 00085 this->Modified(); 00086 } 00087 } 00089 00090 const FileNamesContainer & GetFileNames() const 00091 { 00092 return m_FileNames; 00093 } 00094 00097 void SetFileName(std::string const & name) 00098 { 00099 m_FileNames.clear(); 00100 m_FileNames.push_back(name); 00101 this->Modified(); 00102 } 00104 00107 void AddFileName(std::string const & name) 00108 { 00109 m_FileNames.push_back(name); 00110 this->Modified(); 00111 } 00113 00116 itkSetMacro(ReverseOrder, bool); 00117 itkGetConstMacro(ReverseOrder, bool); 00118 itkBooleanMacro(ReverseOrder); 00120 00125 itkSetObjectMacro(ImageIO, ImageIOBase); 00126 itkGetObjectMacro(ImageIO, ImageIOBase); 00128 00138 itkSetMacro(MetaDataDictionaryArrayUpdate, bool); 00139 itkGetConstMacro(MetaDataDictionaryArrayUpdate, bool); 00140 itkBooleanMacro(MetaDataDictionaryArrayUpdate); 00141 00144 virtual void GenerateOutputInformation(void); 00145 00151 virtual void EnlargeOutputRequestedRegion(DataObject *output); 00152 00155 DictionaryArrayRawPointer GetMetaDataDictionaryArray() const; 00156 00158 itkSetMacro(UseStreaming, bool); 00159 itkGetConstReferenceMacro(UseStreaming, bool); 00160 itkBooleanMacro(UseStreaming); 00161 protected: 00162 ImageSeriesReader():m_ImageIO(0), m_ReverseOrder(false), 00163 m_UseStreaming(true), m_MetaDataDictionaryArrayUpdate(true) {} 00164 ~ImageSeriesReader(); 00165 void PrintSelf(std::ostream & os, Indent indent) const; 00167 00169 virtual void GenerateData(); 00170 00172 ImageIOBase::Pointer m_ImageIO; 00173 00175 bool m_ReverseOrder; 00176 00178 FileNamesContainer m_FileNames; 00179 00185 unsigned int m_NumberOfDimensionsInImage; 00186 00189 DictionaryArrayType m_MetaDataDictionaryArray; 00190 00191 bool m_UseStreaming; 00192 private: 00193 ImageSeriesReader(const Self &); //purposely not implemented 00194 void operator=(const Self &); //purposely not implemented 00195 00196 typedef ImageFileReader< TOutputImage > ReaderType; 00197 00198 int ComputeMovingDimensionIndex(ReaderType *reader); 00199 00201 TimeStamp m_MetaDataDictionaryArrayMTime; 00202 00204 bool m_MetaDataDictionaryArrayUpdate; 00205 }; 00206 } //namespace ITK 00207 00208 #ifndef ITK_MANUAL_INSTANTIATION 00209 #include "itkImageSeriesReader.hxx" 00210 #endif 00211 00212 #endif // __itkImageSeriesReader_h 00213