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
d0b90635
Commit
d0b90635
authored
8 years ago
by
Guillaume Pasero
Browse files
Options
Downloads
Patches
Plain Diff
ENH: clamp values given to any Sampler
parent
67b9ceeb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/Filtering/Statistics/src/otbSamplerBase.cxx
+21
-6
21 additions, 6 deletions
Modules/Filtering/Statistics/src/otbSamplerBase.cxx
with
21 additions
and
6 deletions
Modules/Filtering/Statistics/src/otbSamplerBase.cxx
+
21
−
6
View file @
d0b90635
...
@@ -33,14 +33,16 @@ void
...
@@ -33,14 +33,16 @@ void
SamplerBase
::
SetNumberOfElements
(
unsigned
long
needed
,
unsigned
long
total
)
SamplerBase
::
SetNumberOfElements
(
unsigned
long
needed
,
unsigned
long
total
)
{
{
bool
modified
=
false
;
bool
modified
=
false
;
unsigned
long
neededChecked
=
needed
;
if
(
needed
>
total
)
if
(
needed
>
total
)
{
{
itkExceptionMacro
(
<<
"Needed elements ("
<<
needed
<<
itkWarningMacro
(
<<
"Needed elements ("
<<
needed
<<
") greater than total elements"
<<
total
<<
")."
<<
std
::
endl
);
") will be clamped to total elements ("
<<
total
<<
")"
<<
std
::
endl
);
neededChecked
=
total
;
}
}
if
(
m_NeededElements
!=
needed
)
if
(
m_NeededElements
!=
needed
Checked
)
{
{
m_NeededElements
=
needed
;
m_NeededElements
=
needed
Checked
;
modified
=
true
;
modified
=
true
;
}
}
if
(
m_TotalElements
!=
total
)
if
(
m_TotalElements
!=
total
)
...
@@ -66,9 +68,22 @@ void
...
@@ -66,9 +68,22 @@ void
SamplerBase
::
SetRate
(
double
rate
,
unsigned
long
total
)
SamplerBase
::
SetRate
(
double
rate
,
unsigned
long
total
)
{
{
bool
modified
=
false
;
bool
modified
=
false
;
if
(
m_Rate
!=
rate
)
double
rateChecked
=
rate
;
if
(
rate
>
1.0
)
{
{
m_Rate
=
rate
;
itkWarningMacro
(
<<
"Rate ("
<<
rate
<<
") will be clamped to 1.0"
<<
std
::
endl
);
rateChecked
=
1.0
;
}
if
(
rate
<
0.0
)
{
itkWarningMacro
(
<<
"Rate ("
<<
rate
<<
") will be clamped to 0.0"
<<
std
::
endl
);
rateChecked
=
0.0
;
}
if
(
m_Rate
!=
rateChecked
)
{
m_Rate
=
rateChecked
;
modified
=
true
;
modified
=
true
;
}
}
if
(
m_TotalElements
!=
total
)
if
(
m_TotalElements
!=
total
)
...
...
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