829 std::vector<size_t> dose_map(
nxy);
830 std::vector<size_t> sumx_map(
nxy);
831 std::vector<size_t> sumy_map(
nxy);
832 std::vector<uint16_t> frame(camera_spec->nx_cam * camera_spec->ny_cam);
833 std::vector<uint16_t> *p_frame = &frame;
841 std::array<float, 2> com_xy = {0.0, 0.0};
842 std::array<float, 2> *p_com_xy = &com_xy;
843 std::array<float, 2> com_xy_sum = {0.0, 0.0};
851 size_t first_frame = img_num *
nxy;
852 size_t end_frame = (img_num + 1) *
nxy;
853 size_t fr_total_u = (size_t)
fr_total;
858 dose_map.assign(
nxy, 0);
859 sumx_map.assign(
nxy, 0);
860 sumy_map.assign(
nxy, 0);
861 reinit_vectors_limits();
866 int idxx = prog_mon.fr_count -
nxy * img_num - 2;
873 camera_spec->read_frame_com_cbed(prog_mon.fr_count,
874 dose_map, sumx_map, sumy_map,
878 first_frame, end_frame);
883 camera_spec->read_frame_com(prog_mon.fr_count,
884 dose_map, sumx_map, sumy_map,
887 first_frame, end_frame);
892 if (dose_map[idxx] == 0)
899 com_xy[0] = sumx_map[idxx] / dose_map[idxx];
900 com_xy[1] = sumy_map[idxx] / dose_map[idxx];
904 com_xy_sum[0] += com_xy[0];
905 com_xy_sum[1] += com_xy[1];
908 iy = floor(idxx /
nx);
913 { icom(com_xy, ix, iy); });
917 icom(p_com_xy, ix, iy);
921 compute_electric_field(com_xy, idxx);
925 if (prog_mon.report_set)
927 update_surfaces(iy, p_frame);
930 frame.assign(camera_spec->nx_cam * camera_spec->ny_cam, 0);
935 rescales_recomputes();
936 for (
int i = 0; i < 2; i++)
938 com_public[i] = com_xy_sum[i] / prog_mon.fr_count_i;
941 prog_mon.reset_flags();
945 if (prog_mon.fr_count >= end_frame)
947 if (prog_mon.fr_count != fr_total_u)
950 first_frame = img_num *
nxy;
951 end_frame = (img_num + 1) *
nxy;
952 reinit_vectors_limits();
953 dose_map.assign(
nxy, 0);
954 sumx_map.assign(
nxy, 0);
955 sumy_map.assign(
nxy, 0);
965 if (prog_mon.fr_count == fr_total_u ||
rc_quit)
void init(int n_threads, int limit)
void push_task(const T &task)
void wait_for_completion()
std::array< float, 2 > radius2