22 #ifndef __StreamingLargeFeatherMosaicFilter_hxx
23 #define __StreamingLargeFeatherMosaicFilter_hxx
33 template <
class TInputImage,
class TOutputImage,
class TDistanceImage,
class TInternalValueType>
42 const unsigned int nbOfUsedInputImages = Superclass::GetNumberOfUsedInputImages();
45 const unsigned int nBands = Superclass::GetNumberOfBands();
48 IteratorType outputIt(mosaicImage, outputRegionForThread);
51 typename std::vector<InputImageType*> currentImage;
52 typename std::vector<InterpolatorPointerType> interp;
53 Superclass::PrepareImageAccessors(currentImage, interp);
56 typename std::vector<DistanceImageType*> currentDistanceImage;
57 typename std::vector<DistanceImageInterpolatorPointer> distanceInterpolator;
58 Superclass::PrepareDistanceImageAccessors(currentDistanceImage, distanceInterpolator);
65 interpolatedMathPixel.SetSize(nBands);
66 tempOutputPixel.SetSize(nBands);
70 bool isDataInCurrentOutputPixel;
77 for (outputIt.GoToBegin(); !outputIt.IsAtEnd(); ++outputIt)
80 mosaicImage->TransformIndexToPhysicalPoint(outputIt.GetIndex(), geoPoint);
83 isDataInCurrentOutputPixel =
false;
87 tempOutputPixel.Fill(0.0);
90 for (i = 0; i < nbOfUsedInputImages; i++)
96 if (interp[i]->IsInsideBuffer(geoPoint))
99 interpolatedPixel = interp[i]->Evaluate(geoPoint);
102 if (Superclass::IsPixelNotEmpty(interpolatedPixel))
105 if (distanceInterpolator[i]->IsInsideBuffer(geoPoint))
107 distanceImagePixel = distanceInterpolator[i]->Evaluate(geoPoint);
108 distanceImagePixel -= Superclass::GetDistanceOffset();
110 if (distanceImagePixel > 0)
113 isDataInCurrentOutputPixel =
true;
116 sumDistances += distanceImagePixel;
123 const unsigned int inputImageIndex = Superclass::GetUsedInputImageIndice(i);
124 for (band = 0; band < nBands; band++)
127 interpolatedMathPixel[band] =
static_cast<InternalValueType>(interpolatedPixel[band]);
130 if (this->GetShiftScaleInputImages())
132 this->ShiftScaleValue(interpolatedMathPixel[band], inputImageIndex, band);
136 interpolatedMathPixel[band] *= distanceImagePixel;
139 tempOutputPixel[band] += interpolatedMathPixel[band];
147 itkWarningMacro(<<
"Unable to evaluate distance at point " << geoPoint);
156 if (isDataInCurrentOutputPixel)
160 for (band = 0; band < nBands; band++)
164 pixelValue = tempOutputPixel[band] / sumDistances;
165 Superclass::NormalizePixelValue(pixelValue);
172 outputIt.Set(outputPixel);
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
Superclass::OutputImagePointType OutputImagePointType
Superclass::IteratorType IteratorType
Superclass::OutputImagePixelType OutputImagePixelType
Superclass::InternalValueType InternalValueType
Superclass::OutputImageInternalPixelType OutputImageInternalPixelType
Superclass::OutputImageRegionType OutputImageRegionType
Superclass::InputImagePixelType InputImagePixelType
Superclass::OutputImageType OutputImageType
Superclass::InternalPixelType InternalPixelType
Superclass::InputImageRegionType InputImageRegionType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.