ImFusion SDK 4.3
Controller Class Referenceabstract

#include <ImFusion/GUI/Controller.h>

Base interface for a GUI element within MainWindowBase. More...

+ Inheritance diagram for Controller:

Detailed Description

Base interface for a GUI element within MainWindowBase.

A Controller enables the user to configure and control the underlying entity such as an Algorithm or a Data instance hosted by a MainWindowBase. Furthermore, a Controller has access to the parent MainWindowBase instance and can therefore also access entities that usually would not be accessible by the underlying entity (e.g. DisplayWidget, DataModel, other Algorithms, ...). Furthermore, it provides the following callbacks for convenience:

The Controller interface by itself is just an interface providing the necessary link to the parent MainWindowBase instance and does not provide any "visible" GUI. This is done in order to avoid a dependency to a particular GUI framework. However, usually all concrete implementations of this interface will provide a concrete GUI and therefore depend on a particular GUI framework (Qt in the case of all ImFusion Controllers).

Depending on the application a Controller can be placed in different locations within the GUI, which can be customized by the programmer through the supportedLocations() and preferredLocation() member functions. The actual placement within the application GUI is to be performed from the outside by the hosting MainWindowBase and the ControllerDecorator class/interface. Custom applications specializing MainWindowBase are free to implement their own container widgets supporting additional locations.

Note
Due to technical constraints Controller requires a two-step initialization procedure! After construction, setMainWindowBase() must be called to provide the parent MainWindowBase instance and complete the initialization procedure. Usually, programmers do not need to call this function manually since this is already done by MainWindowBase::addController(). Implementers of Controllers should put initialization code into the pure virtual init() function since it's called by setMainWindowBase() once the parent main window is known. Users must not call any other functions on Controllers before their initialization is complete.
See also
AlgorithmController, DataController, MainWindowBase, ControllerDecorator

Public Types

enum class  Location : int {
  Unknown = -1 , Naked = 0 , PrimaryDock = 1 , SecondaryDock = 2 ,
  Detached = 3 , ToolBar = 4 , UserLocation = 100
}
 Enumeration of possible placement/decoration options of a Controller. More...
 

Public Member Functions

void setMainWindowBase (MainWindowBase *mw)
 Complete the initialization by providing the parent MainWindowBase instance hosting the controller by setting m_main and m_disp and eventually call init().
 
virtual void onSelectedDataChanged (const DataList &)
 Called by MainWindowBase in the case that the selection in the data model has changed.
 
virtual void onVisibleDataChanged (const DataList &)
 Called by MainWindowBase in the case that the currently visible data has changed.
 
virtual std::vector< LocationsupportedLocations () const
 Returns the list of locations in which this controller is allowed to be placed by the parent MainWindowBase.
 
virtual Location preferredLocation () const
 Returns the preferred location in which the parent MainWindowBase should place this controller.
 
virtual void onLocationChanged (Location newLocation)
 Callback function called by the parent MainWindowBase/ControllerDecorator whenever the place was changed.
 
Location location () const
 Convenience function to query the current controller Location from the parent ControllerDecorator.
 
virtual std::string title () const =0
 Returns the shown widget title if the controller is shown in a mode that supports this (e.g. when in dock).
 
ControllerDecoratorgetDecorator () const
 Convenience function to return m_main->getControllerDecorator(this) if m_main is set or nullptr otherwise.
 
template<typename T>
T * getDecorator () const
 Convenience function to dynamic_cast the return value of getDecorator() to a derived type.
 
- Public Member Functions inherited from Configurable
virtual void configure (const Properties *p)
 Configure this object instance by de-serializing the given Properties.
 
virtual void configuration (Properties *p) const
 Serialize the current object configuration into the given Properties object.
 
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
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 

Public Attributes

Signal signalTitleChanged
 Signal emitted when the title() has changed.
 
- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 

Protected Member Functions

virtual void init ()=0
 Two-step initialization function to be implemented by subclasses.
 

Protected Attributes

MainWindowBasem_main = nullptr
 The parent MainWindowBase instance hosting this Controller.
 
DisplayWidgetMultim_disp = nullptr
 The main DisplayWidget instance, convenience shortcut for m_main->display().
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Member Enumeration Documentation

◆ Location

enum class Location : int
strong

Enumeration of possible placement/decoration options of a Controller.

Enumerator
Unknown 

Exact location could not be determined (e.g. when Controller is not yet initialized).

Naked 

Controller should not be wrapped/placed by MainWindowBase at all (e.g. Controller hosts its own window).

PrimaryDock 

Controller should be placed in MainWindowBase::algorithmDock() if available.

SecondaryDock 

Controller should be placed in MainWindowBase::secondaryAlgorithmDock() if available.

Detached 

Controller should be placed in a detached floating window.

ToolBar 

Controller should be placed in MainWindowBase::controllerBar() if available.

UserLocation 

First unreserved enum value that can be used for custom or application-specific purposes.

Member Function Documentation

◆ setMainWindowBase()

void setMainWindowBase ( MainWindowBase * mw)

Complete the initialization by providing the parent MainWindowBase instance hosting the controller by setting m_main and m_disp and eventually call init().

This function is called by MainWindowBase::addController() so that you normally do not need to call it manually from the outside except in case you want to use a Controller without adding it to MainWindowBase.

Note
Controllers do not support exchanging their main window. Therefore, this function must not be called multiple times with different arguments!

◆ onSelectedDataChanged()

◆ onVisibleDataChanged()

◆ supportedLocations()

virtual std::vector< Location > supportedLocations ( ) const
inlinevirtual

Returns the list of locations in which this controller is allowed to be placed by the parent MainWindowBase.

If the controller should not be placed/wrapped by the host but stand by itself you should return a list containing only Location::Naked.

Reimplemented in DataController, Gated4DImageSetDisplayDataController, ImFusionFileIoController, IoController, SetModalityController, TrackedSharedImageSetDisplayDataController, TrackedSharedImageSetPropertiesLegacy, TrackingStreamProperties, ExportCalibrationController, UltrasoundCalibrationWizard, VideoCameraStreamPropertiesInspectorController, and VitalsDataController.

◆ preferredLocation()

virtual Location preferredLocation ( ) const
inlinevirtual

◆ onLocationChanged()

virtual void onLocationChanged ( Location newLocation)
virtual

Callback function called by the parent MainWindowBase/ControllerDecorator whenever the place was changed.

Reimplemented in MeshDataController.

◆ location()

Location location ( ) const

Convenience function to query the current controller Location from the parent ControllerDecorator.

If the current location could not be determined, Location::Unknown is returned.

◆ title()

virtual std::string title ( ) const
pure virtual

◆ init()

virtual void init ( )
protectedpure virtual

Two-step initialization function to be implemented by subclasses.

This function is called by setMainWindowBase() after the m_disp and m_main attributes have been set and hence a complete initialization of the controller is possible at this point.

Implemented in AnatomyController, InspectStyleSheetsController, ASCAlgorithmController, ASCProjectionController, BasicImageProcessingController, BullseyeVisualizationController, CombinedTrackingStreamController, AlgorithmReconstructionDecoratorController, AutoFocusMotionCompensationAlgorithmController, ConeBeamGeometryController, ConeBeamSimulationController, GeometrySelfCalibrationController, Gl2D3DRegistrationController, GridBasedDistortionCorrectionController, Mesh2D3DRegistrationController, XRay2D3DRegistrationAlgorithmController, CurvedViewSettingsController, DataController, DefaultAlgorithmController, DefaultASCRegistrationController, DefaultASCSegmentationController< SegmentationAlgorithm >, DeformationEditorController, DescriptorsRegistrationController, RTStructureDataController, DrawGraphController, EvaluateLinearShapeModelController, FilterController, GraphDataController, CreateDeviceController, ImageRegistrationController, ImageResamplingController, ImageStatisticsController, ImFusionFileIoController, InteractiveSegmentationController, IoController, LabelingController, LiftChartOverlayController, LineToIsosurfaceIntersectionController, LinkPoseDeformableController, LiveHandEyeCalibrationController, LiveHandEyeEvaluationController, LiveStereoCalibrationController, MaskEditorController, MeshCollisionDetectionController, MeshDataController, MeshDistanceController, MeshMeasurementsController, MeshPointCloudCroppingController, NDITrackingController, ParametricImageRegistrationController, PlottingAlgorithmController, PointCloudAnalysisController, PointCorrespondenceController, PointCorrespondencesController, RegistrationResultsController, RGBDStreamController, FrankaManagerController, RTStructureToLabelMapController, StructuresViewAlgorithmController, SetModalityController, SpineBaseController, SpineMeshCurvatureController, SplineSlicingController, StereoImageStreamDataController, StereoSharedImageSetController, StreamAlgorithmExecutorController, StreamControllerBase, StreamRecorderController, ThresholdingFiducialExtractionController, ToolCalibrationController, ToolVisualizationController, TrackedSharedImageSetDisplayDataController, TrackedSharedImageSetProperties, TrackedSharedImageSetPropertiesLegacy, TrackingStreamProperties, TrackingToolCalibrationWizard, TransferGraphFeatureToMeshController, BoneSegmentationController, ExportCalibrationController, FrameGeometryPropertiesController, FrameGrabbingConfigEditorController, FrameGrabbingController, GeometryDetectionController, ImportCalibrationController, LiveSweepRecordingVisualizationController, NeedleSweepCalibrationController, ProcessUltrasoundController, RawDataController, StreamDisplayDataController, SweepDisplayDataController, SweepGlobalInitController, SweepPointCorrController, SweepRecorderController, SyntheticUltrasoundSweepController, TrackingEstimationController, UltrasoundCalibrationController, UltrasoundCalibrationWizard, UltrasoundDISARegistrationController, UltrasoundRegistrationController, VertebraDissectionLegacyController, VideoCameraStreamPropertiesInspectorController, VitalsDataController, VolumeBasedMeshCurvatureController, and VolumeBasedMeshRegistrationController.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close