21 #ifndef otbDEMToImageGenerator_hxx
22 #define otbDEMToImageGenerator_hxx
26 #include "itkProgressReporter.h"
31 template <
class TDEMImage>
34 m_OutputSpacing[0] = 0.0001;
35 m_OutputSpacing[1] = -0.0001;
38 m_OutputOrigin[0] = 0;
39 m_OutputOrigin[1] = 0;
40 m_DefaultUnknownValue = itk::NumericTraits<PixelType>::ZeroValue();
41 m_AboveEllipsoid =
false;
43 m_Transform = GenericRSTransformType::New();
47 template <
class TDEMImage>
58 largestPossibleRegion.SetSize(m_OutputSize);
59 largestPossibleRegion.SetIndex(start);
61 output->SetLargestPossibleRegion(largestPossibleRegion);
62 output->SetSignedSpacing(m_OutputSpacing);
63 output->SetOrigin(m_OutputOrigin);
67 if (m_Transform->GetInputImageMetadata() !=
nullptr)
68 output->m_Imd.Merge(*m_Transform->GetInputImageMetadata());
72 template <
class TDEMImage>
75 m_Transform->InstantiateTransform();
78 template <
class TDEMImage>
81 InstantiateTransform();
85 DEMImage->SetBufferedRegion(DEMImage->GetRequestedRegion());
87 DEMImage->FillBuffer(0);
91 template <
class TDEMImage>
100 itk::ProgressReporter progress(
this, threadId, outputRegionForThread.GetNumberOfPixels());
108 for (outIt.GoToBegin(); !outIt.IsAtEnd(); ++outIt)
110 currentindex = outIt.GetIndex();
111 DEMImage->TransformIndexToPhysicalPoint(currentindex, phyPoint);
114 if (m_Transform.IsNotNull())
116 geoPoint = m_Transform->TransformPoint(phyPoint);
117 if (m_AboveEllipsoid)
130 if (m_AboveEllipsoid)
147 if (!vnl_math_isnan(height))
150 DEMImage->SetPixel(currentindex,
static_cast<PixelType>(height));
155 DEMImage->SetPixel(currentindex, m_DefaultUnknownValue);
157 progress.CompletedPixel();
161 template <
class TDEMImage>
164 Superclass::PrintSelf(os, indent);
166 os << indent <<
"Output Spacing:" << m_OutputSpacing[0] <<
"," << m_OutputSpacing[1] << std::endl;
167 os << indent <<
"Output Origin:" << m_OutputOrigin[0] <<
"," << m_OutputOrigin[1] << std::endl;
168 os << indent <<
"Output Size:" << m_OutputSize[0] <<
"," << m_OutputSize[1] << std::endl;