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
47acd787
Commit
47acd787
authored
13 years ago
by
Otmane Lahlou
Browse files
Options
Downloads
Plain Diff
MRG
parents
6d433de2
e8ccc5a3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Applications/Projections/otbSuperimpose.cxx
+167
-0
167 additions, 0 deletions
Applications/Projections/otbSuperimpose.cxx
with
167 additions
and
0 deletions
Applications/Projections/otbSuperimpose.cxx
0 → 100644
+
167
−
0
View file @
47acd787
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include
"otbWrapperApplication.h"
#include
"otbWrapperApplicationFactory.h"
#include
"otbGenericRSResampleImageFilter.h"
#include
"otbBCOInterpolateImageFunction.h"
namespace
otb
{
namespace
Wrapper
{
class
Superimpose
:
public
Application
{
public:
/** Standard class typedefs. */
typedef
Superimpose
Self
;
typedef
Application
Superclass
;
typedef
itk
::
SmartPointer
<
Self
>
Pointer
;
typedef
itk
::
SmartPointer
<
const
Self
>
ConstPointer
;
/** Standard macro */
itkNewMacro
(
Self
);
itkTypeMacro
(
Superimpose
,
Application
);
typedef
unsigned
short
int
PixelType
;
typedef
otb
::
BCOInterpolateImageFunction
<
UInt16VectorImageType
>
InterpolatorType
;
typedef
otb
::
GenericRSResampleImageFilter
<
UInt16VectorImageType
,
UInt16VectorImageType
>
ResamplerType
;
private:
Superimpose
()
{
SetName
(
"Superimpose"
);
SetDescription
(
"Using available image metadata, project one image onto another one"
);
// Documentation
SetDocName
(
"Superimpose sensor application"
);
SetDocLongDescription
(
"This application performs /...."
);
SetDocLimitations
(
"None"
);
SetDocAuthors
(
"OTB-Team"
);
SetDocSeeAlso
(
" "
);
SetDocCLExample
(
"otbApplicationLauncherCommandLine Superimpose ${OTB-BIN}/bin "
"--inr ${OTB-Data}/Examples/QB_Toulouse_Ortho_PAN.tif --inm ${OTB-Data}/Examples/QB_Toulouse_Ortho_XS.tif "
"--out otbSuperimposedXS_to_PAN.tif"
);
AddDocTag
(
"Projection"
);
AddDocTag
(
"Image manipulation"
);
AddDocTag
(
"Superimposition"
);
}
virtual
~
Superimpose
()
{
}
void
DoCreateParameters
()
{
AddParameter
(
ParameterType_InputImage
,
"inr"
,
"Reference input"
);
AddParameter
(
ParameterType_InputImage
,
"inm"
,
"The image to reproject"
);
AddParameter
(
ParameterType_Directory
,
"dem"
,
"DEM directory"
);
AddParameter
(
ParameterType_Float
,
"lms"
,
"Spacing of the deformation field"
);
SetParameterDescription
(
"lms"
,
"Generate a coarser deformation field with the given spacing"
);
SetDefaultParameterFloat
(
"lms"
,
4.
);
AddParameter
(
ParameterType_OutputImage
,
"out"
,
"Output image"
);
AddParameter
(
ParameterType_RAM
,
"ram"
,
"Available RAM"
);
SetDefaultParameterInt
(
"ram"
,
256
);
MandatoryOff
(
"dem"
);
MandatoryOff
(
"lms"
);
MandatoryOff
(
"ram"
);
}
void
DoUpdateParameters
()
{
// Nothing to do here : all parameters are independent
}
void
DoExecute
()
{
// Get the inputs
UInt16VectorImageType
*
refImage
=
GetParameterUInt16VectorImage
(
"inr"
);
UInt16VectorImageType
*
movingImage
=
GetParameterUInt16VectorImage
(
"inm"
);
// Resample filter
m_Resampler
=
ResamplerType
::
New
();
m_Interpolator
=
InterpolatorType
::
New
();
m_Resampler
->
SetInterpolator
(
m_Interpolator
);
// Configure DEM directory
if
(
IsParameterEnabled
(
"dem"
))
{
m_Resampler
->
SetDEMDirectory
(
GetParameterString
(
"dem"
));
}
else
{
if
(
otb
::
ConfigurationFile
::
GetInstance
()
->
IsValid
()
)
{
m_Resampler
->
SetDEMDirectory
(
otb
::
ConfigurationFile
::
GetInstance
()
->
GetDEMDirectory
());
}
}
// Set up output image informations
UInt16VectorImageType
::
SpacingType
spacing
=
refImage
->
GetSpacing
();
UInt16VectorImageType
::
IndexType
start
=
refImage
->
GetLargestPossibleRegion
().
GetIndex
();
UInt16VectorImageType
::
SizeType
size
=
refImage
->
GetLargestPossibleRegion
().
GetSize
();
UInt16VectorImageType
::
PointType
origin
=
refImage
->
GetOrigin
();
if
(
IsParameterEnabled
(
"lms"
))
{
float
defScalarSpacing
=
GetParameterFloat
(
"lms"
);
std
::
cout
<<
"Generating coarse deformation field (spacing="
<<
defScalarSpacing
<<
")"
<<
std
::
endl
;
UInt16VectorImageType
::
SpacingType
defSpacing
;
defSpacing
[
0
]
=
defScalarSpacing
;
defSpacing
[
1
]
=
defScalarSpacing
;
m_Resampler
->
SetDeformationFieldSpacing
(
defSpacing
);
}
UInt16VectorImageType
::
PixelType
defaultValue
;
itk
::
PixelBuilder
<
UInt16VectorImageType
::
PixelType
>::
Zero
(
defaultValue
,
movingImage
->
GetNumberOfComponentsPerPixel
());
m_Resampler
->
SetInput
(
movingImage
);
m_Resampler
->
SetOutputOrigin
(
origin
);
m_Resampler
->
SetOutputSpacing
(
spacing
);
m_Resampler
->
SetOutputSize
(
size
);
m_Resampler
->
SetOutputStartIndex
(
start
);
m_Resampler
->
SetOutputKeywordList
(
refImage
->
GetImageKeywordlist
());
m_Resampler
->
SetOutputProjectionRef
(
refImage
->
GetProjectionRef
());
m_Resampler
->
SetEdgePaddingValue
(
defaultValue
);
// Set the output image
SetParameterOutputImage
(
"out"
,
m_Resampler
->
GetOutput
());
}
ResamplerType
::
Pointer
m_Resampler
;
InterpolatorType
::
Pointer
m_Interpolator
;
};
}
// end namespace Wrapper
}
// end namespace otb
OTB_APPLICATION_EXPORT
(
otb
::
Wrapper
::
Superimpose
)
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