Skip to content
Snippets Groups Projects
Commit 929d1400 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

ENH: add streaming to DEMToOrthoImageGenerator

parent 4cc351f5
No related branches found
No related tags found
No related merge requests found
......@@ -103,7 +103,6 @@ protected:
~DEMToImageGenerator(){};
void PrintSelf(std::ostream& os, itk::Indent indent) const;
// void GenerateData();
void BeforeThreadedGenerateData();
void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
int threadId);
......
......@@ -70,50 +70,6 @@ void DEMToImageGenerator<TDEMImage>
output->SetOrigin(m_OutputOrigin);
}
/*
// GenerateData method
template <class TDEMImage>
void
DEMToImageGenerator<TDEMImage>
::GenerateData()
{
DEMImagePointerType DEMImage = this->GetOutput();
// allocate the output buffer
DEMImage->SetBufferedRegion( DEMImage->GetRequestedRegion() );
DEMImage->Allocate();
DEMImage->FillBuffer(0);
// Create an iterator that will walk the output region
ImageIteratorType outIt = ImageIteratorType(DEMImage,DEMImage->GetRequestedRegion());
// Walk the output image, evaluating the height at each pixel
IndexType currentindex;
PointType phyPoint;
double height;
for (outIt.GoToBegin(); !outIt.IsAtEnd(); ++outIt)
{
currentindex=outIt.GetIndex();
DEMImage->TransformIndexToPhysicalPoint(currentindex, phyPoint);
// otbMsgDevMacro(<< "PhyPoint : (" << phyPoint[0] << "," << phyPoint[1] << ")");
height=m_DEMHandler->GetHeightAboveMSL(phyPoint); // Altitude calculation
// otbMsgDevMacro(<< "height" << height);
// MNT sets a default value (-32768) at point where it doesn't have altitude information.
// OSSIM has chosen to change this default value in OSSIM_DBL_NAN (-4.5036e15).
if (!ossim::isnan(height))
{
// Fill the image
DEMImage->SetPixel(currentindex, static_cast<PixelType>(height) );
}
else
{
// Back to the MNT default value
DEMImage->SetPixel(currentindex, m_DefaultUnknownValue);
}
}
}*/
template <class TDEMImage>
void
......
......@@ -100,11 +100,13 @@ public :
protected:
DEMToOrthoImageGenerator();
~DEMToOrthoImageGenerator();
~DEMToOrthoImageGenerator(){};
void PrintSelf(std::ostream& os, Indent indent) const;
void GenerateData();
virtual void GenerateOutputInformation();
void BeforeThreadedGenerateData();
void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
int threadId);
DEMHandlerPointerType m_DEMHandler;
PointType m_OutputOrigin;
......
......@@ -41,14 +41,6 @@ DEMToOrthoImageGenerator<TDEMImage, TMapProjection>
m_MapProjection = NULL;
}
template<class TDEMImage, class TMapProjection>
DEMToOrthoImageGenerator<TDEMImage, TMapProjection>
::~DEMToOrthoImageGenerator()
{
// Nothing to be done...
}
// GenerateOutputInformation method
template <class TDEMImage, class TMapProjection>
void DEMToOrthoImageGenerator<TDEMImage, TMapProjection>
......@@ -71,27 +63,37 @@ void DEMToOrthoImageGenerator<TDEMImage, TMapProjection>
output->SetOrigin(m_OutputOrigin);
}
// GenerateData method
template <class TDEMImage, class TMapProjection>
void
DEMToOrthoImageGenerator<TDEMImage, TMapProjection>
::GenerateData()
::BeforeThreadedGenerateData()
{
if (!m_MapProjection)
{
itkExceptionMacro( <<
"Please set map projection!" );
}
DEMImagePointerType DEMImage = this->GetOutput();
// allocate the output buffer
DEMImage->SetBufferedRegion( DEMImage->GetRequestedRegion() );
DEMImage->Allocate();
DEMImage->FillBuffer(0);
}
// GenerateData method
template <class TDEMImage, class TMapProjection>
void
DEMToOrthoImageGenerator<TDEMImage, TMapProjection>
::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
int threadId)
{
DEMImagePointerType DEMImage = this->GetOutput();
// Create an iterator that will walk the output region
ImageIteratorType outIt = ImageIteratorType(DEMImage,DEMImage->GetRequestedRegion());
ImageIteratorType outIt = ImageIteratorType(DEMImage, outputRegionForThread);
// Walk the output image, evaluating the height at each pixel
IndexType currentindex;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment