Mantid
Loading...
Searching...
No Matches
ConnectedComponentLabeling.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2014 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
11#include "MantidCrystal/DllConfig.h"
12#include "MantidKernel/V3D.h"
13#include <boost/tuple/tuple.hpp>
14#include <map>
15#include <memory>
16#include <optional>
17#include <unordered_set>
18
19namespace Mantid {
20namespace API {
21class Progress;
22}
23
24namespace Crystal {
25class ICluster;
29namespace ConnectedComponentMappingTypes {
30using SignalErrorSQPair = boost::tuple<double, double>;
31using LabelIdIntensityMap = std::map<size_t, SignalErrorSQPair>;
32using PositionToLabelIdMap = std::map<Mantid::Kernel::V3D, size_t>;
33using VecIndexes = std::vector<size_t>;
34using VecElements = std::vector<DisjointElement>;
35using SetIds = std::unordered_set<size_t>;
36using ClusterMap = std::map<size_t, std::shared_ptr<Mantid::Crystal::ICluster>>;
37using ClusterTuple = boost::tuple<Mantid::API::IMDHistoWorkspace_sptr, ClusterMap>;
38} // namespace ConnectedComponentMappingTypes
39
41
45class MANTID_CRYSTAL_DLL ConnectedComponentLabeling {
46
47public:
49 ConnectedComponentLabeling(const size_t &startId = 1, const std::optional<int> &nThreads = std::nullopt);
50
52 size_t getStartLabelId() const;
53
55 void startLabelingId(const size_t &id);
56
58 std::shared_ptr<Mantid::API::IMDHistoWorkspace> execute(Mantid::API::IMDHistoWorkspace_sptr ws,
59 BackgroundStrategy *const strategy,
60 Mantid::API::Progress &progress) const;
61
64 BackgroundStrategy *const strategy,
65 Mantid::API::Progress &progress) const;
66
69
70private:
73 BackgroundStrategy *const baseStrategy,
74 Mantid::API::Progress &progress) const;
75
77 size_t m_startId;
78
81};
82
83} // namespace Crystal
84} // namespace Mantid
Helper class for reporting progress from algorithms.
Definition Progress.h:25
BackgroundStrategy : Abstract class used for identifying elements of a IMDWorkspace that are not cons...
ConnectedComponentLabelling : Implements connected component labeling on MDHistoWorkspaces.
virtual ~ConnectedComponentLabeling()
Destructor.
std::shared_ptr< IMDHistoWorkspace > IMDHistoWorkspace_sptr
shared pointer to Mantid::API::IMDHistoWorkspace
std::map< size_t, std::shared_ptr< Mantid::Crystal::ICluster > > ClusterMap
std::map< Mantid::Kernel::V3D, size_t > PositionToLabelIdMap
boost::tuple< Mantid::API::IMDHistoWorkspace_sptr, ClusterMap > ClusterTuple
std::map< size_t, SignalErrorSQPair > LabelIdIntensityMap
Helper class which provides the Collimation Length for SANS instruments.