Slicer 5.13
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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 vtkMRMLFileIOHandler * ioHandler () const
 
virtual Q_INVOKABLE qSlicerIOOptions * options () const
 
 qSlicerIO (QObject *parent=nullptr)
 
void setMRMLScene (vtkMRMLScene *scene) override
 Set the scene of this object.
 
virtual Q_INVOKABLE vtkMRMLMessageCollection * userMessages () const
 Additional warning or error messages occurred during IO operation.
 
 ~qSlicerIO () override
 
- Public Member Functions inherited from qSlicerObject
vtkMRMLScene * mrmlScene () const
 Return a pointer on the MRML scene.
 
 qSlicerObject ()
 
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
 

Additional Inherited Members

- Static Public Member Functions inherited from qSlicerIO
static IOProperties fromVTKProperties (vtkMRMLIOProperties *vtkProperties)
 
static bool qImageToVTKImageData (const QImage &image, vtkImageData *imageData)
 Convert Qt image to VTK image (RGBA, unsigned char).
 
static void toVTKProperties (const IOProperties &properties, vtkMRMLIOProperties *vtkProperties)
 
static QImage vtkImageDataToQImage (vtkImageData *imageData)
 Convert VTK image (unsigned char, 1, 3, or 4 components) to Qt image.
 

Detailed Description

Base class of legacy Qt-based file readers.

Deprecated
File readers are implemented as vtkMRMLFileReader subclasses. This class is kept for backward compatibility and to provide Qt options widgets (see options()). See https://slicer.readthedocs.io/en/latest/developer_guide/mrml_overview.html#qt-interface

Definition at line 40 of file qSlicerFileReader.h.

Member Typedef Documentation

◆ Superclass

Definition at line 44 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 qSlicerVTKFileReader.

◆ 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 qSlicerVTKFileReader.

◆ 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 qSlicerVTKFileReader.

◆ extensions()

virtual Q_INVOKABLE QStringList qSlicerFileReader::extensions ( ) const
virtual

Return a list of the supported extensions. Please read QFileDialog::nameFilters for the allowed formats Example: "Image (*.jpg *.png *.tiff)", "Model (*.vtk)"

Reimplemented in qSlicerVTKFileReader.

◆ load()

virtual Q_INVOKABLE bool qSlicerFileReader::load ( const IOProperties & properties)
virtual

Properties available: fileMode, multipleFiles, fileType.

Reimplemented in qSlicerVTKFileReader.

◆ 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 qSlicerVTKFileReader.

◆ 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 qSlicerVTKFileReader.

◆ 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 99 of file qSlicerFileReader.h.


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