ImFusion C++ SDK 4.4.0
ImFusion::ConnectedComponentsAction Class Reference
Inheritance diagram for ImFusion::ConnectedComponentsAction:

Classes

struct  MappingResult

Public Member Functions

bool isProjectCompatible () const override
bool isProjectCompatible (const Project::ProjectTypes &, bool) const override
bool areActiveLayersCompatible () const override
bool isDataSetCompatible (const DataSet &) const override
void dataSetChanged () override
QIcon icon () const override
QString text () const override
QString description () const override
QString docPath () const override
bool isReadOnly () const override
QWidget * ui (QWidget *parent=nullptr) override
void activate () override
void deactivate () override
void configure (const Properties *p) override
 Configure this object instance by de-serializing the given Properties.
void configuration (Properties *p) const override
 Serialize the current object configuration into the given Properties object.
bool inputEvent (QEvent *event) override
Public Member Functions inherited from ImFusion::AnnotationAction
virtual void init ()
Public Member Functions inherited from ImFusion::Configurable
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 Configurable (const Configurable &rhs)
 Configurable (Configurable &&rhs) noexcept
Configurable & operator= (const Configurable &)
Configurable & operator= (Configurable &&) noexcept
Public Member Functions inherited from ImFusion::SignalReceiver
 SignalReceiver ()=default
 Default constructor.
 SignalReceiver (const SignalReceiver &other)
 Copy constructor, does not copy any existing signal connections from other.
SignalReceiveroperator= (SignalReceiver rhs)
 Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs.
virtual ~SignalReceiver ()
 Virtual destructor disconnects from all connected signals.

Static Public Member Functions

static MappingResult mapAndCompactComponents (TypedImage< unsigned char > &componentsImage, const std::unordered_map< unsigned char, unsigned char > &mapping={}, std::optional< std::array< bool, 256 > > usedComponents=std::nullopt)
 Maps components to different values and afterwards compacts them so that only consecutive components are used.
static unsigned int splitComponentsAlongSlice (SharedImageSet &componentsImage, const Slice &slice, const std::set< unsigned char > &lockedComponents, std::string &warning)
 Split the components along the given plane (represented by the Slice).
static std::unordered_map< unsigned char, unsigned char > reassignLockedLabels (const TypedImage< unsigned char > &labelmap, TypedImage< unsigned char > &componentsImage, int &numberOfComponents, std::array< bool, 256 > lockedLabels, std::unordered_map< unsigned char, size_t > mapLabelToTypeIndex)
 Re-assign the components for all locked labels.

Additional Inherited Members

Public Attributes inherited from ImFusion::Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
Protected Member Functions inherited from ImFusion::SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.
Protected Attributes inherited from ImFusion::AnnotationAction
bool m_isActive = false
DataSetm_dataSet = nullptr
const Projectm_project = nullptr
DisplayWidgetMultiAdapter m_disp
ThumbnailLoaderm_thumbnailLoader = nullptr
AnnotationActionSharedStatem_sharedState = nullptr
AnnotationViewm_annotationView = nullptr
Protected Attributes inherited from ImFusion::Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.

Member Function Documentation

◆ isProjectCompatible() [1/2]

bool ImFusion::ConnectedComponentsAction::isProjectCompatible ( ) const
overridevirtual

◆ isProjectCompatible() [2/2]

bool ImFusion::ConnectedComponentsAction::isProjectCompatible ( const Project::ProjectTypes & ,
bool  ) const
overridevirtual

◆ areActiveLayersCompatible()

bool ImFusion::ConnectedComponentsAction::areActiveLayersCompatible ( ) const
overridevirtual

◆ isDataSetCompatible()

bool ImFusion::ConnectedComponentsAction::isDataSetCompatible ( const DataSet & ) const
overridevirtual

◆ dataSetChanged()

void ImFusion::ConnectedComponentsAction::dataSetChanged ( )
overridevirtual

Reimplemented from ImFusion::AnnotationAction.

◆ icon()

QIcon ImFusion::ConnectedComponentsAction::icon ( ) const
inlineoverridevirtual

◆ text()

QString ImFusion::ConnectedComponentsAction::text ( ) const
inlineoverridevirtual

◆ description()

QString ImFusion::ConnectedComponentsAction::description ( ) const
inlineoverridevirtual

◆ docPath()

QString ImFusion::ConnectedComponentsAction::docPath ( ) const
inlineoverridevirtual

◆ isReadOnly()

bool ImFusion::ConnectedComponentsAction::isReadOnly ( ) const
inlineoverridevirtual

◆ ui()

QWidget * ImFusion::ConnectedComponentsAction::ui ( QWidget * parent = nullptr)
overridevirtual

◆ activate()

void ImFusion::ConnectedComponentsAction::activate ( )
overridevirtual

Reimplemented from ImFusion::AnnotationAction.

◆ deactivate()

void ImFusion::ConnectedComponentsAction::deactivate ( )
overridevirtual

Reimplemented from ImFusion::AnnotationAction.

◆ configure()

void ImFusion::ConnectedComponentsAction::configure ( const Properties * p)
overridevirtual

Configure this object instance by de-serializing the given Properties.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configuration() for the inverse functionality

Reimplemented from ImFusion::AnnotationAction.

◆ configuration()

void ImFusion::ConnectedComponentsAction::configuration ( Properties * p) const
overridevirtual

Serialize the current object configuration into the given Properties object.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configure() for the inverse functionality

Reimplemented from ImFusion::AnnotationAction.

◆ inputEvent()

bool ImFusion::ConnectedComponentsAction::inputEvent ( QEvent * event)
overridevirtual

Reimplemented from ImFusion::AnnotationAction.

◆ mapAndCompactComponents()

MappingResult ImFusion::ConnectedComponentsAction::mapAndCompactComponents ( TypedImage< unsigned char > & componentsImage,
const std::unordered_map< unsigned char, unsigned char > & mapping = {},
std::optional< std::array< bool, 256 > > usedComponents = std::nullopt )
static

Maps components to different values and afterwards compacts them so that only consecutive components are used.

The mapping is optional and values not contained in the mapping will be left unchanged. The optional usedComponents should contain which of the components are currently used. If its not passed, it is computed from the components image. If the usedComponents do not reflect the components, the behaviour is undefined. Returns the used components after the mapping and the how components got mapped.

◆ splitComponentsAlongSlice()

unsigned int ImFusion::ConnectedComponentsAction::splitComponentsAlongSlice ( SharedImageSet & componentsImage,
const Slice & slice,
const std::set< unsigned char > & lockedComponents,
std::string & warning )
static

Split the components along the given plane (represented by the Slice).

Components that are intersected by the plane will be split into two components. The component for a pixel is decided according to which side of the plane the pixel center is. Components that are not intersected by the plane will be left unchanged.

When a component gets split, one part will remain the old component value while the other part is assigned a new (so far unused) value.

The lockedComponents contain the pixel values of the componentsImage that are considered locked and will therefore be left unchanged even if intersected by the plane.

In case the final number of components exceeds the maximum number of components (i.e. 255), a user warning is generated and some components will not be split even when intersecting the plane.

The new total number of components is returned.

◆ reassignLockedLabels()

std::unordered_map< unsigned char, unsigned char > ImFusion::ConnectedComponentsAction::reassignLockedLabels ( const TypedImage< unsigned char > & labelmap,
TypedImage< unsigned char > & componentsImage,
int & numberOfComponents,
std::array< bool, 256 > lockedLabels,
std::unordered_map< unsigned char, size_t > mapLabelToTypeIndex )
static

Re-assign the components for all locked labels.

All pixel values in the componentsImage that correspond to a locked label will be re-assigned to a new component. This new component will be pre-assigned to the locked label value. Those pre-assignments are returned.

Warning
The final number of components increases by the number of locked labels. If this final number of components would exceed this maximum number of labels (i.e. 255), the highest components are removed to make space for the locked labels.

The documentation for this class was generated from the following file:
  • ImFusionLabels/lib/include/ImFusion/Labels/Annotation/ConnectedComponentsAction.h
Search Tab / S to search, Esc to close