mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-01-31 14:14:57 +01:00
conform to file interface (PR#4) (#33)
* use FileInterface with numpy --------- Co-authored-by: Bechir <bechir.brahem420@gmail.com>
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
// Your First C++ Program
|
||||
#include "aare/ContextManager.hpp"
|
||||
#include "aare/File.hpp"
|
||||
#include "aare/utils/logger.hpp"
|
||||
#include <iostream>
|
||||
|
||||
#define AARE_ROOT_DIR_VAR "PROJECT_ROOT_DIR"
|
||||
|
||||
void test1(File *f, int frame_number) {
|
||||
void test1(File &f, int frame_number) {
|
||||
std::cout << "frame number: " << frame_number << std::endl;
|
||||
Frame frame = f->get_frame(frame_number);
|
||||
Frame frame = f.iread(frame_number);
|
||||
std::cout << *((uint32_t *)frame.get(0, 0)) << std::endl;
|
||||
std::cout << *((uint32_t *)frame.get(0, 1)) << std::endl;
|
||||
std::cout << *((uint32_t *)frame.get(0, 3839)) << std::endl;
|
||||
@@ -20,29 +20,24 @@ void test1(File *f, int frame_number) {
|
||||
}
|
||||
}
|
||||
|
||||
void test2(File *f, int frame_number) {
|
||||
void test2(File &f, int frame_number) {
|
||||
std::cout << "frame number: " << frame_number << std::endl;
|
||||
Frame frame = f->get_frame(frame_number);
|
||||
Frame frame = f.iread(frame_number);
|
||||
std::cout << *((uint32_t *)frame.get(0, 0)) << std::endl;
|
||||
std::cout << *((uint32_t *)frame.get(0, 1)) << std::endl;
|
||||
std::cout << *((uint32_t *)frame.get(0, 1280*4 -1)) << std::endl;
|
||||
std::cout << *((uint32_t *)frame.get(0, 1280 * 4 - 1)) << std::endl;
|
||||
}
|
||||
|
||||
int main() {
|
||||
ContextManager ctx_manager;
|
||||
auto PROJECT_ROOT_DIR = std::filesystem::path(getenv(AARE_ROOT_DIR_VAR));
|
||||
if (PROJECT_ROOT_DIR.empty()) {
|
||||
throw std::runtime_error("environment variable PROJECT_ROOT_DIR is not set");
|
||||
}
|
||||
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "mythen" / "m3_master_0.json");
|
||||
File *file = ctx_manager.get_file(fpath);
|
||||
File file(fpath, "r");
|
||||
test1(file, 0);
|
||||
|
||||
fpath = (PROJECT_ROOT_DIR / "data" / "mythen" / "scan242_master_3.raw");
|
||||
file = ctx_manager.get_file(fpath);
|
||||
test2(file, 0);
|
||||
|
||||
|
||||
|
||||
|
||||
File file2(fpath, "r");
|
||||
test2(file2, 0);
|
||||
}
|
||||
Reference in New Issue
Block a user