Skip to content
Snippets Groups Projects
Commit eb65a4d2 authored by Otmane Lahlou's avatar Otmane Lahlou
Browse files

ENH : simplify the class

parent 1cfa6279
Branches
Tags
No related merge requests found
......@@ -76,7 +76,7 @@ public:
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(OrthoRectificationFilter, StreamingResampleImageFilter);
itkTypeMacro(OrthoRectificationFilter, GenericRSResampleImageFilter);
/** Accessors */
virtual void SetMapProjection(MapProjectionType* arg)
......@@ -84,7 +84,6 @@ public:
if (this->m_MapProjection != arg)
{
this->m_MapProjection = arg;
m_IsComputed = false;
this->Modified();
}
}
......@@ -100,19 +99,13 @@ protected:
OrthoRectificationFilter();
virtual ~OrthoRectificationFilter();
void PrintSelf(std::ostream& os, itk::Indent indent) const;
virtual void GenerateInputRequestedRegion();
virtual void GenerateOutputInformation(void);
private:
OrthoRectificationFilter(const Self &); //purposely not implemented
void operator =(const Self&); //purposely not implemented
/** Calculate transformation model from sensor model and map projection composition */
void ComputeResampleTransformationModel();
/** Boolean used to know if transformation model computation is needed */
bool m_IsComputed;
/** Map Projection used to transform cartographic coordinates in geographic coordinates */
MapProjectionPointerType m_MapProjection;
......
......@@ -26,17 +26,13 @@ namespace otb
template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision>
OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision>
::OrthoRectificationFilter()
{
m_MapProjection = MapProjectionType::New();
m_IsComputed = false;
}
::OrthoRectificationFilter(): m_MapProjection(NULL)
{}
template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision>
OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision>
::~OrthoRectificationFilter()
{
}
{}
template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision>
void OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision>
......@@ -51,7 +47,6 @@ void
OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision>
::GenerateInputRequestedRegion()
{
this->ComputeResampleTransformationModel();
Superclass::GenerateInputRequestedRegion();
}
......@@ -62,25 +57,16 @@ OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolato
{
// call the superclass' implementation of this method
Superclass::GenerateOutputInformation();
// fill up the metadata information for ProjectionRef
itk::MetaDataDictionary& dict = this->GetOutput()->GetMetaDataDictionary();
std::string projectionRef = m_MapProjection->GetWkt();
itk::EncapsulateMetaData<std::string>(dict, MetaDataKey::ProjectionRefKey, projectionRef);
// Fill the GenericRSTransform with those information
this->SetOutputProjectionRef(projectionRef);
}
template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision>
void
OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision>
::ComputeResampleTransformationModel()
{
if (m_IsComputed == false)
if(!m_MapProjection.IsNull() && !m_MapProjection->GetWkt().empty())
{
this->SetInputKeywordList(this->GetInput()->GetImageKeywordlist());
m_IsComputed = true;
// fill up the metadata information for ProjectionRef
itk::MetaDataDictionary& dict = this->GetOutput()->GetMetaDataDictionary();
std::string projectionRef = m_MapProjection->GetWkt();
itk::EncapsulateMetaData<std::string>(dict, MetaDataKey::ProjectionRefKey, projectionRef);
// Fill the GenericRSTransform with those information
this->SetOutputProjectionRef(projectionRef);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment