11 #ifndef STACK_PROCESS_MERGE_HPP
12 #define STACK_PROCESS_MERGE_HPP
36 setName(
"Stack/MultiStack/Align Canvas");
37 setDesc(
"Align two stacks' canvas. Expand the canvas of the first stack so the\n"
38 "second one can be drawn onto it. If the 'change both stack' option is\n"
39 "selected, then all the stacks are extended and made aligned with the\n"
40 "axis of the reference system. Otherwise, the work store of the current\n"
41 "stack is replaced with the projection of the other stack onto the\n"
42 "extended canvas, keeping the resolution of the current stack.");
43 setIcon(QIcon(
":/images/AlignCanvas.png"));
45 addParm(
"Change both stacks",
"Extend the non-active stacks canvas as well",
"True",booleanChoice());
46 addParm(
"Interpolation",
"How to resample data points",
"Linear", QStringList() <<
"Linear" <<
"Nearest");
51 if(not checkState().store(STORE_NON_EMPTY | STORE_VISIBLE, 0)
52 .store(STORE_NON_EMPTY | STORE_VISIBLE, 1))
54 Stack* current = currentStack();
55 Stack* other = stack(1 - current->
id());
57 return setErrorMessage(
"Error, one stack is labeled and the other is not.");
58 bool change_both =
stringToBool(parm(
"Change both stacks"));
59 bool result = run(current, other, change_both, parm(
"Interpolation"));
60 if(not change_both and result)
65 bool run(
Stack* target,
Stack* other,
bool change_both, QString interp =
"Linear");
66 bool projectGlobal(
Stack* s1,
Stack* s2, QString interp =
"Linear");
67 bool projectOnStack(
Stack* target,
const Stack* to_project, QString interp =
"Linear");
80 setName(
"Stack/MultiStack/Combine Stacks");
81 setDesc(
"Combine the values of the main and work store onto the work store.");
82 setIcon(QIcon(
":/images/CombineStacks.png"));
84 addParm(
"Method",
"Method",
"Average", QStringList() <<
"Max" <<
"Min" <<
"Average" <<
"Product" <<
"Add" <<
"Subtract");
89 if(not checkState().store(STORE_NON_EMPTY | STORE_VISIBLE | STORE_MAIN)
90 .store(STORE_NON_EMPTY | STORE_VISIBLE | STORE_WORK))
92 Stack* current = currentStack();
94 return setErrorMessage(
"Error, one store is labeled and the other is not.");
95 return run(current, parm(
"Method"));
98 bool run(
Stack* target, QString method);
114 setName(
"Stack/MultiStack/Merge Stacks");
115 setDesc(
"Merge the main store of the current stack with the current store of the other one.\n"
116 "The current stack will be resampled if required.");
117 setIcon(QIcon(
":/images/MergeStacks.png"));
119 addParm(
"Method",
"Method",
"max", QStringList() <<
"max" <<
"min" <<
"average" <<
"product");
120 addParm(
"Interpolation",
"Interpolation",
"Linear", QStringList() <<
"Linear" <<
"Nearest");
125 if(not checkState().store(STORE_NON_EMPTY | STORE_VISIBLE, 0)
126 .store(STORE_NON_EMPTY | STORE_VISIBLE, 1))
128 Stack* current = currentStack();
129 Stack* other = stack(1 - current->
id());
131 return setErrorMessage(
"Error, the current stack must have its main store active.");
133 return setErrorMessage(
"Error, one stack is labeled and the other is not.");
134 bool result = run(current, other, parm(
"Method"), parm(
"Interpolation"));
140 bool run(
Stack* target,
const Stack* other, QString method, QString interp =
"Linear");