forked from larrylindsey/imageprocessing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubStackSelector.cpp
More file actions
46 lines (33 loc) · 1.17 KB
/
Copy pathSubStackSelector.cpp
File metadata and controls
46 lines (33 loc) · 1.17 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
#include "SubStackSelector.h"
logger::LogChannel substackselectorlog("substackselectorlog", "[SubStackSelector] ");
SubStackSelector::SubStackSelector(int firstImage, int lastImage) :
_firstImage(firstImage),
_lastImage(lastImage) {
registerInput(_stack, "stack");
registerOutput(_subStack, "stack");
}
void
SubStackSelector::updateOutputs() {
_subStack->clear();
LOG_ALL(substackselectorlog)
<< "selecting substack from stack of size "
<< _stack->size() << std::endl;
LOG_ALL(substackselectorlog)
<< "first section is " << _firstImage
<< ", last section is " << _lastImage
<< std::endl;
unsigned int lastImage = (_lastImage <= 0 ? _stack->size() - 1 + _lastImage : _lastImage);
LOG_ALL(substackselectorlog)
<< "set last section to " << lastImage
<< std::endl;
if (lastImage > _stack->size() - 1) {
LOG_ERROR(substackselectorlog)
<< "parameter last section (" << lastImage << ") "
<< "is bigger than number of images in given stack -- "
<< "will use " << (_stack->size() - 1) << " instead"
<< std::endl;
lastImage = _stack->size() - 1;
}
for (unsigned int i = _firstImage; i <= lastImage; i++)
_subStack->add((*_stack)[i]);
}