21 #ifndef __otbImageSeriesFileReader_txx
22 #define __otbImageSeriesFileReader_txx
27 template <
class TImage,
class TInternalImage>
31 m_ExtractorList = ExtractSelectionListType::New();
34 template <
class TImage,
class TInternalImage>
39 for (
unsigned int i = 0; i < this->GetNumberOfOutputs(); ++i)
41 this->m_ImageFileReaderList->PushBack(ReaderType::New());
42 this->m_OutputList->PushBack(OutputImageType::New());
43 m_ExtractorList->PushBack(ExtractSelectionListType::New());
47 template <
class TImage,
class TInternalImage>
52 std::ostringstream msg;
53 msg <<
"Something wrong... Check the template definition of this class in the program...\n";
54 msg <<
"\"ENVI META FILE\" FileName: " << this->m_FileName <<
"\n";
64 template <
class TPixel,
class TInternalPixel>
68 m_ExtractorList = ExtractSelectionListType::New();
74 template <
class TPixel,
class TInternalPixel>
77 ::AllocateListOfComponents()
79 for (
unsigned int i = 0; i < this->GetNumberOfOutputs(); ++i)
81 this->m_ImageFileReaderList->PushBack(ReaderType::New());
82 this->m_OutputList->PushBack(OutputImageType::New());
83 m_ExtractorList->PushBack(ExtractSelectionType::New());
91 template <
class TPixel,
class TInternalPixel>
94 ::TestBandSelection(std::vector<unsigned int>& bands)
96 if (bands.size() != 1)
98 std::ostringstream msg;
99 msg <<
"Unable to handle multicomponent file from Image<> class\n";
100 msg <<
"\"ENVI META FILE\" FileName: " << this->m_FileName <<
"\n";
107 std::ostringstream msg;
108 msg <<
"Unable to handle given band reading from multicomponent file with Image<> class\n";
109 msg <<
"\"ENVI META FILE\" FileName: " << this->m_FileName <<
"\n";
119 template <
class TPixel,
class TInternalPixel>
122 ::GenerateData(
unsigned int idx)
124 otbMsgDebugMacro(<<
"Reading " << idx <<
"th image: " << this->m_ListOfFileNames[idx]);
127 =
static_cast<ReaderType*
>(this->m_ImageFileReaderList->GetNthElement(idx));
137 selection->
GraftOutput(this->m_OutputList->GetNthElement(idx));
140 this->m_OutputList->GetNthElement(idx)->Graft(selection->
GetOutput());
152 template <
class TPixel,
class TInternalPixel>
158 m_ExtractorList = ExtractSelectionListType::New();
164 template <
class TPixel,
class TInternalPixel>
167 ::AllocateListOfComponents()
169 for (
unsigned int i = 0; i < this->GetNumberOfOutputs(); ++i)
171 this->m_ImageFileReaderList->PushBack(ReaderType::New());
172 this->m_OutputList->PushBack(OutputImageType::New());
173 m_ExtractorList->PushBack(ExtractSelectionType::New());
181 template <
class TPixel,
class TInternalPixel>
184 ::TestBandSelection(std::vector<unsigned int>& bands)
186 if (bands.size() != 1)
188 std::ostringstream msg;
189 msg <<
"Unable to handle multicomponent file from Image<> class as output\n";
190 msg <<
"\"ENVI META FILE\" FileName: " << this->m_FileName <<
"\n";
200 template <
class TPixel,
class TInternalPixel>
203 ::GenerateData(
unsigned int idx)
205 otbMsgDebugMacro(<<
"Reading " << idx <<
"th image: " << this->m_ListOfFileNames[idx]);
208 =
static_cast<ReaderType*
>(this->m_ImageFileReaderList->GetNthElement(idx));
216 selection->
SetChannel(this->m_ListOfBandSelection[idx][0]);
219 selection->
GraftOutput(this->m_OutputList->GetNthElement(idx));
222 this->m_OutputList->GetNthElement(idx)->Graft(selection->
GetOutput());
233 template <
class TPixel,
class TInternalPixel>
239 m_ExtractorList = ExtractSelectionListType::New();
245 template <
class TPixel,
class TInternalPixel>
248 ::AllocateListOfComponents()
250 for (
unsigned int i = 0; i < this->GetNumberOfOutputs(); ++i)
252 this->m_ImageFileReaderList->PushBack(ReaderType::New());
253 this->m_OutputList->PushBack(OutputImageType::New());
254 m_ExtractorList->PushBack(ExtractSelectionType::New());
261 template <
class TPixel,
class TInternalPixel>
264 ::GenerateData(
unsigned int idx)
266 otbMsgDebugMacro(<<
"Reading " << idx <<
"th image: " << this->m_ListOfFileNames[idx]);
269 =
static_cast<ReaderType*
>(this->m_ImageFileReaderList->GetNthElement(idx));
278 for (std::vector<unsigned int>::iterator band = this->m_ListOfBandSelection[idx].begin();
279 band != this->m_ListOfBandSelection[idx].end();
286 selection->
GraftOutput(this->m_OutputList->GetNthElement(idx));
289 this->m_OutputList->GetNthElement(idx)->Graft(selection->
GetOutput());