diff --git a/std-det-writer/include/DetWriterConfig.hpp b/std-det-writer/include/DetWriterConfig.hpp index 96aefe3..31e983a 100644 --- a/std-det-writer/include/DetWriterConfig.hpp +++ b/std-det-writer/include/DetWriterConfig.hpp @@ -17,10 +17,12 @@ struct DetWriterConfig { return { config_parameters["detector_name"].GetString(), + config_parameters["image_n_pixels"].GetInt(), }; } const std::string detector_name; + const int image_n_pixels; }; diff --git a/std-det-writer/src/main.cpp b/std-det-writer/src/main.cpp index cb3fcb9..c836d64 100644 --- a/std-det-writer/src/main.cpp +++ b/std-det-writer/src/main.cpp @@ -20,14 +20,17 @@ int main (int argc, char *argv[]) { if (argc != 2) { cout << endl; - cout << "Usage: std-det-writer [detector_json_filename]" << endl; + cout << "Usage: std-det-writer [detector_json_filename]" + " [bit_depth]" << endl; cout << "\tdetector_json_filename: detector config file path." << endl; + cout << "\tbit_depth: bit depth of the incoming udp packets." << endl; cout << endl; exit(-1); } auto const config = DetWriterConfig::from_json_file(string(argv[1])); + const int bit_depth = atoi(argv[2]); MPI_Init(nullptr, nullptr); @@ -42,7 +45,7 @@ int main (int argc, char *argv[]) auto receiver = BufferUtils::connect_socket( ctx, config.detector_name, "writer_agent"); - const size_t IMAGE_N_BYTES = 12; + const size_t IMAGE_N_BYTES = config.image_n_pixels * bit_depth / 8; RamBuffer image_buffer(config.detector_name + "_assembler", sizeof(ImageMetadata), IMAGE_N_BYTES, 1, RAM_BUFFER_N_SLOTS);