Dune::Copasi
Loading...
Searching...
No Matches
tiff_file.hh
Go to the documentation of this file.
1#ifndef DUNE_COPASI_TIFF_FILE_HH
2#define DUNE_COPASI_TIFF_FILE_HH
3
4#include <dune/common/exceptions.hh>
5#include <dune/common/float_cmp.hh>
6
7#include <filesystem>
8#include <memory>
9
10namespace Dune::Copasi {
11
12// NOLINTBEGIN(altera-struct-pack-align)
13
18{
19
21 struct Info
22 {
25 float x_res = 0., x_off = 0.;
26 float y_res = 0., y_off = 0.;
28 bool zero = false;
29 };
30
32 explicit TIFFFile(const std::filesystem::path& filename);
33
34 TIFFFile(const TIFFFile&) = delete;
35 TIFFFile(TIFFFile&&) = delete;
36
37 TIFFFile& operator=(const TIFFFile&) = delete;
39
42
44 void close();
45
47 [[nodiscard]] void* malloc_scanline() const;
48
50 static void free(void* ptr);
51
53 void read_scanline(void* ptr, std::size_t row) const;
54
55 [[nodiscard]] const Info& info() const { return _info; }
56
57private:
58 void* _tiff_file;
59 Info _info;
60};
61
62// NOLINTEND(altera-struct-pack-align)
63
64} // namespace Dune::Copasi
65
66#endif // DUNE_COPASI_TIFF_FILE_HH
Definition axis_names.hh:7
constexpr bool is_bitflags_v
Alias for Bitflag indicator.
Definition bit_flags.hh:24
Basic information about the tiff file.
Definition tiff_file.hh:22
uint16_t bits_per_sample
Definition tiff_file.hh:27
float x_res
Definition tiff_file.hh:25
uint32_t row_size
Definition tiff_file.hh:23
float x_off
Definition tiff_file.hh:25
uint32_t col_size
Definition tiff_file.hh:24
bool zero
Definition tiff_file.hh:28
float y_res
Definition tiff_file.hh:26
float y_off
Definition tiff_file.hh:26
Simple tiff file interface.
Definition tiff_file.hh:18
void read_scanline(void *ptr, std::size_t row) const
Reads one line on the buffer for a given row.
TIFFFile & operator=(TIFFFile &&)=delete
TIFFFile(const TIFFFile &)=delete
void * malloc_scanline() const
Allocates buffer to scan lines of the file.
~TIFFFile()
Destructor, closes the file.
const Info & info() const
Definition tiff_file.hh:55
TIFFFile & operator=(const TIFFFile &)=delete
TIFFFile(TIFFFile &&)=delete
static void free(void *ptr)
Deallocates tiff type pointers.
TIFFFile(const std::filesystem::path &filename)
opens a tiff file from the file system
void close()
Closes the file.