ImFusion SDK 4.3
BackgroundExporter Class Reference

#include <ImFusion/IO/BackgroundExporter.h>

Writing data files into disk in a background thread. More...

+ Inheritance diagram for BackgroundExporter:

Detailed Description

Writing data files into disk in a background thread.

This class exports data lists into disk as ImFusionFile, DICOM, and other supported file formats using a background thread.

Public Types

enum  ExportFileType { IMF = 0 , DICOM = 1 }
 File type used for export. More...
 

Public Member Functions

 BackgroundExporter ()
 Constructor.
 
 ~BackgroundExporter () override
 Destructor.
 
bool saveBlocking (DataList data, const std::string &filepath)
 Save data directly in a blocking fashion on the calling thread to the defined filepath.
 
std::future< void > saveAsync (Data *data, const std::string &filepath)
 Creates a saving task for data, which will not be deleted, to the defined filepath.
 
std::future< void > saveAsync (Data *data, const std::string &filepath, const std::function< void(const DataList &)> &savingCompleteFunc)
 Creates a saving task for data, which will not be deleted, to the defined filepath.
 
std::future< void > saveAsync (const std::vector< Data * > &data, const std::vector< std::string > &filenames, bool deleteAfterwards=false)
 Creates a saving task for elements in data, to the defined paths in filenames.
 
std::future< void > saveAsync (DataList data, const std::string &filepath, const std::function< void(const DataList &)> &savingCompleteFunc)
 Creates a saving task for data, which will not be deleted, to the defined filepath.
 
std::vector< std::stringpreparePatientFilenames (std::string directory, const std::string &patientName, const std::string &suffix, bool createRawSubFolder)
 Produces a non-existing but writable file name in the given directory, of the form patientname - XX - suffix, where XX starts with 01 and counts up.
 
bool isBeingSaved (const Data *data)
 Allows to inquire whether there exists a not completed saving task for the given data. Thread-safe.
 
void setFileType (ExportFileType type)
 Sets the preferred file type.
 
void setCompression (bool b)
 Sets whether compression is used for saving.
 
- Public Member Functions inherited from 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
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 

Methods implementing the Configurable interface

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.
 

Additional Inherited Members

- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Member Enumeration Documentation

◆ ExportFileType

File type used for export.

Enumerator
IMF 

ImFusion file format.

DICOM 

DICOM format.

Member Function Documentation

◆ saveBlocking()

bool saveBlocking ( DataList data,
const std::string & filepath )

Save data directly in a blocking fashion on the calling thread to the defined filepath.

Thread-safe.

◆ saveAsync() [1/4]

std::future< void > saveAsync ( Data * data,
const std::string & filepath )

Creates a saving task for data, which will not be deleted, to the defined filepath.

The task will run on next occasion in an asynchronous thread. data must not otherwise be deleted before the task is completed, see isBeingSaved(). Thread-safe. Returns a future, call future::wait before deleting the data

◆ saveAsync() [2/4]

std::future< void > saveAsync ( Data * data,
const std::string & filepath,
const std::function< void(const DataList &)> & savingCompleteFunc )

Creates a saving task for data, which will not be deleted, to the defined filepath.

The task will run on next occasion in an asynchronous thread. The function savingCompleteFunc will be called with data being the only element of the provided DataList, so that custom tasks can be run after successful saving, for instance removal blocks in the UI to delete the data.

Parameters
datamust not otherwise be deleted before the task is completed, see isBeingSaved().
savingCompleteFuncis called before isBeingSaved() will return false again. Thread-safe. Returns a future, call future::wait before deleting the data

◆ saveAsync() [3/4]

std::future< void > saveAsync ( const std::vector< Data * > & data,
const std::vector< std::string > & filenames,
bool deleteAfterwards = false )

Creates a saving task for elements in data, to the defined paths in filenames.

The task will run on next occasion in an asynchronous thread. Each item in data will be saved individually. Data in data must not be deleted before the task is completed, see isBeingSaved(). Data will be automatically deleted after saving if deleteAfterwards is true. Thread-safe. Returns a future, call future::wait before deleting the data

◆ saveAsync() [4/4]

std::future< void > saveAsync ( DataList data,
const std::string & filepath,
const std::function< void(const DataList &)> & savingCompleteFunc )

Creates a saving task for data, which will not be deleted, to the defined filepath.

The task will run on next occasion in an asynchronous thread. All items in data are saved to the same file. The function savingCompleteFunc will be called with data, so that custom tasks can be run after successful saving, for instance removal blocks in the UI to delete the data.

Parameters
datamust not otherwise be deleted before the task is completed, see isBeingSaved().
savingCompleteFuncis called before isBeingSaved() will return false again. Thread-safe. Returns a future, call future::wait before deleting the data

◆ preparePatientFilenames()

std::vector< std::string > preparePatientFilenames ( std::string directory,
const std::string & patientName,
const std::string & suffix,
bool createRawSubFolder )

Produces a non-existing but writable file name in the given directory, of the form patientname - XX - suffix, where XX starts with 01 and counts up.

Only the part without suffix is checked for determining XX, so that there are no two files with different suffix but identical XX.

Returns
a vector with 0)the file path as described above, and 1) the same file name but additionally in directory, subdirectory RawData for substreams.

◆ configure()

void 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 Configurable.

◆ configuration()

void 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 Configurable.


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