19#include <boost/algorithm/string.hpp>
26using namespace Kernel;
27using namespace Geometry;
29using namespace DataObjects;
36 "InputWorkspace",
"",
Direction::Input, std::make_shared<InstrumentValidator>()),
37 "A workspace containing one or more rectangular area "
38 "detectors. Each spectrum needs to correspond to only one "
39 "pixelID (e.g. no grouping or previous calls to "
43 "The name of the workspace to be created as the output of "
46 auto mustBePositive = std::make_shared<BoundedValidator<int>>();
47 mustBePositive->setLower(1);
50 "The number of X (horizontal) pixels to sum together. This "
51 "must evenly divide the number of X pixels in a detector.");
54 "The number of Y (vertical) pixels to sum together. This "
55 "must evenly divide the number of Y pixels in a detector");
68 const auto &componentInfo = inWS->componentInfo();
69 const auto &spectrumInfo = inWS->spectrumInfo();
70 const auto &det = spectrumInfo.detector(0);
72 const size_t detIndex = componentInfo.indexOf(det.getComponentID());
73 const size_t parentIndex = componentInfo.parent(detIndex);
74 const size_t grandparentIndex = componentInfo.parent(parentIndex);
75 const bool rect = componentInfo.isGridDetector(grandparentIndex);
81 progress.report(
"Smoothing Neighbours...");
84 smooth->setProperty(
"InputWorkspace", inWS);
86 smooth->setProperty(
"SumPixelsX", SumX);
87 smooth->setProperty(
"SumPixelsY", SumY);
89 smooth->setProperty<std::string>(
"RadiusUnits",
"NumberOfPixels");
90 smooth->setProperty(
"Radius",
static_cast<double>(SumX * SumY * SumX * SumY));
91 smooth->setProperty(
"NumberOfNeighbours", SumX * SumY * SumX * SumY * 4);
92 smooth->setProperty(
"SumNumberOfNeighbours", SumX * SumY);
94 smooth->executeAsChildAlg();
98 outWS =
smooth->getProperty(
"OutputWorkspace");
#define DECLARE_ALGORITHM(classname)
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
void progress(double p, const std::string &msg="", double estimatedTime=0.0, int progressPrecision=0)
Sends ProgressNotification.
Helper class for reporting progress from algorithms.
A property class for workspaces.
void exec() override
Executes the algorithm.
void init() override
Initialisation method.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
HistogramData::Histogram smooth(const HistogramData::Histogram &histogram, unsigned int const npts)
@ Input
An input workspace.
@ Output
An output workspace.