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
7112b7b5
Commit
7112b7b5
authored
14 years ago
by
Otmane Lahlou
Browse files
Options
Downloads
Patches
Plain Diff
ENH : add support for input rpc model estimation
parent
2b965b2b
No related branches found
Branches containing commit
No related tags found
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
+61
-13
61 additions, 13 deletions
Code/Projections/otbGenericRSResampleImageFilter.h
Code/Projections/otbGenericRSResampleImageFilter.txx
+22
-11
22 additions, 11 deletions
Code/Projections/otbGenericRSResampleImageFilter.txx
with
83 additions
and
24 deletions
Code/Projections/otbGenericRSResampleImageFilter.h
+
61
−
13
View file @
7112b7b5
...
...
@@ -20,17 +20,28 @@
#include
"itkImageToImageFilter.h"
#include
"otbOptResampleImageFilter.h"
#include
"otbPhysicalToRPCSensorModelImageFilter.h"
#include
"otbGenericRSTransform.h"
namespace
otb
{
/** \class GenericRSResampleImageFilter
* \brief This class is a composite filter
*
* \brief This class is a composite filter that allows you to project
* an input image from any coordinate system to any other one. The
* coordinate systems can be defined by their projection reference,
* the keyword list or a meta data dictionary.
*
*
* This class uses the otb::StreamingResampleImageFilter. It defines
* and uses a otb::GenericRSTransform using the input/output coordinate
* system informations listed below. This class can resample the input to an
* output image with the Size/Origin/Spacing/StartIndex defined by
* the user. Note that there are no default values for all the
* parmeters, so it is mandatory to set correct parameters to have a
* correct result.
*
*
*
* \ingroup Projection
*
...
...
@@ -69,6 +80,10 @@ public:
typedef
typename
ResamplerType
::
IndexType
IndexType
;
typedef
typename
ResamplerType
::
RegionType
RegionType
;
typedef
typename
ResamplerType
::
InterpolatorType
InterpolatorType
;
/** Estimate the rpc model */
typedef
PhysicalToRPCSensorModelImageFilter
<
InputImageType
>
RpcModelEstimatorType
;
typedef
typename
RpcModelEstimatorType
::
Pointer
RpcModelEstimatorPointerType
;
/** Specialisation of OptResampleFilter with a remote
* sensing transform
...
...
@@ -110,7 +125,6 @@ public:
otbSetObjectMemberMacro
(
Resampler
,
OutputSpacing
,
SpacingType
);
otbGetObjectMemberConstReferenceMacro
(
Resampler
,
OutputSpacing
,
SpacingType
);
/** Methods to Set/Get the interpolator */
void
SetInterpolator
(
InterpolatorType
*
interpolator
)
{
...
...
@@ -119,20 +133,33 @@ public:
}
otbGetObjectMemberConstMacro
(
Resampler
,
Interpolator
,
const
InterpolatorType
*
);
/** Set/Get for input and output projections. */
/**
* Set/Get input & output projections.
* Set/Get input & output keywordlist
* The macro are not used here cause the input and the output are
* inversed.
*/
void
SetInputProjectionRef
(
const
std
::
string
&
ref
)
{
m_Transform
->
SetOutputProjectionRef
(
ref
);
this
->
Modified
();
}
otbGetObjectMemberMacro
(
Transform
,
InputProjectionRef
,
std
::
string
);
std
::
string
GetInputProjectionRef
()
{
return
m_Transform
->
GetOutputProjectionRef
();
}
void
SetOutputProjectionRef
(
const
std
::
string
&
ref
)
{
m_Transform
->
SetInputProjectionRef
(
ref
);
this
->
Modified
();
}
otbGetObjectMemberMacro
(
Transform
,
OutputProjectionRef
,
std
::
string
);
std
::
string
GetOutputProjectionRef
()
{
return
m_Transform
->
GetInputProjectionRef
();
}
/** Set/Get Input Keywordlist*/
void
SetInputKeywordList
(
const
ImageKeywordlist
&
kwl
)
...
...
@@ -140,7 +167,10 @@ public:
m_Transform
->
SetOutputKeywordList
(
kwl
);
this
->
Modified
();
}
otbGetObjectMemberConstMacro
(
Transform
,
InputKeywordList
,
ImageKeywordlist
);
const
ImageKeywordlist
GetInputKeywordList
()
{
return
m_Transform
->
GetOutputKeywordList
();
}
/** Set/Get output Keywordlist*/
void
SetOutputKeywordList
(
const
ImageKeywordlist
&
kwl
)
...
...
@@ -148,7 +178,11 @@ public:
m_Transform
->
SetInputKeywordList
(
kwl
);
this
->
Modified
();
}
otbGetObjectMemberConstMacro
(
Transform
,
OutputKeywordList
,
ImageKeywordlist
);
ImageKeywordlist
GetOutputKeywordList
()
{
return
m_Transform
->
GetInputKeywordList
();
}
/** Set/Get the DEMDirectory*/
void
SetDEMDirectory
(
const
std
::
string
&
dem
)
...
...
@@ -157,9 +191,19 @@ public:
this
->
Modified
();
}
otbGetObjectMemberConstMacro
(
Transform
,
DEMDirectory
,
std
::
string
);
/** Useful to set the output parameters from an existing image*/
void
SetOutputParametersFromImage
(
const
InputImageType
*
image
);
/** Macro to Set/Get the grid spacing for rpc estimator*/
otbSetObjectMemberMacro
(
InputRpcEstimator
,
GridSpacing
,
unsigned
int
);
otbGetObjectMemberConstMacro
(
InputRpcEstimator
,
GridSpacing
,
unsigned
int
);
// Macro to tune the EstimateInputRpcModel flag
itkSetMacro
(
EstimateInputRpcModel
,
bool
);
itkGetMacro
(
EstimateInputRpcModel
,
bool
);
itkBooleanMacro
(
EstimateInputRpcModel
);
protected
:
GenericRSResampleImageFilter
();
/** Destructor */
...
...
@@ -173,9 +217,13 @@ private:
GenericRSResampleImageFilter
(
const
Self
&
);
//purposely not implemented
void
operator
=
(
const
Self
&
);
//purposely not implemented
// boolean that allow the estimation of the input rpc model
bool
m_EstimateInputRpcModel
;
// Filters pointers
ResamplerPointerType
m_Resampler
;
GenericRSTransformPointerType
m_Transform
;
ResamplerPointerType
m_Resampler
;
RpcModelEstimatorPointerType
m_InputRpcEstimator
;
GenericRSTransformPointerType
m_Transform
;
};
}
// namespace otb
...
...
This diff is collapsed.
Click to expand it.
Code/Projections/otbGenericRSResampleImageFilter.txx
+
22
−
11
View file @
7112b7b5
...
...
@@ -30,12 +30,13 @@ namespace otb
template <class TInputImage, class TOutputImage, class TDeformationField>
GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField>
::GenericRSResampleImageFilter()
::GenericRSResampleImageFilter()
:m_EstimateInputRpcModel(false)
{
// internal filters instanciation
m_Resampler = ResamplerType::New();
m_Transform = GenericRSTransformType::New();
m_Resampler = ResamplerType::New();
m_InputRpcEstimator = RpcModelEstimatorType::New();
m_Transform = GenericRSTransformType::New();
// Initialize the deformation field spacing
SpacingType initSpacing;
initSpacing[0]= 2.;
...
...
@@ -43,8 +44,6 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField>
this->SetDeformationFieldSpacing(initSpacing);
}
template <class TInputImage, class TOutputImage, class TDeformationField>
void
GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField>
...
...
@@ -80,12 +79,16 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField>
outputPtr->SetLargestPossibleRegion(region);
// E
xpos
e the
in
put metadata
to the output
// E
ncapsulat
e the
out
put
metadata
itk::MetaDataDictionary& dict = this->GetOutput()->GetMetaDataDictionary();
// GetInputProjectionRef is used here cause the RS transform is
// inversed : Output -> Input
itk::EncapsulateMetaData<std::string>(dict, MetaDataKey::ProjectionRefKey,
this->GetInputProjectionRef());
this->GetOutputProjectionRef());
if(this->GetOutputKeywordList().GetSize() > 0)
{
itk::EncapsulateMetaData<ImageKeywordlist>(dict, MetaDataKey::OSSIMKeywordlistKey,
this->GetOutputKeywordList());
}
outputPtr->SetMetaDataDictionary(dict);
}
...
...
@@ -112,7 +115,15 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage, TDeformationField>
m_Transform->InstanciateTransform();
// Generate input requested region
m_Resampler->SetInput(inputPtr);
if (m_EstimateInputRpcModel)
{
m_InputRpcEstimator->SetInput(this->GetInput());
m_Resampler->SetInput(m_InputRpcEstimator->GetOutput());
}
else
{
m_Resampler->SetInput(this->GetInput());
}
m_Resampler->SetTransform(m_Transform);
m_Resampler->SetDeformationFieldSpacing(this->GetDeformationFieldSpacing());
m_Resampler->GetOutput()->UpdateOutputInformation();
...
...
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