restore ssize_t changes

This commit is contained in:
Bechir Braham 2024-04-10 13:57:16 +02:00
parent bfb59d650b
commit 530feca830
No known key found for this signature in database
GPG Key ID: 7F511B55FD8E9671
8 changed files with 25 additions and 25 deletions

View File

@ -25,9 +25,9 @@ class File {
void seek(size_t frame_number);
size_t tell() const;
size_t total_frames() const;
size_t rows() const;
size_t cols() const;
size_t bitdepth() const;
ssize_t rows() const;
ssize_t cols() const;
ssize_t bitdepth() const;
File(File &&other);
~File();

View File

@ -55,9 +55,9 @@ class FileInterface {
// Getter functions
virtual size_t total_frames() const = 0;
virtual size_t rows() const = 0;
virtual size_t cols() const = 0;
virtual size_t bitdepth() const = 0;
virtual ssize_t rows() const = 0;
virtual ssize_t cols() const = 0;
virtual ssize_t bitdepth() const = 0;
// read one frame at position frame_number
Frame iread(size_t frame_number) {
@ -94,9 +94,9 @@ class FileInterface {
size_t max_frames_per_file{};
std::string version;
DetectorType m_type;
size_t m_rows{};
size_t m_cols{};
size_t m_bitdepth{};
ssize_t m_rows{};
ssize_t m_cols{};
ssize_t m_bitdepth{};
size_t current_frame{};
};

View File

@ -25,9 +25,9 @@ class NumpyFile : public FileInterface {
void seek(size_t frame_number) override { this->current_frame = frame_number; }
size_t tell() override { return this->current_frame; }
size_t total_frames() const override { return m_header.shape[0]; }
size_t rows() const override { return m_header.shape[1]; }
size_t cols() const override { return m_header.shape[2]; }
size_t bitdepth() const override { return m_header.dtype.bitdepth(); }
ssize_t rows() const override { return m_header.shape[1]; }
ssize_t cols() const override { return m_header.shape[2]; }
ssize_t bitdepth() const override { return m_header.dtype.bitdepth(); }
DType dtype() const { return m_header.dtype; }
std::vector<size_t> shape() const { return m_header.shape; }

View File

@ -64,9 +64,9 @@ class RawFile : public FileInterface {
~RawFile();
size_t total_frames() const override { return m_total_frames; }
size_t rows() const override { return m_rows; }
size_t cols() const override { return m_cols; }
size_t bitdepth() const override { return m_bitdepth; }
ssize_t rows() const override { return m_rows; }
ssize_t cols() const override { return m_cols; }
ssize_t bitdepth() const override { return m_bitdepth; }
private:
void get_frame_into(size_t frame_number, std::byte *image_buf);

View File

@ -10,11 +10,11 @@ namespace aare {
class SubFile {
protected:
FILE *fp = nullptr;
size_t m_bitdepth;
ssize_t m_bitdepth;
std::filesystem::path m_fname;
size_t m_rows{};
size_t m_cols{};
size_t n_frames{};
ssize_t m_rows{};
ssize_t m_cols{};
ssize_t n_frames{};
int m_sub_file_index_{};
// pointer to functions that will read frames
using pfunc = size_t (SubFile::*)(std::byte *);
@ -35,7 +35,7 @@ class SubFile {
template <typename DataType> size_t read_impl_flip(std::byte *buffer);
template <typename DataType> size_t read_impl_reorder(std::byte *buffer);
SubFile(std::filesystem::path fname, DetectorType detector, size_t rows, size_t cols, uint16_t bitdepth);
SubFile(std::filesystem::path fname, DetectorType detector, ssize_t rows, ssize_t cols, uint16_t bitdepth);
size_t get_part(std::byte *buffer, int frame_number);
size_t frame_number(int frame_index);

View File

@ -36,9 +36,9 @@ size_t File::bytes_per_frame() { return file_impl->bytes_per_frame(); }
size_t File::pixels() { return file_impl->pixels(); }
void File::seek(size_t frame_number) { file_impl->seek(frame_number); }
size_t File::tell() const { return file_impl->tell(); }
size_t File::rows() const { return file_impl->rows(); }
size_t File::cols() const { return file_impl->cols(); }
size_t File::bitdepth() const { return file_impl->bitdepth(); }
ssize_t File::rows() const { return file_impl->rows(); }
ssize_t File::cols() const { return file_impl->cols(); }
ssize_t File::bitdepth() const { return file_impl->bitdepth(); }
File::~File() { delete file_impl; }
Frame File::iread(size_t frame_number) { return file_impl->iread(frame_number); }

View File

@ -7,7 +7,7 @@
namespace aare {
SubFile::SubFile(std::filesystem::path fname, DetectorType detector, size_t rows, size_t cols, uint16_t bitdepth) {
SubFile::SubFile(std::filesystem::path fname, DetectorType detector, ssize_t rows, ssize_t cols, uint16_t bitdepth) {
this->m_rows = rows;
this->m_cols = cols;
this->m_fname = fname;

View File

@ -23,7 +23,7 @@ PYBIND11_MODULE(_aare, m) {
py::enum_<DetectorType>(m, "DetectorType");
py::class_<Frame>(m, "_Frame")
.def(py::init<std::byte *, size_t, size_t, size_t>())
.def(py::init<std::byte *, ssize_t, ssize_t, ssize_t>())
.def("get", &Frame::get)
.def_property_readonly("rows", &Frame::rows)
.def_property_readonly("cols", &Frame::cols)