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

Cluster : Image cluster used by connected component labeling. More...

#include <Cluster.h>

Inheritance diagram for Mantid::Crystal::Cluster:
Mantid::Crystal::ICluster

Public Member Functions

void addIndex (const size_t &index) override
 Track a linear IMDHistoWorkspace index that belongs to the cluster. More...
 
 Cluster (const size_t &label)
 Constructor. More...
 
bool containsLabel (const size_t &label) const override
 Does the cluster contain the label. More...
 
size_t getLabel () const override
 Get the cluster label. More...
 
size_t getOriginalLabel () const override
 Get the original label. More...
 
size_t getRepresentitiveIndex () const override
 Get a representative index of the cluster. More...
 
ClusterIntegratedValues integrate (std::shared_ptr< const Mantid::API::IMDHistoWorkspace > ws) const override
 integrate the cluster More...
 
bool operator== (const Cluster &other) const
 Overloaded equals. More...
 
void setRootCluster (ICluster const *root) override
 Set the root cluster. More...
 
size_t size () const override
 Number of indexes tracked. More...
 
void toUniformMinimum (std::vector< DisjointElement > &disjointSet) override
 Resolve the proper label for this cluster. More...
 
void writeTo (std::shared_ptr< Mantid::API::IMDHistoWorkspace > ws) const override
 Apply labels to the workspace. More...
 
- Public Member Functions inherited from Mantid::Crystal::ICluster
virtual void addIndex (const size_t &index)=0
 Track a linear IMDHistoWorkspace index that belongs to the cluster. More...
 
virtual bool containsLabel (const size_t &label) const =0
 Is the label contained in the cluster. More...
 
virtual size_t getLabel () const =0
 Get the cluster label. More...
 
virtual size_t getOriginalLabel () const =0
 Get the originally set label. More...
 
virtual size_t getRepresentitiveIndex () const =0
 Get a represetiative index of the cluster. More...
 
virtual ClusterIntegratedValues integrate (std::shared_ptr< const Mantid::API::IMDHistoWorkspace > ws) const =0
 integrate the cluster More...
 
virtual void setRootCluster (ICluster const *root)=0
 Set the root cluster. More...
 
virtual size_t size () const =0
 Number of indexes tracked. More...
 
virtual void toUniformMinimum (std::vector< DisjointElement > &disjointSet)=0
 Resolve the proper label for this cluster. More...
 
virtual void writeTo (std::shared_ptr< Mantid::API::IMDHistoWorkspace > ws) const =0
 Apply labels to the workspace. More...
 
virtual ~ICluster ()=default
 Virtual destructor. More...
 

Private Member Functions

 Cluster (const Cluster &)
 Disabled copy construction. More...
 
Clusteroperator= (const Cluster &)
 Disabled assignement. More...
 

Private Attributes

std::vector< size_t > m_indexes
 indexes belonging to cluster. This is how we track cluster objects. More...
 
size_t m_originalLabel
 original label on cluster More...
 
ICluster const * m_rootCluster
 Root cluster. More...
 

Additional Inherited Members

- Public Types inherited from Mantid::Crystal::ICluster
using ClusterIntegratedValues = boost::tuple< double, double >
 

Detailed Description

Cluster : Image cluster used by connected component labeling.

Definition at line 22 of file Cluster.h.

Constructor & Destructor Documentation

◆ Cluster() [1/2]

Mantid::Crystal::Cluster::Cluster ( const size_t &  label)

Constructor.

Parameters
label: Label (taken as original) for Cluster

Definition at line 20 of file Cluster.cpp.

References m_indexes.

◆ Cluster() [2/2]

Mantid::Crystal::Cluster::Cluster ( const Cluster )
private

Disabled copy construction.

Member Function Documentation

◆ addIndex()

void Mantid::Crystal::Cluster::addIndex ( const size_t &  index)
overridevirtual

Track a linear IMDHistoWorkspace index that belongs to the cluster.

Add the index to the cluster.

Parameters
index: index to add

Implements Mantid::Crystal::ICluster.

Definition at line 51 of file Cluster.cpp.

References m_indexes.

◆ containsLabel()

bool Mantid::Crystal::Cluster::containsLabel ( const size_t &  label) const
overridevirtual

Does the cluster contain the label.

Parameters
label: Label to find
Returns
: True only if the label exists.

Implements Mantid::Crystal::ICluster.

Definition at line 121 of file Cluster.cpp.

References getLabel().

◆ getLabel()

size_t Mantid::Crystal::Cluster::getLabel ( ) const
overridevirtual

Get the cluster label.

Get the label.

Returns
: Return label.

Implements Mantid::Crystal::ICluster.

Definition at line 26 of file Cluster.cpp.

References Mantid::Crystal::ICluster::getLabel(), m_originalLabel, and m_rootCluster.

Referenced by containsLabel(), operator==(), and writeTo().

◆ getOriginalLabel()

size_t Mantid::Crystal::Cluster::getOriginalLabel ( ) const
overridevirtual

Get the original label.

Returns
: Original label

Implements Mantid::Crystal::ICluster.

Definition at line 38 of file Cluster.cpp.

References m_originalLabel.

◆ getRepresentitiveIndex()

size_t Mantid::Crystal::Cluster::getRepresentitiveIndex ( ) const
overridevirtual

Get a representative index of the cluster.

Get a representative index which is part of this cluster.

Returns

Implements Mantid::Crystal::ICluster.

Definition at line 101 of file Cluster.cpp.

References m_indexes.

◆ integrate()

ICluster::ClusterIntegratedValues Mantid::Crystal::Cluster::integrate ( std::shared_ptr< const Mantid::API::IMDHistoWorkspace ws) const
overridevirtual

integrate the cluster

Integrate the image over cluster region.

Parameters
ws: Image
Returns
: Integrated values

Implements Mantid::Crystal::ICluster.

Definition at line 70 of file Cluster.cpp.

References m_indexes.

◆ operator=()

Cluster & Mantid::Crystal::Cluster::operator= ( const Cluster )
private

Disabled assignement.

◆ operator==()

bool Mantid::Crystal::Cluster::operator== ( const Cluster other) const

Overloaded equals.

Overlaoded equals operator.

Parameters
other: To compare with
Returns
True only if the objects are equal

Definition at line 114 of file Cluster.cpp.

References getLabel().

◆ setRootCluster()

void Mantid::Crystal::Cluster::setRootCluster ( ICluster const *  root)
overridevirtual

Set the root cluster.

Parameters
root: Root cluster

Implements Mantid::Crystal::ICluster.

Definition at line 107 of file Cluster.cpp.

References m_rootCluster.

◆ size()

size_t Mantid::Crystal::Cluster::size ( ) const
overridevirtual

Number of indexes tracked.

Get the number of indexes which are part of this cluster.

i.e. the size of the cluster

Returns
: Cluster size

Implements Mantid::Crystal::ICluster.

Definition at line 45 of file Cluster.cpp.

References m_indexes.

◆ toUniformMinimum()

void Mantid::Crystal::Cluster::toUniformMinimum ( std::vector< DisjointElement > &  disjointSet)
overridevirtual

Resolve the proper label for this cluster.

Allow the cluster to adopt the uniform minimum value.

Parameters
disjointSet

Implements Mantid::Crystal::ICluster.

Definition at line 87 of file Cluster.cpp.

References Mantid::Crystal::ICluster::getRepresentitiveIndex(), m_indexes, and m_rootCluster.

◆ writeTo()

void Mantid::Crystal::Cluster::writeTo ( std::shared_ptr< Mantid::API::IMDHistoWorkspace ws) const
overridevirtual

Apply labels to the workspace.

Apply the cluster to the image.

Parameters
ws: Image to stencil itself onto

Implements Mantid::Crystal::ICluster.

Definition at line 57 of file Cluster.cpp.

References getLabel(), and m_indexes.

Member Data Documentation

◆ m_indexes

std::vector<size_t> Mantid::Crystal::Cluster::m_indexes
private

indexes belonging to cluster. This is how we track cluster objects.

Definition at line 69 of file Cluster.h.

Referenced by addIndex(), Cluster(), getRepresentitiveIndex(), integrate(), size(), toUniformMinimum(), and writeTo().

◆ m_originalLabel

size_t Mantid::Crystal::Cluster::m_originalLabel
private

original label on cluster

Definition at line 67 of file Cluster.h.

Referenced by getLabel(), and getOriginalLabel().

◆ m_rootCluster

ICluster const* Mantid::Crystal::Cluster::m_rootCluster
private

Root cluster.

Definition at line 71 of file Cluster.h.

Referenced by getLabel(), setRootCluster(), and toUniformMinimum().


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