Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::Crystal::ConnectedComponentLabeling Class Reference

ConnectedComponentLabelling : Implements connected component labeling on MDHistoWorkspaces. More...

#include <ConnectedComponentLabeling.h>

Public Member Functions

 ConnectedComponentLabeling (const size_t &startId=1, boost::optional< int > nThreads=boost::none)
 Constructor. More...
 
std::shared_ptr< Mantid::API::IMDHistoWorkspaceexecute (Mantid::API::IMDHistoWorkspace_sptr ws, BackgroundStrategy *const strategy, Mantid::API::Progress &progress) const
 Execute and return clusters. More...
 
ConnectedComponentMappingTypes::ClusterTuple executeAndFetchClusters (Mantid::API::IMDHistoWorkspace_sptr ws, BackgroundStrategy *const strategy, Mantid::API::Progress &progress) const
 Execute and return clusters, as well as maps to integratable clusters. More...
 
size_t getStartLabelId () const
 Getter for the start label id. More...
 
void startLabelingId (const size_t &id)
 Setter for the label id. More...
 
virtual ~ConnectedComponentLabeling ()
 Destructor. More...
 

Private Member Functions

ConnectedComponentMappingTypes::ClusterMap calculateDisjointTree (const Mantid::API::IMDHistoWorkspace_sptr &ws, BackgroundStrategy *const baseStrategy, Mantid::API::Progress &progress) const
 Calculate the disjoint element tree across the image. More...
 
int getNThreads () const
 Get the number of threads to use. More...
 

Private Attributes

const boost::optional< int > m_nThreads
 Run multithreaded. More...
 
size_t m_startId
 Start labeling index. More...
 

Detailed Description

ConnectedComponentLabelling : Implements connected component labeling on MDHistoWorkspaces.

Definition at line 46 of file ConnectedComponentLabeling.h.

Constructor & Destructor Documentation

◆ ConnectedComponentLabeling()

Mantid::Crystal::ConnectedComponentLabeling::ConnectedComponentLabeling ( const size_t &  startId = 1,
boost::optional< int >  nThreads = boost::none 
)

Constructor.

Parameters
startId: Start Id to use for labeling
nThreads: Optional argument of number of threads to use.

Definition at line 215 of file ConnectedComponentLabeling.cpp.

References m_nThreads.

◆ ~ConnectedComponentLabeling()

Mantid::Crystal::ConnectedComponentLabeling::~ConnectedComponentLabeling ( )
virtualdefault

Destructor.

Member Function Documentation

◆ calculateDisjointTree()

ClusterMap Mantid::Crystal::ConnectedComponentLabeling::calculateDisjointTree ( const Mantid::API::IMDHistoWorkspace_sptr ws,
BackgroundStrategy *const  baseStrategy,
Mantid::API::Progress progress 
) const
private

Calculate the disjoint element tree across the image.

Perform the work of the CCL algorithm.

  • Pre filtering of background
  • Labeling using DisjointElements
Parameters
ws: MDHistoWorkspace to run CCL algorithm on
baseStrategy: Background strategy
progress: Progress object
Returns
: Map of label ids to clusters.

Definition at line 262 of file ConnectedComponentLabeling.cpp.

References Mantid::Crystal::ClusterRegister::add(), Mantid::Crystal::BackgroundStrategy::clone(), Mantid::Crystal::ClusterRegister::clusters(), Mantid::Kernel::Logger::debug(), Mantid::API::Progress::doReport(), Mantid::API::g_log, Mantid::API::IMDIterator::getLinearIndex(), getNThreads(), Mantid::Crystal::BackgroundStrategy::isBackground(), Mantid::API::IMDIterator::jumpTo(), m_startId, Mantid::Crystal::ClusterRegister::merge(), Mantid::API::IMDIterator::next(), and Mantid::Kernel::ProgressBase::resetNumSteps().

Referenced by executeAndFetchClusters().

◆ execute()

std::shared_ptr< Mantid::API::IMDHistoWorkspace > Mantid::Crystal::ConnectedComponentLabeling::execute ( Mantid::API::IMDHistoWorkspace_sptr  ws,
BackgroundStrategy *const  strategy,
Mantid::API::Progress progress 
) const

Execute and return clusters.

Execute CCL to produce a cluster output workspace containing labels.

Parameters
ws: Workspace to perform CCL on
strategy: Background strategy
progress: Progress object
Returns
Cluster output workspace of results

Definition at line 378 of file ConnectedComponentLabeling.cpp.

References executeAndFetchClusters().

◆ executeAndFetchClusters()

ClusterTuple Mantid::Crystal::ConnectedComponentLabeling::executeAndFetchClusters ( Mantid::API::IMDHistoWorkspace_sptr  ws,
BackgroundStrategy *const  strategy,
Mantid::API::Progress progress 
) const

Execute and return clusters, as well as maps to integratable clusters.

Execute.

Parameters
ws: Image workspace to integrate
strategy: Background strategy
progress: Progress object
Returns
Image Workspace containing clusters as well as a map of label ids to cluster objects.

Definition at line 394 of file ConnectedComponentLabeling.cpp.

References calculateDisjointTree(), Mantid::Kernel::Logger::debug(), Mantid::API::g_log, and PARALLEL_FOR_NO_WSP_CHECK.

Referenced by Mantid::Crystal::IntegratePeaksHybrid::exec(), Mantid::Crystal::IntegratePeaksUsingClusters::exec(), and execute().

◆ getNThreads()

int Mantid::Crystal::ConnectedComponentLabeling::getNThreads ( ) const
private

Get the number of threads to use.

Get the number of threads available.

Returns
: Number of available threads

Definition at line 244 of file ConnectedComponentLabeling.cpp.

References Mantid::Kernel::SingletonHolder< T >::Instance(), and m_nThreads.

Referenced by calculateDisjointTree().

◆ getStartLabelId()

size_t Mantid::Crystal::ConnectedComponentLabeling::getStartLabelId ( ) const

Getter for the start label id.

Returns
: The start label id.

Definition at line 233 of file ConnectedComponentLabeling.cpp.

References m_startId.

Referenced by Mantid::Crystal::IntegratePeaksHybrid::exec(), and Mantid::Crystal::IntegratePeaksUsingClusters::exec().

◆ startLabelingId()

void Mantid::Crystal::ConnectedComponentLabeling::startLabelingId ( const size_t &  id)

Setter for the label id.

Set a custom start id.

This has no bearing on the output of the process other than the initial id used.

Parameters
idId to start with

Definition at line 228 of file ConnectedComponentLabeling.cpp.

References m_startId.

Member Data Documentation

◆ m_nThreads

const boost::optional<int> Mantid::Crystal::ConnectedComponentLabeling::m_nThreads
private

Run multithreaded.

Definition at line 84 of file ConnectedComponentLabeling.h.

Referenced by ConnectedComponentLabeling(), and getNThreads().

◆ m_startId

size_t Mantid::Crystal::ConnectedComponentLabeling::m_startId
private

Start labeling index.

Definition at line 81 of file ConnectedComponentLabeling.h.

Referenced by calculateDisjointTree(), getStartLabelId(), and startLabelingId().


The documentation for this class was generated from the following files: