ImFusion C++ SDK 4.4.0
ImFusion::DrawContourAction Class Reference

#include <ImFusionLabels/lib/include/ImFusion/Labels/Annotation/DrawContourAction.h>

An action that allow to draw contours. More...

Inheritance diagram for ImFusion::DrawContourAction:

Detailed Description

An action that allow to draw contours.

A contour is a data structure representing a pointwise annotation, generally a spline. It is defined by the type of pointwise annotation e.g. closed spline, closed polyline, open spline, etc, a sequence of points, a label value, a given name, a creation type (automatic or manual) and some additional secondary properties,

See also
Seg::Contour. The contours are saved in a data component.

On 2D images, all types of Contours are used to create a label map. On 3D data, only open annotations are used.

A label map generated from a closed contour can be refined with the "auto-refine" option: this option uses image information to automatically adjust the label map to the boundaries of the enclosed area. The "refimement margin" parameter controls the sensitivity of the refinement. The applied label map for open contours is controlled by the parameters "radius" and "adaptiveness". The former is used to define how much area around the annotation is taken into account, while the latter is the parameter controlling the sensitivity to the image information.

The contours are displayed in a view table with their name, frame number (if applicable) and creation type.

The action has multiple "operations" in itself which are essentially sub-actions. These are Draw, Clear, Generate, Import-Export and Propagate. The Draw operation allows to change the settings for the contour being actively drawn. The Clear operation gives batch-wise opportunities to delete contours on frame data. The Generate operation enables the user to create contours from label maps. The Import-Export operation is for exporting/importing json/xml files with contour data. The Propagate operation enables the generation of new contours via interpolation between contours on different frames if such exist.

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
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 dataSetChanged () override
bool inputEvent (QEvent *event) override
void configuration (Properties *p) const override
 Serialize the current object configuration into the given Properties object.
void configure (const Properties *p) override
 Configure this object instance by de-serializing the given Properties.
void onManipulatorEvent (Manipulator *src, void *eventData) override
 Called when an event occurs.
void setSkipFactor (int skip)
void setPropagationDirection (DataSetPropagationAlgorithm::PropagationDirection dir)
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.

Protected Member Functions

void startDrawContour (const std::vector< vec3 > &points={})
void finalizeDrawContour (bool accept)
std::string generateContourName (const Seg::Contour &contour) const
 Generates a name as "TypeName" + "IndexOfType".
void removeContourSegmentation (std::vector< const Seg::Contour * > contours={}, int frame=-1)
 Remove the segmentation from the contour(s) from the label map.
bool updateContour (Seg::Contour &contour)
 Update the contour member variables according to the GUI state.
void removeContour ()
void writeContoursToFrame (int frameIdx)
std::pair< int, int > getBoundariesForPropagation (const std::string &name, const int labelValue) const
void removeAllContours (bool activeLabelOnly)
 This is used when a collection of contours are supposed to be removed.
void retrieveContour (int whichContour)
void syncContour2GUIState ()
 Sync the active contour to the GUI.
void generateContours (const std::vector< unsigned char > &labelValues, const std::pair< int, int > &range)
 Create and apply contours for the given label values and the given range of frames.
void generateContours ()
 Create and apply contours for this frame and for all labels values.
void propagateContours ()
void importContours (const Filesystem::Path &fileName)
 Import/Export functions for contours.
void exportContours (const Filesystem::Path &fileName)
void addDrawingManip ()
void removeDrawingManip ()
void addHoverManipulator ()
void removeHoverManipulator ()
void createAnnotation (const std::vector< vec3 > &points={}, std::string type="")
void addAnnotation (GlPointBasedAnnotation *annotation=nullptr)
void removeAnnotation (GlPointBasedAnnotation *annotation=nullptr)
void showPreview ()
void hidePreview ()
void updateWidgetsState ()
void updateContourTable ()
void showTableContextMenu (const QPoint &pos)
void updatePreview ()
void updatePreviewColor ()
bool isClosedContour () const
void waitForInstanceImage ()
Protected Member Functions inherited from ImFusion::SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.

Protected Attributes

bool m_showError = true
bool m_updateFocusFrame = true
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.

Additional Inherited Members

Public Attributes inherited from ImFusion::Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.

Member Function Documentation

◆ isProjectCompatible() [1/2]

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

◆ isProjectCompatible() [2/2]

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

◆ areActiveLayersCompatible()

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

◆ isDataSetCompatible()

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

◆ icon()

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

◆ text()

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

◆ description()

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

◆ docPath()

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

◆ isReadOnly()

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

◆ ui()

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

◆ activate()

void ImFusion::DrawContourAction::activate ( )
overridevirtual

Reimplemented from ImFusion::AnnotationAction.

◆ deactivate()

void ImFusion::DrawContourAction::deactivate ( )
overridevirtual

Reimplemented from ImFusion::AnnotationAction.

◆ dataSetChanged()

void ImFusion::DrawContourAction::dataSetChanged ( )
overridevirtual

Reimplemented from ImFusion::AnnotationAction.

◆ inputEvent()

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

Reimplemented from ImFusion::AnnotationAction.

◆ configuration()

void ImFusion::DrawContourAction::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.

◆ configure()

void ImFusion::DrawContourAction::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.

◆ onManipulatorEvent()

void ImFusion::DrawContourAction::onManipulatorEvent ( Manipulator * src,
void * eventData )
overridevirtual

Called when an event occurs.

Parameters
srcsource of the event
eventDatapointer to event data. Zero if no event data is provided.

Implements ImFusion::ManipulatorListener.

◆ removeContourSegmentation()

void ImFusion::DrawContourAction::removeContourSegmentation ( std::vector< const Seg::Contour * > contours = {},
int frame = -1 )
protected

Remove the segmentation from the contour(s) from the label map.

Parameters
contoursThe contours whose segmentation needs to be removed. If none are given, the active one is taken.
frameThe frame of dataset. If it is not specified the focused frame is taken.

◆ updateContour()

bool ImFusion::DrawContourAction::updateContour ( Seg::Contour & contour)
protected

Update the contour member variables according to the GUI state.

Parameters
contourThe contour to be updated.
Returns
A boolean indicator whether the update is successful. It can fail if an active label is not chosen.

◆ removeAllContours()

void ImFusion::DrawContourAction::removeAllContours ( bool activeLabelOnly)
protected

This is used when a collection of contours are supposed to be removed.

The sub-action is called Clear, the frames are selected through a frame selector.

Parameters
activeLabelOnlyA boolean signifying whether the clearance should be only on the active label

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