11 std::ifstream in(input);
30 }
else if (!(c ==
' ' ||
48 if (magicValue ==
"P2") {
50 }
else if (magicValue ==
"P5") {
54 "Unknown magic value: '" + magicValue +
"'");
59 std::istringstream conv;
66 std::istringstream conv;
73 std::istringstream conv;
96 unsigned int numPixels = 0;
99 for (
unsigned int row = 0; row <
height_m; ++ row) {
100 for (
unsigned int col = 0; col <
width_m; ++ col) {
104 const uint16_t *val =
reinterpret_cast<const uint16_t*
>(&c[0]);
117 const unsigned int printWidth = 5;
118 for (
unsigned int i = 0; i <
height_m; ++ i) {
119 for (
unsigned int j = 0; j <
width_m; ++ j) {
120 unsigned int idx =
getIdx(i, j);
121 std::cout <<
" " << std::setw(printWidth) <<
pixels_m[idx];
The base class for all OPAL exceptions.
unsigned int getIdx(unsigned int h, unsigned int w) const
std::vector< unsigned short > pixels_m
constexpr double c
The velocity of light in m/s.
std::string getNextPart(std::istream &in)
void readImageAscii(std::istream &in)
void readHeader(std::istream &in)
void print(std::ostream &out) const
Inform & endl(Inform &inf)
void readImageBinary(std::istream &in)
PortableGraymapReader(const std::string &input)