![]() |
ImFusion SDK 4.3
|
#include <ImFusion/IO/BackgroundExporter.h>
Writing data files into disk in a background thread. More...
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::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. | |
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. | |
![]() | |
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 |
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 | |
![]() | |
Signal | signalParametersChanged |
Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
![]() | |
std::vector< Param > | m_params |
List of all registered Parameter and SubProperty instances. | |
enum ExportFileType |
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.
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
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.
data | must not otherwise be deleted before the task is completed, see isBeingSaved(). |
savingCompleteFunc | is called before isBeingSaved() will return false again. Thread-safe. Returns a future, call future::wait before deleting the data |
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
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.
data | must not otherwise be deleted before the task is completed, see isBeingSaved(). |
savingCompleteFunc | is called before isBeingSaved() will return false again. Thread-safe. Returns a future, call future::wait before deleting the data |
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.
directory
, subdirectory RawData for substreams.
|
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.
Reimplemented from Configurable.
|
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.
Reimplemented from Configurable.