11 #ifndef STACKPROCESSFILTERS_HPP
12 #define STACKPROCESSFILTERS_HPP
33 setName(
"Stack/Filters/Average");
34 setDesc(
"Average stack data with a square filter.");
35 setIcon(QIcon(
":/images/AvgPix.png"));
37 addParm(
"X Radius",
"X Radius",
"1");
38 addParm(
"Y Radius",
"Y Radius",
"1");
39 addParm(
"Z Radius",
"Z Radius",
"1");
40 addParm(
"Steps",
"Steps",
"1");
45 if(!checkState().store(STORE_NON_EMPTY))
47 Store* input = currentStack()->currentStore();
48 Store* output = currentStack()->work();
49 Point3i r(parm(
"X Radius").toInt(), parm(
"Y Radius").toInt(), parm(
"Z Radius").toInt());
50 bool res = run(input, output, r, parm(
"Steps").toUInt());
69 setName(
"Stack/Filters/Median");
70 setDesc(
"Median of stack data.");
71 setIcon(QIcon(
":/images/AvgPix.png"));
73 addParm(
"X Radius",
"X Radius",
"1");
74 addParm(
"Y Radius",
"Y Radius",
"1");
75 addParm(
"Z Radius",
"Z Radius",
"1");
80 if(!checkState().store(STORE_NON_EMPTY))
82 Store* input = currentStack()->currentStore();
83 Store* output = currentStack()->work();
84 Point3i r(parm(
"X Radius").toInt(), parm(
"Y Radius").toInt(), parm(
"Z Radius").toInt());
85 bool res = run(input, output, r);
105 setName(
"Stack/Filters/Median of Medians");
106 setDesc(
"Median of medians of stack data.");
107 setIcon(QIcon(
":/images/AvgPix.png"));
109 addParm(
"X Radius",
"X Radius",
"1");
110 addParm(
"Y Radius",
"Y Radius",
"1");
111 addParm(
"Z Radius",
"Z Radius",
"1");
116 if(!checkState().store(STORE_NON_EMPTY))
118 Store* input = currentStack()->currentStore();
119 Store* output = currentStack()->work();
120 Point3i r(parm(
"X Radius").toInt(), parm(
"Y Radius").toInt(), parm(
"Z Radius").toInt());
121 bool res = run(input, output, r);
148 setName(
"Stack/Filters/Brighten Darken");
149 setDesc(
"Brighten or Darken stack.\n"
150 "A value > 1 will brighten the stack, < 1 will darken it.\n"
151 "To convert from a 12bit to a 16bit stack, use 16.\n"
152 "To convert from a 8bit to a 16bit stack, use 256.");
153 setIcon(QIcon(
":/images/Brightness.png"));
155 addParm(
"Amount",
"Amount to multiply voxels. Use 16 for 12bit images and 256 for 8bit images",
"16.0");
160 if(!checkState().store(STORE_NON_EMPTY))
162 Stack* s = currentStack();
165 bool res = run(input, output, parm(
"Amount").toFloat());
173 bool run(
const Store* input,
Store* output,
float brightness);
188 setName(
"Stack/Filters/Binarize");
189 setDesc(
"Transform the stack to binary (65535 or 0).\n"
190 "All voxels with an intensity greater than the threshold to 65535, while to others are set to 0.");
191 setIcon(QIcon(
":/images/Brightness.png"));
193 addParm(
"Threshold",
"Voxels above this threshold will be assigned 1.",
"5000");
198 if(!checkState().store(STORE_NON_EMPTY))
200 Stack* s = currentStack();
203 bool res = run(input, output, parm(
"Threshold").toUShort());
225 setName(
"Stack/Filters/Color Gradient");
226 setDesc(
"Compute color gradient in Z direction");
227 setIcon(QIcon(
":/images/ColorGrad.png"));
229 addParm(
"Z Divisor",
"Factor by which the gradient is divided by.",
"5.0");
234 if(!checkState().store(STORE_NON_EMPTY))
236 Stack* s = currentStack();
239 bool res = run(input, output, parm(
"Z Divisor").toFloat());
247 bool run(
const Store* input,
Store* output,
float colorGradDiv);
260 setName(
"Stack/Filters/Invert");
261 setDesc(
"Invert the stack");
262 setIcon(QIcon(
":/images/Invert.png"));
267 if(!checkState().store(STORE_NON_EMPTY))
269 Stack* s = currentStack();
272 bool res = run(input, output);
294 setName(
"Stack/Filters/Trim High Low Values");
295 setDesc(
"Clip the voxel intensities to the interval [Low Threshold, High Threshold].");
296 setIcon(QIcon(
":/images/Filter.png"));
298 addParm(
"Low Threshold",
"Lower bound",
"1000");
299 addParm(
"High Threshold",
"Upper bound",
"0");
304 if(!checkState().store(STORE_NON_EMPTY))
306 Stack* s = currentStack();
309 bool res = run(input, output, parm(
"Low Threshold").toUInt(), parm(
"High Threshold").toUInt());
334 setName(
"Stack/Filters/Gaussian Blur Stack");
335 setDesc(
"Blur the stack, radius = 3 x Sigma");
336 setIcon(QIcon(
":/images/Gaussian.png"));
338 addParm(
"X Sigma (µm)",
"X Sigma (µm)",
"0.3");
339 addParm(
"Y Sigma (µm)",
"Y Sigma (µm)",
"0.3");
340 addParm(
"Z Sigma (µm)",
"Z Sigma (µm)",
"0.3");
345 if(!checkState().store(STORE_NON_EMPTY))
347 Stack* s = currentStack();
350 Point3f sigma(parm(
"X Sigma (µm)").toFloat(), parm(
"Y Sigma (µm)").toFloat(), parm(
"Z Sigma (µm)").toFloat());
351 bool res = run(input, output, sigma);
375 setName(
"Stack/Filters/Diff Gaussians");
376 setDesc(
"Difference of Gaussians, first - second");
377 setIcon(QIcon(
":/images/DiffGaussians.png"));
379 addParm(
"X1 Sigma (µm)",
"X1 Sigma (µm)",
"0.3");
380 addParm(
"Y1 Sigma (µm)",
"Y1 Sigma (µm)",
"0.3");
381 addParm(
"Z1 Sigma (µm)",
"Z1 Sigma (µm)",
"0.3");
382 addParm(
"X2 Sigma (µm)",
"X2 Sigma (µm)",
"10.0");
383 addParm(
"Y2 Sigma (µm)",
"Y2 Sigma (µm)",
"10.0");
384 addParm(
"Z2 Sigma (µm)",
"Z2 Sigma (µm)",
"10.0");
389 if(!checkState().store(STORE_NON_EMPTY))
391 Stack* s = currentStack();
394 Point3f sigma1(parm(
"X1 Sigma (µm)").toFloat(), parm(
"Y1 Sigma (µm)").toFloat(), parm(
"Z1 Sigma (µm)").toFloat());
395 Point3f sigma2(parm(
"X2 Sigma (µm)").toFloat(), parm(
"Y2 Sigma (µm)").toFloat(), parm(
"Z2 Sigma (µm)").toFloat());
396 bool res = run(input, output, sigma1, sigma2);
422 setName(
"Stack/Filters/Sharpen Stack");
423 setDesc(
"Sharpen the stack, radius = 3 x Sigma");
424 setIcon(QIcon(
":/images/Sharpen.png"));
426 addParm(
"X Sigma (µm)",
"X Sigma (µm)",
"0.2");
427 addParm(
"Y Sigma (µm)",
"Y Sigma (µm)",
"0.2");
428 addParm(
"Z Sigma (µm)",
"Z Sigma (µm)",
"1.0");
429 addParm(
"Amount",
"Amount",
"1.0");
430 addParm(
"Passes",
"Passes",
"1");
435 if(!checkState().store(STORE_NON_EMPTY))
437 Stack* s = currentStack();
440 Point3f sigma(parm(
"X Sigma (µm)").toFloat(), parm(
"Y Sigma (µm)").toFloat(), parm(
"Z Sigma (µm)").toFloat());
441 bool res = run(input, output, sigma, parm(
"Amount").toFloat(), parm(
"Passes").toInt());
450 const Point3f &sigma,
float amount,
int passes);
521 setName(
"Stack/Filters/Normalize Stack");
522 setDesc(
"Normalize the stack");
523 setIcon(QIcon(
":/images/Normalize.png"));
525 addParm(
"X Radius (µm)",
"X Radius (µm) for the locality of normalization",
"5.0");
526 addParm(
"Y Radius (µm)",
"Y Radius (µm) for the locality of normalization",
"5.0");
527 addParm(
"Z Radius (µm)",
"Z Radius (µm) for the locality of normalization",
"5.0");
528 addParm(
"X Sigma (µm)",
"X Sigma (µm) for pre-blur",
"0.5");
529 addParm(
"Y Sigma (µm)",
"Y Sigma (µm) for pre-blur",
"0.5");
530 addParm(
"Z Sigma (µm)",
"Z Sigma (µm) for pre-blur",
"0.5");
531 addParm(
"Threshold",
"Threshold under which pixels are cleared considered as background",
"10000");
532 addParm(
"Blur factor",
"Relative contribution of blurred vs unblurred dilation",
"0.7");
537 if(!checkState().store(STORE_NON_EMPTY))
539 Stack* s = currentStack();
542 Point3f radius(parm(
"X Radius (µm)").toFloat(), parm(
"Y Radius (µm)").toFloat(), parm(
"Z Radius (µm)").toFloat());
543 Point3f sigma(parm(
"X Sigma (µm)").toFloat(), parm(
"Y Sigma (µm)").toFloat(), parm(
"Z Sigma (µm)").toFloat());
544 bool res = run(input, output, radius, sigma, parm(
"Threshold").toUInt(), parm(
"Blur factor").toFloat());
553 uint threshold,
float blurFactor);
566 setName(
"Stack/CImage/Gaussian Blur");
567 setDesc(
"CImage Gaussian Blur");
568 setIcon(QIcon(
":/images/Blur.png"));
570 addParm(
"Radius",
"Radius",
"5");
575 if(!checkState().store(STORE_NON_EMPTY))
577 Stack* s = currentStack();
580 bool res = run(input, output, parm(
"Radius").toUInt());
601 setName(
"Stack/CImage/Median Blur");
602 setDesc(
"CImage Median Blur");
603 setIcon(QIcon(
":/images/Blur.png"));
605 addParm(
"Radius (voxels)",
"Size of the median filter.",
"3");
610 if(!checkState().store(STORE_NON_EMPTY))
612 Stack* s = currentStack();
615 bool res = run(input, output, parm(
"Radius (voxels)").toUInt());
636 setName(
"Stack/CImage/Laplace Transform");
637 setIcon(QIcon(
":/images/Laplace.png"));
642 if(!checkState().store(STORE_NON_EMPTY))
644 Stack* s = currentStack();
647 bool res = run(input, output);
670 setName(
"Stack/Filters/Top Hat");
671 setDesc(
"Perform Top Hat transformation on stack, used for background subtraction");
672 setIcon(QIcon(
":/images/TopHat.png"));
674 addParm(
"X Radius",
"X Radius",
"10");
675 addParm(
"Y Radius",
"Y Radius",
"10");
676 addParm(
"Z Radius",
"Z Radius",
"10");
677 addParm(
"Round Nhbd",
"Use a round (Ellipsoidal) neighborhood",
"No",booleanChoice());
682 if(!checkState().store(STORE_NON_EMPTY))
684 Stack* s = currentStack();
687 bool res = run(s, input, output,
688 parm(
"X Radius").toUInt(), parm(
"Y Radius").toUInt(), parm(
"Z Radius").toUInt(),
stringToBool(parm(
"Round Nhbd")));
697 uint xradius,
uint yradius,
uint zradius,
bool roundNhbd);
710 setName(
"Stack/Filters/Add Noise");
711 setDesc(
"Perform Top Hat transformation on stack, used for background subtraction");
712 setIcon(QIcon(
":/images/TopHat.png"));
714 addParm(
"Amount",
"Amount of noise to add",
"1000");
719 if(!checkState().store(STORE_NON_EMPTY))
721 Stack* s = currentStack();
724 bool res = run(s, input, output, parm(
"Amount").toUInt());