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