21 #ifndef otbMulti3DMapToDEMFilter_hxx
22 #define otbMulti3DMapToDEMFilter_hxx
25 #include "itkImageRegionConstIteratorWithIndex.h"
26 #include "itkImageRegionIterator.h"
33 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
36 this->DynamicMultiThreadingOff();
38 this->SetNumberOfIndexedInputs(2);
39 this->SetNumberOfRequiredInputs(1);
43 this->SetNumberOfIndexedOutputs(1);
44 this->SetNthOutput(0, TOutputDEMImage::New());
46 m_MapSplitterList = SplitterListType::New();
48 m_NoDataValue = -32768;
49 m_ElevationMin = -100;
52 m_OutputParametersFrom3DMap = -2;
53 m_IsGeographic =
true;
59 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
64 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
69 this->SetNumberOfIndexedInputs(2 * nb);
73 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
76 return this->GetNumberOfInputs() / 2;
79 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
82 if ((2 * (index + 1)) > this->GetNumberOfInputs())
84 itkExceptionMacro(<<
"Index is greater than the number of images");
87 this->SetNthInput(2 * index,
const_cast<T3DImage*
>(map));
91 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
94 if ((2 * (index + 1)) > this->GetNumberOfInputs())
96 itkExceptionMacro(<<
"Index is greater than the number of images");
99 this->SetNthInput(2 * index + 1,
const_cast<TMaskImage*
>(mask));
102 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
105 if ((2 * (index + 1)) > this->GetNumberOfInputs())
109 return static_cast<const T3DImage*
>(this->itk::ProcessObject::GetInput(2 * index));
112 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
115 if ((2 * (index + 1)) > this->GetNumberOfInputs())
119 return static_cast<const TMaskImage*
>(this->itk::ProcessObject::GetInput(2 * index + 1));
122 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
125 if (this->GetNumberOfOutputs() < 1)
129 return static_cast<const TOutputDEMImage*
>(this->itk::ProcessObject::GetOutput(0));
132 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
135 if (this->GetNumberOfOutputs() < 1)
139 return static_cast<TOutputDEMImage*
>(this->itk::ProcessObject::GetOutput(0));
143 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
146 int index = m_OutputParametersFrom3DMap;
147 if (
static_cast<unsigned int>((2 * (index + 1))) > this->GetNumberOfInputs())
149 itkExceptionMacro(<<
"input at position " << index <<
" is unavailable");
152 unsigned int numberOfInputs = this->GetNumberOfInputs() / 2;
153 unsigned int indexStart = 0;
154 unsigned int indexEnd = numberOfInputs - 1;
164 TOutputDEMImage* outputPtr = this->GetDEMOutput();
169 itk::NumericTraits<DEMPixelType>::max();
170 double box_xmin = itk::NumericTraits<DEMPixelType>::max();
171 double box_xmax = itk::NumericTraits<DEMPixelType>::NonpositiveMin();
172 double box_ymin = itk::NumericTraits<DEMPixelType>::max();
173 double box_ymax = itk::NumericTraits<DEMPixelType>::NonpositiveMin();
175 for (
unsigned int k = indexStart; k <= indexEnd; ++k)
177 T3DImage* imgPtr =
const_cast<T3DImage*
>(this->Get3DMapInput(k));
180 mapToGroundTransform->SetInputImageMetadata(&(imgPtr->GetImageMetadata()));
186 mapToGroundTransform->InstantiateTransform();
188 typename InputMapType::SizeType inputSize = imgPtr->GetLargestPossibleRegion().GetSize();
190 typename InputMapType::PointType ulPt, urPt, llPt, lrPt;
191 itk::ContinuousIndex<double, 2> ulIdx(imgPtr->GetLargestPossibleRegion().GetIndex());
195 itk::ContinuousIndex<double, 2> urIdx(ulIdx);
196 itk::ContinuousIndex<double, 2> lrIdx(ulIdx);
197 itk::ContinuousIndex<double, 2> llIdx(ulIdx);
198 urIdx[0] +=
static_cast<double>(inputSize[0]);
199 lrIdx[0] +=
static_cast<double>(inputSize[0]);
200 lrIdx[1] +=
static_cast<double>(inputSize[1]);
201 llIdx[1] +=
static_cast<double>(inputSize[1]);
203 imgPtr->TransformContinuousIndexToPhysicalPoint(ulIdx, ulPt);
204 imgPtr->TransformContinuousIndexToPhysicalPoint(urIdx, urPt);
205 imgPtr->TransformContinuousIndexToPhysicalPoint(llIdx, llPt);
206 imgPtr->TransformContinuousIndexToPhysicalPoint(lrIdx, lrPt);
209 ul = mapToGroundTransform->TransformPoint(ulPt);
210 ur = mapToGroundTransform->TransformPoint(urPt);
211 ll = mapToGroundTransform->TransformPoint(llPt);
212 lr = mapToGroundTransform->TransformPoint(lrPt);
214 double xmin = std::min(std::min(std::min(ul[0], ur[0]), lr[0]), ll[0]);
215 double xmax = std::max(std::max(std::max(ul[0], ur[0]), lr[0]), ll[0]);
216 double ymin = std::min(std::min(std::min(ul[1], ur[1]), lr[1]), ll[1]);
217 double ymax = std::max(std::max(std::max(ul[1], ur[1]), lr[1]), ll[1]);
219 box_xmin = std::min(box_xmin, xmin);
220 box_xmax = std::max(box_xmax, xmax);
221 box_ymin = std::min(box_ymin, ymin);
222 box_ymax = std::max(box_ymax, ymax);
227 typename TOutputDEMImage::SpacingType outSpacing;
229 outSpacing[0] = 57.295779513 * m_DEMGridStep / (6378137.0 * std::cos((box_ymin + box_ymax) * 0.5 * 0.01745329251));
230 outSpacing[1] = -57.295779513 * m_DEMGridStep / 6378137.0;
231 outputPtr->SetSignedSpacing(outSpacing);
234 typename TOutputDEMImage::PointType outOrigin;
235 outOrigin[0] = box_xmin + 0.5 * outSpacing[0];
236 outOrigin[1] = box_ymax + 0.5 * outSpacing[1];
237 outputPtr->SetOrigin(outOrigin);
240 typename TOutputDEMImage::RegionType outRegion;
241 outRegion.SetIndex(0, 0);
242 outRegion.SetIndex(1, 0);
243 outRegion.SetSize(0,
static_cast<unsigned int>(std::floor((box_xmax - box_xmin) / std::abs(outSpacing[0]) + 0.5)));
244 outRegion.SetSize(1,
static_cast<unsigned int>(std::floor((box_ymax - box_ymin) / std::abs(outSpacing[1]) + 0.5)));
245 outputPtr->SetLargestPossibleRegion(outRegion);
246 outputPtr->SetNumberOfComponentsPerPixel(1);
249 itk::MetaDataDictionary& dictOutput = outputPtr->GetMetaDataDictionary();
257 if (!m_ProjectionRef.empty() && !isWGS84)
262 genericRSEstimator->SetInput(outputPtr);
264 genericRSEstimator->SetOutputProjectionRef(m_ProjectionRef);
265 genericRSEstimator->Compute();
266 outputPtr->SetSignedSpacing(genericRSEstimator->GetOutputSpacing());
267 outputPtr->SetOrigin(genericRSEstimator->GetOutputOrigin());
270 typename TOutputDEMImage::RegionType outRegion2;
271 outRegion2.SetIndex(0, 0);
272 outRegion2.SetIndex(1, 0);
273 outRegion2.SetSize(0, genericRSEstimator->GetOutputSize()[0]);
276 outRegion2.SetSize(1, genericRSEstimator->GetOutputSize()[1]);
277 outputPtr->SetLargestPossibleRegion(outRegion2);
278 outputPtr->SetNumberOfComponentsPerPixel(1);
281 itk::MetaDataDictionary& dict = outputPtr->GetMetaDataDictionary();
288 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
292 TOutputDEMImage* outputPtr = this->GetDEMOutput();
294 if (this->m_OutputParametersFrom3DMap == -2)
296 outputPtr->SetOrigin(m_OutputOrigin);
297 outputPtr->SetSignedSpacing(m_OutputSpacing);
299 typename TOutputDEMImage::RegionType outRegion;
300 outRegion.SetIndex(m_OutputStartIndex);
301 outRegion.SetSize(m_OutputSize);
302 outputPtr->SetLargestPossibleRegion(outRegion);
303 outputPtr->SetNumberOfComponentsPerPixel(1);
305 if (!m_ProjectionRef.empty())
308 itk::MetaDataDictionary& dict = this->GetOutput()->GetMetaDataDictionary();
314 this->SetOutputParametersFromImage();
317 if (!m_ProjectionRef.empty())
319 OGRSpatialReference oSRS;
320 #if GDAL_VERSION_NUM >= 3000000
321 const char* wkt = m_ProjectionRef.c_str();
323 char* wkt =
const_cast<char*
>(m_ProjectionRef.c_str());
325 oSRS.importFromWkt(&wkt);
326 m_IsGeographic = oSRS.IsGeographic();
330 std::vector<bool> noDataValueAvailable;
331 noDataValueAvailable.push_back(
true);
332 std::vector<double> noDataValue;
333 noDataValue.push_back(m_NoDataValue);
335 WriteNoDataFlags(noDataValueAvailable, noDataValue, outputPtr->GetImageMetadata());
338 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
341 const TOutputDEMImage* outputDEM = this->GetDEMOutput();
343 typename TOutputDEMImage::RegionType outRegion = outputDEM->GetRequestedRegion();
344 typename TOutputDEMImage::PointType outOrigin = outputDEM->GetOrigin();
345 typename TOutputDEMImage::SpacingType outSpacing = outputDEM->GetSignedSpacing();
349 corners[0][0] = outOrigin[0] + outSpacing[0] * (-0.5 +
static_cast<double>(outRegion.GetIndex(0)));
350 corners[0][1] = outOrigin[1] + outSpacing[1] * (-0.5 +
static_cast<double>(outRegion.GetIndex(1)));
351 corners[0][2] = m_ElevationMin;
353 corners[1][0] = corners[0][0];
354 corners[1][1] = corners[0][1];
355 corners[1][2] = m_ElevationMax;
357 corners[2][0] = corners[0][0] + outSpacing[0] *
static_cast<double>(outRegion.GetSize(0));
358 corners[2][1] = corners[0][1];
359 corners[2][2] = m_ElevationMin;
361 corners[3][0] = corners[2][0];
362 corners[3][1] = corners[2][1];
363 corners[3][2] = m_ElevationMax;
365 corners[4][0] = corners[0][0] + outSpacing[0] *
static_cast<double>(outRegion.GetSize(0));
366 corners[4][1] = corners[0][1] + outSpacing[1] *
static_cast<double>(outRegion.GetSize(1));
367 corners[4][2] = m_ElevationMin;
369 corners[5][0] = corners[4][0];
370 corners[5][1] = corners[4][1];
371 corners[5][2] = m_ElevationMax;
373 corners[6][0] = corners[0][0];
374 corners[6][1] = corners[0][1] + outSpacing[1] *
static_cast<double>(outRegion.GetSize(1));
375 corners[6][2] = m_ElevationMin;
377 corners[7][0] = corners[6][0];
378 corners[7][1] = corners[6][1];
379 corners[7][2] = m_ElevationMax;
381 for (
unsigned int k = 0; k < this->GetNumberOf3DMaps(); ++k)
385 T3DImage* imgPtr =
const_cast<T3DImage*
>(this->Get3DMapInput(k));
390 groundToSensorTransform->SetInputProjectionRef(m_ProjectionRef);
392 groundToSensorTransform->SetOutputImageMetadata(&(imgPtr->GetImageMetadata()));
393 groundToSensorTransform->SetOutputOrigin(imgPtr->GetOrigin());
394 groundToSensorTransform->SetOutputSpacing(imgPtr->GetSignedSpacing());
395 groundToSensorTransform->InstantiateTransform();
397 typename T3DImage::RegionType mapRegion = imgPtr->GetLargestPossibleRegion();
399 itk::ContinuousIndex<double, 2> mapContiIndex;
400 long int maxMapIndex[2] = {0, 0};
401 long int minMapIndex[2] = {0, 0};
402 maxMapIndex[0] =
static_cast<long int>(mapRegion.GetIndex(0) + mapRegion.GetSize(0));
403 maxMapIndex[1] =
static_cast<long int>(mapRegion.GetIndex(1) + mapRegion.GetSize(1));
404 minMapIndex[0] =
static_cast<long int>(mapRegion.GetIndex(0));
405 minMapIndex[1] =
static_cast<long int>(mapRegion.GetIndex(1));
407 long int minMapRequestedIndex[2] = {0, 0};
408 minMapRequestedIndex[0] = maxMapIndex[0] + 1;
409 minMapRequestedIndex[1] = maxMapIndex[1] + 1;
411 long int maxMapRequestedIndex[2] = {0, 0};
412 maxMapRequestedIndex[0] = 0;
413 maxMapRequestedIndex[1] = 0;
415 for (
unsigned int i = 0; i < 8; i++)
417 TDPointType tmpSensor = groundToSensorTransform->TransformPoint(corners[i]);
419 minMapRequestedIndex[0] = std::min(minMapRequestedIndex[0],
static_cast<long int>(tmpSensor[0] - m_Margin[0]));
421 minMapRequestedIndex[1] = std::min(minMapRequestedIndex[1],
static_cast<long int>(tmpSensor[1] - m_Margin[1]));
423 maxMapRequestedIndex[0] = std::max(maxMapRequestedIndex[0],
static_cast<long int>(tmpSensor[0] + m_Margin[0]));
425 maxMapRequestedIndex[1] = std::max(maxMapRequestedIndex[1],
static_cast<long int>(tmpSensor[1] + m_Margin[1]));
427 minMapRequestedIndex[0] = std::max(minMapRequestedIndex[0], minMapIndex[0]);
428 minMapRequestedIndex[1] = std::max(minMapRequestedIndex[1], minMapIndex[1]);
429 maxMapRequestedIndex[0] = std::min(maxMapRequestedIndex[0], maxMapIndex[0]);
430 maxMapRequestedIndex[1] = std::min(maxMapRequestedIndex[1], maxMapIndex[1]);
433 RegionType largest = imgPtr->GetLargestPossibleRegion();
436 if ((minMapRequestedIndex[0] < maxMapRequestedIndex[0]) && (minMapRequestedIndex[1] < maxMapRequestedIndex[1]))
438 requestedRegion.SetSize(0, maxMapRequestedIndex[0] - minMapRequestedIndex[0]);
439 requestedRegion.SetSize(1, maxMapRequestedIndex[1] - minMapRequestedIndex[1]);
440 requestedRegion.SetIndex(0, minMapRequestedIndex[0]);
441 requestedRegion.SetIndex(1, minMapRequestedIndex[1]);
445 requestedRegion.SetSize(0, 0);
446 requestedRegion.SetSize(1, 0);
447 requestedRegion.SetIndex(0, minMapIndex[0]);
448 requestedRegion.SetIndex(1, minMapIndex[1]);
451 imgPtr->SetRequestedRegion(requestedRegion);
453 TMaskImage* mskPtr =
const_cast<TMaskImage*
>(this->GetMaskInput(k));
457 if (mskPtr->GetLargestPossibleRegion() != largest)
459 itkExceptionMacro(<<
"mask and map at position " << k <<
" have a different largest region");
461 mskPtr->SetRequestedRegion(requestedRegion);
466 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
469 const TOutputDEMImage* outputDEM = this->GetDEMOutput();
473 m_NumberOfSplit.resize(this->GetNumberOf3DMaps());
475 unsigned int maximumRegionsNumber = 1;
477 for (
unsigned int k = 0; k < this->GetNumberOf3DMaps(); ++k)
479 m_MapSplitterList->PushBack(SplitterType::New());
480 T3DImage* imgPtr =
const_cast<T3DImage*
>(this->Get3DMapInput(k));
482 typename T3DImage::RegionType requestedRegion = imgPtr->GetRequestedRegion();
484 typename T3DImage::SizeType requestedSize = requestedRegion.GetSize();
485 unsigned int regionsNumber = 0;
486 if (requestedSize[0] * requestedSize[1] != 0)
488 regionsNumber = m_MapSplitterList->GetNthElement(k)->GetNumberOfSplits(requestedRegion, this->GetNumberOfWorkUnits());
490 m_NumberOfSplit[k] = regionsNumber;
491 otbMsgDevMacro(
"map " << k <<
" will be split into " << regionsNumber <<
" regions");
492 if (maximumRegionsNumber < regionsNumber)
493 maximumRegionsNumber = regionsNumber;
496 m_TempDEMRegions.clear();
497 m_TempDEMAccumulatorRegions.clear();
500 for (
unsigned int i = 0; i < maximumRegionsNumber; i++)
503 typename TOutputDEMImage::Pointer tmpImg = TOutputDEMImage::New();
504 tmpImg->SetNumberOfComponentsPerPixel(1);
505 tmpImg->SetRegions(outputDEM->GetRequestedRegion());
508 tmpImg->FillBuffer(m_NoDataValue);
509 m_TempDEMRegions.push_back(tmpImg);
512 tmpImg2->SetNumberOfComponentsPerPixel(1);
513 tmpImg2->SetRegions(outputDEM->GetRequestedRegion());
516 tmpImg2->FillBuffer(0.);
517 m_TempDEMAccumulatorRegions.push_back(tmpImg2);
520 if (!this->m_IsGeographic)
522 m_GroundTransform = RSTransform2DType::New();
524 m_GroundTransform->SetOutputProjectionRef(m_ProjectionRef);
525 m_GroundTransform->InstantiateTransform();
529 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
531 itk::ThreadIdType threadId)
533 TOutputDEMImage* outputPtr = this->GetOutput();
535 typename OutputImageType::PointType pointRef;
536 typename OutputImageType::PointType pointRefStep;
537 typename OutputImageType::RegionType requestedRegion = outputPtr->GetRequestedRegion();
545 typename TOutputDEMImage::IndexType index = requestedRegion.GetIndex();
546 outputPtr->TransformIndexToPhysicalPoint(index, pointRef);
558 TOutputDEMImage* tmpDEM =
nullptr;
560 typename TOutputDEMImage::RegionType outputRequestedRegion = outputPtr->GetRequestedRegion();
562 typename T3DImage::RegionType splitRegion;
566 itk::ImageRegionConstIterator<InputMapType> mapIt;
567 for (
unsigned int k = 0; k < this->GetNumberOf3DMaps(); ++k)
569 if (m_NumberOfSplit[k] > 0)
571 T3DImage* imgPtr =
const_cast<T3DImage*
>(this->Get3DMapInput(k));
572 TMaskImage* mskPtr =
const_cast<TMaskImage*
>(this->GetMaskInput(k));
574 typename InputMapType::PointType origin;
575 origin = imgPtr->GetOrigin();
576 typename InputMapType::SpacingType spacing;
579 if (
static_cast<unsigned int>(threadId) < m_NumberOfSplit[k])
581 splitRegion = m_MapSplitterList->GetNthElement(k)->GetSplit(threadId, m_NumberOfSplit[k], imgPtr->GetRequestedRegion());
583 tmpDEM = m_TempDEMRegions[threadId];
584 tmpAcc = m_TempDEMAccumulatorRegions[threadId];
586 mapIt = itk::ImageRegionConstIterator<InputMapType>(imgPtr, splitRegion);
588 itk::ImageRegionConstIterator<MaskImageType> maskIt;
589 bool useMask =
false;
593 maskIt = itk::ImageRegionConstIterator<MaskImageType>(mskPtr, splitRegion);
597 while (!mapIt.IsAtEnd())
602 if (!(maskIt.Get() > 0))
610 position = mapIt.Get();
613 if (!this->m_IsGeographic)
617 tmpPoint[0] = position[0];
618 tmpPoint[1] = position[1];
620 position[0] = groundPosition[0];
621 position[1] = groundPosition[1];
630 typename OutputImageType::PointType point2D;
631 point2D[0] = position[0];
632 point2D[1] = position[1];
633 itk::ContinuousIndex<double, 2> continuousIndex;
638 outputPtr->TransformPhysicalPointToContinuousIndex(point2D, continuousIndex);
639 typename OutputImageType::IndexType cellIndex;
640 cellIndex[0] =
static_cast<int>(std::floor(continuousIndex[0] + 0.5));
641 cellIndex[1] =
static_cast<int>(std::floor(continuousIndex[1] + 0.5));
651 if (outputRequestedRegion.IsInside(cellIndex))
661 tmpAcc->SetPixel(cellIndex, tmpAcc->GetPixel(cellIndex) + 1);
665 tmpDEM->SetPixel(cellIndex, cellHeight);
669 DEMPixelType cellCurrentValue = tmpDEM->GetPixel(cellIndex);
671 switch (this->m_CellFusionMode)
675 if (cellHeight < cellCurrentValue)
677 tmpDEM->SetPixel(cellIndex, cellHeight);
683 if (cellHeight > cellCurrentValue)
685 tmpDEM->SetPixel(cellIndex, cellHeight);
691 tmpDEM->SetPixel(cellIndex, cellCurrentValue + cellHeight);
700 itkExceptionMacro(<<
"Unexpected value cell fusion mode :" << this->m_CellFusionMode);
714 splitRegion = requestedRegion;
721 template <
class T3DImage,
class TMaskImage,
class TOutputDEMImage>
725 TOutputDEMImage* outputDEM = this->GetOutput();
728 if (m_TempDEMRegions.size() < 1)
730 outputDEM->FillBuffer(m_NoDataValue);
734 itk::ImageRegionIterator<OutputImageType> outputDEMIt(outputDEM, outputDEM->GetRequestedRegion());
735 itk::ImageRegionIterator<OutputImageType> firstDEMIt(m_TempDEMRegions[0], outputDEM->GetRequestedRegion());
736 itk::ImageRegionIterator<AccumulatorImageType> firstDEMAccIt(m_TempDEMAccumulatorRegions[0], outputDEM->GetRequestedRegion());
739 outputDEMIt.GoToBegin();
740 firstDEMIt.GoToBegin();
741 firstDEMAccIt.GoToBegin();
744 while (!outputDEMIt.IsAtEnd() && !firstDEMIt.IsAtEnd() && !firstDEMAccIt.IsAtEnd())
751 outputDEMIt.Set(m_NoDataValue);
758 outputDEMIt.Set(pixelValue);
762 outputDEMIt.Set(firstDEMIt.Get() /
static_cast<DEMPixelType>(accPixel));
775 for (
unsigned int i = 1; i < m_TempDEMRegions.size(); i++)
778 itk::ImageRegionIterator<OutputImageType> tmpDEMIt(m_TempDEMRegions[i], outputDEM->GetRequestedRegion());
779 itk::ImageRegionIterator<AccumulatorImageType> tmpDEMAccIt(m_TempDEMAccumulatorRegions[i], outputDEM->GetRequestedRegion());
781 outputDEMIt.GoToBegin();
782 tmpDEMIt.GoToBegin();
783 tmpDEMAccIt.GoToBegin();
784 firstDEMAccIt.GoToBegin();
785 while (!outputDEMIt.IsAtEnd() && !tmpDEMIt.IsAtEnd() && !tmpDEMAccIt.IsAtEnd() && !firstDEMAccIt.IsAtEnd())
795 switch (this->m_CellFusionMode)
799 if ((cellHeight < cellCurrentValue) || (cellCurrentValue == m_NoDataValue))
801 outputDEMIt.Set(cellHeight);
807 if ((cellHeight > cellCurrentValue) || ((cellCurrentValue == m_NoDataValue)))
809 outputDEMIt.Set(cellHeight);
816 outputDEMIt.Set(cellCurrentValue *
static_cast<DEMPixelType>(cellCurrentValue != m_NoDataValue) + cellHeight);
817 firstDEMAccIt.Set(firstDEMAccIt.Get() + accPixel);
822 firstDEMAccIt.Set(firstDEMAccIt.Get() + accPixel);
827 itkExceptionMacro(<<
"Unexpected value cell fusion mode :" << this->m_CellFusionMode);
832 if (i == (m_TempDEMRegions.size() - 1))
836 if (
static_cast<DEMPixelType>(firstDEMAccIt.Get()) != 0)
838 outputDEMIt.Set(outputDEMIt.Get() /
static_cast<DEMPixelType>(firstDEMAccIt.Get()));
842 outputDEMIt.Set(m_NoDataValue);
847 outputDEMIt.Set(
static_cast<DEMPixelType>(firstDEMAccIt.Get()));
itk::SmartPointer< Self > Pointer
Creation of an "otb" image which contains metadata.
itk::SmartPointer< Self > Pointer
SpacingType GetSignedSpacing() const
const T3DImage * Get3DMapInput(unsigned int index) const
unsigned int GetNumberOf3DMaps()
void SetMaskInput(unsigned int index, const TMaskImage *mask)
RSTransformType::InputPointType TDPointType
void Set3DMapInput(unsigned int index, const T3DImage *hmap)
OutputImageType::PixelType DEMPixelType
AccumulatorImageType::PixelType AccumulatorPixelType
~Multi3DMapToDEMFilter() override
void BeforeThreadedGenerateData() override
const TMaskImage * GetMaskInput(unsigned int index) const
void SetOutputParametersFromImage()
const TOutputDEMImage * GetDEMOutput() const
InputMapType::PixelType MapPixelType
void SetNumberOf3DMaps(unsigned int nb)
void AfterThreadedGenerateData() override
void GenerateOutputInformation() override
OutputImageType::RegionType RegionType
void GenerateInputRequestedRegion() override
void ThreadedGenerateData(const RegionType &outputRegionForThread, itk::ThreadIdType threadId) override
static SpatialReference FromWGS84()
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
void OTBMetadata_EXPORT WriteNoDataFlags(const std::vector< bool > &flags, const std::vector< double > &values, ImageMetadata &imd)
#define otbMsgDevMacro(x)