Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Simox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Leander Singer
Simox
Commits
7d66c4cd
Commit
7d66c4cd
authored
4 years ago
by
Rainer Kartmann
Browse files
Options
Downloads
Patches
Plain Diff
Use minmax in ColorMap
parent
f3008d9c
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
SimoxUtility/color/ColorMap.h
+32
-1
32 additions, 1 deletion
SimoxUtility/color/ColorMap.h
with
32 additions
and
1 deletion
SimoxUtility/color/ColorMap.h
+
32
−
1
View file @
7d66c4cd
#pragma once
#include
<algorithm>
#include
<functional>
#include
<initializer_list>
#include
<map>
#include
<string>
#include
<SimoxUtility/algorithm/apply.hpp>
#include
<SimoxUtility/algorithm/minmax.h>
#include
"Color.h"
#include
"interpolation.h"
...
...
@@ -78,6 +80,24 @@ namespace simox::color
void
set_vmax
(
float
vmax
)
{
this
->
_vmax
=
vmax
;
}
void
set_vmin
(
const
std
::
vector
<
float
>&
values
)
{
set_vmin
(
*
std
::
max_element
(
values
.
begin
(),
values
.
end
()));
}
void
set_vmax
(
const
std
::
vector
<
float
>&
values
)
{
set_vmax
(
*
std
::
max_element
(
values
.
begin
(),
values
.
end
()));
}
/**
* @brief Set the value minimum to the minimum of `values`, measured by `unaryFunc`.
* You may have to specify the template argument (when template argument deduction fails).
*/
template
<
class
T
>
void
set_vmin
(
const
std
::
vector
<
T
>&
values
,
std
::
function
<
float
(
const
T
&
)
>
unaryFunc
)
{
set_vmax
(
simox
::
alg
::
min
(
values
,
unaryFunc
));
}
/**
* @brief Set the value maximum to the maximum of `values`, measured by `unaryFunc`.
* You may have to specify the template argument (when template argument deduction fails).
*/
template
<
class
T
>
void
set_vmax
(
const
std
::
vector
<
T
>&
values
,
std
::
function
<
float
(
const
T
&
)
>
unaryFunc
)
{
set_vmax
(
simox
::
alg
::
max
(
values
,
unaryFunc
));
}
/// Sets the value limits, i.e. scales the color map to the range [vmin, vmax].
void
set_vlimits
(
float
vmin
,
float
vmax
)
...
...
@@ -91,9 +111,20 @@ namespace simox::color
set_vmin
(
*
min
);
set_vmax
(
*
max
);
}
/**
* @brief Set the value minimum and maximum to the minimum and maximum of `values`, measured by `unaryFunc`.
* You may have to specify the template argument (when template argument deduction fails).
*/
template
<
class
T
>
void
set_vlimits
(
const
std
::
vector
<
T
>&
values
,
std
::
function
<
float
(
const
T
&
)
>
unaryFunc
)
{
const
auto
[
min
,
max
]
=
simox
::
alg
::
minmax
(
simox
::
alg
::
min
(
values
,
unaryFunc
));
set_vmin
(
unaryFunc
(
min
));
set_vmax
(
unaryFunc
(
max
));
}
/// Get this colormap reversed (but defined in the same value range as this).
/// Get this colormap reversed (but defined in the same value range as
`*
this
`
).
ColorMap
reversed
()
const
;
...
...
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