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
b08cf1c7
Commit
b08cf1c7
authored
12 years ago
by
Mickael Savinaud
Browse files
Options
Downloads
Patches
Plain Diff
ITK4 revert from ITK3.20.0 file for itkNumericTraits
parent
a0b2a45d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Utilities/ITK/Code/Common/itkNumericTraits.cxx
+0
-6
0 additions, 6 deletions
Utilities/ITK/Code/Common/itkNumericTraits.cxx
Utilities/ITK/Code/Common/itkNumericTraits.h
+6
-151
6 additions, 151 deletions
Utilities/ITK/Code/Common/itkNumericTraits.h
with
6 additions
and
157 deletions
Utilities/ITK/Code/Common/itkNumericTraits.cxx
+
0
−
6
View file @
b08cf1c7
...
...
@@ -58,12 +58,6 @@ const double NumericTraits<double>::One = 1.0;
const
long
double
NumericTraits
<
long
double
>::
Zero
=
0.0
;
const
long
double
NumericTraits
<
long
double
>::
One
=
1.0
;
const
std
::
complex
<
short
>
NumericTraits
<
std
::
complex
<
short
>
>::
Zero
=
std
::
complex
<
short
>
(
0
,
0
);
const
std
::
complex
<
short
>
NumericTraits
<
std
::
complex
<
short
>
>::
One
=
std
::
complex
<
short
>
(
1
,
0
);
const
std
::
complex
<
int
>
NumericTraits
<
std
::
complex
<
int
>
>::
Zero
=
std
::
complex
<
int
>
(
0
,
0
);
const
std
::
complex
<
int
>
NumericTraits
<
std
::
complex
<
int
>
>::
One
=
std
::
complex
<
int
>
(
1
,
0
);
const
std
::
complex
<
float
>
NumericTraits
<
std
::
complex
<
float
>
>::
Zero
=
std
::
complex
<
float
>
(
0.0
f
,
0.0
f
);
const
std
::
complex
<
float
>
NumericTraits
<
std
::
complex
<
float
>
>::
One
=
std
::
complex
<
float
>
(
1.0
f
,
0.0
f
);
...
...
This diff is collapsed.
Click to expand it.
Utilities/ITK/Code/Common/itkNumericTraits.h
+
6
−
151
View file @
b08cf1c7
...
...
@@ -183,9 +183,6 @@ public:
static
bool
IsNonnegative
(
char
val
)
{
return
val
>=
Zero
;
}
static
char
ZeroValue
()
{
return
Zero
;
}
static
char
OneValue
()
{
return
One
;
}
static
ValueType
Clamp
(
ValueType
val
,
ValueType
minVal
,
ValueType
maxVal
)
{
return
val
<
minVal
?
minVal
:
(
val
>
maxVal
?
maxVal
:
val
);}
};
/** \class NumericTraits<char>
...
...
@@ -217,9 +214,6 @@ public:
static
bool
IsNonnegative
(
signed
char
val
)
{
return
val
>=
Zero
;
}
static
signed
char
ZeroValue
()
{
return
Zero
;
}
static
signed
char
OneValue
()
{
return
One
;
}
static
ValueType
Clamp
(
ValueType
val
,
ValueType
minVal
,
ValueType
maxVal
)
{
return
val
<
minVal
?
minVal
:
(
val
>
maxVal
?
maxVal
:
val
);}
};
/** \class NumericTraits<unsigned char>
...
...
@@ -249,9 +243,6 @@ public:
static
bool
IsNonnegative
(
unsigned
char
val
)
{
return
val
?
true
:
true
;
}
static
unsigned
char
ZeroValue
()
{
return
Zero
;
}
static
unsigned
char
OneValue
()
{
return
One
;
}
static
ValueType
Clamp
(
ValueType
val
,
ValueType
minVal
,
ValueType
maxVal
)
{
return
val
<
minVal
?
minVal
:
(
val
>
maxVal
?
maxVal
:
val
);}
};
/** \class NumericTraits<short>
...
...
@@ -279,9 +270,6 @@ public:
static
bool
IsNonnegative
(
short
val
)
{
return
val
>=
Zero
;
}
static
short
ZeroValue
()
{
return
Zero
;
}
static
short
OneValue
()
{
return
One
;
}
static
ValueType
Clamp
(
ValueType
val
,
ValueType
minVal
,
ValueType
maxVal
)
{
return
val
<
minVal
?
minVal
:
(
val
>
maxVal
?
maxVal
:
val
);}
};
/** \class NumericTraits<unsigned short>
...
...
@@ -310,9 +298,6 @@ public:
static
bool
IsNonnegative
(
unsigned
short
val
)
{
return
val
?
true
:
true
;
}
static
unsigned
short
ZeroValue
()
{
return
Zero
;
}
static
unsigned
short
OneValue
()
{
return
One
;
}
static
ValueType
Clamp
(
ValueType
val
,
ValueType
minVal
,
ValueType
maxVal
)
{
return
val
<
minVal
?
minVal
:
(
val
>
maxVal
?
maxVal
:
val
);}
};
/** \class NumericTraits<int>
...
...
@@ -340,9 +325,6 @@ public:
static
bool
IsNonnegative
(
int
val
)
{
return
val
>=
Zero
;
}
static
int
ZeroValue
()
{
return
Zero
;
}
static
int
OneValue
()
{
return
One
;
}
static
ValueType
Clamp
(
ValueType
val
,
ValueType
minVal
,
ValueType
maxVal
)
{
return
val
<
minVal
?
minVal
:
(
val
>
maxVal
?
maxVal
:
val
);}
};
/** \class NumericTraits<unsigned int>
...
...
@@ -374,9 +356,6 @@ public:
static
bool
IsNonnegative
(
unsigned
int
val
)
{
return
val
?
true
:
true
;
}
static
unsigned
int
ZeroValue
()
{
return
Zero
;
}
static
unsigned
int
OneValue
()
{
return
One
;
}
static
ValueType
Clamp
(
ValueType
val
,
ValueType
minVal
,
ValueType
maxVal
)
{
return
val
<
minVal
?
minVal
:
(
val
>
maxVal
?
maxVal
:
val
);}
};
/** \class NumericTraits<long>
...
...
@@ -405,9 +384,6 @@ public:
static
bool
IsNonnegative
(
long
val
)
{
return
val
>=
Zero
;
}
static
long
ZeroValue
()
{
return
Zero
;
}
static
long
OneValue
()
{
return
One
;
}
static
ValueType
Clamp
(
ValueType
val
,
ValueType
minVal
,
ValueType
maxVal
)
{
return
val
<
minVal
?
minVal
:
(
val
>
maxVal
?
maxVal
:
val
);}
};
/** \class NumericTraits<unsigned long>
...
...
@@ -436,9 +412,6 @@ public:
static
bool
IsNonnegative
(
unsigned
long
)
{
return
true
;
}
static
unsigned
long
ZeroValue
()
{
return
Zero
;
}
static
unsigned
long
OneValue
()
{
return
One
;
}
static
ValueType
Clamp
(
ValueType
val
,
ValueType
minVal
,
ValueType
maxVal
)
{
return
val
<
minVal
?
minVal
:
(
val
>
maxVal
?
maxVal
:
val
);}
};
/** \class NumericTraits<float>
...
...
@@ -467,9 +440,6 @@ public:
static
bool
IsNonnegative
(
float
val
)
{
return
val
>=
Zero
;
}
static
float
ZeroValue
()
{
return
Zero
;
}
static
float
OneValue
()
{
return
One
;
}
static
ValueType
Clamp
(
ValueType
val
,
ValueType
minVal
,
ValueType
maxVal
)
{
return
val
<
minVal
?
minVal
:
(
val
>
maxVal
?
maxVal
:
val
);}
};
/** \class NumericTraits<double>
...
...
@@ -498,9 +468,6 @@ public:
static
bool
IsNonnegative
(
double
val
)
{
return
val
>=
Zero
;
}
static
double
ZeroValue
()
{
return
Zero
;
}
static
double
OneValue
()
{
return
One
;
}
static
ValueType
Clamp
(
ValueType
val
,
ValueType
minVal
,
ValueType
maxVal
)
{
return
val
<
minVal
?
minVal
:
(
val
>
maxVal
?
maxVal
:
val
);}
};
/** \class NumericTraits<long double>
...
...
@@ -529,95 +496,6 @@ public:
static
bool
IsNonnegative
(
long
double
val
)
{
return
val
>=
Zero
;
}
static
long
double
ZeroValue
()
{
return
Zero
;
}
static
long
double
OneValue
()
{
return
One
;
}
static
ValueType
Clamp
(
ValueType
val
,
ValueType
minVal
,
ValueType
maxVal
)
{
return
val
<
minVal
?
minVal
:
(
val
>
maxVal
?
maxVal
:
val
);}
};
/** \class NumericTraits< std::complex<short> >
* \brief Define traits for type std::complex<short>.
* \ingroup DataRepresentation
*/
template
<
>
class
NumericTraits
<
std
::
complex
<
short
>
>
{
public:
typedef
std
::
complex
<
short
>
TheType
;
typedef
short
ValueType
;
typedef
TheType
PrintType
;
typedef
double
AbsType
;
typedef
TheType
AccumulateType
;
typedef
std
::
complex
<
double
>
RealType
;
typedef
double
ScalarRealType
;
typedef
std
::
complex
<
float
>
FloatType
;
static
const
TheType
ITKCommon_EXPORT
Zero
;
static
const
TheType
ITKCommon_EXPORT
One
;
static
TheType
min
()
{
return
TheType
(
vcl_numeric_limits
<
ValueType
>::
min
(),
vcl_numeric_limits
<
ValueType
>::
min
());}
static
TheType
max
()
{
return
TheType
(
vcl_numeric_limits
<
ValueType
>::
max
(),
vcl_numeric_limits
<
ValueType
>::
max
());
}
static
TheType
min
(
TheType
)
{
return
TheType
(
vcl_numeric_limits
<
ValueType
>::
min
(),
vcl_numeric_limits
<
ValueType
>::
min
());
}
static
TheType
max
(
TheType
)
{
return
TheType
(
vcl_numeric_limits
<
ValueType
>::
max
(),
vcl_numeric_limits
<
ValueType
>::
max
());
}
static
TheType
NonpositiveMin
()
{
return
TheType
(
NumericTraits
<
ValueType
>::
NonpositiveMin
(),
NumericTraits
<
ValueType
>::
NonpositiveMin
());
}
static
bool
IsPositive
(
TheType
val
)
{
return
val
.
real
()
>
0.0
;
}
static
bool
IsNonpositive
(
TheType
val
)
{
return
val
.
real
()
<=
0.0
;
}
static
bool
IsNegative
(
TheType
val
)
{
return
val
.
real
()
<
0.0
;
}
static
bool
IsNonnegative
(
TheType
val
)
{
return
val
.
real
()
>=
0.0
;
}
static
TheType
ZeroValue
()
{
return
Zero
;
}
static
TheType
OneValue
()
{
return
One
;
}
static
TheType
Clamp
(
TheType
val
,
TheType
minVal
,
TheType
maxVal
)
{
return
TheType
(
NumericTraits
<
ValueType
>::
Clamp
(
val
.
real
(),
minVal
.
real
(),
maxVal
.
real
()),
NumericTraits
<
ValueType
>::
Clamp
(
val
.
imag
(),
minVal
.
imag
(),
maxVal
.
imag
()));
}
};
/** \class NumericTraits< std::complex<int> >
* \brief Define traits for type std::complex<int>.
* \ingroup DataRepresentation
*/
template
<
>
class
NumericTraits
<
std
::
complex
<
int
>
>
{
public:
typedef
std
::
complex
<
int
>
TheType
;
typedef
int
ValueType
;
typedef
TheType
PrintType
;
typedef
double
AbsType
;
// or int ?
typedef
TheType
AccumulateType
;
typedef
std
::
complex
<
double
>
RealType
;
// or std::complex<int>
typedef
double
ScalarRealType
;
// or int
typedef
std
::
complex
<
float
>
FloatType
;
static
const
TheType
ITKCommon_EXPORT
Zero
;
static
const
TheType
ITKCommon_EXPORT
One
;
static
TheType
min
()
{
return
TheType
(
vcl_numeric_limits
<
ValueType
>::
min
(),
vcl_numeric_limits
<
ValueType
>::
min
());}
static
TheType
max
()
{
return
TheType
(
vcl_numeric_limits
<
ValueType
>::
max
(),
vcl_numeric_limits
<
ValueType
>::
max
());
}
static
TheType
min
(
TheType
)
{
return
TheType
(
vcl_numeric_limits
<
ValueType
>::
min
(),
vcl_numeric_limits
<
ValueType
>::
min
());
}
static
TheType
max
(
TheType
)
{
return
TheType
(
vcl_numeric_limits
<
ValueType
>::
max
(),
vcl_numeric_limits
<
ValueType
>::
max
());
}
static
TheType
NonpositiveMin
()
{
return
TheType
(
NumericTraits
<
ValueType
>::
NonpositiveMin
(),
NumericTraits
<
ValueType
>::
NonpositiveMin
());
}
static
bool
IsPositive
(
TheType
val
)
{
return
val
.
real
()
>
0.0
;
}
static
bool
IsNonpositive
(
TheType
val
)
{
return
val
.
real
()
<=
0.0
;
}
static
bool
IsNegative
(
TheType
val
)
{
return
val
.
real
()
<
0.0
;
}
static
bool
IsNonnegative
(
TheType
val
)
{
return
val
.
real
()
>=
0.0
;
}
static
TheType
ZeroValue
()
{
return
Zero
;
}
static
TheType
OneValue
()
{
return
One
;
}
static
TheType
Clamp
(
TheType
val
,
TheType
minVal
,
TheType
maxVal
)
{
return
TheType
(
NumericTraits
<
ValueType
>::
Clamp
(
val
.
real
(),
minVal
.
real
(),
maxVal
.
real
()),
NumericTraits
<
ValueType
>::
Clamp
(
val
.
imag
(),
minVal
.
imag
(),
maxVal
.
imag
()));
}
};
/** \class NumericTraits< std::complex<float> >
...
...
@@ -639,28 +517,16 @@ public:
static
const
TheType
ITKCommon_EXPORT
Zero
;
static
const
TheType
ITKCommon_EXPORT
One
;
static
TheType
min
()
{
return
TheType
(
vcl_numeric_limits
<
ValueType
>::
min
(),
vcl_numeric_limits
<
ValueType
>::
min
());}
static
TheType
max
()
{
return
TheType
(
vcl_numeric_limits
<
ValueType
>::
max
(),
vcl_numeric_limits
<
ValueType
>::
max
());
}
static
TheType
min
(
TheType
)
{
return
TheType
(
vcl_numeric_limits
<
ValueType
>::
min
(),
vcl_numeric_limits
<
ValueType
>::
min
());
}
static
TheType
max
(
TheType
)
{
return
TheType
(
vcl_numeric_limits
<
ValueType
>::
max
(),
vcl_numeric_limits
<
ValueType
>::
max
());
}
static
TheType
min
(
TheType
)
{
return
vcl_numeric_limits
<
ValueType
>::
min
();
}
static
TheType
max
(
TheType
)
{
return
vcl_numeric_limits
<
ValueType
>::
max
();
}
static
TheType
NonpositiveMin
()
{
return
TheType
(
NumericTraits
<
float
>::
NonpositiveMin
(),
NumericTraits
<
float
>::
NonpositiveMin
()
);
}
return
TheType
(
-
NumericTraits
<
float
>::
NonpositiveMin
(),
0.0
f
);
}
static
bool
IsPositive
(
TheType
val
)
{
return
val
.
real
()
>
0.0
;
}
static
bool
IsNonpositive
(
TheType
val
)
{
return
val
.
real
()
<=
0.0
;
}
static
bool
IsNegative
(
TheType
val
)
{
return
val
.
real
()
<
0.0
;
}
static
bool
IsNonnegative
(
TheType
val
)
{
return
val
.
real
()
>=
0.0
;
}
static
TheType
ZeroValue
()
{
return
Zero
;
}
static
TheType
OneValue
()
{
return
One
;
}
static
TheType
Clamp
(
TheType
val
,
TheType
minVal
,
TheType
maxVal
)
{
return
TheType
(
NumericTraits
<
ValueType
>::
Clamp
(
val
.
real
(),
minVal
.
real
(),
maxVal
.
real
()),
NumericTraits
<
ValueType
>::
Clamp
(
val
.
imag
(),
minVal
.
imag
(),
maxVal
.
imag
()));
}
};
...
...
@@ -682,28 +548,17 @@ public:
static
const
TheType
ITKCommon_EXPORT
Zero
;
static
const
TheType
ITKCommon_EXPORT
One
;
static
TheType
min
()
{
return
TheType
(
vcl_numeric_limits
<
ValueType
>::
min
(),
vcl_numeric_limits
<
ValueType
>::
min
());}
static
TheType
max
()
{
return
TheType
(
vcl_numeric_limits
<
ValueType
>::
max
(),
vcl_numeric_limits
<
ValueType
>::
max
());
}
static
TheType
min
(
TheType
)
{
return
TheType
(
vcl_numeric_limits
<
ValueType
>::
min
(),
vcl_numeric_limits
<
ValueType
>::
min
());
}
static
TheType
max
(
TheType
)
{
return
TheType
(
vcl_numeric_limits
<
ValueType
>::
max
(),
vcl_numeric_limits
<
ValueType
>::
max
());
}
static
TheType
min
(
TheType
)
{
return
vcl_numeric_limits
<
ValueType
>::
min
();
}
static
TheType
max
(
TheType
)
{
return
vcl_numeric_limits
<
ValueType
>::
max
();
}
static
TheType
NonpositiveMin
()
{
return
TheType
(
NumericTraits
<
double
>::
NonpositiveMin
(),
NumericTraits
<
double
>::
NonpositiveMin
()
);
}
return
TheType
(
-
NumericTraits
<
double
>::
NonpositiveMin
(),
0.0
);
}
static
bool
IsPositive
(
TheType
val
)
{
return
val
.
real
()
>
0.0
;
}
static
bool
IsNonpositive
(
TheType
val
)
{
return
val
.
real
()
<=
0.0
;
}
static
bool
IsNegative
(
TheType
val
)
{
return
val
.
real
()
<
0.0
;
}
static
bool
IsNonnegative
(
TheType
val
)
{
return
val
.
real
()
>=
0.0
;
}
static
TheType
ZeroValue
()
{
return
Zero
;
}
static
TheType
OneValue
()
{
return
One
;
}
static
TheType
Clamp
(
TheType
val
,
TheType
minVal
,
TheType
maxVal
)
{
return
TheType
(
NumericTraits
<
ValueType
>::
Clamp
(
val
.
real
(),
minVal
.
real
(),
maxVal
.
real
()),
NumericTraits
<
ValueType
>::
Clamp
(
val
.
imag
(),
minVal
.
imag
(),
maxVal
.
imag
()));
}
};
#ifdef ITK_TYPE_USE_LONG_LONG
...
...
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