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/System.h"
13#include "MantidKernel/V3D.h"
14#include <boost/optional.hpp>
15#include <boost/tuple/tuple.hpp>
16#include <map>
17#include <memory>
18#include <unordered_set>
19
20namespace Mantid {
21namespace API {
22class Progress;
23}
24
25namespace Crystal {
26class ICluster;
30namespace ConnectedComponentMappingTypes {
31using SignalErrorSQPair = boost::tuple<double, double>;
32using LabelIdIntensityMap = std::map<size_t, SignalErrorSQPair>;
33using PositionToLabelIdMap = std::map<Mantid::Kernel::V3D, size_t>;
34using VecIndexes = std::vector<size_t>;
35using VecElements = std::vector<DisjointElement>;
36using SetIds = std::unordered_set<size_t>;
37using ClusterMap = std::map<size_t, std::shared_ptr<Mantid::Crystal::ICluster>>;
38using ClusterTuple = boost::tuple<Mantid::API::IMDHistoWorkspace_sptr, ClusterMap>;
39} // namespace ConnectedComponentMappingTypes
40
42
46class MANTID_CRYSTAL_DLL ConnectedComponentLabeling {
47
48public:
50 ConnectedComponentLabeling(const size_t &startId = 1, boost::optional<int> nThreads = boost::none);
51
53 size_t getStartLabelId() const;
54
56 void startLabelingId(const size_t &id);
57
59 std::shared_ptr<Mantid::API::IMDHistoWorkspace> execute(Mantid::API::IMDHistoWorkspace_sptr ws,
60 BackgroundStrategy *const strategy,
61 Mantid::API::Progress &progress) const;
62
65 BackgroundStrategy *const strategy,
66 Mantid::API::Progress &progress) const;
67
70
71private:
73 int getNThreads() const;
74
77 BackgroundStrategy *const baseStrategy,
78 Mantid::API::Progress &progress) const;
79
81 size_t m_startId;
82
84 const boost::optional<int> m_nThreads;
85};
86
87} // namespace Crystal
88} // 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.
const boost::optional< int > m_nThreads
Run multithreaded.
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.