13#include "MantidAlgorithms/DllConfig.h"
33 throw std::invalid_argument(
"RadiusFilter - Cannot have a negative cutoff.");
43 double cutoff{m_cutoff};
44 std::copy_if(unfiltered.begin(), unfiltered.end(), std::inserter(neighbSpectra, neighbSpectra.end()),
45 [cutoff](
const std::pair<specnum_t, Mantid::Kernel::V3D> &spectraDistance) {
46 return spectraDistance.second.norm() <= cutoff;
66 const std::string
name()
const override {
return "SmoothNeighbours"; }
68 const std::string
summary()
const override {
69 return "Perform a moving-average smoothing by summing spectra of nearest "
70 "neighbours over the face of detectors.";
74 int version()
const override {
return (1); }
75 const std::vector<std::string>
seeAlso()
const override {
return {
"SmoothData"}; }
77 const std::string
category()
const override {
return "Transforms\\Smoothing"; }
84 void execWorkspace2D();
86 void findNeighboursRectangular();
87 void findNeighboursUbiquitous();
90 void setWeightingStrategy(
const std::string &strategyName,
double &cutOff);
92 double translateToMeters(
const std::string &radiusUnits,
const double &enteredRadius)
const;
107 double m_radius = 0.0;
109 int m_nNeighbours = 0;
113 bool m_preserveEvents =
false;
115 bool m_expandSumAllPixels =
false;
125 std::unique_ptr<Mantid::API::Progress> m_progress =
nullptr;
Base class from which all concrete algorithm classes should be derived.
Base MatrixWorkspace Abstract Class.
SpectraDistanceMap apply(SpectraDistanceMap &unfiltered) const
Apply the filtering based on radius.
RadiusFilter(double cutoff)
Constructor.
double m_cutoff
Radius cutoff.
Smooth neighboring pixels.
std::vector< std::vector< weightedNeighbour > > m_neighbours
Vector of list of neighbours (with weight) for each workspace index.
std::unique_ptr< WeightingStrategy > m_weightedSum
Weight the neighbours during summing.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
std::pair< size_t, double > weightedNeighbour
Each neighbours is specified as a pair with workspace index, weight.
Mantid::API::MatrixWorkspace_sptr m_inWS
Input workspace.
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
int version() const override
Algorithm's version for identification overriding a virtual method.
const std::string summary() const override
Summary of algorithms purpose.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::map< specnum_t, Mantid::Kernel::V3D > SpectraDistanceMap
std::shared_ptr< EventWorkspace > EventWorkspace_sptr
shared pointer to the EventWorkspace class
Helper class which provides the Collimation Length for SANS instruments.