Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
|
QmitkIOUtil Provides static helper methods to open and save files with Qt dialogs. More...
#include <QmitkIOUtil.h>
Classes | |
class | SaveFilter |
Static Public Member Functions | |
static QString | GetFileOpenFilterString () |
GetFilterString. More... | |
static QList< mitk::BaseData::Pointer > | Load (const QStringList &paths, QWidget *parent=nullptr) |
Loads the specified files. More... | |
static mitk::DataStorage::SetOfObjects::Pointer | Load (const QStringList &paths, mitk::DataStorage &storage, QWidget *parent=nullptr) |
static QList< mitk::BaseData::Pointer > | Load (const QString &path, QWidget *parent=nullptr) |
static mitk::DataStorage::SetOfObjects::Pointer | Load (const QString &path, mitk::DataStorage &storage, QWidget *parent=nullptr) |
static QString | Save (const mitk::BaseData *data, const QString &defaultBaseName, const QString &defaultPath=QString(), QWidget *parent=nullptr, bool setPathProperty=false) |
static QStringList | Save (const std::vector< const mitk::BaseData *> &data, const QStringList &defaultBaseNames, const QString &defaultPath=QString(), QWidget *parent=nullptr, bool setPathProperty=false) |
Save a list of BaseData objects using a "File Save Dialog". More... | |
static void | SaveBaseDataWithDialog (mitk::BaseData *data, std::string fileName, QWidget *parent=nullptr) |
SaveBaseDataWithDialog Convenience method to save any data with a Qt dialog. More... | |
static void | SaveSurfaceWithDialog (mitk::Surface::Pointer surface, std::string fileName="", QWidget *parent=nullptr) |
SaveSurfaceWithDialog Convenience method to save a surface with a Qt dialog. More... | |
static void | SaveImageWithDialog (mitk::Image::Pointer image, std::string fileName="", QWidget *parent=nullptr) |
SaveImageWithDialog Convenience method to save an image with a Qt dialog. More... | |
static void | SavePointSetWithDialog (mitk::PointSet::Pointer pointset, std::string fileName="", QWidget *parent=nullptr) |
SavePointSetWithDialog Convenience method to save a pointset with a Qt dialog. More... | |
![]() | |
static std::string | GetProgramPath () |
static std::string | GetTempPath () |
static char | GetDirectorySeparator () |
static std::string | CreateTemporaryFile (std::ofstream &tmpStream, const std::string &templateName="XXXXXX", std::string path=std::string()) |
static std::string | CreateTemporaryFile (std::ofstream &tmpStream, std::ios_base::openmode mode, const std::string &templateName="XXXXXX", std::string path=std::string()) |
static std::string | CreateTemporaryFile (const std::string &templateName="XXXXXX", std::string path=std::string()) |
static std::string | CreateTemporaryDirectory (const std::string &templateName="XXXXXX", std::string path=std::string()) |
static DataStorage::SetOfObjects::Pointer | Load (const std::string &path, DataStorage &storage, const ReaderOptionsFunctorBase *optionsCallback=nullptr) |
Load a file into the given DataStorage. More... | |
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. More... | |
static std::vector< BaseData::Pointer > | Load (const std::string &path, const ReaderOptionsFunctorBase *optionsCallback=nullptr) |
Load a file and return the loaded data. More... | |
template<typename T > | |
static T::Pointer | Load (const std::string &path, const ReaderOptionsFunctorBase *optionsCallback=nullptr) |
static std::vector< BaseData::Pointer > | Load (const std::string &path, const IFileReader::Options &options) |
Load a file and return the loaded data. More... | |
template<typename T > | |
static T::Pointer | Load (const std::string &path, const IFileReader::Options &options) |
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. More... | |
static std::vector< BaseData::Pointer > | Load (const std::vector< std::string > &paths, const ReaderOptionsFunctorBase *optionsCallback=nullptr) |
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. More... | |
template<typename T > | |
static T::Pointer | Load (const us::ModuleResource &usResource, std::ios_base::openmode mode=std::ios_base::in) |
static void | Save (const mitk::BaseData *data, const std::string &path, bool setPathProperty=false) |
Save a mitk::BaseData instance. More... | |
static void | Save (const mitk::BaseData *data, const std::string &path, const IFileWriter::Options &options, bool setPathProperty=false) |
Save a mitk::BaseData instance. More... | |
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. More... | |
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. More... | |
static void | Save (std::vector< SaveInfo > &saveInfos, bool setPathProperty=false) |
Use SaveInfo objects to save BaseData instances. More... | |
Additional Inherited Members | |
![]() | |
static std::string | Load (std::vector< LoadInfo > &loadInfos, DataStorage::SetOfObjects *nodeResult, DataStorage *ds, const ReaderOptionsFunctorBase *optionsCallback) |
static std::string | Save (const BaseData *data, const std::string &mimeType, const std::string &path, WriterOptionsFunctorBase *optionsCallback, bool addExtension, bool setPathProperty) |
static std::string | Save (std::vector< SaveInfo > &saveInfos, WriterOptionsFunctorBase *optionsCallback, bool setPathProperty) |
QmitkIOUtil Provides static helper methods to open and save files with Qt dialogs.
Definition at line 51 of file QmitkIOUtil.h.
|
static |
GetFilterString.
Definition at line 119 of file QmitkIOUtil.cpp.
References mitk::IMimeTypeProvider::GetCategories(), mitk::CoreServices::GetMimeTypeProvider(), and mitk::IMimeTypeProvider::GetMimeTypesForCategory().
Referenced by QmitkFileOpenAction::Run().
|
static |
Loads the specified files.
This methods tries to load all specified files and pop-ups dialog boxes if further user input is required (e.g. ambiguous mime-types or reader options).
If the provided DataStorage is not nullptr, some files will be added to it automatically, dependeing on the IFileReader used.
files | A list of files to load. |
ds | An optional data storage passed to IFileReader instances |
Definition at line 150 of file QmitkIOUtil.cpp.
References mitkThrow.
Referenced by Load(), and mitk::WorkbenchUtil::LoadFiles().
|
static |
Definition at line 178 of file QmitkIOUtil.cpp.
References Load().
|
static |
Definition at line 198 of file QmitkIOUtil.cpp.
References Load().
|
static |
Definition at line 205 of file QmitkIOUtil.cpp.
References Load().
|
static |
Definition at line 214 of file QmitkIOUtil.cpp.
Referenced by QmitkFileSaveAction::Run(), Save(), SaveBaseDataWithDialog(), SaveImageWithDialog(), SavePointSetWithDialog(), and SaveSurfaceWithDialog().
|
static |
Save a list of BaseData objects using a "File Save Dialog".
For each element in the data
vector, the following algorithm is used to find a IFileWriter instance for writing the BaseData object.
First, the user is prompted to select file names for each BaseData object. This is equivalent to choosing a specific mime-type, either by selecting a filter in the save dialog or by explicitly providing a file name extension:
In the second phase, each BaseData object is saved to disk using the specified file name and mime-type, according to the following procedure:
data | |
defaultBaseNames | |
defaultPath | |
parent |
Definition at line 227 of file QmitkIOUtil.cpp.
References QmitkIOUtil::SaveFilter::ALL_MIMETYPE(), QmitkIOUtil::SaveFilter::GetDefaultFilter(), QmitkIOUtil::SaveFilter::GetDefaultMimeType(), mitk::MimeType::GetExtensions(), QmitkIOUtil::SaveFilter::GetMimeTypeForFilter(), QmitkIOUtil::SaveFilter::GetMimeTypes(), mitk::MimeType::GetName(), mitk::MimeType::IsValid(), mitk::IOUtil::SaveInfo::m_MimeType, mitk::IOUtil::SaveInfo::m_Path, mitk::IOUtil::SaveInfo::m_WriterSelector, mitkThrow, Save(), mitk::FileWriterSelector::Select(), QmitkIOUtil::SaveFilter::Size(), and QmitkIOUtil::SaveFilter::ToString().
|
static |
SaveBaseDataWithDialog Convenience method to save any data with a Qt dialog.
data | BaseData holding the data you wish to save. |
fileName | The file name where to save the data (including path and extension). |
parent | An optional QWidget as parent. If no parent is supplied, the QFileDialog can occur anywhere on the screen. |
Definition at line 420 of file QmitkIOUtil.cpp.
References Save().
|
static |
SaveImageWithDialog Convenience method to save an image with a Qt dialog.
image | The image to save. |
fileName | The file name where to save the data (including path and extension). |
parent | An optional QWidget as parent. If no parent is supplied, the QFileDialog can occur anywhere on the screen. |
Definition at line 430 of file QmitkIOUtil.cpp.
References Save().
|
static |
SavePointSetWithDialog Convenience method to save a pointset with a Qt dialog.
pointset | The pointset to save. |
fileName | The file name where to save the data (including path and extension). |
parent | An optional QWidget as parent. If no parent is supplied, the QFileDialog can occur anywhere on the screen. |
Definition at line 435 of file QmitkIOUtil.cpp.
References mitk::MimeType::GetComment(), mitk::MimeType::GetExtensions(), mitk::FileWriterSelector::GetMimeTypes(), mitk::IOUtil::SaveInfo::m_WriterSelector, and Save().
|
static |
SaveSurfaceWithDialog Convenience method to save a surface with a Qt dialog.
surface | The surface to save. |
fileName | The file name where to save the data (including path and extension). |
parent | An optional QWidget as parent. If no parent is supplied, the QFileDialog can occur anywhere on the screen. |
Definition at line 425 of file QmitkIOUtil.cpp.
References Save().