13#include "MantidAlgorithms/DllConfig.h"
34 throw std::invalid_argument(
"RadiusFilter - Cannot have a negative cutoff.");
44 double cutoff{m_cutoff};
45 std::copy_if(unfiltered.begin(), unfiltered.end(), std::inserter(neighbSpectra, neighbSpectra.end()),
46 [cutoff](
const std::pair<specnum_t, Mantid::Kernel::V3D> &spectraDistance) {
47 return spectraDistance.second.norm() <= cutoff;
67 const std::string
name()
const override {
return "SmoothNeighbours"; }
69 const std::string
summary()
const override {
70 return "Perform a moving-average smoothing by summing spectra of nearest "
71 "neighbours over the face of detectors.";
75 int version()
const override {
return (1); }
76 const std::vector<std::string>
seeAlso()
const override {
return {
"SmoothData"}; }
78 const std::string
category()
const override {
return "Transforms\\Smoothing"; }
85 void execWorkspace2D();
87 void findNeighboursRectangular();
88 void findNeighboursUbiquitous();
91 void setWeightingStrategy(
const std::string &strategyName,
double &cutOff);
93 double translateToMeters(
const std::string &radiusUnits,
const double &enteredRadius)
const;
108 double m_radius = 0.0;
110 int m_nNeighbours = 0;
114 bool m_preserveEvents =
false;
116 bool m_expandSumAllPixels =
false;
126 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.