39 "An input MDHistoWorkspace.");
41 "A mask MDHistoWorkspace, where true indicates where to set the value.");
45 "Workspace to copy to the output workspace over the input. Optional - "
46 "specify this or Value.");
49 "Single number to set in the output "
50 "workspace. Optional - specify this or "
54 "An output MDHistoWorkspace.");
67 bool useValueWS = (
value == DBL_MAX);
69 if (useValueWS && !valueIWS)
70 throw std::invalid_argument(
"You must specify either ValueWorkspace or Value.");
71 if (!useValueWS && valueIWS)
72 throw std::invalid_argument(
"You must specify either ValueWorkspace or Value, not both!");
74 if (maskIWS->getNumDims() != inIWS->getNumDims())
75 throw std::invalid_argument(
"Input and Mask workspace need to have the same number of dimensions.");
76 if (maskIWS->getNPoints() != inIWS->getNPoints())
77 throw std::invalid_argument(
"Input and Mask workspace need to have the same number of points.");
79 if (maskIWS->getNumDims() != valueIWS->getNumDims())
80 throw std::invalid_argument(
"Input and Value workspace need to have the "
81 "same number of dimensions.");
82 if (maskIWS->getNPoints() != valueIWS->getNPoints())
83 throw std::invalid_argument(
"Input and Value workspace need to have the same number of points.");
86 if (outIWS != inIWS) {
89 clone->setProperty(
"InputWorkspace", std::dynamic_pointer_cast<IMDWorkspace>(inIWS));
90 clone->executeAsChildAlg();
92 outIWS = std::dynamic_pointer_cast<IMDHistoWorkspace>(temp);
99 if (!outWS || !maskWS)
100 throw std::runtime_error(
"Error creating output workspace.");
104 outWS->setUsingMask(*maskWS, *valueWS);
106 outWS->setUsingMask(*maskWS,
value, 0.0 );
#define DECLARE_ALGORITHM(classname)
double value
The value of the point.
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.
A property class for workspaces.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
Algorithm to set a MDHistoWorkspace in points determined by a mask boolean MDHistoWorkspace.
void init() override
Initialize the algorithm's properties.
const std::string category() const override
Algorithm's category for identification.
void exec() override
Execute the algorithm.
int version() const override
Algorithm's version for identification.
std::shared_ptr< IMDHistoWorkspace > IMDHistoWorkspace_sptr
shared pointer to Mantid::API::IMDHistoWorkspace
std::shared_ptr< IMDWorkspace > IMDWorkspace_sptr
Shared pointer to the IMDWorkspace base class.
std::shared_ptr< MDHistoWorkspace > MDHistoWorkspace_sptr
A shared pointer to a MDHistoWorkspace.
@ Input
An input workspace.
@ Output
An output workspace.