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
Container Registry
Model registry
Operate
Environments
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
Main Repositories
otb
Commits
f7b6779e
Commit
f7b6779e
authored
7 years ago
by
Antoine Regimbeau
Browse files
Options
Downloads
Patches
Plain Diff
BUG: bugfix in order to be able to use masked function
parent
1136b39b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!12
Complex image integration
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/Core/ImageBase/include/otbDefaultConvertNewImpl.h
+154
-54
154 additions, 54 deletions
Modules/Core/ImageBase/include/otbDefaultConvertNewImpl.h
with
154 additions
and
54 deletions
Modules/Core/ImageBase/include/otbDefaultConvertNewImpl.h
+
154
−
54
View file @
f7b6779e
...
...
@@ -19,7 +19,6 @@
#define otbDefaultConvertNewImp_h
#include
"itkDefaultConvertPixelTraits.h"
#include
"itkRGBPixel.h"
// #include "itkOffset.h"
// #include "itkVector.h"
...
...
@@ -29,73 +28,81 @@
namespace
otb
{
template
<
typename
PixelType
>
class
DefaultConvertPixelTraitsTest
:
public
itk
::
DefaultConvertPixelTraits
<
PixelType
>
class
DefaultConvertPixelTraitsTest
:
public
itk
::
DefaultConvertPixelTraits
<
PixelType
>
{
public:
typedef
PixelType
TargetType
;
static
void
SetNthComponent
(
int
,
TargetType
&
pixel
,
const
TargetType
&
v
)
{
pixel
=
v
;
}
};
typedef
itk
::
DefaultConvertPixelTraits
<
PixelType
>
SuperClass
;
using
SuperClass
::
ComponentType
;
//
// Default traits for the complex<> pixel type
//
using
SuperClass
::
SetNthComponent
;
template
<
typename
T
>
class
DefaultConvertPixelTraitsTest
<
std
::
complex
<
T
>
>
:
public
itk
::
DefaultConvertPixelTraits
<
std
::
complex
<
T
>
>
{
public:
typedef
itk
::
DefaultConvertPixelTraits
<
std
::
complex
<
T
>
>
SuperClass
;
typedef
typename
SuperClass
::
TargetType
TargetType
;
static
void
SetNthComponent
(
int
,
TargetType
&
pixel
,
const
TargetType
&
v
)
static
void
SetNthComponent
(
int
,
PixelType
&
pixel
,
const
PixelType
&
v
)
{
pixel
=
v
;
}
static
TargetType
GetNthComponent
(
int
,
const
TargetType
&
pixel
)
{
return
pixel
;
}
};
// We might not need this specialization if the compileur allow
// us to declare to function with same signature in some case :
// see "SetNthComponent"
#define OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(type) \
template< > \
class DefaultConvertPixelTraitsTest < type > \
: public itk::DefaultConvertPixelTraits < type > \
{ \
public: \
typedef itk::DefaultConvertPixelTraits < type > SuperClass; \
using typename SuperClass::ComponentType; \
};
OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
(
float
)
OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
(
double
)
OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
(
long
double
)
OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
(
int
)
OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
(
char
)
OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
(
short
)
OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
(
unsigned
int
)
OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
(
signed
char
)
OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
(
unsigned
char
)
OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
(
unsigned
short
)
OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
(
long
)
OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
(
unsigned
long
)
OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
(
long
long
)
OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
(
unsigned
long
long
)
OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
(
bool
)
#undef OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL
//
// Default traits for the Offset<> pixel type
//
template
<
unsigned
int
VDimension
>
class
DefaultConvertPixelTraitsTest
<
itk
::
Offset
<
VDimension
>
>
:
public
itk
::
DefaultConvertPixelTraits
<
itk
::
Offset
<
VDimension
>
>
{
public:
typedef
itk
::
DefaultConvertPixelTraits
<
itk
::
Offset
<
VDimension
>
>
SuperClass
;
typedef
typename
SuperClass
::
TargetType
TargetType
;
static
void
SetNthComponent
(
int
,
TargetType
&
pixel
,
const
TargetType
&
v
)
{
pixel
=
v
;
}
};
// template<unsigned int VDimension>
// class DefaultConvertPixelTraitsTest < itk::Offset< VDimension > > :
// public itk::DefaultConvertPixelTraits< itk::Offset< VDimension > >
// {
// public:
// typedef itk::DefaultConvertPixelTraits < itk::Offset< VDimension > > SuperClass;
// using typename SuperClass::ComponentType;
// using SuperClass::SetNthComponent;
// static void SetNthComponent(int , TargetType & pixel, const TargetType& v)
// {
// pixel = v;
// }
// };
//
// Default traits for the pixel types deriving from
Matrix
<>
// Default traits for the pixel types deriving from
FixedArray
<>
//
template
<
typename
VComponent
,
unsigned
VRows
,
unsigned
VCols
>
class
DefaultConvertPixelTraitsTest
<
itk
::
Matrix
<
VComponent
,
VRows
,
VCols
>
>
:
public
itk
::
DefaultConvertPixelTraits
<
itk
::
Matrix
<
VComponent
,
VRows
,
VCols
>
>
{
public:
typedef
itk
::
DefaultConvertPixelTraits
<
itk
::
Matrix
<
VComponent
,
VRows
,
VCols
>
>
SuperClass
;
typedef
typename
SuperClass
::
TargetType
TargetType
;
static
void
SetNthComponent
(
int
,
TargetType
&
pixel
,
const
TargetType
&
v
)
{
pixel
=
v
;
}
};
#define OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(type) \
/*
define OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(type) \
template < typename TComponentType , unsigned VDimension > \
class DefaultConvertPixelTraitsTest < type < TComponentType , VDimension > > \
: public itk::DefaultConvertPixelTraits < type < TComponentType , VDimension > > \
...
...
@@ -108,11 +115,104 @@ public:
pixel = v; \
} \
} \
*/
// OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(itk::FixedArray);
// OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(itk::Vector);
// OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(itk::CovariantVector);
// OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(itk::Point);
// #undef OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE
//
// Default traits for pixel types deriving from VariableLengthVector<>
//
// template < typename T >
// class DefaultConvertPixelTraitsTest < itk::VariableLengthVector < T > >
// : public itk::DefaultConvertPixelTraits < itk::VariableLengthVector< T > >
// {
// public:
// typedef itk::DefaultConvertPixelTraits< itk::VariableLengthVector < T > > SuperClass;
// using typename SuperClass::TargetType;
// using typename SuperClass::ComponentType;
// };
//
// Default traits for the pixel types deriving from Matrix<>
//
// template<typename VComponent, unsigned VRows, unsigned VCols >
// class DefaultConvertPixelTraitsTest < itk::Matrix< VComponent, VRows, VCols > >
// : public itk::DefaultConvertPixelTraits < itk::Matrix< VComponent, VRows, VCols > >
// {
// public:
// typedef itk::DefaultConvertPixelTraits < itk::Matrix< VComponent, VRows, VCols > > SuperClass;
// using typename SuperClass::TargetType;
// using typename SuperClass::ComponentType;
// using SuperClass::SetNthComponent;
// static void SetNthComponent(int , TargetType & pixel, const TargetType& v)
// {
// pixel = v;
// }
// };
//
// Default traits for pixel types deriving from VariableSizeMatrix<>
//
// template < typename T >
// class DefaultConvertPixelTraitsTest< itk::VariableSizeMatrix< T > >
// : public itk::DefaultConvertPixelTraits< itk::VariableSizeMatrix< T > >
// {
// public:
// typedef itk::DefaultConvertPixelTraits< itk::VariableSizeMatrix < T > > SuperClass;
// using typename SuperClass::TargetType;
// using typename SuperClass::ComponentType;
// };
//
// Default traits for pixel types deriving from std::complex<>
//
OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE
(
itk
::
Vector
);
OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE
(
itk
::
CovariantVector
);
OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE
(
itk
::
Point
);
OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE
(
itk
::
FixedArray
);
template
<
typename
T
>
class
DefaultConvertPixelTraitsTest
<
::
std
::
complex
<
T
>
>
:
public
itk
::
DefaultConvertPixelTraits
<
::
std
::
complex
<
T
>
>
{
public:
typedef
itk
::
DefaultConvertPixelTraits
<
::
std
::
complex
<
T
>
>
SuperClass
;
using
typename
SuperClass
::
TargetType
;
using
typename
SuperClass
::
ComponentType
;
using
SuperClass
::
SetNthComponent
;
static
void
SetNthComponent
(
int
,
TargetType
&
pixel
,
const
TargetType
&
v
)
{
pixel
=
v
;
}
static
TargetType
GetNthComponent
(
int
,
const
TargetType
&
pixel
)
{
return
pixel
;
}
static
ComponentType
GetScalarValue
(
const
TargetType
&
pixel
)
{
/*
* This seems to be dead code, since the complex to scalar
* conversion is done by ConvertPixelBuffer
*
* Historically, it was returning std::norm, which causes
* compilation error on MacOSX 10.9.
* Now returns the equivalent implementation of std::norm.
*/
return
static_cast
<
ComponentType
>
(
pixel
.
real
()
*
pixel
.
real
()
+
pixel
.
imag
()
*
pixel
.
imag
()
);
}
};
}
// end namespace
#endif
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