![]() |
Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
|
#include <Base/QTGUI/qSlicerIOManager.h>
Public Types | |
typedef qSlicerCoreIOManager | Superclass |
Public Slots | |
bool | openAddColorTableDialog () |
bool | openAddDataDialog () |
bool | openAddDataDialog (QString fileName) |
bool | openAddFiberBundleDialog () |
bool | openAddFiducialDialog () |
bool | openAddMarkupsDialog () |
bool | openAddModelDialog () |
bool | openAddScalarOverlayDialog () |
bool | openAddSceneDialog () |
bool | openAddTransformDialog () |
bool | openAddVolumeDialog () |
bool | openAddVolumesDialog () |
bool | openLoadSceneDialog () |
bool | openSaveDataDialog () |
void | openSceneViewsDialog () |
void | openScreenshotDialog () |
void | setDefaultSceneFileType (QString) |
void | setDefaultMaximumFileNameLength (int) |
Public Member Functions | |
void | addHistory (const QString &path) |
void | dragEnterEvent (QDragEnterEvent *event) |
void | dropEvent (QDropEvent *event) |
const QList< QUrl > & | favorites () const |
const QStringList & | history () const |
Q_INVOKABLE bool | isDialogRegistered (qSlicerIO::IOFileType fileType, qSlicerFileDialog::IOAction action) const |
bool | loadNodes (const QList< qSlicerIO::IOProperties > &files, vtkCollection *loadedNodes=nullptr, vtkMRMLMessageCollection *userMessages=nullptr) override |
Q_INVOKABLE bool | loadNodes (const qSlicerIO::IOFileType &fileType, const qSlicerIO::IOProperties ¶meters, vtkCollection *loadedNodes=nullptr, vtkMRMLMessageCollection *userMessages=nullptr) override |
Q_INVOKABLE bool | openDialog (qSlicerIO::IOFileType fileType, qSlicerFileDialog::IOAction action, qSlicerIO::IOProperties ioProperties=qSlicerIO::IOProperties(), vtkCollection *loadedNodes=nullptr) |
qSlicerIOManager (QObject *parent=nullptr) | |
void | registerDialog (qSlicerFileDialog *dialog) |
void | setFavorites (const QList< QUrl > &urls) |
~qSlicerIOManager () override | |
![]() | |
Q_INVOKABLE void | addDefaultStorageNodes () |
Q_INVOKABLE QStringList | allReadableFileExtensions () const |
Q_INVOKABLE QStringList | allWritableFileExtensions () const |
Q_INVOKABLE QString | completeSlicerWritableFileNameSuffix (vtkMRMLStorableNode *node) const |
int | defaultMaximumFileNameLength () const |
Q_INVOKABLE bool | exportNodes (const QList< qSlicerIO::IOProperties > ¶meterMaps, bool hardenTransforms, vtkMRMLMessageCollection *userMessages=nullptr) |
Q_INVOKABLE bool | exportNodes (const QStringList &nodeIDs, const QStringList &fileNames, const qSlicerIO::IOProperties &commonParameterMap, bool hardenTransforms, vtkMRMLMessageCollection *userMessages=nullptr) |
Q_INVOKABLE QString | extractKnownExtension (const QString &fileName, vtkObject *object) |
Q_INVOKABLE QStringList | fileDescriptions (const QString &file) const |
QStringList | fileDescriptionsByType (const qSlicerIO::IOFileType fileType) const |
qSlicerIOOptions * | fileOptions (const QString &fileDescription) const |
Return the file read options for the best reader associated with a file type. | |
Q_INVOKABLE qSlicerIO::IOFileType | fileType (const QString &file) const |
Return the most likely file type (SegmentationFile, TextFile, ...) for reading a file. | |
Q_INVOKABLE qSlicerIO::IOFileType | fileTypeFromDescription (const QString &fileDescription) const |
Return the most likely file description (SegmentationFile, TextFile, ...) for reading a file. | |
Q_INVOKABLE QList< qSlicerIO::IOFileType > | fileTypes (const QString &file) const |
Return all supported file types for reading a file. | |
Q_INVOKABLE QStringList | fileWriterDescriptions (const qSlicerIO::IOFileType &fileType) const |
Q_INVOKABLE QStringList | fileWriterExtensions (vtkObject *object) const |
Q_INVOKABLE qSlicerIO::IOFileType | fileWriterFileType (vtkObject *object, const QString &extension=QString()) const |
Return the file type of the best file writer for the input VTK object. | |
qSlicerIOOptions * | fileWriterOptions (vtkObject *object, const QString &extension) const |
Return the file write options of the best file writer for the input VTK object. | |
Q_INVOKABLE QString | forceFileNameMaxLength (const QString &filename, int extensionLength, int maxLength=-1) |
Q_INVOKABLE bool | loadFile (const QString &fileName, vtkMRMLMessageCollection *userMessages=nullptr) |
vtkMRMLNode * | loadNodesAndGetFirst (qSlicerIO::IOFileType fileType, const qSlicerIO::IOProperties ¶meters, vtkMRMLMessageCollection *userMessages=nullptr) |
Q_INVOKABLE bool | loadScene (const QString &fileName, bool clear=true, vtkMRMLMessageCollection *userMessages=nullptr) |
qSlicerCoreIOManager (QObject *parent=nullptr) | |
void | registerIO (qSlicerIO *io) |
Q_INVOKABLE bool | saveNodes (qSlicerIO::IOFileType fileType, const qSlicerIO::IOProperties ¶meters, vtkMRMLMessageCollection *userMessages=nullptr, vtkMRMLScene *scene=nullptr) |
Q_INVOKABLE bool | saveScene (const QString &fileName, QImage screenShot, vtkMRMLMessageCollection *userMessages=nullptr) |
Q_INVOKABLE QString | stripKnownExtension (const QString &fileName, vtkObject *object) |
qSlicerFileWriter * | writer (vtkObject *object, const QString &extension=QString()) const |
Return best file writer for this object. | |
~qSlicerCoreIOManager () override | |
Q_INVOKABLE int | registeredFileReaderCount (const qSlicerIO::IOFileType &fileType) const |
Q_INVOKABLE int | registeredFileWriterCount (const qSlicerIO::IOFileType &fileType) const |
Q_INVOKABLE void | emitNewFileLoaded (const QVariantMap &loadedFileParameters) |
Q_INVOKABLE void | emitFileSaved (const QVariantMap &savedFileParameters) |
Q_INVOKABLE QString | defaultSceneFileType () const |
Defines the file format that should be offered by default when the scene is saved. | |
Q_INVOKABLE bool | examineFileInfoList (QFileInfoList &fileInfoList, QFileInfo &archetypeEntry, QString &readerDescription, qSlicerIO::IOProperties &ioProperties) const |
Static Public Member Functions | |
static Q_INVOKABLE void | showLoadNodesResultDialog (bool success, vtkMRMLMessageCollection *userMessages) |
![]() | |
static Q_INVOKABLE QRegExp | fileNameRegExp (const QString &extension=QString()) |
static Q_INVOKABLE QString | forceFileNameValidCharacters (const QString &filename) |
Remove characters that are likely to cause problems in a filename. | |
static Q_INVOKABLE vtkMRMLStorageNode * | createAndAddDefaultStorageNode (vtkMRMLStorableNode *node) |
}@ | |
Protected Slots | |
void | execDelayedFileDialog () |
void | updateProgressDialog () |
Protected Member Functions | |
const QList< qSlicerFileReader * > & | readers () const |
Returns the list of registered readers. | |
QList< qSlicerFileReader * > | readers (const qSlicerIO::IOFileType &fileType) const |
Returns the list of registered readers or writers associated with fileType. | |
const QList< qSlicerFileReader * > & | readers () const |
Returns the list of registered readers. | |
const QList< qSlicerFileWriter * > & | writers () const |
Returns the list of registered writers. | |
QList< qSlicerFileWriter * > | writers (const qSlicerIO::IOFileType &fileType) const |
Returns the list of registered writers for a given fileType. | |
QList< qSlicerFileReader * > | readers (const qSlicerIO::IOFileType &fileType) const |
Returns the list of registered readers or writers associated with fileType. | |
qSlicerFileReader * | reader (const QString &ioDescription) const |
Protected Attributes | |
QScopedPointer< qSlicerIOManagerPrivate > | d_ptr |
QScopedPointer< qSlicerCoreIOManagerPrivate > | d_ptr |
Friends | |
class | qSlicerFileDialog |
Additional Inherited Members | |
![]() | |
int | defaultMaximumFileNameLength |
QString | defaultSceneFileType |
void | newFileLoaded (const qSlicerIO::IOProperties &loadedFileParameters) |
void | fileSaved (const qSlicerIO::IOProperties &savedFileParameters) |
Definition at line 26 of file qSlicerIOManager.h.
Definition at line 31 of file qSlicerIOManager.h.
qSlicerIOManager::qSlicerIOManager | ( | QObject * | parent = nullptr | ) |
|
override |
void qSlicerIOManager::addHistory | ( | const QString & | path | ) |
void qSlicerIOManager::dragEnterEvent | ( | QDragEnterEvent * | event | ) |
dragEnterEvents can be forwarded to the IOManager, if a registered dialog supports it, the event is accepted, otherwise ignored.
void qSlicerIOManager::dropEvent | ( | QDropEvent * | event | ) |
Search, in the list of registered readers, the first dialog that handles the drop event. If the event is accepted by the dialog ( usually the is also used to populate the dialog), the manager opens the dialog, otherwise the next dialog is tested. The order in which dialogs are being tested is the opposite of the dialogs are registered.
|
protectedslot |
const QList< QUrl > & qSlicerIOManager::favorites | ( | ) | const |
const QStringList & qSlicerIOManager::history | ( | ) | const |
Q_INVOKABLE bool qSlicerIOManager::isDialogRegistered | ( | qSlicerIO::IOFileType | fileType, |
qSlicerFileDialog::IOAction | action ) const |
Return True if a custom file dialog was registered.
|
overridevirtual |
If you have a list of nodes to load, it's best to use this function in order to have a unique progress dialog instead of multiple ones. It internally calls loadNodes() for each file.
Reimplemented from qSlicerCoreIOManager.
|
overridevirtual |
Displays a progress dialog if it takes too long to load There is no way to know in advance how long the loading will take, so the progress dialog listens to the scene and increment the progress anytime a node is added.
Reimplemented from qSlicerCoreIOManager.
|
inlineslot |
Definition at line 180 of file qSlicerIOManager.h.
|
inlineslot |
Definition at line 142 of file qSlicerIOManager.h.
|
inlineslot |
Definition at line 134 of file qSlicerIOManager.h.
|
inlineslot |
Definition at line 198 of file qSlicerIOManager.h.
|
inlineslot |
Definition at line 186 of file qSlicerIOManager.h.
|
inlineslot |
Definition at line 192 of file qSlicerIOManager.h.
|
inlineslot |
Definition at line 162 of file qSlicerIOManager.h.
|
inlineslot |
Definition at line 168 of file qSlicerIOManager.h.
|
slot |
|
inlineslot |
Definition at line 174 of file qSlicerIOManager.h.
|
inlineslot |
Definition at line 148 of file qSlicerIOManager.h.
|
inlineslot |
Definition at line 154 of file qSlicerIOManager.h.
Q_INVOKABLE bool qSlicerIOManager::openDialog | ( | qSlicerIO::IOFileType | fileType, |
qSlicerFileDialog::IOAction | action, | ||
qSlicerIO::IOProperties | ioProperties = qSlicerIO::IOProperties(), | ||
vtkCollection * | loadedNodes = nullptr ) |
Search for the most appropriate dialog based on the action and fileType, and open it. Once the user select the file(s), the action (read or write) is done. Note that to write a node, the "nodeID" property must be passed. If no dialog is registered for a given fileType (e.g. QString("SceneFile")), a default dialog (qSlicerStandardFileDialog) is used. If reading files (action == qSlicerFileDialog::Read) and if loadedNodes is not null, the loadedNodes collection is being populated with the loaded nodes. Returns true on success, false otherwise.
|
slot |
|
inlineslot |
Definition at line 204 of file qSlicerIOManager.h.
|
slot |
|
slot |
|
protected |
Returns the list of registered readers.
|
protected |
Returns the list of registered readers or writers associated with fileType.
void qSlicerIOManager::registerDialog | ( | qSlicerFileDialog * | dialog | ) |
Takes ownership. Any previously set dialog corresponding to the same fileType (only 1 dialog per filetype) is overridden.
void qSlicerIOManager::setFavorites | ( | const QList< QUrl > & | urls | ) |
|
static |
Helper function to display result of loadNodes. If success is set false then an error popup is displayed. If success is set to true then a popup is only displayed if error or warning messages are logged. If a popup is displayed then all the user-displayable messages are displayed in a collapsed "Details" section. The dialog is not displayed if the application is launched with testing mode enabled.
|
protectedslot |
|
friend |
Definition at line 123 of file qSlicerIOManager.h.
|
protected |
Definition at line 126 of file qSlicerIOManager.h.