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
Julien Cabieces
otb
Commits
d47e9321
Commit
d47e9321
authored
5 years ago
by
Cédric Traizet
Browse files
Options
Downloads
Patches
Plain Diff
ENH: some code modernization
parent
566a195b
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
Modules/Applications/AppFiltering/app/otbFastNLMeans.cxx
+9
-9
9 additions, 9 deletions
Modules/Applications/AppFiltering/app/otbFastNLMeans.cxx
Modules/Applications/AppFiltering/app/otbSmoothing.cxx
+18
-22
18 additions, 22 deletions
Modules/Applications/AppFiltering/app/otbSmoothing.cxx
with
27 additions
and
31 deletions
Modules/Applications/AppFiltering/app/otbFastNLMeans.cxx
+
9
−
9
View file @
d47e9321
...
...
@@ -110,25 +110,25 @@ private:
void
DoExecute
()
override
{
// Get the input image
ImageType
::
Pointer
imIn
=
this
->
GetParameterFloatImage
(
"in"
);
float
sigma
=
this
->
GetParameterFloat
(
"sig"
);
float
cutoffDistance
=
this
->
GetParameterFloat
(
"thresh"
);
int
halfPatchSize
=
this
->
GetParameterInt
(
"patchradius"
);
int
halfSearchSize
=
this
->
GetParameterInt
(
"searchradius"
);
NLMeansFilterType
::
Pointer
nlMeansFilter
=
NLMeansFilterType
::
New
();
// Get the input parameters
const
auto
imIn
=
this
->
GetParameterFloatImage
(
"in"
);
const
auto
sigma
=
this
->
GetParameterFloat
(
"sig"
);
const
auto
cutoffDistance
=
this
->
GetParameterFloat
(
"thresh"
);
const
auto
halfPatchSize
=
this
->
GetParameterInt
(
"patchradius"
);
const
auto
halfSearchSize
=
this
->
GetParameterInt
(
"searchradius"
);
auto
nlMeansFilter
=
NLMeansFilterType
::
New
();
nlMeansFilter
->
SetInput
(
imIn
);
nlMeansFilter
->
SetSigma
(
sigma
);
nlMeansFilter
->
SetHalfWindowSize
(
halfPatchSize
);
nlMeansFilter
->
SetHalfSearchSize
(
halfSearchSize
);
nlMeansFilter
->
SetCutOffDistance
(
cutoffDistance
);
m_FilterRef
=
nlMeansFilter
;
SetParameterOutputImage
(
"out"
,
nlMeansFilter
->
GetOutput
());
RegisterPipeline
();
}
itk
::
LightObject
::
Pointer
m_FilterRef
;
};
// end class
}
// namespace Wrapper
...
...
This diff is collapsed.
Click to expand it.
Modules/Applications/AppFiltering/app/otbSmoothing.cxx
+
18
−
22
View file @
d47e9321
...
...
@@ -147,83 +147,79 @@ private:
void
DoExecute
()
override
{
GetLogger
()
->
Debug
(
"Entering DoExecute
\n
"
);
FloatVectorImageType
::
Pointer
inImage
=
GetParameterImage
(
"in"
);
const
auto
inImage
=
GetParameterImage
(
"in"
);
switch
(
GetParameterInt
(
"type"
))
{
case
Smoothing_Mean
:
{
GetLogger
()
->
Debug
(
"Using mean"
);
otbAppLogINFO
(
"Using mean
smoothing
"
);
typedef
itk
::
MeanImageFilter
<
ImageType
,
ImageType
>
MeanFilterType
;
typedef
otb
::
PerBandVectorImageFilter
<
FloatVectorImageType
,
FloatVectorImageType
,
MeanFilterType
>
PerBandMeanFilterType
;
PerBandMeanFilterType
::
Pointer
perBand
=
PerBandMeanFilterType
::
New
();
auto
perBand
=
PerBandMeanFilterType
::
New
();
perBand
->
SetInput
(
inImage
);
MeanFilterType
::
InputSizeType
radius
;
radius
.
Fill
(
GetParameterInt
(
"type.mean.radius"
));
perBand
->
GetFilter
()
->
SetRadius
(
radius
);
perBand
->
UpdateOutputInformation
();
m_FilterRef
=
perBand
;
SetParameterOutputImage
(
"out"
,
perBand
->
GetOutput
());
RegisterPipeline
();
}
break
;
case
Smoothing_Gaussian
:
{
GetLogger
()
->
Debug
(
"Using gaussian"
);
otbAppLogINFO
(
"Using gaussian
smoothing
"
);
typedef
itk
::
DiscreteGaussianImageFilter
<
ImageType
,
ImageType
>
DiscreteGaussianFilterType
;
typedef
otb
::
PerBandVectorImageFilter
<
FloatVectorImageType
,
FloatVectorImageType
,
DiscreteGaussianFilterType
>
PerBandDiscreteGaussianFilterType
;
PerBandDiscreteGaussianFilterType
::
Pointer
perBand
=
PerBandDiscreteGaussianFilterType
::
New
();
auto
perBand
=
PerBandDiscreteGaussianFilterType
::
New
();
perBand
->
SetInput
(
inImage
);
const
double
stdev
=
GetParameterFloat
(
"type.gaussian.stdev"
);
double
variance
=
stdev
*
stdev
;
const
auto
stdev
=
GetParameterFloat
(
"type.gaussian.stdev"
);
const
auto
variance
=
stdev
*
stdev
;
perBand
->
GetFilter
()
->
SetVariance
(
variance
);
perBand
->
GetFilter
()
->
SetUseImageSpacing
(
false
);
perBand
->
GetFilter
()
->
SetMaximumError
(
GetParameterFloat
(
"type.gaussian.maxerror"
));
perBand
->
GetFilter
()
->
SetMaximumKernelWidth
(
GetParameterInt
(
"type.gaussian.maxwidth"
));
perBand
->
UpdateOutputInformation
();
m_FilterRef
=
perBand
;
SetParameterOutputImage
(
"out"
,
perBand
->
GetOutput
());
RegisterPipeline
();
}
break
;
case
Smoothing_Anisotropic
:
{
GetLogger
()
->
Debug
(
"Using anisotropic diffusion"
);
otbAppLogINFO
(
"Using anisotropic diffusion
smoothing
"
);
typedef
itk
::
GradientAnisotropicDiffusionImageFilter
<
ImageType
,
ImageType
>
GradientAnisotropicDiffusionFilterType
;
typedef
otb
::
PerBandVectorImageFilter
<
FloatVectorImageType
,
FloatVectorImageType
,
GradientAnisotropicDiffusionFilterType
>
PerBandGradientAnisotropicDiffusionFilterType
;
PerBandGradientAnisotropicDiffusionFilterType
::
Pointer
perBand
=
PerBandGradientAnisotropicDiffusionFilterType
::
New
();
auto
perBand
=
PerBandGradientAnisotropicDiffusionFilterType
::
New
();
perBand
->
SetInput
(
inImage
);
const
int
aniDifNbIter
=
GetParameterInt
(
"type.anidif.nbiter"
);
const
auto
aniDifNbIter
=
GetParameterInt
(
"type.anidif.nbiter"
);
perBand
->
GetFilter
()
->
SetNumberOfIterations
(
static_cast
<
unsigned
int
>
(
aniDifNbIter
));
const
float
aniDifTimeStep
=
GetParameterFloat
(
"type.anidif.timestep"
);
const
auto
aniDifTimeStep
=
GetParameterFloat
(
"type.anidif.timestep"
);
perBand
->
GetFilter
()
->
SetTimeStep
(
static_cast
<
double
>
(
aniDifTimeStep
));
perBand
->
GetFilter
()
->
SetConductanceParameter
(
GetParameterFloat
(
"type.anidif.conductance"
));
perBand
->
GetFilter
()
->
SetUseImageSpacing
(
false
);
perBand
->
UpdateOutputInformation
();
m_FilterRef
=
perBand
;
SetParameterOutputImage
(
"out"
,
perBand
->
GetOutput
());
RegisterPipeline
();
}
break
;
}
}
itk
::
LightObject
::
Pointer
m_FilterRef
;
};
}
}
...
...
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