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

#include <Libs/MRML/Logic/vtkMRMLFileIOManager.h>

Inheritance diagram for vtkMRMLFileIOManager:
Collaboration diagram for vtkMRMLFileIOManager:

Public Types

enum  { HandlerRegisteredEvent = 24100 , HandlerUnregisteredEvent , NewFileLoadedEvent , FileSavedEvent }
 
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.
 
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)
 
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 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

std::vector< vtkSmartPointer< vtkMRMLFileWriter > > GetWritersForFile (const std::string &fileType, vtkMRMLIOProperties *properties, vtkMRMLScene *scene)
 
 vtkMRMLFileIOManager ()
 
 ~vtkMRMLFileIOManager () override
 

Static Protected Member Functions

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
 
std::vector< vtkSmartPointer< vtkMRMLFileReader > > Readers
 
vtkWeakPointer< vtkMRMLScene > Scene
 
std::vector< vtkSmartPointer< vtkMRMLFileWriter > > Writers
 

Detailed Description

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 49 of file vtkMRMLFileIOManager.h.

Member Typedef Documentation

◆ Superclass

Definition at line 53 of file vtkMRMLFileIOManager.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Events. Call data: the reader or writer (HandlerRegisteredEvent, HandlerUnregisteredEvent), the vtkMRMLIOProperties of the loaded or saved file (NewFileLoadedEvent, FileSavedEvent; for loaded files it contains "fileType" and the IDs of the loaded nodes in "nodeIDs").

Enumerator
HandlerRegisteredEvent 
HandlerUnregisteredEvent 
NewFileLoadedEvent 
FileSavedEvent 

Definition at line 59 of file vtkMRMLFileIOManager.h.

Constructor & Destructor Documentation

◆ vtkMRMLFileIOManager()

vtkMRMLFileIOManager::vtkMRMLFileIOManager ( )
protected

◆ ~vtkMRMLFileIOManager()

vtkMRMLFileIOManager::~vtkMRMLFileIOManager ( )
overrideprotected

Member Function Documentation

◆ AddDefaultStorageNodes()

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.

◆ CreateAndAddDefaultStorageNode()

static vtkMRMLStorageNode * vtkMRMLFileIOManager::CreateAndAddDefaultStorageNode ( vtkMRMLStorableNode * node)
static

Create and add default storage node.

◆ ExamineFileList()

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).

◆ ExportNodes() [1/2]

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.

◆ ExportNodes() [2/2]

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

◆ ExtractKnownExtension()

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.

◆ ForceFileNameMaxLength()

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.

◆ ForceFileNameValidCharacters()

static std::string vtkMRMLFileIOManager::ForceFileNameValidCharacters ( const std::string & filename)
static

Remove characters that are likely to cause problems in a filename.

◆ GetAllReadableFileExtensions()

std::vector< std::string > vtkMRMLFileIOManager::GetAllReadableFileExtensions ( )

All the readable file extensions for all registered types of storage nodes. Includes the leading dot.

◆ GetAllWritableFileExtensions()

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.

◆ GetApplicationLogic()

vtkMRMLApplicationLogic * vtkMRMLFileIOManager::GetApplicationLogic ( ) const

◆ GetClassName()

virtual const char * vtkMRMLFileIOManager::GetClassName ( )
virtual

◆ GetCompleteSlicerWritableFileNameSuffix()

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.

◆ GetDefaultMaximumFileNameLength()

virtual int vtkMRMLFileIOManager::GetDefaultMaximumFileNameLength ( )
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.

◆ GetDefaultSceneFileType()

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)").

◆ GetDescriptionForFileType()

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.

◆ GetExtensionsForFileType()

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".

◆ GetFileDescriptionsByType()

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.

◆ GetFileDescriptionsForFile()

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.

◆ GetFileNameValidCharactersPattern()

static std::string vtkMRMLFileIOManager::GetFileNameValidCharactersPattern ( )
static

Characters that are allowed in file names by ForceFileNameValidCharacters, as a regular expression character set.

◆ GetFileTypeForFile()

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.

◆ GetFileTypeForObject()

std::string vtkMRMLFileIOManager::GetFileTypeForObject ( vtkObject * object)

Same as GetFileWriterFileType(object).

◆ GetFileTypeFromDescription()

std::string vtkMRMLFileIOManager::GetFileTypeFromDescription ( const std::string & description)

The file type of the reader that has the specified description, or an empty string.

◆ GetFileTypesForFile()

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.

◆ GetFileWriterDescriptions()

std::vector< std::string > vtkMRMLFileIOManager::GetFileWriterDescriptions ( const std::string & fileType)

Descriptions of all writers of a file type.

◆ GetFileWriterExtensions()

std::vector< std::string > vtkMRMLFileIOManager::GetFileWriterExtensions ( vtkObject * object)

Name filters of all writers that can write the object, the most confident writer's first.

◆ GetFileWriterFileType()

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.

◆ GetNameFiltersForFileType()

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)".

◆ GetNthReader()

vtkMRMLFileReader * vtkMRMLFileIOManager::GetNthReader ( int index) const

◆ GetNthWriter()

vtkMRMLFileWriter * vtkMRMLFileIOManager::GetNthWriter ( int index) const

◆ GetNumberOfReaders()

int vtkMRMLFileIOManager::GetNumberOfReaders ( ) const

What is registered.

◆ GetNumberOfWriters()

int vtkMRMLFileIOManager::GetNumberOfWriters ( ) const

◆ GetReaderByClassName()

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.

◆ GetReaderByDescription()

vtkMRMLFileReader * vtkMRMLFileIOManager::GetReaderByDescription ( const std::string & description)

The reader that has the specified description, or nullptr.

◆ GetReaderFileTypes()

std::vector< std::string > vtkMRMLFileIOManager::GetReaderFileTypes ( )

The file types that are registered, and what belongs to each of them.

◆ GetReaderForFile()

vtkMRMLFileReader * vtkMRMLFileIOManager::GetReaderForFile ( const std::string & filePath)

The reader that is surest it can read this file, or nullptr.

◆ GetReadersForFile()

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.

◆ GetReadersForFileType()

std::vector< vtkSmartPointer< vtkMRMLFileReader > > vtkMRMLFileIOManager::GetReadersForFileType ( const std::string & fileType)

The readers of a file type, in the order they were registered.

◆ GetScene()

vtkMRMLScene * vtkMRMLFileIOManager::GetScene ( ) const

◆ GetWriterByClassName()

vtkMRMLFileWriter * vtkMRMLFileIOManager::GetWriterByClassName ( const std::string & className) const

◆ GetWriterFileTypes()

std::vector< std::string > vtkMRMLFileIOManager::GetWriterFileTypes ( )

◆ GetWriterForObject()

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.

◆ GetWritersForFile()

std::vector< vtkSmartPointer< vtkMRMLFileWriter > > vtkMRMLFileIOManager::GetWritersForFile ( const std::string & fileType,
vtkMRMLIOProperties * properties,
vtkMRMLScene * scene )
protected

Writers that can write the file, writers that match the file extension first and generic writers (that can write any file) last.

◆ GetWritersForFileType()

std::vector< vtkSmartPointer< vtkMRMLFileWriter > > vtkMRMLFileIOManager::GetWritersForFileType ( const std::string & fileType)

The writers of a file type, in the order they were registered.

◆ GetWritersForObject()

std::vector< vtkSmartPointer< vtkMRMLFileWriter > > vtkMRMLFileIOManager::GetWritersForObject ( vtkObject * object)

Writers.

The writers that can write this node, the one that is surest of itself first.

◆ InvokeFileSavedEvent()

void vtkMRMLFileIOManager::InvokeFileSavedEvent ( vtkMRMLIOProperties * savedFileProperties)

Invoke FileSavedEvent. It may be used by writers that save files without the manager.

◆ InvokeNewFileLoadedEvent()

void vtkMRMLFileIOManager::InvokeNewFileLoadedEvent ( vtkMRMLIOProperties * loadedFileProperties)

Invoke NewFileLoadedEvent. It may be used by readers that load files without the manager.

◆ IsA()

virtual int vtkMRMLFileIOManager::IsA ( const char * type)
virtual

◆ IsTypeOf()

static int vtkMRMLFileIOManager::IsTypeOf ( const char * type)
static

◆ LoadFile()

bool vtkMRMLFileIOManager::LoadFile ( const std::string & fileName,
vtkMRMLMessageCollection * userMessages = nullptr )

Load a file. All the options (e.g., file type) are chosen by default.

◆ LoadNodes()

virtual bool vtkMRMLFileIOManager::LoadNodes ( const std::string & fileType,
vtkMRMLIOProperties * properties,
vtkCollection * loadedNodes = nullptr,
vtkMRMLMessageCollection * userMessages = nullptr )
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.

◆ LoadNodesAndGetFirst()

vtkMRMLNode * vtkMRMLFileIOManager::LoadNodesAndGetFirst ( const std::string & fileType,
vtkMRMLIOProperties * properties,
vtkMRMLMessageCollection * userMessages = nullptr )

Load nodes and return the first loaded node.

◆ LoadNodesFromList()

virtual bool vtkMRMLFileIOManager::LoadNodesFromList ( vtkCollection * propertiesList,
vtkCollection * loadedNodes = nullptr,
vtkMRMLMessageCollection * userMessages = nullptr )
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.

◆ LoadScene()

bool vtkMRMLFileIOManager::LoadScene ( const std::string & fileName,
bool clear = true,
vtkMRMLMessageCollection * userMessages = nullptr )

Load or import a scene.

◆ New()

static vtkMRMLFileIOManager * vtkMRMLFileIOManager::New ( )
static

◆ PrintSelf()

void vtkMRMLFileIOManager::PrintSelf ( ostream & os,
vtkIndent indent )
override

◆ RegisterHandler()

void vtkMRMLFileIOManager::RegisterHandler ( vtkMRMLFileIOHandler * handler)

Add a reader or a writer (calls RegisterReader() or RegisterWriter(), depending on the type of the handler). It is not named Register(), because that would hide vtkObjectBase::Register() in C++ and it would be called instead of this method in Python (which would increment the reference count of the manager).

◆ RegisterNodeWriter()

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.

See also
vtkMRMLNodeWriter::CreateNodeWriter()

◆ RegisterReader()

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.

◆ RegisterWriter()

void vtkMRMLFileIOManager::RegisterWriter ( vtkMRMLFileWriter * writer)

◆ SafeDownCast()

static vtkMRMLFileIOManager * vtkMRMLFileIOManager::SafeDownCast ( vtkObject * o)
static

◆ SaveNodes()

bool vtkMRMLFileIOManager::SaveNodes ( const std::string & fileType,
vtkMRMLIOProperties * properties,
vtkMRMLMessageCollection * userMessages = nullptr,
vtkMRMLScene * scene = nullptr )

Saving.

Save nodes (or scene) using the registered writers. 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.

◆ SaveScene()

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.

◆ SetApplicationLogic()

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.

◆ SetDefaultMaximumFileNameLength()

virtual void vtkMRMLFileIOManager::SetDefaultMaximumFileNameLength ( int )
virtual

◆ SetDefaultSceneFileType()

void vtkMRMLFileIOManager::SetDefaultSceneFileType ( const std::string & fileType)

◆ SetScene()

virtual void vtkMRMLFileIOManager::SetScene ( vtkMRMLScene * scene)
virtual

The scene the handlers read into and write from.

◆ SortedByConfidence()

template<typename HandlerType>
static std::vector< vtkSmartPointer< HandlerType > > vtkMRMLFileIOManager::SortedByConfidence ( const std::vector< vtkSmartPointer< HandlerType > > & handlers,
const std::vector< double > & confidences )
staticprotected

Handlers with their confidence, highest first; ties keep the order of registration. Handlers with zero confidence are not included.

◆ StripKnownExtension()

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.

◆ UnregisterHandler()

void vtkMRMLFileIOManager::UnregisterHandler ( vtkMRMLFileIOHandler * handler)

Remove a reader or a writer. Whoever registered a handler is responsible for unregistering it.

Member Data Documentation

◆ ApplicationLogic

vtkWeakPointer<vtkMRMLApplicationLogic> vtkMRMLFileIOManager::ApplicationLogic
protected

Definition at line 317 of file vtkMRMLFileIOManager.h.

◆ DefaultMaximumFileNameLength

int vtkMRMLFileIOManager::DefaultMaximumFileNameLength { 1000 }
protected

Definition at line 322 of file vtkMRMLFileIOManager.h.

◆ DefaultSceneFileType

std::string vtkMRMLFileIOManager::DefaultSceneFileType
protected

Definition at line 321 of file vtkMRMLFileIOManager.h.

◆ Readers

std::vector<vtkSmartPointer<vtkMRMLFileReader> > vtkMRMLFileIOManager::Readers
protected

Definition at line 318 of file vtkMRMLFileIOManager.h.

◆ Scene

vtkWeakPointer<vtkMRMLScene> vtkMRMLFileIOManager::Scene
protected

Definition at line 316 of file vtkMRMLFileIOManager.h.

◆ Writers

std::vector<vtkSmartPointer<vtkMRMLFileWriter> > vtkMRMLFileIOManager::Writers
protected

Definition at line 319 of file vtkMRMLFileIOManager.h.


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