forked from larrylindsey/imageprocessing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageExtractor.cpp
More file actions
59 lines (36 loc) · 1.37 KB
/
Copy pathImageExtractor.cpp
File metadata and controls
59 lines (36 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <boost/lexical_cast.hpp>
#include <imageprocessing/ImageStack.h>
#include <imageprocessing/Image.h>
#include "ImageExtractor.h"
static logger::LogChannel imageextractorlog("imageextractorlog", "[ImageExtractor] ");
ImageExtractor::ImageExtractor() {
registerInput(_stack, "stack");
_stack.registerBackwardCallback(&ImageExtractor::onInputSet, this);
}
void
ImageExtractor::onInputSet(const pipeline::InputSet<ImageStack>&) {
LOG_ALL(imageextractorlog) << "input image stack set" << std::endl;
updateInputs();
_images.resize(_stack->size());
// for each image in the stack
for (unsigned int i = 0; i < _stack->size(); i++) {
LOG_ALL(imageextractorlog) << "(re)setting output " << i << std::endl;
if (_images[i]) {
LOG_ALL(imageextractorlog) << "image was " << _images[i]->width() << "x" << _images[i]->height() << std::endl;
} else {
LOG_ALL(imageextractorlog) << "image was unset" << std::endl;
}
_images[i] = (*_stack)[i];
LOG_ALL(imageextractorlog) << "image is " << _images[i]->width() << "x" << _images[i]->height() << std::endl;
LOG_ALL(imageextractorlog) << "registering output 'image " << i << "'" << std::endl;
registerOutput(_images[i], "image " + boost::lexical_cast<std::string>(i));
}
}
void
ImageExtractor::updateOutputs() {
// there is nothing to do here
}
unsigned int
ImageExtractor::getNumImages() {
return _images.size();
}