#pragma once #include "TeledyneXrayProcessingLib.h" #include template class Image { public: int width; int height; std::vector pixels; Image() { this->width = 0; this->height = 0; this->pixels.clear(); } bool Create(int w, int h, bool zero = false) { if (w <= 0 || h <= 0) { return false; } this->width = w; this->height = h; this->pixels.resize(w * h); if (zero) { std::fill(this->pixels.begin(), this->pixels.end(), 0); } return true; } bool Load(std::string fileName) { int w = TXP_GetTiffWidth(fileName.c_str()); int h = TXP_GetTiffHeight(fileName.c_str()); return this->Create(w, h) && TXP_ReadTiff(fileName.c_str(), this->pixels.data(), this->width, this->height); } bool Save(std::string fileName) { return TXP_WriteTiff(fileName.c_str(), this->pixels.data(), this->width, this->height); } };