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
edbf97ae
Commit
edbf97ae
authored
6 years ago
by
Julien Michel
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Functor by copy instead of reference
parent
ccfbd9e2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/Core/Functor/include/otbFunctorImageFilter.h
+11
-12
11 additions, 12 deletions
Modules/Core/Functor/include/otbFunctorImageFilter.h
with
11 additions
and
12 deletions
Modules/Core/Functor/include/otbFunctorImageFilter.h
+
11
−
12
View file @
edbf97ae
...
...
@@ -211,7 +211,7 @@ template <typename C, typename R, typename... T, typename TNameMap> struct Funct
/**
* \brief This helper method builds a fully functional FunctorImageFilter from a functor instance
*
* Functor can be any operator() (const or non-const) that matches the following:
*
\tparam
Functor can be any operator() (const or non-const) that matches the following:
* - Accepts any number of arguments of T,
* (const) itk::VariableLengthVector<T> (&),(const)
* itk::Neighborhood<T> (&), (const)
...
...
@@ -223,8 +223,8 @@ template <typename C, typename R, typename... T, typename TNameMap> struct Funct
* SetVariadicInputs() method (see VariadicInputsImageFilter class for
* details)
*
* \param
f
the Functor to build the filter from
* \param radius The size of neighborhood to use, if there is any
* \param
[in]
the Functor to build the filter from
* \param
[in]
radius The size of neighborhood to use, if there is any
* itk::Neighborhood<T> in the operator() arguments.
* \return A ready to use OTB filter, which accepts n input image of
* type derived from the operator() arguments, and producing an image
...
...
@@ -234,13 +234,13 @@ template <typename C, typename R, typename... T, typename TNameMap> struct Funct
* provided it returns a scalar type. If your lambda returns a
* VariableLengthVector, see the other NewFunctorFilter implementation.
*/
template
<
typename
Functor
,
typename
TNameMap
=
void
>
auto
NewFunctorFilter
(
const
Functor
&
f
,
itk
::
Size
<
2
>
radius
=
{{
0
,
0
}});
template
<
typename
Functor
,
typename
TNameMap
=
void
>
auto
NewFunctorFilter
(
Functor
f
,
itk
::
Size
<
2
>
radius
=
{{
0
,
0
}});
/** \class FunctorImageFilter
* \brief A generic functor filter templated by its functor
*
* TFunction can be any operator() (const or non-const) that matches the following:
*
\tparam
TFunction can be any operator() (const or non-const) that matches the following:
* - Accepts any number of arguments of T,
* (const) itk::VariableLengthVector<T> (&),(const)
* itk::Neighborhood<T> (&), (const)
...
...
@@ -317,7 +317,7 @@ protected:
private
:
/// Actual creation of the filter is handled by this free function
friend
auto
NewFunctorFilter
<
TFunction
,
TNameMap
>
(
const
TFunction
&
f
,
itk
::
Size
<
2
>
radius
);
friend
auto
NewFunctorFilter
<
TFunction
,
TNameMap
>
(
TFunction
f
,
itk
::
Size
<
2
>
radius
);
/** Overload of ThreadedGenerateData */
void
ThreadedGenerateData
(
const
OutputImageRegionType
&
outputRegionForThread
,
itk
::
ThreadIdType
threadId
)
override
;
...
...
@@ -341,7 +341,7 @@ private:
};
// Actual implementation of NewFunctorFilter free function
template
<
typename
Functor
,
typename
TNameMap
>
auto
NewFunctorFilter
(
const
Functor
&
f
,
itk
::
Size
<
2
>
radius
)
template
<
typename
Functor
,
typename
TNameMap
>
auto
NewFunctorFilter
(
Functor
f
,
itk
::
Size
<
2
>
radius
)
{
using
FilterType
=
FunctorImageFilter
<
Functor
,
TNameMap
>
;
using
PointerType
=
typename
FilterType
::
Pointer
;
...
...
@@ -362,11 +362,10 @@ template <typename Functor, typename TNameMap> auto NewFunctorFilter(const Funct
* It is used internally in NewFunctorFilter version with
* numberOfOutputBands parameter.
*/
template
<
typename
F
>
struct
NumberOfOutputBandsDecorator
:
F
{
public:
constexpr
NumberOfOutputBandsDecorator
(
const
F
t
,
unsigned
int
nbComp
)
:
F
(
t
),
m_NumberOfOutputBands
(
nbComp
)
{}
constexpr
NumberOfOutputBandsDecorator
(
F
t
,
unsigned
int
nbComp
)
:
F
(
t
),
m_NumberOfOutputBands
(
nbComp
)
{}
using
F
::
operator
();
constexpr
size_t
OutputSize
(...)
const
...
...
@@ -383,8 +382,8 @@ private:
* FunctorImageFilter from a functor instance which does not provide
* the OutputSize() service, or a lambda, returing a VariableLengthVector
*
* \param f the Functor to build the filter from
* \param numberOfOutputBands The number of output bands that
* \param
[in]
f the Functor to build the filter from
* \param
[in]
numberOfOutputBands The number of output bands that
* this filter will return
* \param radius The size of neighborhood to use, if there is any
* itk::Neighborhood<T> in the operator() arguments.
...
...
@@ -398,7 +397,7 @@ private:
*/
template
<
typename
Functor
,
typename
TNameMap
=
void
>
auto
NewFunctorFilter
(
const
Functor
&
f
,
unsigned
int
numberOfOutputBands
,
itk
::
Size
<
2
>
radius
)
template
<
typename
Functor
,
typename
TNameMap
=
void
>
auto
NewFunctorFilter
(
Functor
f
,
unsigned
int
numberOfOutputBands
,
itk
::
Size
<
2
>
radius
)
{
using
FunctorType
=
NumberOfOutputBandsDecorator
<
Functor
>
;
FunctorType
decoratedF
(
f
,
numberOfOutputBands
);
...
...
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