18 #ifndef __otbObjectListToObjectListFilter_txx
19 #define __otbObjectListToObjectListFilter_txx
30 template <
class TInputList,
class TOutputList>
34 this->SetNumberOfRequiredInputs(1);
37 template <
class TInputList,
class TOutputList>
44 const_cast<InputListType *>(input));
47 template <
class TInputList,
class TOutputList>
52 if (this->GetNumberOfInputs() < 1)
57 return static_cast<const TInputList *
>
61 template <
class TInputList,
class TOutputList>
66 unsigned int requestedElements,
67 unsigned int& startIndex,
68 unsigned int& stopIndex)
70 startIndex =
static_cast<unsigned int>(vcl_floor(
71 requestedElements * static_cast<double>(threadId) /
72 static_cast<double>(threadCount) + 0.5
74 stopIndex =
static_cast<unsigned int>(vcl_floor(
76 static_cast<double>(threadId + 1) / static_cast<double>(threadCount) + 0.5
78 if (stopIndex > requestedElements) stopIndex = requestedElements;
89 template <
class TInputList,
class TOutputList>
97 this->BeforeThreadedGenerateData();
108 this->GetMultiThreader()->SetNumberOfThreads(this->GetNumberOfThreads());
109 this->GetMultiThreader()->SetSingleMethod(this->ThreaderCallback, &str);
112 this->GetMultiThreader()->SingleMethodExecute();
116 this->AfterThreadedGenerateData();
120 template <
class TInputList,
class TOutputList>
125 this->AllocateOutputs();
128 template <
class TInputList,
class TOutputList>
137 std::ostringstream message;
138 message <<
"itk::ERROR: " << this->GetNameOfClass()
139 <<
"(" <<
this <<
"): " <<
"Subclass should override this method!!!";
145 template <
class TInputList,
class TOutputList>
151 int threadId, threadCount;
152 unsigned int total, start, stop;
153 unsigned int requestedElements;
159 requestedElements = str->
Filter->GetInput()->Size();
160 total = str->
Filter->SplitRequestedRegion(threadId, threadCount, requestedElements, start, stop);
162 if (threadId < static_cast<int>(total))
169 str->
Filter->ThreadedGenerateData(start, stop, threadId);
185 template <
class TInputList,
class TOutputList>
190 Superclass::PrintSelf(os, indent);