17 void save_numpy(std::string *path,
int nx,
int ny, std::vector<T> *data)
19 std::string ext = std::filesystem::path(*path).extension().string();
24 const std::vector<long unsigned> shape{
static_cast<long unsigned>(ny),
static_cast<long unsigned>(nx)};
25 npy::SaveArrayAsNumpy(path->c_str(),
false, shape.size(), shape.data(), *data);
27 template void save_numpy<float>(std::string *path,
int nx,
int ny, std::vector<float> *data);
28 template void save_numpy<std::complex<float>>(std::string *path,
int nx,
int ny, std::vector<std::complex<float>> *data);
32 std::string ext = std::filesystem::path(*path).extension().string();
33 if ((ext !=
".png") && (ext !=
".PNG"))
37 IMG_SavePNG(sdl_srf, path->c_str());
41 void v_splitter(
float thickness,
float &size0,
const float &min_h,
const float &max_h,
const float &offset)
44 ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetStyle().Colors[ImGuiCol_ScrollbarGrab]);
45 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::GetStyle().Colors[ImGuiCol_ScrollbarGrabHovered]);
46 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImGui::GetStyle().Colors[ImGuiCol_ScrollbarGrabActive]);
47 ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, ImGui::GetStyle().ScrollbarRounding);
48 ImGui::Button(
"v", ImVec2(-1, thickness));
49 ImGui::PopStyleColor(3);
50 ImGui::PopStyleVar(1);
51 if (ImGui::IsItemHovered() || ImGui::IsItemActive())
53 ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeNS);
56 if (ImGui::IsItemActive())
58 float d = ImGui::GetMousePos().y - offset;
75 ImGui::SetNextWindowPos(pos);
76 ImGui::SetNextWindowSize(size);
80 static auto first_time =
true;
84 ImGui::DockBuilderRemoveNode(
dock_id);
86 ImGui::DockBuilderSetNodePos(
dock_id, pos);
87 ImGui::DockBuilderSetNodeSize(
dock_id, size);
88 ImGui::DockBuilderDockWindow(
"RICOM",
dock_id);
89 ImGui::DockBuilderFinish(
dock_id);
97 void draw_pixel(SDL_Surface *surface,
int x,
int y,
float val,
int col_map)
99 tinycolormap::Color c = tinycolormap::GetColor(val, tinycolormap::ColormapType(col_map));
100 Uint32 px = SDL_MapRGB(surface->format, (Uint8)(c.ri()), (Uint8)(c.gi()), (Uint8)(c.bi()));
101 Uint32 *
const target_pixel = (Uint32 *)((Uint8 *)surface->pixels + y * surface->pitch + x * surface->format->BytesPerPixel);
105 void draw_pixel(SDL_Surface *surface,
int x,
int y,
float ang,
float mag,
int col_map)
107 tinycolormap::Color c = mag * tinycolormap::GetColor(ang, tinycolormap::ColormapType(col_map));
108 Uint32 px = SDL_MapRGB(surface->format, (Uint8)(c.ri()), (Uint8)(c.gi()), (Uint8)(c.bi()));
109 Uint32 *
const target_pixel = (Uint32 *)((Uint8 *)surface->pixels + y * surface->pitch + x * surface->format->BytesPerPixel);
template void save_numpy< float >(std::string *path, int nx, int ny, std::vector< float > *data)
void save_numpy(std::string *path, int nx, int ny, std::vector< T > *data)
void save_image(std::string *path, SDL_Surface *sdl_srf)
void v_splitter(float thickness, float &size0, const float &min_h, const float &max_h, const float &offset)
const ImGuiWindowFlags window_flags
void render(ImVec2 pos, ImVec2 size)
const ImGuiDockNodeFlags dockspace_flags
Main_Dock(ImGuiID dock_id)
void draw_pixel(SDL_Surface *surface, int x, int y, float val, int col_map)