21 #ifndef otbProfileToProfileDerivativeFilter_hxx
22 #define otbProfileToProfileDerivativeFilter_hxx
31 template <
class TInputImageList,
class TOutputImageList>
34 m_SubtractFilter = SubtractFilterType::New();
35 m_AbsFilter = AbsFilterType::New();
40 template <
class TInputImageList,
class TOutputImageList>
44 InputImageListPointerType inputPtr = this->GetInput();
45 OutputImageListPointerType outputPtr = this->GetOutput();
48 if (outputPtr->Size() != inputPtr->Size() - 1)
52 typename InputImageListType::ConstIterator inputListIt = inputPtr->Begin();
54 while (inputListIt != inputPtr->End())
56 outputPtr->PushBack(OutputImageType::New());
63 typename InputImageListType::ConstIterator inputListIt = inputPtr->Begin();
64 typename OutputImageListType::Iterator outputListIt = outputPtr->Begin();
66 while (inputListIt != inputPtr->End() && outputListIt != outputPtr->End())
69 outputListIt.Get()->CopyInformation(inputListIt.Get());
70 outputListIt.Get()->SetLargestPossibleRegion(inputListIt.Get()->GetLargestPossibleRegion());
77 template <
class TInputImageList,
class TOutputImageList>
81 InputImageListPointerType inputPtr = this->GetInput();
82 OutputImageListPointerType outputPtr = this->GetOutput();
86 typename InputImageListType::ConstIterator inputListIt = inputPtr->Begin();
87 typename OutputImageListType::Iterator outputListIt = outputPtr->Begin();
90 while (inputListIt != inputPtr->End() && outputListIt != outputPtr->End())
92 inputListIt.Get()->SetRequestedRegion(outputListIt.Get()->GetRequestedRegion());
98 template <
class TInputImageList,
class TOutputImageList>
101 m_AbsFilter->SetInput(m_SubtractFilter->GetOutput());
104 InputImageListPointerType inputPtr = this->GetInput();
105 OutputImageListPointerType outputPtr = this->GetOutput();
108 typename InputImageListType::ConstIterator inputListIt = inputPtr->Begin();
109 typename OutputImageListType::Iterator outputListIt = outputPtr->Begin();
110 unsigned int counter = 0;
112 InputImagePointerType lastImage = inputListIt.Get();
115 while (inputListIt != inputPtr->End() && outputListIt != outputPtr->End())
117 m_SubtractFilter->SetInput1(inputListIt.Get());
118 m_SubtractFilter->SetInput2(lastImage);
119 m_AbsFilter->GetOutput()->SetRequestedRegion(outputListIt.Get()->GetRequestedRegion());
120 m_AbsFilter->Update();
121 outputPtr->SetNthElement(counter,
static_cast<OutputImageType*
>(m_AbsFilter->GetOutput()));
122 outputListIt.Get()->DisconnectPipeline();
123 lastImage = inputListIt.Get();