Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
qSlicerFileReader Class Reference

#include <Base/QTCore/qSlicerFileReader.h>

Inheritance diagram for qSlicerFileReader:
Collaboration diagram for qSlicerFileReader:

Public Types

typedef qSlicerIO Superclass
 
- Public Types inherited from qSlicerIO
typedef QString IOFileType
 
typedef QVariantMap IOProperties
 
typedef QObject Superclass
 

Public Member Functions

virtual Q_INVOKABLE bool canLoadFile (const QString &file) const
 
virtual Q_INVOKABLE double canLoadFileConfidence (const QString &file) const
 
virtual Q_INVOKABLE bool examineFileInfoList (QFileInfoList &fileInfoList, QFileInfo &archetypeFileInfo, qSlicerIO::IOProperties &ioProperties) const
 
virtual Q_INVOKABLE QStringList extensions () const
 
virtual Q_INVOKABLE bool load (const IOProperties &properties)
 Properties available: fileMode, multipleFiles, fileType.
 
virtual Q_INVOKABLE QStringList loadedNodes () const
 
 qSlicerFileReader (QObject *parent=nullptr)
 
Q_INVOKABLE QStringList supportedNameFilters (const QString &fileName, int *longestExtensionMatchPtr=nullptr) const
 
 ~qSlicerFileReader () override
 
- Public Member Functions inherited from qSlicerIO
virtual Q_INVOKABLE QString description () const =0
 Unique name of the reader/writer.
 
virtual Q_INVOKABLE qSlicerIO::IOFileType fileType () const =0
 Multiple readers can share the same file type.
 
virtual Q_INVOKABLE qSlicerIOOptionsoptions () const
 
 qSlicerIO (QObject *parent=nullptr)
 
Q_INVOKABLE vtkMRMLMessageCollectionuserMessages () const
 Additional warning or error messages occurred during IO operation.
 
 ~qSlicerIO () override
 
- Public Member Functions inherited from qSlicerObject
vtkMRMLScenemrmlScene () const
 Return a pointer on the MRML scene.
 
 qSlicerObject ()
 
virtual void setMRMLScene (vtkMRMLScene *)
 Set the current MRML scene to the widget.
 
virtual ~qSlicerObject ()
 

Protected Member Functions

virtual void setLoadedNodes (const QStringList &nodes)
 

Protected Attributes

QScopedPointer< qSlicerFileReaderPrivate > d_ptr
 
- Protected Attributes inherited from qSlicerIO
QScopedPointer< qSlicerIOPrivate > d_ptr
 
- Protected Attributes inherited from qSlicerObject
QScopedPointer< qSlicerObjectPrivate > d_ptr
 

Detailed Description

Definition at line 34 of file qSlicerFileReader.h.

Member Typedef Documentation

◆ Superclass

Definition at line 39 of file qSlicerFileReader.h.

Constructor & Destructor Documentation

◆ qSlicerFileReader()

qSlicerFileReader::qSlicerFileReader ( QObject * parent = nullptr)
explicit

◆ ~qSlicerFileReader()

qSlicerFileReader::~qSlicerFileReader ( )
override

Member Function Documentation

◆ canLoadFile()

virtual Q_INVOKABLE bool qSlicerFileReader::canLoadFile ( const QString & file) const
virtual

Returns true if the reader can load this file. Default implementation is a simple and fast, it just checks if file extension matches any of the wildcards returned by extensions() method. This method is kept for backward compatibility, readers should override canLoadFileConfidence method instead of this method to indicate if they can read a file.

Reimplemented in qSlicerScriptedFileReader.

◆ canLoadFileConfidence()

virtual Q_INVOKABLE double qSlicerFileReader::canLoadFileConfidence ( const QString & file) const
virtual

Returns a positive number (>0) if the reader can load this file. The higher the returned value is the more confident the reader it is the most suitable class to load the file. By default, the method calls canLoadFile and if it returns true then the returned confidence value is 0.5 + 0.01 * matchedFileExtensionLength. The additional confidence for longer matched file extensions allow prioritization of more specific readers. For example, "*.seg.nrrd" is more specific than "*.nrrd"; "*.nrrd" is more specific than "*.*".

Reimplemented in qSlicerColorsReader, qSlicerMarkupsReader, qSlicerModelsReader, qSlicerScriptedFileReader, qSlicerSegmentationsReader, qSlicerSequencesReader, qSlicerTablesReader, qSlicerTerminologiesReader, qSlicerTransformsReader, and qSlicerVolumesReader.

◆ examineFileInfoList()

virtual Q_INVOKABLE bool qSlicerFileReader::examineFileInfoList ( QFileInfoList & fileInfoList,
QFileInfo & archetypeFileInfo,
qSlicerIO::IOProperties & ioProperties ) const
virtual

Implements the file list examination for the corresponding method in the core IO manager.

See also
qSlicerCoreIOManager

Reimplemented in qSlicerVolumesReader.

◆ extensions()

virtual Q_INVOKABLE QStringList qSlicerFileReader::extensions ( ) const
virtual

◆ load()

◆ loadedNodes()

virtual Q_INVOKABLE QStringList qSlicerFileReader::loadedNodes ( ) const
virtual

Return the list of generated nodes from loading the file(s) in load(). Empty list if load() failed

See also
setLoadedNodes(), load()

Reimplemented in qSlicerScriptedFileReader.

◆ setLoadedNodes()

virtual void qSlicerFileReader::setLoadedNodes ( const QStringList & nodes)
protectedvirtual

Must be called in load() on success with the list of nodes added into the scene.

Reimplemented in qSlicerScriptedFileReader.

◆ supportedNameFilters()

Q_INVOKABLE QStringList qSlicerFileReader::supportedNameFilters ( const QString & fileName,
int * longestExtensionMatchPtr = nullptr ) const

Return the matching name filters -> if the fileName is "my_image.nrrd" and the supported extensions are "Volumes (*.mha *.nrrd *.raw)", "Images (*.png" *.jpg")", "DICOM (*)" then it returns "Volumes (*.mha *.nrrd *.raw), DICOM (*)"

Parameters
longestExtensionMatchPtrIf non-zero then the method returns the length of the longest matched extension length in this argument. It can be used to determine how specifically extension matched.

Member Data Documentation

◆ d_ptr

QScopedPointer<qSlicerFileReaderPrivate> qSlicerFileReader::d_ptr
protected

Definition at line 94 of file qSlicerFileReader.h.


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