Mantid
Loading...
Searching...
No Matches
SlicingAlgorithm.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2011 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
20#include "MantidKernel/VMD.h"
21#include "MantidMDAlgorithms/DllConfig.h"
22
23namespace Mantid {
24namespace MDAlgorithms {
25
33class MANTID_MDALGORITHMS_DLL SlicingAlgorithm : public API::Algorithm {
34public:
36
39 static std::string getDimensionChars() { return "012345"; }
40
41protected:
42 ~SlicingAlgorithm() = default;
44 void initSlicingProps();
45
46 void createTransform();
47
48 void createGeneralTransform();
49 void processGeneralTransformProperties();
50 void createAlignedTransform();
51
52 void makeAlignedDimensionFromString(const std::string &str);
53 void makeBasisVectorFromString(const std::string &str);
54
55 std::unique_ptr<Mantid::Geometry::MDImplicitFunction> getImplicitFunctionForChunk(const size_t *const chunkMin,
56 const size_t *const chunkMax);
57 std::unique_ptr<Mantid::Geometry::MDImplicitFunction> getGeneralImplicitFunction(const size_t *const chunkMin,
58 const size_t *const chunkMax);
59
62
66
69 std::vector<Mantid::Geometry::MDHistoDimension_sptr> m_binDimensions;
70
73 std::vector<size_t> m_dimensionToBinFrom;
74
78 std::unique_ptr<API::CoordTransform> m_transform;
79
82 std::unique_ptr<API::CoordTransform> m_transformFromOriginal;
85 std::unique_ptr<API::CoordTransform> m_transformToOriginal;
86
92 std::unique_ptr<DataObjects::CoordTransformAffine> m_transformFromIntermediate;
94 std::unique_ptr<DataObjects::CoordTransformAffine> m_transformToIntermediate;
95
98
100 size_t m_outD;
101
103 std::vector<Mantid::Kernel::VMD> m_bases;
104
108 std::vector<double> m_binningScaling;
109
114 std::vector<double> m_transformScaling;
115
119
123
125 std::vector<double> m_minExtents;
126
128 std::vector<double> m_maxExtents;
129
131 std::vector<int> m_numBins;
132
135
136private:
137 Mantid::Geometry::MDFrame_uptr createMDFrameForNonAxisAligned(const std::string &units,
138 const Mantid::Kernel::VMD &basisVector) const;
139 std::vector<Mantid::Kernel::VMD> getOldBasis(size_t dimension) const;
140 bool isProjectingOnFrame(const Mantid::Kernel::VMD &oldVector, const Mantid::Kernel::VMD &basisVector) const;
141 std::vector<size_t> getIndicesWithProjection(const Mantid::Kernel::VMD &basisVector,
142 const std::vector<Mantid::Kernel::VMD> &oldBasis) const;
143 Mantid::Geometry::MDFrame_uptr extractMDFrameForNonAxisAligned(std::vector<size_t> indicesWithProjection,
144 const std::string &units) const;
145 void setTargetUnits(Mantid::Geometry::MDFrame_uptr &frame, const std::string &units) const;
146};
147
148} // namespace MDAlgorithms
149} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
Abstract Algorithm class that will be used by: BinMD and SliceMD and shares code for getting a slice ...
std::unique_ptr< API::CoordTransform > m_transformFromOriginal
Coordinate transformation to save in the output workspace (original->binned)
Mantid::API::IMDWorkspace_sptr m_intermediateWS
Intermediate original workspace.
std::vector< size_t > m_dimensionToBinFrom
Index of the dimension in the MDEW for the dimension in the output.
std::unique_ptr< API::CoordTransform > m_transform
Coordinate transformation to apply.
Mantid::API::IMDWorkspace_sptr m_originalWS
Original (MDEventWorkspace) that inWS was based on.
Mantid::Kernel::VMD m_inputMinPoint
Coordinates in the INPUT workspace corresponding to the minimum edge in all dimensions.
std::vector< double > m_maxExtents
For non-aligned, the maximum coordinate extents in each OUTPUT dimension.
Mantid::API::IMDWorkspace_sptr m_inWS
Input workspace.
std::unique_ptr< API::CoordTransform > m_transformToOriginal
Coordinate transformation to save in the output workspace (binned->original)
std::unique_ptr< DataObjects::CoordTransformAffine > m_transformFromIntermediate
Coordinate transformation to save in the output WS, from the intermediate WS.
std::vector< double > m_binningScaling
Scaling factor to apply for each basis vector (to map to the bins).
size_t m_outD
Number of dimensions in the output (binned) workspace.
bool m_NormalizeBasisVectors
The NormalizeBasisVectors option.
std::vector< Mantid::Kernel::VMD > m_bases
Basis vectors of the output dimensions, normalized to unity length.
bool m_axisAligned
Set to true if the cut is aligned with the axes.
std::vector< int > m_numBins
For non-aligned, the number of bins in each OUTPUT dimension.
Mantid::Kernel::VMD m_translation
Translation from the OUTPUT to the INPUT workspace i.e.
std::vector< double > m_transformScaling
Scaling factor to apply for each basis vector to transfor to the output dimensions.
std::vector< double > m_minExtents
For non-aligned, the minimum coordinate extents in each OUTPUT dimension.
std::unique_ptr< DataObjects::CoordTransformAffine > m_transformToIntermediate
Coordinate transformation to save in the intermediate WS.
std::vector< Mantid::Geometry::MDHistoDimension_sptr > m_binDimensions
Bin dimensions to actually use.
std::shared_ptr< IMDWorkspace > IMDWorkspace_sptr
Shared pointer to the IMDWorkspace base class.
Definition: IMDWorkspace.h:146
std::unique_ptr< MDFrame > MDFrame_uptr
Definition: MDFrame.h:36
Helper class which provides the Collimation Length for SANS instruments.