tdegeus / cppcolormap Goto Github PK
View Code? Open in Web Editor NEWLibrary with colormaps for C++
License: GNU General Public License v3.0
Library with colormaps for C++
License: GNU General Public License v3.0
Please complete the JSON file functionality.
Hi! Built the tests fine, but gcc doesn't seem to like the signatures in the python bindings
error: invalid 'static_cast' from type '<unresolved overloaded function type>' to type 'std::string (*)(const xt::pytensor<double, 1, xt::layout_type::dynamic>&)' {aka 'std::__cxx11::basic_string<char> (*)(const xt::pytensor<dou
│ ble, 1, xt::layout_type::dynamic>&)'}
69 │ 61 | static_cast<std::string (*)(const xt::pytensor<double, 1>&)>(&cppcolormap::rgb2hex),
Logs: https://gist.github.com/SomeoneSerge/2507244e5bc3b11982948ff0ed86a681
Getting the same error with gcc11 and gcc12.
Pybind11 version: pybind11-2.10.3/include (found version "2.10.3")
Built with: SomeoneSerge/pkgs@b0274d7
https://stackoverflow.com/a/59574671/2646505
Apply PackConstructorInitializers
and remove
// clang-format off
...
// clang-format on
Hello,
I have some problems when I try to compile cppcolormap on my Linux machine. On my windows machine everything compiles without errors. Is there a simple solution to fix this issue?
Some of the errors occur several times so I attached only a snippet of them.
Architecture is:
Ubuntu 18.04.5 LTS x86_64
Used package versions:
xtl-0.6.11
xtensor-0.21.3
/opt/xtensor-win/include/xtensor/xutils.hpp:347:17: note: no known conversion for argument 1 from ‘<unresolved overloaded function type>’ to ‘xt::fixed_shape<>&’
In file included from /home/espu/Desktop/AMADEUS.u/plain_cpp_headers/helper_headers/Intensity_To_RGB_Converter.h:22:0,
from /home/espu/Desktop/AMADEUS.u/plain_cpp_sources/helper_sources/Intensity_To_RGB_Converter.cpp:1:
/home/espu/Desktop/AMADEUS.u/plain_cpp_headers/helper_headers/cppcolormap.h: In function ‘xt::xtensor<double, 2> cppcolormap::Accent_r(size_t)’:
/home/espu/Desktop/AMADEUS.u/plain_cpp_headers/helper_headers/cppcolormap.h:3144:70: error: could not convert ‘xt::flip<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag> >(cppcolormap::Accent(size_t)(), 0)’ from ‘void’ to ‘xt::xtensor<double, 2> {aka xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>}’
nline xt::xtensor<double,2> Accent_r(size_t N = 8) { return xt::flip(Accent(N), 0); }
~~~~~~~~^~~~~~~~~~~~~~
/home/espu/Desktop/AMADEUS.u/plain_cpp_headers/helper_headers/cppcolormap.h: In function ‘xt::xtensor<double, 2> cppcolormap::Dark2_r(size_t)’:
/home/espu/Desktop/AMADEUS.u/plain_cpp_headers/helper_headers/cppcolormap.h:3145:69: error: could not convert ‘xt::flip<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag> >(cppcolormap::Dark2(size_t)(), 0)’ from ‘void’ to ‘xt::xtensor<double, 2> {aka xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>}’
inline xt::xtensor<double,2> Dark2_r(size_t N = 8) { return xt::flip(Dark2(N), 0); }
~~~~~~~~^~~~~~~~~~~~~
/home/espu/Desktop/AMADEUS.u/plain_cpp_headers/helper_headers/cppcolormap.h: In function ‘xt::xtensor<double, 2> cppcolormap::Paired_r(size_t)’:
/home/espu/Desktop/AMADEUS.u/plain_cpp_headers/helper_headers/cppcolormap.h:3146:71: error: could not convert ‘xt::flip<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag> >(cppcolormap::Paired(size_t)(), 0)’ from ‘void’ to ‘xt::xtensor<double, 2> {aka xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>}’
line xt::xtensor<double,2> Paired_r(size_t N = 12) { return xt::flip(Paired(N), 0); }
~~~~~~~~^~~~~~~~~~~~~~
/home/espu/Desktop/AMADEUS.u/plain_cpp_headers/helper_headers/cppcolormap.h: In function ‘xt::xtensor<double, 2> cppcolormap::Spectral_r(size_t)’:
/home/espu/Desktop/AMADEUS.u/plain_cpp_headers/helper_headers/cppcolormap.h:3147:73: error: could not convert ‘xt::flip<xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag> >(cppcolormap::Spectral(size_t)(), 0)’ from ‘void’ to ‘xt::xtensor<double, 2> {aka xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>}’
ne xt::xtensor<double,2> Spectral_r(size_t N = 11) { return xt::flip(Spectral( ), 0); }
~~~~~~~~^~~~~~~~~~~~~~~~~~
home/espu/Desktop/AMADEUS.u/plain_cpp_headers/helper_headers/cppcolormap.h: In function ‘xt::xtensor<double, 2> cppcolormap::YellowOrange(size_t)’:
/home/espu/Desktop/AMADEUS.u/plain_cpp_headers/helper_headers/cppcolormap.h:3137:24: error: no match for ‘operator/’ (operand types are ‘xt::xtensor<double, 2> {aka xt::xtensor_container<xt::uvector<double, std::allocator<double> >, 2, (xt::layout_type)1, xt::xtensor_expression_tag>}’ and ‘double’)
return interp(data / 255.0, N);
I was looking for a way to use cppcolormap to convert a 2D xarray into a 3D xarray (the added dimension being RGB), as you would do with matplotlib, e.g.:
# in python using matplotlib
a2 = plt.cm.viridis(a1)
I think using xt::vectorize
is the way to go, but I'm not sure. Or maybe it already exists in this library and I missed it?
Add a dialog to prompt the user to save the modified results before the program is closed.
This is not entirely serious, but could be a cool feature:
Modern terminals can handle 256 colors, which are mapped to some values here: https://jonasjacek.github.io/colors/
This website also has a JSON file.
What I am wondering is wether we could map the (interpolated) RGB colors to terminal colors and then return a vector colormap of terminal colors so that we could plot a heatmap like this with different color schemes:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.