Medical Imaging Interaction Toolkit
2016.11.0
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=NULL) |
Loads the specified files. More... | |
static mitk::DataStorage::SetOfObjects::Pointer | Load (const QStringList &paths, mitk::DataStorage &storage, QWidget *parent=NULL) |
static QList< mitk::BaseData::Pointer > | Load (const QString &path, QWidget *parent=NULL) |
static mitk::DataStorage::SetOfObjects::Pointer | Load (const QString &path, mitk::DataStorage &storage, QWidget *parent=NULL) |
static QString | Save (const mitk::BaseData *data, const QString &defaultBaseName, const QString &defaultPath=QString(), QWidget *parent=NULL) |
static QStringList | Save (const std::vector< const mitk::BaseData * > &data, const QStringList &defaultBaseNames, const QString &defaultPath=QString(), QWidget *parent=NULL) |
Save a list of BaseData objects using a "File Save Dialog". More... | |
static void | SaveBaseDataWithDialog (mitk::BaseData *data, std::string fileName, QWidget *parent=NULL) |
SaveBaseDataWithDialog Convenience method to save any data with a Qt dialog. More... | |
static void | SaveSurfaceWithDialog (mitk::Surface::Pointer surface, std::string fileName="", QWidget *parent=NULL) |
SaveSurfaceWithDialog Convenience method to save a surface with a Qt dialog. More... | |
static void | SaveImageWithDialog (mitk::Image::Pointer image, std::string fileName="", QWidget *parent=NULL) |
SaveImageWithDialog Convenience method to save an image with a Qt dialog. More... | |
static void | SavePointSetWithDialog (mitk::PointSet::Pointer pointset, std::string fileName="", QWidget *parent=NULL) |
SavePointSetWithDialog Convenience method to save a pointset with a Qt dialog. More... | |
Static Public Member Functions inherited from mitk::IOUtil | |
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) |
Load a file into the given DataStorage. More... | |
static DataStorage::SetOfObjects::Pointer | Load (const std::string &path, const IFileReader::Options &options, DataStorage &storage) |
static std::vector< BaseData::Pointer > | Load (const std::string &path) |
static std::vector< BaseData::Pointer > | Load (const std::string &path, const IFileReader::Options &options) |
static DataStorage::SetOfObjects::Pointer | Load (const std::vector< std::string > &paths, DataStorage &storage) |
Loads a list of file paths into the given DataStorage. More... | |
static std::vector< BaseData::Pointer > | Load (const std::vector< std::string > &paths) |
static int | LoadFiles (const std::vector< std::string > &fileNames, DataStorage &storage) |
static DataStorage::Pointer | LoadFiles (const std::vector< std::string > &fileNames) |
static mitk::BaseData::Pointer | LoadBaseData (const std::string &path) |
Create a BaseData object from the given file. More... | |
static mitk::DataNode::Pointer | LoadDataNode (const std::string &path) |
LoadDataNode Method to load an arbitrary DataNode. More... | |
static mitk::Image::Pointer | LoadImage (const std::string &path) |
LoadImage Convenience method to load an arbitrary mitkImage. More... | |
static mitk::Surface::Pointer | LoadSurface (const std::string &path) |
LoadSurface Convenience method to load an arbitrary mitkSurface. More... | |
static mitk::PointSet::Pointer | LoadPointSet (const std::string &path) |
LoadPointSet Convenience method to load an arbitrary mitkPointSet. More... | |
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... | |
static void | Save (const mitk::BaseData *data, const std::string &path) |
Save a mitk::BaseData instance. More... | |
static void | Save (const mitk::BaseData *data, const std::string &path, const IFileWriter::Options &options) |
Save a mitk::BaseData instance. More... | |
static void | Save (const mitk::BaseData *data, const std::string &mimeType, const std::string &path, bool addExtension=true) |
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) |
Save a mitk::BaseData instance. More... | |
static void | Save (std::vector< SaveInfo > &saveInfos) |
Use SaveInfo objects to save BaseData instances. More... | |
static bool | SaveImage (mitk::Image::Pointer image, const std::string &path) |
SaveImage Convenience method to save an arbitrary mitkImage. More... | |
static bool | SaveBaseData (mitk::BaseData *data, const std::string &path) |
SaveBaseData Convenience method to save arbitrary baseData. More... | |
static bool | SaveSurface (mitk::Surface::Pointer surface, const std::string &path) |
SaveSurface Convenience method to save an arbitrary mitkSurface. More... | |
static bool | SavePointSet (mitk::PointSet::Pointer pointset, const std::string &path) |
SavePointSet Convenience method to save an mitkPointSet. More... | |
Additional Inherited Members | |
Static Protected Member Functions inherited from mitk::IOUtil | |
static std::string | Load (std::vector< LoadInfo > &loadInfos, DataStorage::SetOfObjects *nodeResult, DataStorage *ds, ReaderOptionsFunctorBase *optionsCallback) |
static std::string | Save (const BaseData *data, const std::string &mimeType, const std::string &path, WriterOptionsFunctorBase *optionsCallback, bool addExtension) |
static std::string | Save (std::vector< SaveInfo > &saveInfos, WriterOptionsFunctorBase *optionsCallback) |
QmitkIOUtil Provides static helper methods to open and save files with Qt dialogs.
Definition at line 55 of file QmitkIOUtil.h.
|
static |
GetFilterString.
Definition at line 86 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 NULL, 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 117 of file QmitkIOUtil.cpp.
References mitkThrow.
Referenced by Load(), and mitk::WorkbenchUtil::LoadFiles().
|
static |
Definition at line 145 of file QmitkIOUtil.cpp.
References Load(), and mitk::New().
|
static |
Definition at line 165 of file QmitkIOUtil.cpp.
References Load().
|
static |
Definition at line 172 of file QmitkIOUtil.cpp.
References Load().
|
static |
Definition at line 181 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 193 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 374 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 384 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 389 of file QmitkIOUtil.cpp.
References 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 379 of file QmitkIOUtil.cpp.
References Save().