mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-14 08:17:13 +02:00
new folder structure
This commit is contained in:
23
core/src/Frame.cpp
Normal file
23
core/src/Frame.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include "aare/Frame.hpp"
|
||||
#include <iostream>
|
||||
|
||||
template <typename DataType>
|
||||
Frame<DataType>::Frame(std::byte* bytes, ssize_t rows, ssize_t cols):
|
||||
rows(rows), cols(cols) {
|
||||
data = new DataType[rows*cols];
|
||||
std::memcpy(data, bytes, rows*cols*sizeof(DataType));
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename DataType>
|
||||
DataType Frame<DataType>::get(int row, int col) {
|
||||
if (row < 0 || row >= rows || col < 0 || col >= cols) {
|
||||
std::cerr << "Invalid row or column index" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
return data[row*cols + col];
|
||||
}
|
||||
|
||||
|
||||
template class Frame<uint16_t>;
|
Reference in New Issue
Block a user