13 #ifndef IMAGE_OUTPUT_HPP
14 #define IMAGE_OUTPUT_HPP
30 :
image(L), cache(false), file(0), chars(0)
38 case 'b': file =
new rawb(name, 0, height, width, depth,
true);
break;
39 case 'c': file =
new rawc(name, 0, height, width, depth,
true);
break;
40 case 'u': file =
new rawu(name, 0, height, width, depth,
true);
break;
41 case 'U': file =
new rawU(name, 0, height, width, depth,
true);
break;
42 case 's': file =
new raws(name, 0, height, width, depth,
true);
break;
43 case 'S': file =
new rawS(name, 0, height, width, depth,
true);
break;
44 case 'l': file =
new rawl(name, 0, height, width, depth,
true);
break;
45 case 'L': file =
new rawL(name, 0, height, width, depth,
true);
break;
46 case 'i': file =
new rawi(name, 0, height, width, depth,
true);
break;
47 case 'I': file =
new rawI(name, 0, height, width, depth,
true);
break;
48 case 'f': file =
new rawf(name, 0, height, width, depth,
true);
break;
49 case 'F': file =
new rawF(name, 0, height, width, depth,
true);
break;
50 case 'd': file =
new rawd(name, 0, height, width, depth,
true);
break;
51 case 'D': file =
new rawD(name, 0, height, width, depth,
true);
break;
60 virtual double get(
int i,
int j,
int k)
const
63 0 <= j && j < file->get_width () &&
64 0 <= k && k < file->get_depth ())
67 return file->get(i, j, k);
69 return L->
get(i, j, k);
74 virtual void doc(std::ostream& out)
const
76 out <<
"output " << file->get_name ()
77 <<
" " << file->get_height()
78 <<
" " << file->get_width ()
79 <<
" " << file->get_depth ();
99 #pragma omp parallel for private(i, j, k) schedule(dynamic)
100 for (f = 0; f < h; f += g)
104 int l = std::min(f + g, h);
106 for (i = f; i < l; ++i)
107 for (j = 0; j < w; ++j)
108 for (k = 0; k < d; ++k)
109 file->put(i, j, k,
L->
get(i, j, k));
116 if (omp_get_thread_num() == 0)
131 void report(
int i,
int n)
133 std::ostringstream stream;
135 stream <<
"Wrote " << i
137 <<
" to " << file->get_name();
140 std::cout << std::string(chars,
'\b') << stream.str() << std::flush;
142 std::cout << std::string(chars,
'\b') << stream.str() << std::endl;
144 chars = stream.str().size();
virtual double get(int i, int j, int k) const =0
Return the value of the sample at row i, column j, channel k.
virtual void process()
Process all samples of this image, storing them in the file. Then, switch into cached mode...
Definition: image_output.hpp:88
output(std::string name, char type, image *L)
Write a raw-formatted data file named name. Type is a character giving the output sample type...
Definition: image_output.hpp:29
image * L
Left child.
Definition: image.hpp:117
RAW image file.
Definition: raw.hpp:68
virtual void doc(std::ostream &out) const
Produce a string documenting the function of this object.
Definition: image_output.hpp:74
Signed 32-bit RAW adapter.
Definition: raw.hpp:331
Byte-swapped single precision floating point RAW adapter.
Definition: raw.hpp:463
Single precision floating point RAW adapter.
Definition: raw.hpp:445
Unigned 32-bit RAW adapter.
Definition: raw.hpp:369
Base class for all image sources, filters, and operators.
Definition: image.hpp:20
Unsigned 16-bit RAW adapter.
Definition: raw.hpp:293
Byte-swapped unsigned 16-bit RAW adapter.
Definition: raw.hpp:311
virtual int get_height() const
Return the height of this image.
Definition: image.hpp:46
Unsigned 8-bit RAW adapter.
Definition: raw.hpp:235
Signed 8-bit RAW adapter.
Definition: raw.hpp:217
virtual int get_depth() const
Return the depth of this image.
Definition: image.hpp:66
virtual int get_width() const
Return the height of this image.
Definition: image.hpp:56
Byte-swapped single precision floating point RAW adapter.
Definition: raw.hpp:425
Single precision floating point RAW adapter.
Definition: raw.hpp:407
Signed 16-bit RAW adapter.
Definition: raw.hpp:255
Byte-swapped signed 16-bit RAW adapter.
Definition: raw.hpp:273
Byte-swapped signed 32-bit RAW adapter.
Definition: raw.hpp:349
Image file writer.
Definition: image_output.hpp:20
Byte-swapped unsigned 32-bit RAW adapter.
Definition: raw.hpp:387
virtual void process()
Process all samples of both children.
Definition: image.hpp:103