riCOM_cpp
This repository contains the C++ implementation of the riCOM (Real Time Centre Of Mass) algorithm for 4D Scanning electron microscopy.
GuiUtils.h
Go to the documentation of this file.
1 /* Copyright (C) 2021 Thomas Friedrich, Chu-Ping Yu,
2  * University of Antwerp - All Rights Reserved.
3  * You may use, distribute and modify
4  * this code under the terms of the GPL3 license.
5  * You should have received a copy of the GPL3 license with
6  * this file. If not, please visit:
7  * https://www.gnu.org/licenses/gpl-3.0.en.html
8  *
9  * Authors:
10  * Thomas Friedrich <thomas.friedrich@uantwerpen.be>
11  * Chu-Ping Yu <chu-ping.yu@uantwerpen.be>
12  */
13 
14 #ifndef GUI_UTILS_H
15 #define GUI_UTILS_H
16 
17 #include <string>
18 #include <vector>
19 #include <complex>
20 #include <filesystem>
21 
22 #include <SDL_image.h>
23 
24 #include "imgui.h"
25 #include "imgui_internal.h"
26 
27 #include "libnpy.hpp"
28 #include "tinycolormap.hpp"
29 class Main_Dock
30 {
31 public:
32  ImGuiID dock_id;
33  const ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_PassthruCentralNode | ImGuiDockNodeFlags_DockSpace;
34  const ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
35  explicit Main_Dock(ImGuiID dock_id);
36  void render(ImVec2 pos, ImVec2 size);
37 };
38 
39 template <typename T>
40 void save_numpy(std::string *path, int nx, int ny, std::vector<T> *data);
41 
42 void save_image(std::string *path, SDL_Surface *sdl_srf);
43 
44 void v_splitter(float thickness,float &size0, const float &min_h, const float &max_h, const float &offset);
45 namespace SDL_Utils
46 {
47  void draw_pixel(SDL_Surface *surface, int x, int y, float val, int color_map);
48  void draw_pixel(SDL_Surface *surface, int x, int y, float ang, float mag, int color_map);
49 }
50 
51 #endif // GUI_UTILS_H
void save_numpy(std::string *path, int nx, int ny, std::vector< T > *data)
Definition: GuiUtils.cpp:17
void save_image(std::string *path, SDL_Surface *sdl_srf)
Definition: GuiUtils.cpp:30
void v_splitter(float thickness, float &size0, const float &min_h, const float &max_h, const float &offset)
Definition: GuiUtils.cpp:41
const ImGuiWindowFlags window_flags
Definition: GuiUtils.h:34
void render(ImVec2 pos, ImVec2 size)
Definition: GuiUtils.cpp:73
const ImGuiDockNodeFlags dockspace_flags
Definition: GuiUtils.h:33
ImGuiID dock_id
Definition: GuiUtils.h:32
Main_Dock(ImGuiID dock_id)
Definition: GuiUtils.cpp:68
void draw_pixel(SDL_Surface *surface, int x, int y, float val, int col_map)
Definition: GuiUtils.cpp:97