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


Classes | |
| struct | ListProgress |
| State of processing (loading or saving) a list of files. More... | |
Public Types | |
| enum | { HandlerRegisteredEvent = 24100 , HandlerUnregisteredEvent , NewFileLoadedEvent , FileSavedEvent , OperationStartEvent , OperationProgressEvent , OperationEndEvent } |
| typedef vtkObject | Superclass |
Public Member Functions | |
| void | AddDefaultStorageNodes () |
| vtkMRMLFileReader * | ExamineFileList (std::vector< std::string > &fileList, vtkMRMLIOProperties *ioProperties) |
| bool | ExportNodes (const std::vector< std::string > &nodeIDs, const std::vector< std::string > &fileNames, vtkMRMLIOProperties *commonProperties, bool hardenTransforms, vtkMRMLMessageCollection *userMessages=nullptr) |
| Export nodes, with the same properties for all nodes. | |
| bool | ExportNodes (vtkCollection *propertiesList, bool hardenTransforms, vtkMRMLMessageCollection *userMessages=nullptr) |
| std::string | ExtractKnownExtension (const std::string &fileName, vtkObject *object) |
| std::string | ForceFileNameMaxLength (const std::string &filename, int extensionLength, int maxLength=-1) |
| std::vector< std::string > | GetAllReadableFileExtensions () |
| All the readable file extensions for all registered types of storage nodes. Includes the leading dot. | |
| std::vector< std::string > | GetAllWritableFileExtensions () |
| File extensions and names. | |
| vtkMRMLApplicationLogic * | GetApplicationLogic () const |
| virtual const char * | GetClassName () |
| std::string | GetCompleteSlicerWritableFileNameSuffix (vtkMRMLStorableNode *node) |
| virtual int | GetDefaultMaximumFileNameLength () |
| std::string | GetDefaultSceneFileType () const |
| std::string | GetDescriptionForFileType (const std::string &fileType, bool writers) |
| What a file type is called ("Volume"), from the first handler that has a description. | |
| std::vector< std::string > | GetExtensionsForFileType (const std::string &fileType, bool writers) |
| The extensions of every reader (or writer) of a file type: ".mcs", ".mcs.gz". | |
| std::vector< std::string > | GetFileDescriptionsByType (const std::string &fileType) |
| Descriptions of all the readers of a file type. Usually there is only one reader for a file type. | |
| std::vector< std::string > | GetFileDescriptionsForFile (const std::string &filePath) |
| The descriptions ("Volume", "Segmentation", ...) of the readers that can read the file, most likely first. | |
| std::string | GetFileTypeForFile (const std::string &filePath) |
| The file type of the reader that is surest it can read this file ("VolumeFile"), or an empty string. | |
| std::string | GetFileTypeForObject (vtkObject *object) |
| Same as GetFileWriterFileType(object). | |
| std::string | GetFileTypeFromDescription (const std::string &description) |
| The file type of the reader that has the specified description, or an empty string. | |
| std::vector< std::string > | GetFileTypesForFile (const std::string &filePath) |
| All the file types that can be used for reading the file, most likely first. | |
| std::vector< std::string > | GetFileWriterDescriptions (const std::string &fileType) |
| Descriptions of all writers of a file type. | |
| std::vector< std::string > | GetFileWriterExtensions (vtkObject *object) |
| Name filters of all writers that can write the object, the most confident writer's first. | |
| std::string | GetFileWriterFileType (vtkObject *object, const std::string &format=std::string()) |
| The file type of the best file writer for this object, or an empty string. | |
| virtual double | GetMaximumProgressUpdatesPerSecond () |
| std::vector< std::string > | GetNameFiltersForFileType (const std::string &fileType, bool writers) |
| The name filters of every reader (or writer) of a file type: "Mimics project (*.mcs)". | |
| vtkMRMLFileReader * | GetNthReader (int index) const |
| vtkMRMLFileWriter * | GetNthWriter (int index) const |
| int | GetNumberOfReaders () const |
| What is registered. | |
| int | GetNumberOfWriters () const |
| vtkMRMLFileReader * | GetReaderByClassName (const std::string &className) const |
| Get a registered reader or writer by its class name (exact match). Returns nullptr if not found. | |
| vtkMRMLFileReader * | GetReaderByDescription (const std::string &description) |
| The reader that has the specified description, or nullptr. | |
| std::vector< std::string > | GetReaderFileTypes () |
| The file types that are registered, and what belongs to each of them. | |
| vtkMRMLFileReader * | GetReaderForFile (const std::string &filePath) |
| The reader that is surest it can read this file, or nullptr. | |
| std::vector< vtkSmartPointer< vtkMRMLFileReader > > | GetReadersForFile (const std::string &filePath) |
| Readers. | |
| std::vector< vtkSmartPointer< vtkMRMLFileReader > > | GetReadersForFileType (const std::string &fileType) |
| The readers of a file type, in the order they were registered. | |
| vtkMRMLScene * | GetScene () const |
| vtkMRMLFileWriter * | GetWriterByClassName (const std::string &className) const |
| std::vector< std::string > | GetWriterFileTypes () |
| vtkMRMLFileWriter * | GetWriterForObject (vtkObject *object, const std::string &format=std::string()) |
| std::vector< vtkSmartPointer< vtkMRMLFileWriter > > | GetWritersForFileType (const std::string &fileType) |
| The writers of a file type, in the order they were registered. | |
| std::vector< vtkSmartPointer< vtkMRMLFileWriter > > | GetWritersForObject (vtkObject *object) |
| Writers. | |
| void | InvokeFileSavedEvent (vtkMRMLIOProperties *savedFileProperties) |
| Invoke FileSavedEvent. It may be used by writers that save files without the manager. | |
| void | InvokeNewFileLoadedEvent (vtkMRMLIOProperties *loadedFileProperties) |
| Invoke NewFileLoadedEvent. It may be used by readers that load files without the manager. | |
| virtual int | IsA (const char *type) |
| bool | LoadFile (const std::string &fileName, vtkMRMLMessageCollection *userMessages=nullptr) |
| Load a file. All the options (e.g., file type) are chosen by default. | |
| virtual bool | LoadNodes (const std::string &fileType, vtkMRMLIOProperties *properties, vtkCollection *loadedNodes=nullptr, vtkMRMLMessageCollection *userMessages=nullptr) |
| Loading. | |
| vtkMRMLNode * | LoadNodesAndGetFirst (const std::string &fileType, vtkMRMLIOProperties *properties, vtkMRMLMessageCollection *userMessages=nullptr) |
| Load nodes and return the first loaded node. | |
| virtual bool | LoadNodesFromList (vtkCollection *propertiesList, vtkCollection *loadedNodes=nullptr, vtkMRMLMessageCollection *userMessages=nullptr) |
| bool | LoadScene (const std::string &fileName, bool clear=true, vtkMRMLMessageCollection *userMessages=nullptr) |
| Load or import a scene. | |
| void | PrintSelf (ostream &os, vtkIndent indent) override |
| void | RegisterHandler (vtkMRMLFileIOHandler *handler) |
| Add a reader or a writer (calls RegisterReader() or RegisterWriter(), depending on the type of the handler). | |
| vtkMRMLNodeWriter * | RegisterNodeWriter (const std::string &description, const std::string &fileType, const std::vector< std::string > &nodeClassNames, bool supportUseCompression=true) |
| void | RegisterReader (vtkMRMLFileReader *reader) |
| void | RegisterWriter (vtkMRMLFileWriter *writer) |
| bool | SaveNodes (const std::string &fileType, vtkMRMLIOProperties *properties, vtkMRMLMessageCollection *userMessages=nullptr, vtkMRMLScene *scene=nullptr) |
| Saving. | |
| bool | SaveScene (const std::string &fileName, vtkImageData *screenShot=nullptr, vtkMRMLMessageCollection *userMessages=nullptr) |
| void | SetApplicationLogic (vtkMRMLApplicationLogic *applicationLogic) |
| virtual void | SetDefaultMaximumFileNameLength (int) |
| void | SetDefaultSceneFileType (const std::string &fileType) |
| virtual void | SetMaximumProgressUpdatesPerSecond (double) |
| virtual void | SetScene (vtkMRMLScene *scene) |
| The scene the handlers read into and write from. | |
| std::string | StripKnownExtension (const std::string &fileName, vtkObject *object) |
| void | UnregisterHandler (vtkMRMLFileIOHandler *handler) |
| Remove a reader or a writer. Whoever registered a handler is responsible for unregistering it. | |
Static Public Member Functions | |
| static vtkMRMLStorageNode * | CreateAndAddDefaultStorageNode (vtkMRMLStorableNode *node) |
| Create and add default storage node. | |
| static std::string | ForceFileNameValidCharacters (const std::string &filename) |
| Remove characters that are likely to cause problems in a filename. | |
| static std::string | GetFileNameValidCharactersPattern () |
| static int | IsTypeOf (const char *type) |
| static vtkMRMLFileIOManager * | New () |
| static vtkMRMLFileIOManager * | SafeDownCast (vtkObject *o) |
Protected Member Functions | |
| bool | EndListItemProgress (ListProgress &listProgress, int fileIndex) |
| void | EndListProgress (ListProgress &listProgress, vtkMRMLMessageCollection *userMessages, const std::string &abortedMessageFormat) |
| void | EndOperationProgress (bool operationStarted, bool aborted=false) |
| bool | ExportNode (vtkMRMLIOProperties *properties, vtkMRMLScene *temporaryScene, bool hardenTransforms, vtkMRMLMessageCollection *userMessages) |
| std::vector< vtkSmartPointer< vtkMRMLFileWriter > > | GetWritersForFile (const std::string &fileType, vtkMRMLIOProperties *properties, vtkMRMLScene *scene) |
| void | InvokeProgressEvent (bool force=false) |
| void | ReportFileProgress (double fileProgress, const std::string &text=std::string()) |
| void | StartListItemProgress (ListProgress &listProgress, int fileIndex) |
| Report that processing of the file at fileIndex starts. | |
| ListProgress | StartListProgress (const std::string &title, int numberOfFiles) |
| bool | StartOperationProgress (const std::string &title, int numberOfFiles) |
| vtkMRMLFileIOManager () | |
| ~vtkMRMLFileIOManager () override | |
Static Protected Member Functions | |
| static void | OnSceneProgress (vtkObject *caller, unsigned long eid, void *clientData, void *callData) |
| Forwards scene import or save progress (percent) as file progress. | |
| template<typename HandlerType> | |
| static std::vector< vtkSmartPointer< HandlerType > > | SortedByConfidence (const std::vector< vtkSmartPointer< HandlerType > > &handlers, const std::vector< double > &confidences) |
Protected Attributes | |
| vtkWeakPointer< vtkMRMLApplicationLogic > | ApplicationLogic |
| int | DefaultMaximumFileNameLength { 1000 } |
| std::string | DefaultSceneFileType |
| double | LastProgressEventTime { 0.0 } |
| Time of the last invoked progress event (universal time in seconds) | |
| double | MaximumProgressUpdatesPerSecond { 3.0 } |
| vtkSmartPointer< vtkMRMLOperationProgress > | OperationProgress |
| Progress of the loading or saving operation that is in progress (nullptr if no operation is in progress) | |
| bool | ProgressEventPending { false } |
| True if progress changed since the last progress event. | |
| std::vector< vtkSmartPointer< vtkMRMLFileReader > > | Readers |
| vtkWeakPointer< vtkMRMLScene > | Scene |
| bool | SceneProgressObserved { false } |
| True while the scene is observed for reporting its import progress. | |
| std::vector< vtkSmartPointer< vtkMRMLFileWriter > > | Writers |
Manages reading and writing of files: keeps the list of registered readers and writers, chooses the reader or writer to use for a file or a node, and loads and saves nodes using them. The application logic owns the file IO manager of the application (vtkMRMLApplicationLogic::GetFileIOManager()).
See https://slicer.readthedocs.io/en/latest/developer_guide/mrml_overview.html#file-reading-and-writing
Definition at line 50 of file vtkMRMLFileIOManager.h.
| typedef vtkObject vtkMRMLFileIOManager::Superclass |
Definition at line 54 of file vtkMRMLFileIOManager.h.
| anonymous enum |
| Enumerator | |
|---|---|
| HandlerRegisteredEvent | A reader or writer is registered. Call data: the reader or writer (vtkMRMLFileIOHandler). |
| HandlerUnregisteredEvent | A reader or writer is unregistered. Call data: the reader or writer (vtkMRMLFileIOHandler). |
| NewFileLoadedEvent | A file is loaded. Call data: vtkMRMLIOProperties of the loaded file, which contains "fileType" and the IDs of the loaded nodes in "nodeIDs". |
| FileSavedEvent | A file is saved. Call data: vtkMRMLIOProperties of the saved file. |
| OperationStartEvent | Loading or saving of files is started. Call data: vtkMRMLOperationProgress. |
| OperationProgressEvent | Progress of loading or saving files changed. Call data: vtkMRMLOperationProgress. The number of these events per second is limited by MaximumProgressUpdatesPerSecond (except when processing of a new file starts). |
| OperationEndEvent | Loading or saving of files is completed. Call data: vtkMRMLOperationProgress. |
Definition at line 57 of file vtkMRMLFileIOManager.h.
|
protected |
|
overrideprotected |
| void vtkMRMLFileIOManager::AddDefaultStorageNodes | ( | ) |
Create default storage nodes for all storable nodes that are to be saved with the scene and do not have a storage node already.
|
static |
Create and add default storage node.
|
protected |
Report that processing of the file at fileIndex is completed. Returns true if processing of the list must be stopped, because the operation is aborted.
|
protected |
End processing of the list. If processing was aborted then a warning is added to userMessages (abortedMessageFormat contains %1 for the number of processed files and %2 for the number of files).
|
protected |
End the operation (invokes OperationEndEvent), if it was started by StartOperationProgress(). If the operation is not aborted then completion of the operation is reported.
| vtkMRMLFileReader * vtkMRMLFileIOManager::ExamineFileList | ( | std::vector< std::string > & | fileList, |
| vtkMRMLIOProperties * | ioProperties ) |
Iterates through readers looking at the file list 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 from the list and sets the ioProperties so that the corresponding loader will read these files. The "fileName" property is set to the archetype file. Returns the reader that recognized the files or nullptr if no pattern is recognized. If multiple readers recognize a group of files then the one with the highest confidence (see vtkMRMLFileReader::ExamineFileListConfidence) is used. 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. In Python, fileList must be a list (it is modified in place).
|
protected |
Export a single node to a file. Used by ExportNodes() to export each node of the list.
The node is copied into temporaryScene (with its display node and, if requested, with its parent transforms hardened) and saved from there, so that the storage nodes of the main scene are not modified.
| properties | Export options: "nodeID" (ID of the node in the main scene), "fileName", "fileFormat", and any other options that the writer uses. |
| temporaryScene | Scene that ExportNodes() created for exporting. It is shared by all nodes of the list. |
| hardenTransforms | If true, parent transforms of the node are applied to the exported data. |
| userMessages | Errors and warnings to display to the user are added to this collection (may be nullptr). |
| bool vtkMRMLFileIOManager::ExportNodes | ( | const std::vector< std::string > & | nodeIDs, |
| const std::vector< std::string > & | fileNames, | ||
| vtkMRMLIOProperties * | commonProperties, | ||
| bool | hardenTransforms, | ||
| vtkMRMLMessageCollection * | userMessages = nullptr ) |
Export nodes, with the same properties for all nodes.
| bool vtkMRMLFileIOManager::ExportNodes | ( | vtkCollection * | propertiesList, |
| bool | hardenTransforms, | ||
| vtkMRMLMessageCollection * | userMessages = nullptr ) |
Export nodes using the registered writers. Unlike SaveNodes(), this function creates a temporary scene while saving, in order to avoid modifying storage nodes in the current scene. Saving progress is reported (see SaveNodes()), each exported node counts as one file. Exporting of multiple nodes is abortable. Each item in propertiesList is a vtkMRMLIOProperties object that specifies a "nodeID" (ID of a node in the main scene), a "fileName" (an absolute file path), a "fileFormat" (e.g. "NRRD (.nrrd)"), and any other options that the associated writer may use. If hardenTransforms is true then transforms are temporarily hardened before export. If a node cannot be exported then the remaining nodes are still exported. Returns true if all nodes were exported successfully.
| std::string vtkMRMLFileIOManager::ExtractKnownExtension | ( | const std::string & | fileName, |
| vtkObject * | object ) |
If fileName ends with an extension that is associated with the object, then return that extension. Otherwise return an empty string. If there are multiple candidates (such as for "something.seg.nrrd" both ".nrrd" and ".seg.nrrd" extensions match) then the longest is returned.
| std::string vtkMRMLFileIOManager::ForceFileNameMaxLength | ( | const std::string & | filename, |
| int | extensionLength, | ||
| int | maxLength = -1 ) |
Clamp the length of a filename to a maximum number of characters. The length of the filename extension must also be specified so that it is not included in the shortened section. If the extension is not known then ExtractKnownExtension() method can be used to get the extension. If maxLength is negative, the default maximum length (DefaultMaximumFileNameLength) is used.
|
static |
Remove characters that are likely to cause problems in a filename.
| std::vector< std::string > vtkMRMLFileIOManager::GetAllReadableFileExtensions | ( | ) |
All the readable file extensions for all registered types of storage nodes. Includes the leading dot.
| std::vector< std::string > vtkMRMLFileIOManager::GetAllWritableFileExtensions | ( | ) |
File extensions and names.
All the writable file extensions for all registered types of storage nodes. Includes the leading dot.
| vtkMRMLApplicationLogic * vtkMRMLFileIOManager::GetApplicationLogic | ( | ) | const |
|
virtual |
| std::string vtkMRMLFileIOManager::GetCompleteSlicerWritableFileNameSuffix | ( | vtkMRMLStorableNode * | node | ) |
Returns a full extension for this storable node that is recognised by Slicer IO. Consults the storage node for a list of known suffixes. If no match is found then "." is returned. Always includes the leading dot.
|
virtual |
Default maximum length for a filename. It is used when maximum filename length is enforced by calling ForceFileNameMaxLength() without providing a specific maximum length value.
| std::string vtkMRMLFileIOManager::GetDefaultSceneFileType | ( | ) | const |
Defines the file format that should be offered by default when the scene is saved. Valid options are defined by the scene writer (for example, "MRML Scene (.mrml)" or "Medical Reality Bundle (.mrb)").
| std::string vtkMRMLFileIOManager::GetDescriptionForFileType | ( | const std::string & | fileType, |
| bool | writers ) |
What a file type is called ("Volume"), from the first handler that has a description.
| std::vector< std::string > vtkMRMLFileIOManager::GetExtensionsForFileType | ( | const std::string & | fileType, |
| bool | writers ) |
The extensions of every reader (or writer) of a file type: ".mcs", ".mcs.gz".
| std::vector< std::string > vtkMRMLFileIOManager::GetFileDescriptionsByType | ( | const std::string & | fileType | ) |
Descriptions of all the readers of a file type. Usually there is only one reader for a file type.
| std::vector< std::string > vtkMRMLFileIOManager::GetFileDescriptionsForFile | ( | const std::string & | filePath | ) |
The descriptions ("Volume", "Segmentation", ...) of the readers that can read the file, most likely first.
|
static |
Characters that are allowed in file names by ForceFileNameValidCharacters, as a regular expression character set.
| std::string vtkMRMLFileIOManager::GetFileTypeForFile | ( | const std::string & | filePath | ) |
The file type of the reader that is surest it can read this file ("VolumeFile"), or an empty string.
| std::string vtkMRMLFileIOManager::GetFileTypeForObject | ( | vtkObject * | object | ) |
Same as GetFileWriterFileType(object).
| std::string vtkMRMLFileIOManager::GetFileTypeFromDescription | ( | const std::string & | description | ) |
The file type of the reader that has the specified description, or an empty string.
| std::vector< std::string > vtkMRMLFileIOManager::GetFileTypesForFile | ( | const std::string & | filePath | ) |
All the file types that can be used for reading the file, most likely first.
| std::vector< std::string > vtkMRMLFileIOManager::GetFileWriterDescriptions | ( | const std::string & | fileType | ) |
Descriptions of all writers of a file type.
| std::vector< std::string > vtkMRMLFileIOManager::GetFileWriterExtensions | ( | vtkObject * | object | ) |
Name filters of all writers that can write the object, the most confident writer's first.
| std::string vtkMRMLFileIOManager::GetFileWriterFileType | ( | vtkObject * | object, |
| const std::string & | format = std::string() ) |
The file type of the best file writer for this object, or an empty string.
|
virtual |
Maximum number of progress events (OperationProgressEvent) per second while loading or saving files. Progress changes that would exceed this rate are reported in the next progress event. 0 means that every progress change is reported. Default: 3.
| std::vector< std::string > vtkMRMLFileIOManager::GetNameFiltersForFileType | ( | const std::string & | fileType, |
| bool | writers ) |
The name filters of every reader (or writer) of a file type: "Mimics project (*.mcs)".
| vtkMRMLFileReader * vtkMRMLFileIOManager::GetNthReader | ( | int | index | ) | const |
| vtkMRMLFileWriter * vtkMRMLFileIOManager::GetNthWriter | ( | int | index | ) | const |
| int vtkMRMLFileIOManager::GetNumberOfReaders | ( | ) | const |
What is registered.
| int vtkMRMLFileIOManager::GetNumberOfWriters | ( | ) | const |
| vtkMRMLFileReader * vtkMRMLFileIOManager::GetReaderByClassName | ( | const std::string & | className | ) | const |
Get a registered reader or writer by its class name (exact match). Returns nullptr if not found.
| vtkMRMLFileReader * vtkMRMLFileIOManager::GetReaderByDescription | ( | const std::string & | description | ) |
The reader that has the specified description, or nullptr.
| std::vector< std::string > vtkMRMLFileIOManager::GetReaderFileTypes | ( | ) |
The file types that are registered, and what belongs to each of them.
| vtkMRMLFileReader * vtkMRMLFileIOManager::GetReaderForFile | ( | const std::string & | filePath | ) |
The reader that is surest it can read this file, or nullptr.
| std::vector< vtkSmartPointer< vtkMRMLFileReader > > vtkMRMLFileIOManager::GetReadersForFile | ( | const std::string & | filePath | ) |
Readers.
The readers that can read this file, the one that is surest of itself first. Only readers that answer a confidence above zero are in the list.
| std::vector< vtkSmartPointer< vtkMRMLFileReader > > vtkMRMLFileIOManager::GetReadersForFileType | ( | const std::string & | fileType | ) |
The readers of a file type, in the order they were registered.
| vtkMRMLScene * vtkMRMLFileIOManager::GetScene | ( | ) | const |
| vtkMRMLFileWriter * vtkMRMLFileIOManager::GetWriterByClassName | ( | const std::string & | className | ) | const |
| std::vector< std::string > vtkMRMLFileIOManager::GetWriterFileTypes | ( | ) |
| vtkMRMLFileWriter * vtkMRMLFileIOManager::GetWriterForObject | ( | vtkObject * | object, |
| const std::string & | format = std::string() ) |
Return the best file writer for this object. Best match is the writer that supports the node type and the specific format (name filter, such as "NRRD (.nrrd)"), closest match is the writer that supports the node type but not that specific format. If there are multiple matches then the one with the highest confidence is returned. If format is empty then the writer with the highest confidence is returned.
|
protected |
Writers that can write the file, writers that match the file extension first and generic writers (that can write any file) last.
| std::vector< vtkSmartPointer< vtkMRMLFileWriter > > vtkMRMLFileIOManager::GetWritersForFileType | ( | const std::string & | fileType | ) |
The writers of a file type, in the order they were registered.
| std::vector< vtkSmartPointer< vtkMRMLFileWriter > > vtkMRMLFileIOManager::GetWritersForObject | ( | vtkObject * | object | ) |
Writers.
The writers that can write this node, the one that is surest of itself first.
| void vtkMRMLFileIOManager::InvokeFileSavedEvent | ( | vtkMRMLIOProperties * | savedFileProperties | ) |
Invoke FileSavedEvent. It may be used by writers that save files without the manager.
| void vtkMRMLFileIOManager::InvokeNewFileLoadedEvent | ( | vtkMRMLIOProperties * | loadedFileProperties | ) |
Invoke NewFileLoadedEvent. It may be used by readers that load files without the manager.
|
protected |
Invoke OperationProgressEvent with the current progress, unless the maximum update rate would be exceeded (then the event is invoked later). If force is true then the event is invoked regardless of the update rate.
|
virtual |
|
static |
| bool vtkMRMLFileIOManager::LoadFile | ( | const std::string & | fileName, |
| vtkMRMLMessageCollection * | userMessages = nullptr ) |
Load a file. All the options (e.g., file type) are chosen by default.
|
virtual |
Loading.
Load nodes using the readers of the file type. The properties must contain "fileName" (a string or a list of strings) and may contain more specific properties. For example, the volume reader can be called with the following parameters: "labelmap" (bool), "center" (bool). Nodes that are loaded are added to loadedNodes (if not nullptr). If a valid userMessages is passed then additional error or warning information is added to it. Returns false if loading fails.
Progress is reported by OperationStartEvent, OperationProgressEvent, and OperationEndEvent. A list of files is loaded as one operation, which can be aborted between files.
| vtkMRMLNode * vtkMRMLFileIOManager::LoadNodesAndGetFirst | ( | const std::string & | fileType, |
| vtkMRMLIOProperties * | properties, | ||
| vtkMRMLMessageCollection * | userMessages = nullptr ) |
Load nodes and return the first loaded node.
|
virtual |
Load a list of files. Each item in propertiesList is a vtkMRMLIOProperties object that specifies the "fileType" property in addition to the properties needed by the reader. Loading progress is reported (see LoadNodes()).
| bool vtkMRMLFileIOManager::LoadScene | ( | const std::string & | fileName, |
| bool | clear = true, | ||
| vtkMRMLMessageCollection * | userMessages = nullptr ) |
Load or import a scene.
|
static |
|
staticprotected |
Forwards scene import or save progress (percent) as file progress.
|
override |
| void vtkMRMLFileIOManager::RegisterHandler | ( | vtkMRMLFileIOHandler * | handler | ) |
Add a reader or a writer (calls RegisterReader() or RegisterWriter(), depending on the type of the handler).
| vtkMRMLNodeWriter * vtkMRMLFileIOManager::RegisterNodeWriter | ( | const std::string & | description, |
| const std::string & | fileType, | ||
| const std::vector< std::string > & | nodeClassNames, | ||
| bool | supportUseCompression = true ) |
Convenience method for creating and registering a vtkMRMLNodeWriter, which writes nodes of the specified classes using their storage nodes. Returns the registered writer.
| void vtkMRMLFileIOManager::RegisterReader | ( | vtkMRMLFileReader * | reader | ) |
Add a reader or a writer. The manager keeps a reference to it; registering the same object twice does nothing.
| void vtkMRMLFileIOManager::RegisterWriter | ( | vtkMRMLFileWriter * | writer | ) |
|
protected |
Report progress of processing (loading or saving) the current file (0.0-1.0; negative value if only the text changes) and optionally update the progress text.
|
static |
| bool vtkMRMLFileIOManager::SaveNodes | ( | const std::string & | fileType, |
| vtkMRMLIOProperties * | properties, | ||
| vtkMRMLMessageCollection * | userMessages = nullptr, | ||
| vtkMRMLScene * | scene = nullptr ) |
Saving.
Save nodes (or scene) using the registered writers. Progress is reported the same way as for loading (see LoadNodes()). Properties are typically: "fileName"; for nodes: "nodeID", "useCompression", "fileFormat". If a valid scene is passed then the writers use that scene instead of the scene of the manager. Returns true on success.
| bool vtkMRMLFileIOManager::SaveScene | ( | const std::string & | fileName, |
| vtkImageData * | screenShot = nullptr, | ||
| vtkMRMLMessageCollection * | userMessages = nullptr ) |
Save the scene. Equivalent to calling SaveNodes with "SceneFile" file type with the fileName and screenShot set as properties.
| void vtkMRMLFileIOManager::SetApplicationLogic | ( | vtkMRMLApplicationLogic * | applicationLogic | ) |
Application logic that owns this manager (not reference counted). Readers and writers may use it for accessing application-wide logic, such as the color logic.
|
virtual |
| void vtkMRMLFileIOManager::SetDefaultSceneFileType | ( | const std::string & | fileType | ) |
|
virtual |
|
virtual |
The scene the handlers read into and write from.
|
staticprotected |
Handlers with their confidence, highest first; ties keep the order of registration. Handlers with zero confidence are not included.
|
protected |
Report that processing of the file at fileIndex starts.
|
protected |
Start processing a list of files (starts an operation if no operation is in progress). Each file covers an equal part of the progress range of the list. If the operation is started by the list then the files of the list are the files of the operation (see vtkMRMLOperationProgress::GetNumberOfFiles()).
|
protected |
Start a loading or saving operation, if no operation is in progress (invokes OperationStartEvent). numberOfFiles is 0 if a single file is processed (progress of processing a file is only known if it is reported). Returns true if a new operation is started.
| std::string vtkMRMLFileIOManager::StripKnownExtension | ( | const std::string & | fileName, |
| vtkObject * | object ) |
If fileName ends with an extension that is associated with the object, then return a stripped version of fileName, where that extension has been chopped off. If the extension is duplicated in the tail of fileName, then all duplicates are stripped away.
| void vtkMRMLFileIOManager::UnregisterHandler | ( | vtkMRMLFileIOHandler * | handler | ) |
Remove a reader or a writer. Whoever registered a handler is responsible for unregistering it.
|
protected |
Definition at line 339 of file vtkMRMLFileIOManager.h.
|
protected |
Definition at line 344 of file vtkMRMLFileIOManager.h.
|
protected |
Definition at line 343 of file vtkMRMLFileIOManager.h.
|
protected |
Time of the last invoked progress event (universal time in seconds)
Definition at line 406 of file vtkMRMLFileIOManager.h.
|
protected |
Definition at line 404 of file vtkMRMLFileIOManager.h.
|
protected |
Progress of the loading or saving operation that is in progress (nullptr if no operation is in progress)
Definition at line 411 of file vtkMRMLFileIOManager.h.
|
protected |
True if progress changed since the last progress event.
Definition at line 408 of file vtkMRMLFileIOManager.h.
|
protected |
Definition at line 340 of file vtkMRMLFileIOManager.h.
|
protected |
Definition at line 338 of file vtkMRMLFileIOManager.h.
|
protected |
True while the scene is observed for reporting its import progress.
Definition at line 413 of file vtkMRMLFileIOManager.h.
|
protected |
Definition at line 341 of file vtkMRMLFileIOManager.h.