ImFusion SDK 4.3
ConsoleController Class Reference

#include <ImFusion/GUI/ConsoleController.h>

Specialization of ApplicationController for a console application which loads data and runs algorithms. More...

+ Inheritance diagram for ConsoleController:

Detailed Description

Specialization of ApplicationController for a console application which loads data and runs algorithms.

Depending on the constructor arguments, instantiating this class can also take care of proper initialization (e.g. factories, OpenGL contexts, etc.) of the ImFusion SDK. In this case you do not need to call Framework::init() explicitly.

Public Member Functions

 ConsoleController (std::optional< Framework::InitConfig > sdkInitConfig, const std::string &organizationName, const std::string &applicationName)
 Instantiate and initialize the ConsoleController.
 
 ~ConsoleController () override
 Destructor.
 
Progressprogress () override
 Returns the optional Progress instance that can be used to report progress updates.
 
std::vector< std::map< std::string, std::string > > askWorkspacePlaceholders (const std::vector< std::string > &placeholderKeys) override
 Asks the user the value of some placeholders and returns the input of the user.
 
- Public Member Functions inherited from ApplicationController
 ApplicationController (std::unique_ptr< DataModel > dataModel, std::optional< Framework::InitConfig > sdkInitConfig)
 Instantiate and initialize the ApplicationController interface.
 
void load (int argc, char **argv)
 Load configuration file and optional further parameters.
 
void loadAll (const std::vector< std::string > &fileNames)
 Loads all files passed as arguments.
 
virtual bool loadWorkspace (const Filesystem::Path &filename, const std::optional< std::map< std::string, std::string > > &=std::nullopt)
 Loads a workspace file from the path denoted by filename.
 
virtual bool open (const std::string &filename, DataList *outDataList=nullptr)
 Opens a generic file and adds it to the DataModel.
 
virtual void closeAll ()
 Closes all data, algorithms and annotations.
 
virtual void addAlgorithm (std::unique_ptr< Algorithm > a, const Properties *config=nullptr)
 Adds an algorithm.
 
virtual void removeAlgorithm (Algorithm *a, bool del=true)
 Removes the algorithm and deletes it if del is true.
 
virtual void clearAlgorithms ()
 Removes all algorithm and deletes it if del is true.
 
virtual void executeAlgorithms ()
 Executes all algorithms. TODO: delete algorithms afterwards?
 
virtual void addAlgorithmToHistory (const Algorithm &a, bool allowReplayWorkspaces=true)
 Adds an already executed algorithm to the history.
 
void registerAlgorithm (const Algorithm &alg)
 Registers the algorithm.
 
void updateRegisteredAlgorithm (const Algorithm &alg)
 Update the description of a recorded algorithm.
 
void ignoreDataInHistory (Data &data)
 Ignore the given Data in the algorithm history/workspace.
 
void ignoreAnnotationInHistory (InteractiveObject &annotation)
 Ignore the given Annotation in the algorithm history/workspace.
 
const WorkspacealgorithmHistory () const
 Return the workspace instance modeling list of executed algorithms and their input/output data.
 
std::vector< Algorithm * > algorithms () const
 Returns the list of all algorithms.
 
virtual std::vector< Algorithm * > dependingAlgorithms (const Data *data) const
 Returns the algorithms that depend on data.
 
virtual std::vector< Algorithm * > dependingAlgorithms (const DataList &data) const
 Returns the algorithms that depend on exactly the provided data list.
 
virtual AlgorithmgetAlgorithm (const std::string &id) const
 Returns the first algorithm with the given id or nullptr if not existing.
 
template<typename T>
T * getAlgorithm (const std::string &id="") const
 Returns the first algorithm of the given type, optionally with id filtering.
 
virtual void addPlaceholder (const std::string &name, const std::string &value)
 Adds a placeholder value to m_placeholders (or overwrites it if it already exists)
 
virtual std::map< std::string, std::stringplaceholders () const
 Gets the currently set placeholders.
 
virtual void setPlaceholders (const std::map< std::string, std::string > &placeholders)
 Sets the placeholders.
 
virtual bool saveWorkspace (const Filesystem::Path &filename, std::optional< std::set< std::string > > selectedDataComps=std::nullopt)
 Save current workspace to a iws file Selected data components passed as parameter are also saved.
 
virtual DataModeldataModel ()
 
virtual const DataModeldataModel () const
 
void loadPlugins (const std::vector< std::string > &pluginFolders=std::vector< std::string >())
 Load and register/initializes all ImFusion plugins from the specified folders.
 
virtual bool canBeDeleted (const Data *data)
 Check whether data can be deleted or loaded algorithms depend on it.
 

Additional Inherited Members

- Public Attributes inherited from ApplicationController
Signal< const Algorithm * > signalAlgorithmRemoved
 Signal emitted just before an Algorithm is removed.
 
- Protected Member Functions inherited from ApplicationController
virtual void configureAlgorithm (Algorithm *)
 Called before an Algorithm is executed, allows for custom configuration.
 
virtual bool open (const std::string &algorithm, const std::string &name, DataList *outDataList, bool addToRecentFiles=true, const Properties *p=nullptr, std::string *pathOut=nullptr)
 Open a specific file type.
 
virtual bool prepareData (Data *data) const
 Prepares data for processing and display.
 
virtual AlgorithmControllergetAlgorithmController (const Algorithm *) const
 Returns the controller of the algorithm or nullptr if not existing (default implementation).
 
bool checkDicomMagicByte (const Filesystem::Path &filename) const
 Checks the given file whether it contains the DICOM magic byte ("DICM" at bytes 128 ff.).
 
virtual bool openWithIoAlgorithms (const std::vector< std::string > &algs, const std::string &filename, DataList *dataOut)
 Uses the first of the given algs to open filename, store them in the DataModel and optionally put them in dataOut.
 
- Protected Attributes inherited from ApplicationController
std::unique_ptr< DataModelm_dataModel
 
std::unique_ptr< Workspacem_algorithmHistory
 History of executed algorithms and their input/output data.
 
std::map< std::string, std::stringm_placeholders
 Placeholders as extra command line arguments.
 
std::vector< std::unique_ptr< Algorithm > > m_algorithms
 List of all active Algorithms.
 
std::vector< Propertiesm_algorithmTemplates
 List of templates that newly instantiated algorithms should be configured from.
 
DataList m_untrackedData
 Data that has been added to the data model but is not yet assigned to an output of an algorithm.
 
std::vector< Data * > m_ignoredData
 Data that has been explicitly marked to be ignored in workspaces.
 
std::vector< InteractiveObject * > m_ignoredAnnotations
 Annotations that have been explicitly marked to be ignored in workspaces.
 
bool m_prepareShiftOnly = true
 Only shift intensities during prepareData.
 
bool m_prepareNoShiftScale = false
 Do not shift or scale intensities during prepareData, overrides m_prepareShiftOnly.
 
bool m_prepareDownsample = false
 Downsample data during prepareData.
 
- Static Protected Attributes inherited from ApplicationController
static std::string m_logFileLocation
 Path to the log file (empty if not set)
 

Constructor & Destructor Documentation

◆ ConsoleController()

ConsoleController ( std::optional< Framework::InitConfig > sdkInitConfig,
const std::string & organizationName,
const std::string & applicationName )

Instantiate and initialize the ConsoleController.

Parameters
sdkInitConfigFlag and parameters whether to call Framework::init() during construction. Leave the Optional empty in case you have initialized the SDK already manually.
organizationNameForwarded to QCoreApplication::setOrganizationName(), determines the path for the global settings (see Settings).
applicationNameForwarded to QCoreApplication::setApplicationName(), determines the path for the global settings (see Settings).

Member Function Documentation

◆ progress()

Progress * progress ( )
overridevirtual

Returns the optional Progress instance that can be used to report progress updates.

Reimplemented from ApplicationController.

◆ askWorkspacePlaceholders()

std::vector< std::map< std::string, std::string > > askWorkspacePlaceholders ( const std::vector< std::string > & placeholderKeys)
overridevirtual

Asks the user the value of some placeholders and returns the input of the user.

Reimplemented from ApplicationController.


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