mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-13 15:57:14 +02: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,12 +1,12 @@
|
||||
// Your First C++ Program
|
||||
#include "aare/ContextManager.hpp"
|
||||
#include "aare/File.hpp"
|
||||
#include <iostream>
|
||||
|
||||
#define AARE_ROOT_DIR_VAR "PROJECT_ROOT_DIR"
|
||||
|
||||
void test(File *f, int frame_number) {
|
||||
void test(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 << *((uint16_t *)frame.get(0, 0)) << std::endl;
|
||||
std::cout << *((uint16_t *)frame.get(0, 1)) << std::endl;
|
||||
std::cout << *((uint16_t *)frame.get(1, 0)) << std::endl;
|
||||
@ -14,13 +14,12 @@ void test(File *f, int frame_number) {
|
||||
}
|
||||
|
||||
int main() {
|
||||
ContextManager ctx_manager;
|
||||
|
||||
auto PROJECT_ROOT_DIR = std::filesystem::path(getenv(AARE_ROOT_DIR_VAR));
|
||||
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "numpy" / "test_numpy_file.npy");
|
||||
std::cout << fpath << std::endl;
|
||||
|
||||
File *file = ctx_manager.get_file(fpath);
|
||||
File file(fpath,"r");
|
||||
test(file, 0);
|
||||
test(file, 2);
|
||||
test(file, 24);
|
||||
|
Reference in New Issue
Block a user