40 "An input MDHistoWorkspace.");
42 "A mask MDHistoWorkspace, where true indicates where to set the value.");
46 "Workspace to copy to the output workspace over the input. Optional - "
47 "specify this or Value.");
50 "Single number to set in the output "
51 "workspace. Optional - specify this or "
55 "An output MDHistoWorkspace.");
68 bool useValueWS = (
value == DBL_MAX);
70 if (useValueWS && !valueIWS)
71 throw std::invalid_argument(
"You must specify either ValueWorkspace or Value.");
72 if (!useValueWS && valueIWS)
73 throw std::invalid_argument(
"You must specify either ValueWorkspace or Value, not both!");
75 if (maskIWS->getNumDims() != inIWS->getNumDims())
76 throw std::invalid_argument(
"Input and Mask workspace need to have the same number of dimensions.");
77 if (maskIWS->getNPoints() != inIWS->getNPoints())
78 throw std::invalid_argument(
"Input and Mask workspace need to have the same number of points.");
80 if (maskIWS->getNumDims() != valueIWS->getNumDims())
81 throw std::invalid_argument(
"Input and Value workspace need to have the "
82 "same number of dimensions.");
83 if (maskIWS->getNPoints() != valueIWS->getNPoints())
84 throw std::invalid_argument(
"Input and Value workspace need to have the same number of points.");
87 if (outIWS != inIWS) {
90 clone->setProperty(
"InputWorkspace", std::dynamic_pointer_cast<IMDWorkspace>(inIWS));
91 clone->executeAsChildAlg();
93 outIWS = std::dynamic_pointer_cast<IMDHistoWorkspace>(temp);
100 if (!outWS || !maskWS)
101 throw std::runtime_error(
"Error creating output workspace.");
105 outWS->setUsingMask(*maskWS, *valueWS);
107 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.