Slicer 5.13
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
qSlicerIOManager Class Reference

#include <Base/QTGUI/qSlicerIOManager.h>

Inheritance diagram for qSlicerIOManager:
Collaboration diagram for qSlicerIOManager:

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

Q_INVOKABLE void addHistory (const QString &path)
 
void dragEnterEvent (QDragEnterEvent *event)
 
void dropEvent (QDropEvent *event)
 
Q_INVOKABLE QList< QUrl > favorites () const
 
qSlicerIOOptionsWidget * fileOptionsWidget (const QString &fileDescription, QWidget *parent=nullptr) const
 
qSlicerIOOptionsWidget * fileWriterOptionsWidget (vtkObject *object, const QString &extension=QString(), QWidget *parent=nullptr) const
 
Q_INVOKABLE QStringList history () const
 
Q_INVOKABLE bool isDialogRegistered (qSlicerIO::IOFileType fileType, qSlicerFileDialog::IOAction action) const
 
Q_INVOKABLE 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 &parameters, 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)
 
Q_INVOKABLE void registerDialog (qSlicerFileDialog *dialog)
 
Q_INVOKABLE void setFavorites (const QList< QUrl > &urls)
 
 ~qSlicerIOManager () override
 
- Public Member Functions inherited from qSlicerCoreIOManager
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 > &parameterMaps, 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
 
Q_INVOKABLE QStringList fileDescriptionsByType (const qSlicerIO::IOFileType fileType) const
 
Q_INVOKABLE vtkMRMLFileIOManager * fileIOManager () const
 
qSlicerIOOptions * fileOptions (const QString &fileDescription) const
 
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
 
Q_INVOKABLE QString forceFileNameMaxLength (const QString &filename, int extensionLength, int maxLength=-1)
 
Q_INVOKABLE bool loadFile (const QString &fileName, vtkMRMLMessageCollection *userMessages=nullptr)
 
Q_INVOKABLE vtkMRMLNode * loadNodesAndGetFirst (qSlicerIO::IOFileType fileType, const qSlicerIO::IOProperties &parameters, vtkMRMLMessageCollection *userMessages=nullptr)
 
Q_INVOKABLE bool loadScene (const QString &fileName, bool clear=true, vtkMRMLMessageCollection *userMessages=nullptr)
 
 qSlicerCoreIOManager (QObject *parent=nullptr)
 
Q_INVOKABLE void registerIO (qSlicerIO *io)
 
Q_INVOKABLE bool saveNodes (qSlicerIO::IOFileType fileType, const qSlicerIO::IOProperties &parameters, 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)
 
Q_INVOKABLE 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
 
Q_INVOKABLE QList< qSlicerFileReader * > readers () const
 Returns the list of registered readers.
 
Q_INVOKABLE QList< qSlicerFileWriter * > writers () const
 Returns the list of registered writers.
 
Q_INVOKABLE QList< qSlicerFileWriter * > writers (const qSlicerIO::IOFileType &fileType) const
 Returns the list of registered writers for a given fileType.
 
Q_INVOKABLE QList< qSlicerFileReader * > readers (const qSlicerIO::IOFileType &fileType) const
 Returns the list of registered readers or writers associated with fileType.
 
Q_INVOKABLE qSlicerFileReader * reader (const QString &ioDescription) const
 Returns the reader that has the specified description (such as "Volume")
 

Static Public Member Functions

static Q_INVOKABLE void showLoadNodesResultDialog (bool success, vtkMRMLMessageCollection *userMessages)
 
- Static Public Member Functions inherited from qSlicerCoreIOManager
static Q_INVOKABLE QRegularExpression fileNameRegularExpression (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 ()
 

Protected Member Functions

qSlicerIOOptions * createGenericOptions (vtkMRMLFileIOHandler *ioHandler) const override
 Create a qSlicerGenericIOOptionsWidget if the reader or writer describes its options.
 
void endProgress (vtkMRMLOperationProgress *progress) override
 
void startProgress (vtkMRMLOperationProgress *progress) override
 Show, update, and hide the progress dialog.
 
void updateProgress (vtkMRMLOperationProgress *progress) override
 

Protected Attributes

QScopedPointer< qSlicerIOManagerPrivate > d_ptr
 
QScopedPointer< qSlicerCoreIOManagerPrivate > d_ptr
 

Friends

class qSlicerFileDialog
 

Additional Inherited Members

- Properties inherited from qSlicerCoreIOManager
int defaultMaximumFileNameLength
 
QString defaultSceneFileType
 
void newFileLoaded (const qSlicerIO::IOProperties &loadedFileParameters)
 
void fileSaved (const qSlicerIO::IOProperties &savedFileParameters)
 

Detailed Description

Definition at line 27 of file qSlicerIOManager.h.

Member Typedef Documentation

◆ Superclass

Constructor & Destructor Documentation

◆ qSlicerIOManager()

qSlicerIOManager::qSlicerIOManager ( QObject * parent = nullptr)

◆ ~qSlicerIOManager()

qSlicerIOManager::~qSlicerIOManager ( )
override

Member Function Documentation

◆ addHistory()

Q_INVOKABLE void qSlicerIOManager::addHistory ( const QString & path)

◆ createGenericOptions()

qSlicerIOOptions * qSlicerIOManager::createGenericOptions ( vtkMRMLFileIOHandler * ioHandler) const
overrideprotectedvirtual

Create a qSlicerGenericIOOptionsWidget if the reader or writer describes its options.

Reimplemented from qSlicerCoreIOManager.

◆ dragEnterEvent()

void qSlicerIOManager::dragEnterEvent ( QDragEnterEvent * event)

dragEnterEvents can be forwarded to the IOManager, if a registered dialog supports it, the event is accepted, otherwise ignored.

See also
dropEvent()

◆ dropEvent()

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.

See also
dragEnterEvent()

◆ endProgress()

void qSlicerIOManager::endProgress ( vtkMRMLOperationProgress * progress)
overrideprotectedvirtual

Reimplemented from qSlicerCoreIOManager.

◆ execDelayedFileDialog

void qSlicerIOManager::execDelayedFileDialog ( )
protectedslot

◆ favorites()

Q_INVOKABLE QList< QUrl > qSlicerIOManager::favorites ( ) const

◆ fileOptionsWidget()

qSlicerIOOptionsWidget * qSlicerIOManager::fileOptionsWidget ( const QString & fileDescription,
QWidget * parent = nullptr ) const

Return the options widget of the reader that has the specified description (such as "Volume"). Returns nullptr if the reader does not have options. If parent is specified then the widget is owned by the parent, otherwise the caller takes ownership of the returned widget. In Python, the returned widget is deleted when it is no longer referenced (unless it has a parent), see qSlicerBaseQTGUIPythonQtDecorators.

See also
qSlicerCoreIOManager::fileOptions()

◆ fileWriterOptionsWidget()

qSlicerIOOptionsWidget * qSlicerIOManager::fileWriterOptionsWidget ( vtkObject * object,
const QString & extension = QString(),
QWidget * parent = nullptr ) const

Return the options widget of the best file writer for the input VTK object. Returns nullptr if the writer does not have options. If parent is specified then the widget is owned by the parent, otherwise the caller takes ownership of the returned widget. In Python, the returned widget is deleted when it is no longer referenced (unless it has a parent), see qSlicerBaseQTGUIPythonQtDecorators.

See also
qSlicerCoreIOManager::fileWriterOptions()

◆ history()

Q_INVOKABLE QStringList qSlicerIOManager::history ( ) const

◆ isDialogRegistered()

Q_INVOKABLE bool qSlicerIOManager::isDialogRegistered ( qSlicerIO::IOFileType fileType,
qSlicerFileDialog::IOAction action ) const

Return True if a custom file dialog was registered.

See also
registerDialog()
qSlicerScriptedLoadableModule::registerFileDialog()
qSlicerScriptedFileDialog

◆ loadNodes() [1/2]

Q_INVOKABLE bool qSlicerIOManager::loadNodes ( const QList< qSlicerIO::IOProperties > & files,
vtkCollection * loadedNodes = nullptr,
vtkMRMLMessageCollection * userMessages = nullptr )
overridevirtual

Load a list of files. Rendering is paused while loading. The files are loaded as a single operation, so a single progress dialog is displayed for the whole list.

Reimplemented from qSlicerCoreIOManager.

◆ loadNodes() [2/2]

Q_INVOKABLE bool qSlicerIOManager::loadNodes ( const qSlicerIO::IOFileType & fileType,
const qSlicerIO::IOProperties & parameters,
vtkCollection * loadedNodes = nullptr,
vtkMRMLMessageCollection * userMessages = nullptr )
overridevirtual

Load a file. Rendering is paused while loading. A progress dialog is displayed if loading takes long (see startProgress()).

Reimplemented from qSlicerCoreIOManager.

◆ openAddColorTableDialog

bool qSlicerIOManager::openAddColorTableDialog ( )
inlineslot

Definition at line 203 of file qSlicerIOManager.h.

◆ openAddDataDialog [1/2]

bool qSlicerIOManager::openAddDataDialog ( )
inlineslot

Definition at line 165 of file qSlicerIOManager.h.

◆ openAddDataDialog [2/2]

bool qSlicerIOManager::openAddDataDialog ( QString fileName)
inlineslot

Definition at line 157 of file qSlicerIOManager.h.

◆ openAddFiberBundleDialog

bool qSlicerIOManager::openAddFiberBundleDialog ( )
inlineslot

Definition at line 221 of file qSlicerIOManager.h.

◆ openAddFiducialDialog

bool qSlicerIOManager::openAddFiducialDialog ( )
inlineslot

Definition at line 209 of file qSlicerIOManager.h.

◆ openAddMarkupsDialog

bool qSlicerIOManager::openAddMarkupsDialog ( )
inlineslot

Definition at line 215 of file qSlicerIOManager.h.

◆ openAddModelDialog

bool qSlicerIOManager::openAddModelDialog ( )
inlineslot

Definition at line 185 of file qSlicerIOManager.h.

◆ openAddScalarOverlayDialog

bool qSlicerIOManager::openAddScalarOverlayDialog ( )
inlineslot

Definition at line 191 of file qSlicerIOManager.h.

◆ openAddSceneDialog

bool qSlicerIOManager::openAddSceneDialog ( )
slot

◆ openAddTransformDialog

bool qSlicerIOManager::openAddTransformDialog ( )
inlineslot

Definition at line 197 of file qSlicerIOManager.h.

◆ openAddVolumeDialog

bool qSlicerIOManager::openAddVolumeDialog ( )
inlineslot

Definition at line 171 of file qSlicerIOManager.h.

◆ openAddVolumesDialog

bool qSlicerIOManager::openAddVolumesDialog ( )
inlineslot

Definition at line 177 of file qSlicerIOManager.h.

◆ openDialog()

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.

◆ openLoadSceneDialog

bool qSlicerIOManager::openLoadSceneDialog ( )
slot

◆ openSaveDataDialog

bool qSlicerIOManager::openSaveDataDialog ( )
inlineslot

Definition at line 227 of file qSlicerIOManager.h.

◆ openSceneViewsDialog

void qSlicerIOManager::openSceneViewsDialog ( )
slot

◆ openScreenshotDialog

void qSlicerIOManager::openScreenshotDialog ( )
slot

◆ registerDialog()

Q_INVOKABLE void qSlicerIOManager::registerDialog ( qSlicerFileDialog * dialog)

Takes ownership. Any previously set dialog corresponding to the same fileType (only 1 dialog per filetype) is overridden.

◆ setFavorites()

Q_INVOKABLE void qSlicerIOManager::setFavorites ( const QList< QUrl > & urls)

◆ showLoadNodesResultDialog()

static Q_INVOKABLE void qSlicerIOManager::showLoadNodesResultDialog ( bool success,
vtkMRMLMessageCollection * userMessages )
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.

◆ startProgress()

void qSlicerIOManager::startProgress ( vtkMRMLOperationProgress * progress)
overrideprotectedvirtual

Show, update, and hide the progress dialog.

Reimplemented from qSlicerCoreIOManager.

◆ updateProgress()

void qSlicerIOManager::updateProgress ( vtkMRMLOperationProgress * progress)
overrideprotectedvirtual

Reimplemented from qSlicerCoreIOManager.

Friends And Related Symbol Documentation

◆ qSlicerFileDialog

friend class qSlicerFileDialog
friend

Definition at line 146 of file qSlicerIOManager.h.

Member Data Documentation

◆ d_ptr

QScopedPointer<qSlicerIOManagerPrivate> qSlicerIOManager::d_ptr
protected

Definition at line 149 of file qSlicerIOManager.h.


The documentation for this class was generated from the following file: