Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Youssefi
otb
Commits
ee21beb2
Commit
ee21beb2
authored
14 years ago
by
Otmane Lahlou
Browse files
Options
Downloads
Patches
Plain Diff
ENH : correct the input rpc model estimation
parent
7bb14c7d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Projections/otbGenericRSResampleImageFilter.h
+4
-1
4 additions, 1 deletion
Code/Projections/otbGenericRSResampleImageFilter.h
Code/Projections/otbGenericRSResampleImageFilter.txx
+44
-10
44 additions, 10 deletions
Code/Projections/otbGenericRSResampleImageFilter.txx
with
48 additions
and
11 deletions
Code/Projections/otbGenericRSResampleImageFilter.h
+
4
−
1
View file @
ee21beb2
...
@@ -243,12 +243,15 @@ private:
...
@@ -243,12 +243,15 @@ private:
GenericRSResampleImageFilter
(
const
Self
&
);
//purposely not implemented
GenericRSResampleImageFilter
(
const
Self
&
);
//purposely not implemented
void
operator
=
(
const
Self
&
);
//purposely not implemented
void
operator
=
(
const
Self
&
);
//purposely not implemented
// Method to estimate the output rpc model
// Method to estimate the
input &
output rpc model
void
EstimateOutputRpcModel
();
void
EstimateOutputRpcModel
();
void
EstimateInputRpcModel
();
// boolean that allow the estimation of the input rpc model
// boolean that allow the estimation of the input rpc model
bool
m_EstimateInputRpcModel
;
bool
m_EstimateInputRpcModel
;
bool
m_EstimateOutputRpcModel
;
bool
m_EstimateOutputRpcModel
;
bool
m_rpcEstimationUpdated
;
// Filters pointers
// Filters pointers
ResamplerPointerType
m_Resampler
;
ResamplerPointerType
m_Resampler
;
...
...
This diff is collapsed.
Click to expand it.
Code/Projections/otbGenericRSResampleImageFilter.txx
+
44
−
10
View file @
ee21beb2
...
@@ -30,7 +30,8 @@ namespace otb
...
@@ -30,7 +30,8 @@ namespace otb
template <class TInputImage, class TOutputImage, class TDeformationField>
template <class TInputImage, class TOutputImage, class TDeformationField>
GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField>
GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField>
::GenericRSResampleImageFilter():m_EstimateInputRpcModel(false),
::GenericRSResampleImageFilter():m_EstimateInputRpcModel(false),
m_EstimateOutputRpcModel(false)
m_EstimateOutputRpcModel(false),
m_rpcEstimationUpdated(false)
{
{
// internal filters instanciation
// internal filters instanciation
m_Resampler = ResamplerType::New();
m_Resampler = ResamplerType::New();
...
@@ -66,7 +67,6 @@ void
...
@@ -66,7 +67,6 @@ void
GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField>
GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField>
::GenerateOutputInformation()
::GenerateOutputInformation()
{
{
std::cout <<"GenerateOutputInformation" << std::endl;
// call the superclass's implementation of this method
// call the superclass's implementation of this method
Superclass::GenerateOutputInformation();
Superclass::GenerateOutputInformation();
...
@@ -142,11 +142,13 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField>
...
@@ -142,11 +142,13 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField>
{
{
if(m_EstimateInputRpcModel)
if(m_EstimateInputRpcModel)
{
{
//std::cout <<"m_InputRpcEstimator->GetOutput()->GetImageKeywordlist() "<< m_InputRpcEstimator->GetOutput()->GetImageKeywordlist() << std::endl;
m_Transform->SetOutputKeywordList( m_InputRpcEstimator->GetOutput()->GetImageKeywordlist());
m_Transform->SetOutputKeywordList( m_InputRpcEstimator->GetOutput()->GetImageKeywordlist());
}
}
if(m_EstimateOutputRpcModel)
if(m_EstimateOutputRpcModel)
{
{
//std::cout <<"m_OutputRpcEstimator->GetOutput()->GetImageKeywordlist() "<< m_OutputRpcEstimator->GetOutput()->GetImageKeywordlist() << std::endl;
m_Transform->SetInputKeywordList( m_OutputRpcEstimator->GetOutput()->GetImageKeywordlist());
m_Transform->SetInputKeywordList( m_OutputRpcEstimator->GetOutput()->GetImageKeywordlist());
}
}
...
@@ -173,19 +175,14 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField>
...
@@ -173,19 +175,14 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField>
RegionType requestedRegion = outputPtr->GetRequestedRegion();
RegionType requestedRegion = outputPtr->GetRequestedRegion();
// Generate input requested region
// Generate input requested region
if (m_EstimateInputRpcModel)
if (m_EstimateInputRpcModel
&& !m_rpcEstimationUpdated
)
{
{
m_InputRpcEstimator->SetInput(this->GetInput());
this->EstimateInputRpcModel();
m_Resampler->SetInput(m_InputRpcEstimator->GetOutput());
}
else
{
m_Resampler->SetInput(this->GetInput());
}
}
// Instanciate the RS transform
// Instanciate the RS transform
this->UpdateTransform();
this->UpdateTransform();
m_Resampler->SetInput(this->GetInput());
m_Resampler->SetTransform(m_Transform);
m_Resampler->SetTransform(m_Transform);
m_Resampler->SetDeformationFieldSpacing(this->GetDeformationFieldSpacing());
m_Resampler->SetDeformationFieldSpacing(this->GetDeformationFieldSpacing());
m_Resampler->GetOutput()->UpdateOutputInformation();
m_Resampler->GetOutput()->UpdateOutputInformation();
...
@@ -193,6 +190,43 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField>
...
@@ -193,6 +190,43 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField>
m_Resampler->GetOutput()->PropagateRequestedRegion();
m_Resampler->GetOutput()->PropagateRequestedRegion();
}
}
/**
* Method to estimate the rpc model of the output using a temporary image
*/
template <class TInputImage, class TOutputImage, class TDeformationField>
void
GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField>
::EstimateInputRpcModel()
{
// Get the output dictionary
itk::MetaDataDictionary& dict = const_cast<InputImageType*>(this->GetInput())->GetMetaDataDictionary();
// Temp image : not allocated but with the sampe metadata as the
// output
typename InputImageType::Pointer tempPtr = InputImageType::New();
tempPtr->SetRegions(this->GetInput()->GetLargestPossibleRegion());
// Encapsulate the output metadata in the temp image
itk::MetaDataDictionary& tempDict = tempPtr->GetMetaDataDictionary();
itk::EncapsulateMetaData<std::string>(tempDict, MetaDataKey::ProjectionRefKey,
this->GetInputProjectionRef() );
itk::EncapsulateMetaData<ImageKeywordlist>(tempDict, MetaDataKey::OSSIMKeywordlistKey,
this->GetInputKeywordList());
// Estimate the rpc model from the temp image
m_InputRpcEstimator->SetInput(tempPtr);
m_InputRpcEstimator->GenerateOutputInformation();
// Encapsulate the estimated rpc model in the output
if(m_InputRpcEstimator->GetInput()->GetImageKeywordlist().GetSize() > 0)
itk::EncapsulateMetaData<ImageKeywordlist>(dict,
MetaDataKey::OSSIMKeywordlistKey,
m_InputRpcEstimator->GetOutput()->GetImageKeywordlist());
//Update the flag for input rpcEstimation
m_rpcEstimationUpdated = true;
}
/**
/**
* Method used to copy the parameters of the input image
* Method used to copy the parameters of the input image
*
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment