|
Slicer 5.13
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
|
#include <Libs/MRML/Logic/vtkMRMLFileReader.h>


Public Types | |
| typedef vtkMRMLFileIOHandler | Superclass |
Public Types inherited from vtkMRMLFileIOHandler | |
| typedef vtkObject | Superclass |
Public Member Functions | |
| void | AddLoadedNodeID (const std::string &nodeID) |
| virtual bool | CanLoadFile (const std::string &filePath) |
| virtual double | CanLoadFileConfidence (const std::string &filePath) |
| void | ClearLoadedNodeIDs () |
| virtual std::string | ExamineFileList (std::vector< std::string > &fileList, vtkMRMLIOProperties *ioProperties) |
| virtual double | ExamineFileListConfidence (std::vector< std::string > &fileList, vtkMRMLIOProperties *ioProperties) |
| virtual const char * | GetClassName () |
| virtual double | GetConfidenceForMatchingExtension () |
| const std::vector< std::string > & | GetLoadedNodeIDs () const |
| The nodes the last Load added, by node ID. | |
| std::vector< std::string > | GetSupportedNameFilters (const std::string &filePath) |
| std::vector< std::string > | GetSupportedNameFilters (const std::string &filePath, int &longestExtensionMatch) |
| virtual int | IsA (const char *type) |
| virtual bool | Load (vtkMRMLIOProperties *properties) |
| void | PrintSelf (ostream &os, vtkIndent indent) override |
| virtual void | SetConfidenceForMatchingExtension (double) |
| void | SetLoadedNodeIDs (const std::vector< std::string > &nodeIDs) |
Public Member Functions inherited from vtkMRMLFileIOHandler | |
| void | FillOptionsDescription (vtkMRMLIOProperties *properties, vtkMRMLIOOptionsDescription *description) |
| virtual std::string | GetDescription () |
| What to call this in a file dialog ("Volume", "Mimics project"). | |
| const std::vector< std::string > & | GetExtensions () const |
| vtkMRMLFileIOManager * | GetFileIOManager () const |
| virtual std::string | GetFileType () |
| virtual std::string | GetMatchedExtension (const std::string &filePath) const |
| The longest matching extension of filePath, or an empty string. | |
| const std::vector< std::string > & | GetNameFilters () const |
| vtkMRMLIOProperties * | GetOptionDefaults () |
| virtual void | GetOptionsDescription (vtkMRMLIOOptionsDescription *description) |
| std::string | GetOptionsDescriptionJSON (vtkMRMLIOProperties *properties) |
| void | GetOptionValues (vtkMRMLIOProperties *properties, vtkMRMLIOProperties *values) |
| vtkMRMLScene * | GetScene () const |
| vtkMRMLMessageCollection * | GetUserMessages () const |
| virtual bool | IsWriter () const |
| Whether this writes rather than reads. | |
| virtual bool | MatchesExtension (const std::string &filePath) const |
| void | PrintSelf (ostream &os, vtkIndent indent) override |
| virtual void | SetDescription (std::string) |
| void | SetFileIOManager (vtkMRMLFileIOManager *manager) |
| virtual void | SetFileType (std::string) |
| void | SetNameFilters (const std::vector< std::string > &filters) |
| The name filters, as Slicer writes them: "Mimics project (*.mcs *.mcs.gz)". | |
| virtual void | SetScene (vtkMRMLScene *scene) |
| Where the nodes go, and where messages for the user are collected. | |
Static Public Member Functions | |
| static int | IsTypeOf (const char *type) |
| static vtkMRMLFileReader * | New () |
| static vtkMRMLFileReader * | SafeDownCast (vtkObject *o) |
Static Public Member Functions inherited from vtkMRMLFileIOHandler | |
| static std::vector< std::string > | ExtensionsFromNameFilter (const std::string &nameFilter) |
| The extensions named by a filter such as "Mimics project (*.mcs *.mcs.gz)". | |
| static std::vector< std::string > | GetMatchingNameFilters (const std::string &filePath, const std::vector< std::string > &nameFilters, bool requireReadableFile, int *longestExtensionMatch=nullptr) |
| static int | IsTypeOf (const char *type) |
| static std::string | LongestMatchingExtension (const std::string &filePath, const std::vector< std::string > &extensions) |
| static std::vector< std::string > | NameFilterToWildcards (const std::string &nameFilter) |
| static vtkMRMLFileIOHandler * | New () |
| static vtkMRMLFileIOHandler * | SafeDownCast (vtkObject *o) |
| static bool | WildcardMatch (const std::string &pattern, const std::string &text) |
| Case-insensitive wildcard matching of the whole text. Supported wildcards: '*', '?', and character sets ("[abc]", "[!abc]"). | |
Protected Member Functions | |
| vtkMRMLFileReader () | |
| ~vtkMRMLFileReader () override | |
Protected Member Functions inherited from vtkMRMLFileIOHandler | |
| vtkMRMLFileIOHandler () | |
| ~vtkMRMLFileIOHandler () override | |
Static Protected Member Functions | |
| static bool | EndsWithNoCase (const std::string &text, const std::string &suffix) |
| Returns true if the string ends with the suffix (case-insensitive). | |
| static std::string | ReadFileHeader (const std::string &filePath, size_t maxLength) |
Protected Attributes | |
| double | ConfidenceForMatchingExtension { 0.5 } |
| std::vector< std::string > | LoadedNodeIDs |
Protected Attributes inherited from vtkMRMLFileIOHandler | |
| std::string | Description |
| std::vector< std::string > | Extensions |
| vtkWeakPointer< vtkMRMLFileIOManager > | FileIOManager |
| std::string | FileType |
| std::vector< std::string > | NameFilters |
| vtkNew< vtkMRMLIOProperties > | OptionDefaults |
| vtkWeakPointer< vtkMRMLScene > | Scene |
| vtkNew< vtkMRMLMessageCollection > | UserMessages |
Base class of file readers, which read files into the scene. Subclasses override Load() and, if the file extension is not enough to decide if the file can be loaded, CanLoadFileConfidence().
See https://slicer.readthedocs.io/en/latest/developer_guide/mrml_overview.html#the-reader
Definition at line 30 of file vtkMRMLFileReader.h.
Definition at line 34 of file vtkMRMLFileReader.h.
|
protected |
|
overrideprotected |
| void vtkMRMLFileReader::AddLoadedNodeID | ( | const std::string & | nodeID | ) |
|
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 name filters.
Reimplemented in vtkSlicerScriptedFileReaderBridge.
|
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 ConfidenceForMatchingExtension (0.5 by default)
Reimplemented in vtkSlicerColorsReader, vtkSlicerMarkupsReader, vtkSlicerModelsReader, vtkSlicerScriptedFileReaderBridge, vtkSlicerSegmentationsReader, vtkSlicerSequencesReader, vtkSlicerTablesReader, vtkSlicerTerminologiesReader, vtkSlicerTransformsReader, and vtkSlicerVolumesReader.
| void vtkMRMLFileReader::ClearLoadedNodeIDs | ( | ) |
|
staticprotected |
Returns true if the string ends with the suffix (case-insensitive).
|
virtual |
Examine the list of files to see if there is an entry that can serve as an archetype for loading multiple files. If so, the reader removes the recognized files (except the archetype) from the list, sets the ioProperties so that the reader will read these files, and returns the archetype file path. If no pattern is recognized then the method returns an empty string. The specific motivating use case is when the file list contains a set of related files, such as a list of image files that are recognized as a volume. This method is kept for backward compatibility, readers should override ExamineFileListConfidence() instead (similarly to CanLoadFile() and CanLoadFileConfidence()).
Reimplemented in vtkSlicerScriptedFileReaderBridge, and vtkSlicerVolumesReader.
|
virtual |
Examine the list of files to see if there is an entry that can serve as an archetype for loading multiple files. If so, the reader removes the recognized files (except the archetype) from the list, sets the ioProperties so that the reader will read these files (including the "fileName" property, which is set to the archetype file path), and returns the confidence (between 0.0 and 1.0) that the reader can load the group of files. If no pattern is recognized then the method returns 0.0. If multiple readers recognize a group of files then the file IO manager uses the one with the highest confidence. The default implementation calls ExamineFileList() and returns the confidence that the reader can load the archetype file (CanLoadFileConfidence).
Reimplemented in vtkSlicerScriptedFileReaderBridge.
|
virtual |
Reimplemented from vtkMRMLFileIOHandler.
Reimplemented in vtkMRMLSceneBundleReader, vtkSlicerAnnotationsReader, vtkSlicerColorsReader, vtkSlicerMarkupsReader, vtkSlicerModelsReader, vtkSlicerSceneReader, vtkSlicerScriptedFileReaderBridge, vtkSlicerSegmentationsReader, vtkSlicerSequencesReader, vtkSlicerShaderPropertyReader, vtkSlicerTablesReader, vtkSlicerTerminologiesReader, vtkSlicerTextsReader, vtkSlicerTransformsReader, vtkSlicerVolumeRenderingReader, and vtkSlicerVolumesReader.
|
virtual |
Confidence value returned by the default CanLoadFileConfidence implementation when the file matches one of the name filters. A small value is added for longer matched extensions.
| const std::vector< std::string > & vtkMRMLFileReader::GetLoadedNodeIDs | ( | ) | const |
The nodes the last Load added, by node ID.
| std::vector< std::string > vtkMRMLFileReader::GetSupportedNameFilters | ( | const std::string & | filePath | ) |
Return the name filters that match the file. For example, if the file name is "my_image.nrrd" and the supported name filters are "Volumes (*.mha *.nrrd *.raw)", "Images (*.png *.jpg)", "DICOM (*)" then it returns "Volumes (*.mha *.nrrd *.raw)" and "DICOM (*)". No name filters are returned if the file is not a readable file.
| std::vector< std::string > vtkMRMLFileReader::GetSupportedNameFilters | ( | const std::string & | filePath, |
| int & | longestExtensionMatch ) |
Same as GetSupportedNameFilters(filePath) but it also returns the length of the longest matched extension in longestExtensionMatch (it can be used to determine how specifically extension matched).
|
virtual |
Reimplemented from vtkMRMLFileIOHandler.
Reimplemented in vtkMRMLSceneBundleReader, vtkSlicerAnnotationsReader, vtkSlicerColorsReader, vtkSlicerMarkupsReader, vtkSlicerModelsReader, vtkSlicerSceneReader, vtkSlicerScriptedFileReaderBridge, vtkSlicerSegmentationsReader, vtkSlicerSequencesReader, vtkSlicerShaderPropertyReader, vtkSlicerTablesReader, vtkSlicerTerminologiesReader, vtkSlicerTextsReader, vtkSlicerTransformsReader, vtkSlicerVolumeRenderingReader, and vtkSlicerVolumesReader.
|
static |
|
virtual |
Read the file specified by the "fileName" property into the scene. Loaded nodes are reported by AddLoadedNodeID(). Returns true on success. The base class reads nothing and returns false.
Reimplemented in vtkMRMLSceneBundleReader, vtkSlicerAnnotationsReader, vtkSlicerColorsReader, vtkSlicerMarkupsReader, vtkSlicerModelsReader, vtkSlicerSceneReader, vtkSlicerScriptedFileReaderBridge, vtkSlicerSegmentationsReader, vtkSlicerSequencesReader, vtkSlicerShaderPropertyReader, vtkSlicerTablesReader, vtkSlicerTerminologiesReader, vtkSlicerTextsReader, vtkSlicerTransformsReader, vtkSlicerVolumeRenderingReader, and vtkSlicerVolumesReader.
|
static |
|
override |
|
staticprotected |
Read the first maxLength characters of a text file (to inspect a file header). Returns empty string if the file cannot be read.
|
static |
|
virtual |
| void vtkMRMLFileReader::SetLoadedNodeIDs | ( | const std::vector< std::string > & | nodeIDs | ) |
|
protected |
Definition at line 109 of file vtkMRMLFileReader.h.
|
protected |
Definition at line 110 of file vtkMRMLFileReader.h.