30 #if !defined(MITK_WINDOWS_NO_UNDEF) && defined(GetTempPath)
191 const std::string &templateName =
"XXXXXX",
192 const std::string &path = std::string());
217 std::ios_base::openmode mode,
218 const std::string &templateName =
"XXXXXX",
219 std::string path = std::string());
242 const std::string &path = std::string());
261 std::string path = std::string());
279 static DataStorage::SetOfObjects::Pointer
Load(
const std::string &path,
DataStorage &storage,
297 static DataStorage::SetOfObjects::Pointer
Load(
const std::string &path,
316 static std::vector<BaseData::Pointer>
Load(
const std::string &path,
327 template <
typename T>
330 return dynamic_cast<T*
>(Load(path, optionsCallback).at(0).GetPointer());
354 template <
typename T>
357 return dynamic_cast<T*
>(Load(path, options).at(0).GetPointer());
374 static DataStorage::SetOfObjects::Pointer
Load(
const std::vector<std::string> &paths,
DataStorage &storage,
384 static std::vector<BaseData::Pointer>
Load(
const std::vector<std::string> &paths,
397 std::ios_base::openmode mode = std::ios_base::in);
404 template <
typename T>
407 return dynamic_cast<T*
>(Load(usResource, mode).at(0).GetPointer());
457 const std::string &mimeType,
458 const std::string &path,
459 bool addExtension =
true,
460 bool setPathProperty =
false);
477 const std::string &mimeType,
478 const std::string &path,
480 bool addExtension =
true,
481 bool setPathProperty =
false);
494 static void Save(std::vector<SaveInfo> &saveInfos,
bool setPathProperty =
false);
505 static std::string
Load(std::vector<LoadInfo> &loadInfos,
521 const std::string &mimeType,
522 const std::string &path,
525 bool setPathProperty);
534 static std::string
Save(std::vector<SaveInfo> &saveInfos,
536 bool setPathProperty);
Base class of all data objects.
Abstract data management class that organizes DataNode objects in a directed acyclic graph.
itk::VectorContainer< unsigned int, DataNode::Pointer > SetOfObjects
Container type used as a result set of query operations such as GetSubset().
Selects the most suitable IFileReader for a given file path.
Selects the most suitable IFileWriter for a given BaseData object.
A utility class to load and save data from/to the local file system.
static BaseData::Pointer Load(const std::string &path, const PropertyList *properties)
Load a file with additional properties for the reader.
static std::string Save(std::vector< SaveInfo > &saveInfos, WriterOptionsFunctorBase *optionsCallback, bool setPathProperty)
Internal save implementation that processes SaveInfo objects.
static void Save(const mitk::BaseData *data, const std::string &path, bool setPathProperty=false)
Save a mitk::BaseData instance.
static T::Pointer Load(const std::string &path, const ReaderOptionsFunctorBase *optionsCallback=nullptr)
Load a file, cast the first result to type T and return it.
static std::string CreateTemporaryFile(std::ofstream &tmpStream, std::ios_base::openmode mode, const std::string &templateName="XXXXXX", std::string path=std::string())
static void Save(std::vector< SaveInfo > &saveInfos, bool setPathProperty=false)
Use SaveInfo objects to save BaseData instances.
static std::string CreateTemporaryFile(std::ofstream &tmpStream, const std::string &templateName="XXXXXX", const std::string &path=std::string())
static std::vector< BaseData::Pointer > Load(const us::ModuleResource &usResource, std::ios_base::openmode mode=std::ios_base::in)
Loads the contents of a us::ModuleResource and returns the corresponding mitk::BaseData.
static DataStorage::SetOfObjects::Pointer Load(const std::vector< std::string > &paths, DataStorage &storage, const ReaderOptionsFunctorBase *optionsCallback=nullptr)
Loads a list of file paths into the given DataStorage.
static std::string CreateTemporaryDirectory(const std::string &templateName="XXXXXX", std::string path=std::string())
static std::vector< BaseData::Pointer > Load(const std::string &path, const IFileReader::Options &options)
Load a file and return the loaded data.
static char GetDirectorySeparator()
static void Save(const mitk::BaseData *data, const std::string &mimeType, const std::string &path, const mitk::IFileWriter::Options &options, bool addExtension=true, bool setPathProperty=false)
Save a mitk::BaseData instance.
static std::vector< BaseData::Pointer > Load(const std::string &path, const ReaderOptionsFunctorBase *optionsCallback=nullptr)
Load a file and return the loaded data.
static void Save(const mitk::BaseData *data, const std::string &mimeType, const std::string &path, bool addExtension=true, bool setPathProperty=false)
Save a mitk::BaseData instance.
static DataStorage::SetOfObjects::Pointer Load(const std::string &path, const IFileReader::Options &options, DataStorage &storage)
Load a file into the given DataStorage given user defined IFileReader::Options.
static std::string CreateTemporaryFile(const std::string &templateName="XXXXXX", const std::string &path=std::string())
static T::Pointer Load(const us::ModuleResource &usResource, std::ios_base::openmode mode=std::ios_base::in)
Load a module resource, cast the first result to type T and return it.
static void Save(const mitk::BaseData *data, const std::string &path, const IFileWriter::Options &options, bool setPathProperty=false)
Save a mitk::BaseData instance.
static fs::path GetAppBundlePath(AppBundlePath path=AppBundlePath::Parent)
static T::Pointer Load(const std::string &path, const IFileReader::Options &options)
Load a file with options, cast the first result to type T and return it.
static std::string GetTempPath()
static std::vector< BaseData::Pointer > Load(const std::vector< std::string > &paths, const ReaderOptionsFunctorBase *optionsCallback=nullptr)
Load a list of file paths and return the loaded data.
static std::string GetProgramPath()
static std::string Load(std::vector< LoadInfo > &loadInfos, DataStorage::SetOfObjects *nodeResult, DataStorage *ds, const ReaderOptionsFunctorBase *optionsCallback)
Internal load implementation that processes LoadInfo objects.
static DataStorage::SetOfObjects::Pointer Load(const std::string &path, DataStorage &storage, const ReaderOptionsFunctorBase *optionsCallback=nullptr)
Load a file into the given DataStorage.
static std::string Save(const BaseData *data, const std::string &mimeType, const std::string &path, WriterOptionsFunctorBase *optionsCallback, bool addExtension, bool setPathProperty)
Internal save implementation with writer options callback.
Immutable, value-type wrapper for a registered mime-type.
Key-value list holding instances of BaseProperty.
Represents a resource (text file, image, etc.) embedded in a CppMicroServices module.
Portability header that provides a unified namespace alias for the C++ filesystem library.
Find image slices visible on a given plane.
std::map< std::string, us::Any > Options
Options for reading or writing data.
Contains information about the current loading process.
bool m_Cancel
Flag indicating if the load operation should be canceled.
const PropertyList * m_Properties
Optional properties to pass to the file reader.
std::vector< BaseData::Pointer > m_Output
The loaded BaseData objects (output).
LoadInfo(const std::string &path)
Constructor.
std::string m_Path
The file path to load.
FileReaderSelector m_ReaderSelector
The reader selector containing all suitable readers for the file.
Base class for option callbacks used in load operations.
virtual bool operator()(LoadInfo &loadInfo) const =0
Callback operator invoked during load to configure reader options.
Contains information about a save operation for a BaseData object.
SaveInfo(const BaseData *baseData, const MimeType &mimeType, const std::string &path)
Constructor.
std::string m_Path
The path to write the BaseData object to.
const BaseData * m_BaseData
The BaseData object to save.
bool m_Cancel
Flag indicating if sub-sequent save operations are to be canceled.
MimeType m_MimeType
The selected mime-type, used to restrict results from FileWriterSelector.
FileWriterSelector m_WriterSelector
Contains a set of IFileWriter objects.
bool operator<(const SaveInfo &other) const
Comparison operator for ordering SaveInfo objects.
Base class for option callbacks used in save operations.
virtual bool operator()(SaveInfo &saveInfo) const =0
Callback operator invoked during save to configure writer options.