21 #ifndef otbMulti3DMapToDEMFilter_hxx
22 #define otbMulti3DMapToDEMFilter_hxx
25 #include "itkImageRegionConstIteratorWithIndex.h"
26 #include "itkImageRegionIterator.h"
33 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
37 this->SetNumberOfIndexedInputs(2);
38 this->SetNumberOfRequiredInputs(1);
42 this->SetNumberOfIndexedOutputs(1);
43 this->SetNthOutput(0, TOutputDEMImage::New());
45 m_MapSplitterList = SplitterListType::New();
47 m_NoDataValue = -32768;
48 m_ElevationMin = -100;
51 m_OutputParametersFrom3DMap = -2;
52 m_IsGeographic =
true;
58 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
63 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
68 this->SetNumberOfIndexedInputs(2 * nb);
72 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
75 return this->GetNumberOfInputs() / 2;
78 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
81 if ((2 * (index + 1)) > this->GetNumberOfInputs())
83 itkExceptionMacro(<<
"Index is greater than the number of images");
86 this->SetNthInput(2 * index,
const_cast<T3DImage*
>(map));
90 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
93 if ((2 * (index + 1)) > this->GetNumberOfInputs())
95 itkExceptionMacro(<<
"Index is greater than the number of images");
98 this->SetNthInput(2 * index + 1,
const_cast<TMaskImage*
>(mask));
101 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
104 if ((2 * (index + 1)) > this->GetNumberOfInputs())
108 return static_cast<const T3DImage*
>(this->itk::ProcessObject::GetInput(2 * index));
111 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
114 if ((2 * (index + 1)) > this->GetNumberOfInputs())
118 return static_cast<const TMaskImage*
>(this->itk::ProcessObject::GetInput(2 * index + 1));
121 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
124 if (this->GetNumberOfOutputs() < 1)
128 return static_cast<const TOutputDEMImage*
>(this->itk::ProcessObject::GetOutput(0));
131 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
134 if (this->GetNumberOfOutputs() < 1)
138 return static_cast<TOutputDEMImage*
>(this->itk::ProcessObject::GetOutput(0));
142 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
145 int index = m_OutputParametersFrom3DMap;
146 if (
static_cast<unsigned int>((2 * (index + 1))) > this->GetNumberOfInputs())
148 itkExceptionMacro(<<
"input at position " << index <<
" is unavailable");
151 unsigned int numberOfInputs = this->GetNumberOfInputs() / 2;
152 unsigned int indexStart = 0;
153 unsigned int indexEnd = numberOfInputs - 1;
163 TOutputDEMImage* outputPtr = this->GetDEMOutput();
168 itk::NumericTraits<DEMPixelType>::max();
169 double box_xmin = itk::NumericTraits<DEMPixelType>::max();
170 double box_xmax = itk::NumericTraits<DEMPixelType>::NonpositiveMin();
171 double box_ymin = itk::NumericTraits<DEMPixelType>::max();
172 double box_ymax = itk::NumericTraits<DEMPixelType>::NonpositiveMin();
174 for (
unsigned int k = indexStart; k <= indexEnd; ++k)
176 T3DImage* imgPtr =
const_cast<T3DImage*
>(this->Get3DMapInput(k));
179 mapToGroundTransform->SetInputImageMetadata(&(imgPtr->GetImageMetadata()));
185 mapToGroundTransform->InstantiateTransform();
187 typename InputMapType::SizeType inputSize = imgPtr->GetLargestPossibleRegion().GetSize();
189 typename InputMapType::PointType ulPt, urPt, llPt, lrPt;
190 itk::ContinuousIndex<double, 2> ulIdx(imgPtr->GetLargestPossibleRegion().GetIndex());
194 itk::ContinuousIndex<double, 2> urIdx(ulIdx);
195 itk::ContinuousIndex<double, 2> lrIdx(ulIdx);
196 itk::ContinuousIndex<double, 2> llIdx(ulIdx);
197 urIdx[0] +=
static_cast<double>(inputSize[0]);
198 lrIdx[0] +=
static_cast<double>(inputSize[0]);
199 lrIdx[1] +=
static_cast<double>(inputSize[1]);
200 llIdx[1] +=
static_cast<double>(inputSize[1]);
202 imgPtr->TransformContinuousIndexToPhysicalPoint(ulIdx, ulPt);
203 imgPtr->TransformContinuousIndexToPhysicalPoint(urIdx, urPt);
204 imgPtr->TransformContinuousIndexToPhysicalPoint(llIdx, llPt);
205 imgPtr->TransformContinuousIndexToPhysicalPoint(lrIdx, lrPt);
208 ul = mapToGroundTransform->TransformPoint(ulPt);
209 ur = mapToGroundTransform->TransformPoint(urPt);
210 ll = mapToGroundTransform->TransformPoint(llPt);
211 lr = mapToGroundTransform->TransformPoint(lrPt);
213 double xmin = std::min(std::min(std::min(ul[0], ur[0]), lr[0]), ll[0]);
214 double xmax = std::max(std::max(std::max(ul[0], ur[0]), lr[0]), ll[0]);
215 double ymin = std::min(std::min(std::min(ul[1], ur[1]), lr[1]), ll[1]);
216 double ymax = std::max(std::max(std::max(ul[1], ur[1]), lr[1]), ll[1]);
218 box_xmin = std::min(box_xmin, xmin);
219 box_xmax = std::max(box_xmax, xmax);
220 box_ymin = std::min(box_ymin, ymin);
221 box_ymax = std::max(box_ymax, ymax);
226 typename TOutputDEMImage::SpacingType outSpacing;
228 outSpacing[0] = 57.295779513 * m_DEMGridStep / (6378137.0 * std::cos((box_ymin + box_ymax) * 0.5 * 0.01745329251));
229 outSpacing[1] = -57.295779513 * m_DEMGridStep / 6378137.0;
230 outputPtr->SetSignedSpacing(outSpacing);
233 typename TOutputDEMImage::PointType outOrigin;
234 outOrigin[0] = box_xmin + 0.5 * outSpacing[0];
235 outOrigin[1] = box_ymax + 0.5 * outSpacing[1];
236 outputPtr->SetOrigin(outOrigin);
239 typename TOutputDEMImage::RegionType outRegion;
240 outRegion.SetIndex(0, 0);
241 outRegion.SetIndex(1, 0);
242 outRegion.SetSize(0,
static_cast<unsigned int>(std::floor((box_xmax - box_xmin) / std::abs(outSpacing[0]) + 0.5)));
243 outRegion.SetSize(1,
static_cast<unsigned int>(std::floor((box_ymax - box_ymin) / std::abs(outSpacing[1]) + 0.5)));
244 outputPtr->SetLargestPossibleRegion(outRegion);
245 outputPtr->SetNumberOfComponentsPerPixel(1);
248 itk::MetaDataDictionary& dictOutput = outputPtr->GetMetaDataDictionary();
256 if (!m_ProjectionRef.empty() && !isWGS84)
261 genericRSEstimator->SetInput(outputPtr);
263 genericRSEstimator->SetOutputProjectionRef(m_ProjectionRef);
264 genericRSEstimator->Compute();
265 outputPtr->SetSignedSpacing(genericRSEstimator->GetOutputSpacing());
266 outputPtr->SetOrigin(genericRSEstimator->GetOutputOrigin());
269 typename TOutputDEMImage::RegionType outRegion2;
270 outRegion2.SetIndex(0, 0);
271 outRegion2.SetIndex(1, 0);
272 outRegion2.SetSize(0, genericRSEstimator->GetOutputSize()[0]);
275 outRegion2.SetSize(1, genericRSEstimator->GetOutputSize()[1]);
276 outputPtr->SetLargestPossibleRegion(outRegion2);
277 outputPtr->SetNumberOfComponentsPerPixel(1);
280 itk::MetaDataDictionary& dict = outputPtr->GetMetaDataDictionary();
287 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
291 TOutputDEMImage* outputPtr = this->GetDEMOutput();
293 if (this->m_OutputParametersFrom3DMap == -2)
295 outputPtr->SetOrigin(m_OutputOrigin);
296 outputPtr->SetSignedSpacing(m_OutputSpacing);
298 typename TOutputDEMImage::RegionType outRegion;
299 outRegion.SetIndex(m_OutputStartIndex);
300 outRegion.SetSize(m_OutputSize);
301 outputPtr->SetLargestPossibleRegion(outRegion);
302 outputPtr->SetNumberOfComponentsPerPixel(1);
304 if (!m_ProjectionRef.empty())
307 itk::MetaDataDictionary& dict = this->GetOutput()->GetMetaDataDictionary();
313 this->SetOutputParametersFromImage();
316 if (!m_ProjectionRef.empty())
318 OGRSpatialReference oSRS;
319 #if GDAL_VERSION_NUM >= 3000000 // importFromWkt is const-correct in GDAL 3
320 const char* wkt = m_ProjectionRef.c_str();
322 char* wkt =
const_cast<char*
>(m_ProjectionRef.c_str());
324 oSRS.importFromWkt(&wkt);
325 m_IsGeographic = oSRS.IsGeographic();
329 std::vector<bool> noDataValueAvailable;
330 noDataValueAvailable.push_back(
true);
331 std::vector<double> noDataValue;
332 noDataValue.push_back(m_NoDataValue);
334 WriteNoDataFlags(noDataValueAvailable, noDataValue, outputPtr->GetImageMetadata());
337 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
340 const TOutputDEMImage* outputDEM = this->GetDEMOutput();
342 typename TOutputDEMImage::RegionType outRegion = outputDEM->GetRequestedRegion();
343 typename TOutputDEMImage::PointType outOrigin = outputDEM->GetOrigin();
344 typename TOutputDEMImage::SpacingType outSpacing = outputDEM->GetSignedSpacing();
348 corners[0][0] = outOrigin[0] + outSpacing[0] * (-0.5 +
static_cast<double>(outRegion.GetIndex(0)));
349 corners[0][1] = outOrigin[1] + outSpacing[1] * (-0.5 +
static_cast<double>(outRegion.GetIndex(1)));
350 corners[0][2] = m_ElevationMin;
352 corners[1][0] = corners[0][0];
353 corners[1][1] = corners[0][1];
354 corners[1][2] = m_ElevationMax;
356 corners[2][0] = corners[0][0] + outSpacing[0] *
static_cast<double>(outRegion.GetSize(0));
357 corners[2][1] = corners[0][1];
358 corners[2][2] = m_ElevationMin;
360 corners[3][0] = corners[2][0];
361 corners[3][1] = corners[2][1];
362 corners[3][2] = m_ElevationMax;
364 corners[4][0] = corners[0][0] + outSpacing[0] *
static_cast<double>(outRegion.GetSize(0));
365 corners[4][1] = corners[0][1] + outSpacing[1] *
static_cast<double>(outRegion.GetSize(1));
366 corners[4][2] = m_ElevationMin;
368 corners[5][0] = corners[4][0];
369 corners[5][1] = corners[4][1];
370 corners[5][2] = m_ElevationMax;
372 corners[6][0] = corners[0][0];
373 corners[6][1] = corners[0][1] + outSpacing[1] *
static_cast<double>(outRegion.GetSize(1));
374 corners[6][2] = m_ElevationMin;
376 corners[7][0] = corners[6][0];
377 corners[7][1] = corners[6][1];
378 corners[7][2] = m_ElevationMax;
380 for (
unsigned int k = 0; k < this->GetNumberOf3DMaps(); ++k)
384 T3DImage* imgPtr =
const_cast<T3DImage*
>(this->Get3DMapInput(k));
389 groundToSensorTransform->SetInputProjectionRef(m_ProjectionRef);
391 groundToSensorTransform->SetOutputImageMetadata(&(imgPtr->GetImageMetadata()));
392 groundToSensorTransform->SetOutputOrigin(imgPtr->GetOrigin());
393 groundToSensorTransform->SetOutputSpacing(imgPtr->GetSignedSpacing());
394 groundToSensorTransform->InstantiateTransform();
396 typename T3DImage::RegionType mapRegion = imgPtr->GetLargestPossibleRegion();
398 itk::ContinuousIndex<double, 2> mapContiIndex;
399 long int maxMapIndex[2] = {0, 0};
400 long int minMapIndex[2] = {0, 0};
401 maxMapIndex[0] =
static_cast<long int>(mapRegion.GetIndex(0) + mapRegion.GetSize(0));
402 maxMapIndex[1] =
static_cast<long int>(mapRegion.GetIndex(1) + mapRegion.GetSize(1));
403 minMapIndex[0] =
static_cast<long int>(mapRegion.GetIndex(0));
404 minMapIndex[1] =
static_cast<long int>(mapRegion.GetIndex(1));
406 long int minMapRequestedIndex[2] = {0, 0};
407 minMapRequestedIndex[0] = maxMapIndex[0] + 1;
408 minMapRequestedIndex[1] = maxMapIndex[1] + 1;
410 long int maxMapRequestedIndex[2] = {0, 0};
411 maxMapRequestedIndex[0] = 0;
412 maxMapRequestedIndex[1] = 0;
414 for (
unsigned int i = 0; i < 8; i++)
416 TDPointType tmpSensor = groundToSensorTransform->TransformPoint(corners[i]);
418 minMapRequestedIndex[0] = std::min(minMapRequestedIndex[0],
static_cast<long int>(tmpSensor[0] - m_Margin[0]));
420 minMapRequestedIndex[1] = std::min(minMapRequestedIndex[1],
static_cast<long int>(tmpSensor[1] - m_Margin[1]));
422 maxMapRequestedIndex[0] = std::max(maxMapRequestedIndex[0],
static_cast<long int>(tmpSensor[0] + m_Margin[0]));
424 maxMapRequestedIndex[1] = std::max(maxMapRequestedIndex[1],
static_cast<long int>(tmpSensor[1] + m_Margin[1]));
426 minMapRequestedIndex[0] = std::max(minMapRequestedIndex[0], minMapIndex[0]);
427 minMapRequestedIndex[1] = std::max(minMapRequestedIndex[1], minMapIndex[1]);
428 maxMapRequestedIndex[0] = std::min(maxMapRequestedIndex[0], maxMapIndex[0]);
429 maxMapRequestedIndex[1] = std::min(maxMapRequestedIndex[1], maxMapIndex[1]);
432 RegionType largest = imgPtr->GetLargestPossibleRegion();
435 if ((minMapRequestedIndex[0] < maxMapRequestedIndex[0]) && (minMapRequestedIndex[1] < maxMapRequestedIndex[1]))
437 requestedRegion.SetSize(0, maxMapRequestedIndex[0] - minMapRequestedIndex[0]);
438 requestedRegion.SetSize(1, maxMapRequestedIndex[1] - minMapRequestedIndex[1]);
439 requestedRegion.SetIndex(0, minMapRequestedIndex[0]);
440 requestedRegion.SetIndex(1, minMapRequestedIndex[1]);
444 requestedRegion.SetSize(0, 0);
445 requestedRegion.SetSize(1, 0);
446 requestedRegion.SetIndex(0, minMapIndex[0]);
447 requestedRegion.SetIndex(1, minMapIndex[1]);
450 imgPtr->SetRequestedRegion(requestedRegion);
452 TMaskImage* mskPtr =
const_cast<TMaskImage*
>(this->GetMaskInput(k));
456 if (mskPtr->GetLargestPossibleRegion() != largest)
458 itkExceptionMacro(<<
"mask and map at position " << k <<
" have a different largest region");
460 mskPtr->SetRequestedRegion(requestedRegion);
465 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
468 const TOutputDEMImage* outputDEM = this->GetDEMOutput();
472 m_NumberOfSplit.resize(this->GetNumberOf3DMaps());
474 unsigned int maximumRegionsNumber = 1;
476 for (
unsigned int k = 0; k < this->GetNumberOf3DMaps(); ++k)
478 m_MapSplitterList->PushBack(SplitterType::New());
479 T3DImage* imgPtr =
const_cast<T3DImage*
>(this->Get3DMapInput(k));
481 typename T3DImage::RegionType requestedRegion = imgPtr->GetRequestedRegion();
483 typename T3DImage::SizeType requestedSize = requestedRegion.GetSize();
484 unsigned int regionsNumber = 0;
485 if (requestedSize[0] * requestedSize[1] != 0)
487 regionsNumber = m_MapSplitterList->GetNthElement(k)->GetNumberOfSplits(requestedRegion, this->GetNumberOfThreads());
489 m_NumberOfSplit[k] = regionsNumber;
490 otbMsgDevMacro(
"map " << k <<
" will be split into " << regionsNumber <<
" regions");
491 if (maximumRegionsNumber < regionsNumber)
492 maximumRegionsNumber = regionsNumber;
495 m_TempDEMRegions.clear();
496 m_TempDEMAccumulatorRegions.clear();
499 for (
unsigned int i = 0; i < maximumRegionsNumber; i++)
502 typename TOutputDEMImage::Pointer tmpImg = TOutputDEMImage::New();
503 tmpImg->SetNumberOfComponentsPerPixel(1);
504 tmpImg->SetRegions(outputDEM->GetRequestedRegion());
507 tmpImg->FillBuffer(m_NoDataValue);
508 m_TempDEMRegions.push_back(tmpImg);
511 tmpImg2->SetNumberOfComponentsPerPixel(1);
512 tmpImg2->SetRegions(outputDEM->GetRequestedRegion());
515 tmpImg2->FillBuffer(0.);
516 m_TempDEMAccumulatorRegions.push_back(tmpImg2);
519 if (!this->m_IsGeographic)
521 m_GroundTransform = RSTransform2DType::New();
523 m_GroundTransform->SetOutputProjectionRef(m_ProjectionRef);
524 m_GroundTransform->InstantiateTransform();
528 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
530 itk::ThreadIdType threadId)
532 TOutputDEMImage* outputPtr = this->GetOutput();
534 typename OutputImageType::PointType pointRef;
535 typename OutputImageType::PointType pointRefStep;
536 typename OutputImageType::RegionType requestedRegion = outputPtr->GetRequestedRegion();
544 typename TOutputDEMImage::IndexType index = requestedRegion.GetIndex();
545 outputPtr->TransformIndexToPhysicalPoint(index, pointRef);
557 TOutputDEMImage* tmpDEM =
nullptr;
559 typename TOutputDEMImage::RegionType outputRequestedRegion = outputPtr->GetRequestedRegion();
561 typename T3DImage::RegionType splitRegion;
565 itk::ImageRegionConstIterator<InputMapType> mapIt;
566 for (
unsigned int k = 0; k < this->GetNumberOf3DMaps(); ++k)
568 if (m_NumberOfSplit[k] > 0)
570 T3DImage* imgPtr =
const_cast<T3DImage*
>(this->Get3DMapInput(k));
571 TMaskImage* mskPtr =
const_cast<TMaskImage*
>(this->GetMaskInput(k));
573 typename InputMapType::PointType origin;
574 origin = imgPtr->GetOrigin();
575 typename InputMapType::SpacingType spacing;
578 if (
static_cast<unsigned int>(threadId) < m_NumberOfSplit[k])
580 splitRegion = m_MapSplitterList->GetNthElement(k)->GetSplit(threadId, m_NumberOfSplit[k], imgPtr->GetRequestedRegion());
582 tmpDEM = m_TempDEMRegions[threadId];
583 tmpAcc = m_TempDEMAccumulatorRegions[threadId];
585 mapIt = itk::ImageRegionConstIterator<InputMapType>(imgPtr, splitRegion);
587 itk::ImageRegionConstIterator<MaskImageType> maskIt;
588 bool useMask =
false;
592 maskIt = itk::ImageRegionConstIterator<MaskImageType>(mskPtr, splitRegion);
596 while (!mapIt.IsAtEnd())
601 if (!(maskIt.Get() > 0))
609 position = mapIt.Get();
612 if (!this->m_IsGeographic)
616 tmpPoint[0] = position[0];
617 tmpPoint[1] = position[1];
619 position[0] = groundPosition[0];
620 position[1] = groundPosition[1];
629 typename OutputImageType::PointType point2D;
630 point2D[0] = position[0];
631 point2D[1] = position[1];
632 itk::ContinuousIndex<double, 2> continuousIndex;
637 outputPtr->TransformPhysicalPointToContinuousIndex(point2D, continuousIndex);
638 typename OutputImageType::IndexType cellIndex;
639 cellIndex[0] =
static_cast<int>(std::floor(continuousIndex[0] + 0.5));
640 cellIndex[1] =
static_cast<int>(std::floor(continuousIndex[1] + 0.5));
650 if (outputRequestedRegion.IsInside(cellIndex))
660 tmpAcc->SetPixel(cellIndex, tmpAcc->GetPixel(cellIndex) + 1);
664 tmpDEM->SetPixel(cellIndex, cellHeight);
668 DEMPixelType cellCurrentValue = tmpDEM->GetPixel(cellIndex);
670 switch (this->m_CellFusionMode)
674 if (cellHeight < cellCurrentValue)
676 tmpDEM->SetPixel(cellIndex, cellHeight);
682 if (cellHeight > cellCurrentValue)
684 tmpDEM->SetPixel(cellIndex, cellHeight);
690 tmpDEM->SetPixel(cellIndex, cellCurrentValue + cellHeight);
699 itkExceptionMacro(<<
"Unexpected value cell fusion mode :" << this->m_CellFusionMode);
713 splitRegion = requestedRegion;
720 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
724 TOutputDEMImage* outputDEM = this->GetOutput();
727 if (m_TempDEMRegions.size() < 1)
729 outputDEM->FillBuffer(m_NoDataValue);
733 itk::ImageRegionIterator<OutputImageType> outputDEMIt(outputDEM, outputDEM->GetRequestedRegion());
734 itk::ImageRegionIterator<OutputImageType> firstDEMIt(m_TempDEMRegions[0], outputDEM->GetRequestedRegion());
735 itk::ImageRegionIterator<AccumulatorImageType> firstDEMAccIt(m_TempDEMAccumulatorRegions[0], outputDEM->GetRequestedRegion());
738 outputDEMIt.GoToBegin();
739 firstDEMIt.GoToBegin();
740 firstDEMAccIt.GoToBegin();
743 while (!outputDEMIt.IsAtEnd() && !firstDEMIt.IsAtEnd() && !firstDEMAccIt.IsAtEnd())
750 outputDEMIt.Set(m_NoDataValue);
757 outputDEMIt.Set(pixelValue);
761 outputDEMIt.Set(firstDEMIt.Get() /
static_cast<DEMPixelType>(accPixel));
774 for (
unsigned int i = 1; i < m_TempDEMRegions.size(); i++)
777 itk::ImageRegionIterator<OutputImageType> tmpDEMIt(m_TempDEMRegions[i], outputDEM->GetRequestedRegion());
778 itk::ImageRegionIterator<AccumulatorImageType> tmpDEMAccIt(m_TempDEMAccumulatorRegions[i], outputDEM->GetRequestedRegion());
780 outputDEMIt.GoToBegin();
781 tmpDEMIt.GoToBegin();
782 tmpDEMAccIt.GoToBegin();
783 firstDEMAccIt.GoToBegin();
784 while (!outputDEMIt.IsAtEnd() && !tmpDEMIt.IsAtEnd() && !tmpDEMAccIt.IsAtEnd() && !firstDEMAccIt.IsAtEnd())
794 switch (this->m_CellFusionMode)
798 if ((cellHeight < cellCurrentValue) || (cellCurrentValue == m_NoDataValue))
800 outputDEMIt.Set(cellHeight);
806 if ((cellHeight > cellCurrentValue) || ((cellCurrentValue == m_NoDataValue)))
808 outputDEMIt.Set(cellHeight);
815 outputDEMIt.Set(cellCurrentValue *
static_cast<DEMPixelType>(cellCurrentValue != m_NoDataValue) + cellHeight);
816 firstDEMAccIt.Set(firstDEMAccIt.Get() + accPixel);
821 firstDEMAccIt.Set(firstDEMAccIt.Get() + accPixel);
826 itkExceptionMacro(<<
"Unexpected value cell fusion mode :" << this->m_CellFusionMode);
831 if (i == (m_TempDEMRegions.size() - 1))
835 if (
static_cast<DEMPixelType>(firstDEMAccIt.Get()) != 0)
837 outputDEMIt.Set(outputDEMIt.Get() /
static_cast<DEMPixelType>(firstDEMAccIt.Get()));
841 outputDEMIt.Set(m_NoDataValue);
846 outputDEMIt.Set(
static_cast<DEMPixelType>(firstDEMAccIt.Get()));