24 std::string save_img =
"";
25 std::string save_dat =
"";
28 for (
int i = 1; i < argc; i++)
33 if (strcmp(argv[i],
"-filename") == 0)
35 if (std::filesystem::path(argv[i + 1]).extension() ==
".t3p")
38 ImGui::DragInt(
"dwell time", &ricom->
dt, 1, 1);
40 else if (std::filesystem::path(argv[i + 1]).extension() ==
".tpx3")
47 if (strcmp(argv[i],
"-ip") == 0)
54 if (strcmp(argv[i],
"-port") == 0)
61 if (strcmp(argv[i],
"-nx") == 0)
63 ricom->
nx = std::stoi(argv[i + 1]);
67 if (strcmp(argv[i],
"-ny") == 0)
69 ricom->
ny = std::stoi(argv[i + 1]);
73 if (strcmp(argv[i],
"-cam_nxy") == 0)
75 ricom->
n_cam = std::stoi(argv[i + 1]);
80 if (strcmp(argv[i],
"-skipr") == 0)
82 ricom->
skip_row = std::stoi(argv[i + 1]);
86 if (strcmp(argv[i],
"-skipi") == 0)
88 ricom->
skip_img = std::stoi(argv[i + 1]);
92 if (strcmp(argv[i],
"-k") == 0)
98 if (strcmp(argv[i],
"-r") == 0)
104 if (strcmp(argv[i],
"-offset") == 0)
106 ricom->
offset[0] = std::stof(argv[i + 1]);
108 ricom->
offset[1] = std::stof(argv[i + 1]);
112 if (strcmp(argv[i],
"-update_offset") == 0)
118 if (strcmp(argv[i],
"-radius") == 0)
127 if (strcmp(argv[i],
"-f") == 0)
138 if (strcmp(argv[i],
"-rep") == 0)
140 ricom->
rep = std::stoi(argv[i + 1]);
144 if (strcmp(argv[i],
"-dwell_time") == 0)
146 ricom->
dt = std::stof(argv[i + 1]);
151 if (strcmp(argv[i],
"-threads") == 0)
153 ricom->
n_threads = std::stoi(argv[i + 1]);
157 if (strcmp(argv[i],
"-queue_size") == 0)
163 if (strcmp(argv[i],
"-redraw_interval") == 0)
170 if (strcmp(argv[i],
"-save_img_path") == 0)
172 save_img = argv[i + 1];
177 if (strcmp(argv[i],
"-save_data_path") == 0)
179 save_dat = argv[i + 1];
183 if (strcmp(argv[i],
"-plot_e_field") == 0)
185 ricom->
b_e_mag = (bool)std::stoi(argv[i + 1]);
193 std::vector<SdlImageWindow> image_windows;
194 std::thread run_thread;
208 SDL_Init(SDL_INIT_EVERYTHING);
209 SDL_GetCurrentDisplayMode(0, &DM);
210 float scale = (std::min)(((
float)DM.w) / ricom->
nx, ((float)DM.h) / ricom->
ny) * 0.8;
211 bool b_redraw =
false;
222 bool b_open_window =
true;
223 while (b_open_window)
240 for (
auto &wnd : image_windows)
246 while (SDL_PollEvent(&event))
248 if (event.type == SDL_QUIT ||
249 (event.type == SDL_WINDOWEVENT &&
250 event.window.event == SDL_WINDOWEVENT_CLOSE))
254 b_open_window =
false;
266 std::cout <<
"riCOM reconstruction data saved as " + save_dat << std::endl;
271 std::cout <<
"riCOM reconstruction image saved as " + save_img << std::endl;
void save_numpy(std::string *path, int nx, int ny, std::vector< T > *data)
void save_image(std::string *path, SDL_Surface *sdl_srf)
int run_cli(int argc, char *argv[], Ricom *ricom)
std::atomic< bool > report_set_public
std::array< float, 2 > radius
std::array< int, 2 > kernel_filter_frequency
ProgressMonitor * p_prog_mon
std::vector< float > ricom_image
std::array< float, 2 > offset