20#include <boost/algorithm/string.hpp>
27using namespace Kernel;
28using namespace Geometry;
30using namespace DataObjects;
37 "InputWorkspace",
"",
Direction::Input, std::make_shared<InstrumentValidator>()),
38 "A workspace containing one or more rectangular area "
39 "detectors. Each spectrum needs to correspond to only one "
40 "pixelID (e.g. no grouping or previous calls to "
44 "The name of the workspace to be created as the output of "
47 auto mustBePositive = std::make_shared<BoundedValidator<int>>();
48 mustBePositive->setLower(1);
51 "The number of X (horizontal) pixels to sum together. This "
52 "must evenly divide the number of X pixels in a detector.");
55 "The number of Y (vertical) pixels to sum together. This "
56 "must evenly divide the number of Y pixels in a detector");
69 const auto &spectrumInfo = inWS->spectrumInfo();
70 const auto &det = spectrumInfo.detector(0);
72 std::shared_ptr<const Geometry::IComponent> parent = det.getParent();
73 std::shared_ptr<const RectangularDetector>
rect;
76 rect = std::dynamic_pointer_cast<const RectangularDetector>(parent->getParent());
83 progress.report(
"Smoothing Neighbours...");
86 smooth->setProperty(
"InputWorkspace", inWS);
88 smooth->setProperty(
"SumPixelsX", SumX);
89 smooth->setProperty(
"SumPixelsY", SumY);
91 smooth->setProperty<std::string>(
"RadiusUnits",
"NumberOfPixels");
92 smooth->setProperty(
"Radius",
static_cast<double>(SumX * SumY * SumX * SumY));
93 smooth->setProperty(
"NumberOfNeighbours", SumX * SumY * SumX * SumY * 4);
94 smooth->setProperty(
"SumNumberOfNeighbours", SumX * SumY);
96 smooth->executeAsChildAlg();
100 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, int npts)
@ Input
An input workspace.
@ Output
An output workspace.