1.1 --- a/Code/IO/otbImageSeriesFileReaderBase.h Thu Jul 02 14:31:03 2009 +0200
1.2 +++ b/Code/IO/otbImageSeriesFileReaderBase.h Thu Jul 02 15:06:19 2009 +0200
1.3 @@ -60,126 +60,138 @@
1.4 */
1.5
1.6 template < class TImage, class TInternalImage = TImage >
1.7 -class ITK_EXPORT ImageSeriesFileReaderBase : public ImageListSource< TImage >
1.8 +class ITK_EXPORT ImageSeriesFileReaderBase
1.9 + : public ImageListSource< TImage >
1.10 {
1.11 - public:
1.12 - /** Standart typedefs */
1.13 - typedef ImageSeriesFileReaderBase Self;
1.14 - typedef ImageListSource< TImage > Superclass;
1.15 - typedef itk::SmartPointer<Self> Pointer;
1.16 - typedef itk::SmartPointer<const Self> ConstPointer;
1.17 +public:
1.18 + /** Standart typedefs */
1.19 + typedef ImageSeriesFileReaderBase Self;
1.20 + typedef ImageListSource< TImage > Superclass;
1.21 + typedef itk::SmartPointer<Self> Pointer;
1.22 + typedef itk::SmartPointer<const Self> ConstPointer;
1.23
1.24 - /** Creation through object factory macro */
1.25 - itkNewMacro(Self);
1.26 - /** Runtime informations macro */
1.27 - itkTypeMacro(ImageSeriesFileReaderBase,ImageListSource);
1.28 + /** Creation through object factory macro */
1.29 + itkNewMacro(Self);
1.30 + /** Runtime informations macro */
1.31 + itkTypeMacro(ImageSeriesFileReaderBase,ImageListSource);
1.32
1.33 - typedef TImage OutputImageType;
1.34 - typedef typename OutputImageType::Pointer OutputImagePointerType;
1.35 - typedef typename OutputImageType::InternalPixelType PixelType;
1.36 - typedef typename OutputImageType::ValueType ValueType;
1.37 - typedef typename OutputImageType::IndexType IndexType;
1.38 - typedef typename OutputImageType::SizeType SizeType;
1.39 - typedef typename OutputImageType::RegionType RegionType;
1.40 + typedef TImage OutputImageType;
1.41 + typedef typename OutputImageType::Pointer OutputImagePointerType;
1.42 + typedef typename OutputImageType::InternalPixelType PixelType;
1.43 + typedef typename OutputImageType::ValueType ValueType;
1.44 + typedef typename OutputImageType::IndexType IndexType;
1.45 + typedef typename OutputImageType::SizeType SizeType;
1.46 + typedef typename OutputImageType::RegionType RegionType;
1.47
1.48 - typedef ImageList<OutputImageType> OutputImageListType;
1.49 - typedef typename OutputImageListType::Pointer OutputImageListPointerType;
1.50 - typedef typename OutputImageListType::ConstPointer OutputImageListConstPointerType;
1.51 + typedef ImageList<OutputImageType> OutputImageListType;
1.52 + typedef typename OutputImageListType::Pointer OutputImageListPointerType;
1.53 + typedef typename OutputImageListType::ConstPointer OutputImageListConstPointerType;
1.54
1.55 - typedef TInternalImage InternalImageType;
1.56 - typedef typename InternalImageType::Pointer InternalImagePointerType;
1.57 - typedef typename InternalImageType::InternalPixelType InternalPixelType;
1.58 - typedef typename InternalImageType::ValueType InternalValueType;
1.59 - typedef typename InternalImageType::IndexType InternalIndexType;
1.60 - typedef typename InternalImageType::SizeType InternalSizeType;
1.61 - typedef typename InternalImageType::RegionType InternalRegionType;
1.62 + typedef TInternalImage InternalImageType;
1.63 + typedef typename InternalImageType::Pointer InternalImagePointerType;
1.64 + typedef typename InternalImageType::InternalPixelType InternalPixelType;
1.65 + typedef typename InternalImageType::ValueType InternalValueType;
1.66 + typedef typename InternalImageType::IndexType InternalIndexType;
1.67 + typedef typename InternalImageType::SizeType InternalSizeType;
1.68 + typedef typename InternalImageType::RegionType InternalRegionType;
1.69
1.70 - typedef ImageFileReader< InternalImageType > ReaderType;
1.71 - typedef typename ReaderType::Pointer ReaderPointerType;
1.72 + typedef ImageFileReader< InternalImageType > ReaderType;
1.73 + typedef typename ReaderType::Pointer ReaderPointerType;
1.74
1.75 - typedef ObjectList< ReaderType > ReaderListType;
1.76 - typedef typename ReaderListType::Pointer ReaderListPointerType;
1.77 + typedef ObjectList< ReaderType > ReaderListType;
1.78 + typedef typename ReaderListType::Pointer ReaderListPointerType;
1.79
1.80 - /** Get the file to be read */
1.81 - itkGetStringMacro(FileName);
1.82 - /**
1.83 - * Set the file to be read. Once the Filename is set, ReadMeatFile is called in order to get
1.84 - * the number of image files to be read, the images file names, the band and region
1.85 - * selection
1.86 - */
1.87 - virtual void SetFileName ( const std::string & file );
1.88 - virtual void SetFileName ( const char * file );
1.89 + /** Get the file to be read */
1.90 + itkGetStringMacro(FileName);
1.91
1.92 - /** Get the readers */
1.93 - itkGetObjectMacro(ImageFileReaderList,ReaderListType);
1.94 + /**
1.95 + * Set the file to be read. Once the Filename is set, ReadMeatFile is called in order to get
1.96 + * the number of image files to be read, the images file names, the band and region
1.97 + * selection
1.98 + */
1.99 + virtual void SetFileName ( const std::string & file );
1.100 + virtual void SetFileName ( const char * file );
1.101
1.102 - /** Get the output list */
1.103 - virtual unsigned int GetNumberOfOutputs () const
1.104 - {
1.105 - return m_ListOfFileNames.size();
1.106 - }
1.107 - virtual OutputImageListType * GetOutput(void);
1.108 - virtual OutputImageType * GetOutput( unsigned int idx );
1.109 + /** get the Filenames */
1.110 + std::string GetFileName ( unsigned int i ) const
1.111 + {
1.112 + return this->m_ListOfFileNames.at(i);
1.113 + }
1.114
1.115 - /** Performs selective file extraction */
1.116 - virtual OutputImageListType * GenerateOutput (void);
1.117 - virtual OutputImageType * GenerateOutput ( unsigned int idx );
1.118 + /** Get the readers */
1.119 + itkGetObjectMacro(ImageFileReaderList,ReaderListType);
1.120 + ReaderType * GetImageFileReader ( unsigned int i ) const
1.121 + {
1.122 + return this->m_ImageFileReaderList->GetNthElement(i);
1.123 + }
1.124
1.125 - /** Synchronization */
1.126 - void Update ()
1.127 - {
1.128 - this->GenerateData();
1.129 - }
1.130 + /** Get the output list */
1.131 + virtual unsigned int GetNumberOfOutputs () const
1.132 + {
1.133 + return m_ListOfFileNames.size();
1.134 + }
1.135 + virtual OutputImageListType * GetOutput(void);
1.136 + virtual OutputImageType * GetOutput( unsigned int idx );
1.137
1.138 - protected:
1.139 - ImageSeriesFileReaderBase();
1.140 - virtual ~ImageSeriesFileReaderBase () { }
1.141 + /** Performs selective file extraction */
1.142 + virtual OutputImageListType * GenerateOutput (void);
1.143 + virtual OutputImageType * GenerateOutput ( unsigned int idx );
1.144
1.145 - enum FileType { kFileName = 0, kImageFileName, kAnyFileName };
1.146 - /**
1.147 - * Test files.
1.148 - * If the filename to test is an imageFileName, the file name may be modified in
1.149 - * order to add the appropriated path
1.150 - */
1.151 - virtual void TestFileExistanceAndReadability( std::string & file, FileType fileType );
1.152 - virtual void TestBandSelection( std::vector<unsigned int> & bands ) { }
1.153 + /** Synchronization */
1.154 + void Update ()
1.155 + {
1.156 + this->GenerateData();
1.157 + }
1.158
1.159 - virtual void GenerateData ( void );
1.160 +protected:
1.161 + ImageSeriesFileReaderBase();
1.162 + virtual ~ImageSeriesFileReaderBase () { }
1.163
1.164 - /** GenerateData
1.165 - * This method will be specialised if template definitions follow:
1.166 - * - TImage is a VectorImage
1.167 - * - TImage is an Image and TInteranalImage is a VectorImage
1.168 - * - TImage and TInternalImage are of Image type.
1.169 - */
1.170 - virtual void GenerateData ( unsigned int idx );
1.171 + enum FileType { kFileName = 0, kImageFileName, kAnyFileName };
1.172 + /**
1.173 + * Test files.
1.174 + * If the filename to test is an imageFileName, the file name may be modified in
1.175 + * order to add the appropriated path
1.176 + */
1.177 + virtual void TestFileExistanceAndReadability( std::string & file, FileType fileType );
1.178 + virtual void TestBandSelection( std::vector<unsigned int> & bands ) { }
1.179
1.180 - /**
1.181 - * Read the MetaFile and test its effectiveness once inputFileName is set.
1.182 - */
1.183 - virtual void ReadMetaFile ();
1.184 - /**
1.185 - * Once MetaFile is read, allocation of lists are performed in SetFileName.
1.186 - * This allows specific (or global) initialisation in the GenerateData methods,
1.187 - * that the user may invoke throught GenerateOutput() or GenerateOutput( idx ).
1.188 - */
1.189 - virtual void AllocateListOfComponents ( void );
1.190 + virtual void GenerateData ( void );
1.191
1.192 - /** PrintSelf method */
1.193 - virtual void PrintSelf ( std::ostream& os, itk::Indent indent ) const;
1.194 + /** GenerateData
1.195 + * This method will be specialised if template definitions follow:
1.196 + * - TImage is a VectorImage
1.197 + * - TImage is an Image and TInteranalImage is a VectorImage
1.198 + * - TImage and TInternalImage are of Image type.
1.199 + */
1.200 + virtual void GenerateData ( unsigned int idx );
1.201
1.202 - std::string m_FileName;
1.203 - OutputImageListPointerType m_OutputList;
1.204 + /**
1.205 + * Read the MetaFile and test its effectiveness once inputFileName is set.
1.206 + */
1.207 + virtual void ReadMetaFile ();
1.208 + /**
1.209 + * Once MetaFile is read, allocation of lists are performed in SetFileName.
1.210 + * This allows specific (or global) initialisation in the GenerateData methods,
1.211 + * that the user may invoke throught GenerateOutput() or GenerateOutput( idx ).
1.212 + */
1.213 + virtual void AllocateListOfComponents ( void );
1.214
1.215 - std::vector< std::string > m_ListOfFileNames;
1.216 - std::vector< std::vector<unsigned int> > m_ListOfBandSelection;
1.217 - std::vector< InternalRegionType > m_ListOfRegionSelection;
1.218 + /** PrintSelf method */
1.219 + virtual void PrintSelf ( std::ostream& os, itk::Indent indent ) const;
1.220
1.221 - ReaderListPointerType m_ImageFileReaderList;
1.222 + std::string m_FileName;
1.223 + OutputImageListPointerType m_OutputList;
1.224
1.225 - private:
1.226 - ImageSeriesFileReaderBase ( const Self & );
1.227 - void operator= ( const Self & );
1.228 + std::vector< std::string > m_ListOfFileNames;
1.229 + std::vector< std::vector<unsigned int> > m_ListOfBandSelection;
1.230 + std::vector< InternalRegionType > m_ListOfRegionSelection;
1.231 +
1.232 + ReaderListPointerType m_ImageFileReaderList;
1.233 +
1.234 +private:
1.235 + ImageSeriesFileReaderBase ( const Self & );
1.236 + void operator= ( const Self & );
1.237 }; // end of class
1.238
1.239 } // end of namespace otb