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)
39 if (strcmp(argv[i],
"-ip") == 0)
46 if (strcmp(argv[i],
"-port") == 0)
53 if (strcmp(argv[i],
"-nx") == 0)
55 ricom->
nx = std::stoi(argv[i + 1]);
59 if (strcmp(argv[i],
"-ny") == 0)
61 ricom->
ny = std::stoi(argv[i + 1]);
65 if (strcmp(argv[i],
"-cam_nx") == 0)
72 if (strcmp(argv[i],
"-cam_ny") == 0)
79 if (strcmp(argv[i],
"-skipr") == 0)
81 ricom->
skip_row = std::stoi(argv[i + 1]);
85 if (strcmp(argv[i],
"-skipi") == 0)
87 ricom->
skip_img = std::stoi(argv[i + 1]);
91 if (strcmp(argv[i],
"-k") == 0)
97 if (strcmp(argv[i],
"-r") == 0)
103 if (strcmp(argv[i],
"-offset") == 0)
105 ricom->
offset[0] = std::stof(argv[i + 1]);
107 ricom->
offset[1] = std::stof(argv[i + 1]);
111 if (strcmp(argv[i],
"-update_offset") == 0)
117 if (strcmp(argv[i],
"-radius") == 0)
126 if (strcmp(argv[i],
"-f") == 0)
135 if (strcmp(argv[i],
"-depth") == 0)
142 if (strcmp(argv[i],
"-rep") == 0)
144 ricom->
rep = std::stoi(argv[i + 1]);
148 if (strcmp(argv[i],
"-dwell_time") == 0)
155 if (strcmp(argv[i],
"-threads") == 0)
157 ricom->
n_threads = std::stoi(argv[i + 1]);
161 if (strcmp(argv[i],
"-queue_size") == 0)
167 if (strcmp(argv[i],
"-redraw_interval") == 0)
174 if (strcmp(argv[i],
"-save_img_path") == 0)
176 save_img = argv[i + 1];
181 if (strcmp(argv[i],
"-save_data_path") == 0)
183 save_dat = argv[i + 1];
187 if (strcmp(argv[i],
"-plot_e_field") == 0)
189 ricom->
b_e_mag = (bool)std::stoi(argv[i + 1]);
197 std::vector<SdlImageWindow> image_windows;
198 std::thread run_thread;
211 SDL_Init(SDL_INIT_EVERYTHING);
212 SDL_GetCurrentDisplayMode(0, &DM);
213 float scale = (std::min)(((
float)DM.w) / ricom->
nx, ((float)DM.h) / ricom->
ny) * 0.8;
214 bool b_redraw =
false;
225 bool b_open_window =
true;
226 while (b_open_window)
243 for (
auto &wnd : image_windows)
249 while (SDL_PollEvent(&event))
251 if (event.type == SDL_QUIT ||
252 (event.type == SDL_WINDOWEVENT &&
253 event.window.event == SDL_WINDOWEVENT_CLOSE))
257 b_open_window =
false;
269 std::cout <<
"riCOM reconstruction data saved as " + save_dat << std::endl;
274 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, CAMERA::Default_configurations &hardware_configurations)
std::atomic< bool > report_set_public
std::array< float, 2 > radius
std::array< int, 2 > kernel_filter_frequency
std::vector< float > ricom_data
ProgressMonitor * p_prog_mon
enum CAMERA::Camera_model select_mode_by_file(const char *filename)
CAMERA::Camera_BASE camera
std::array< float, 2 > offset
void run_ricom(Ricom *r, RICOM::modes mode)