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

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

Inheritance diagram for vtkMRMLFileIOHandler:
Collaboration diagram for vtkMRMLFileIOHandler:

Public Types

typedef vtkObject Superclass
 

Public Member Functions

void FillOptionsDescription (vtkMRMLIOProperties *properties, vtkMRMLIOOptionsDescription *description)
 
virtual const char * GetClassName ()
 
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 int IsA (const char *type)
 
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 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

 vtkMRMLFileIOHandler ()
 
 ~vtkMRMLFileIOHandler () override
 

Protected Attributes

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
 

Detailed Description

Base class of file readers and writers (vtkMRMLFileReader, vtkMRMLFileWriter). It stores the file type, description, and name filters of the reader or writer and describes its options.

See https://slicer.readthedocs.io/en/latest/developer_guide/mrml_overview.html#file-reading-and-writing

Definition at line 41 of file vtkMRMLFileIOHandler.h.

Member Typedef Documentation

◆ Superclass

Definition at line 45 of file vtkMRMLFileIOHandler.h.

Constructor & Destructor Documentation

◆ vtkMRMLFileIOHandler()

vtkMRMLFileIOHandler::vtkMRMLFileIOHandler ( )
protected

◆ ~vtkMRMLFileIOHandler()

vtkMRMLFileIOHandler::~vtkMRMLFileIOHandler ( )
overrideprotected

Member Function Documentation

◆ ExtensionsFromNameFilter()

static std::vector< std::string > vtkMRMLFileIOHandler::ExtensionsFromNameFilter ( const std::string & nameFilter)
static

The extensions named by a filter such as "Mimics project (*.mcs *.mcs.gz)".

◆ FillOptionsDescription()

void vtkMRMLFileIOHandler::FillOptionsDescription ( vtkMRMLIOProperties * properties,
vtkMRMLIOOptionsDescription * description )

Fill the description of options for the specified context (properties may be nullptr). Sets properties and defaults in the description, then calls GetOptionsDescription().

◆ GetClassName()

◆ GetDescription()

virtual std::string vtkMRMLFileIOHandler::GetDescription ( )
virtual

What to call this in a file dialog ("Volume", "Mimics project").

◆ GetExtensions()

const std::vector< std::string > & vtkMRMLFileIOHandler::GetExtensions ( ) const
inline

The extensions of the name filters, lower case and with the dot: ".mcs", ".mcs.gz". A filter of "*.*" or "*" gives no extension: such a handler takes any file.

Definition at line 63 of file vtkMRMLFileIOHandler.h.

◆ GetFileIOManager()

vtkMRMLFileIOManager * vtkMRMLFileIOHandler::GetFileIOManager ( ) const

The manager this handler is registered in (set by the manager), nullptr if it is not registered. It allows readers and writers to update application-wide IO settings, such as the default scene file type.

◆ GetFileType()

virtual std::string vtkMRMLFileIOHandler::GetFileType ( )
virtual

The kind of file this handles, as the rest of Slicer names it ("VolumeFile", "ModelFile", "SceneFile", or whatever a module calls its own).

◆ GetMatchedExtension()

virtual std::string vtkMRMLFileIOHandler::GetMatchedExtension ( const std::string & filePath) const
virtual

The longest matching extension of filePath, or an empty string.

◆ GetMatchingNameFilters()

static std::vector< std::string > vtkMRMLFileIOHandler::GetMatchingNameFilters ( const std::string & filePath,
const std::vector< std::string > & nameFilters,
bool requireReadableFile,
int * longestExtensionMatch = nullptr )
static

Return the name filters that the file name matches. For example, if the file name is "my_image.nrrd" and the name filters are "Volumes (*.mha *.nrrd *.raw)", "Images (*.png *.jpg)", "DICOM (*)" then it returns "Volumes (*.mha *.nrrd *.raw)" and "DICOM (*)". If ␇ requireReadableFile is true then no filters are returned if the file is not a readable file (or it is a temporary file, with '~' in its extension).

Parameters
longestExtensionMatchIf non-zero then it is set to the length of the longest matched extension (not counting wildcard characters). It can be used to determine how specifically extension matched.

◆ GetNameFilters()

const std::vector< std::string > & vtkMRMLFileIOHandler::GetNameFilters ( ) const
inline

Definition at line 59 of file vtkMRMLFileIOHandler.h.

◆ GetOptionDefaults()

vtkMRMLIOProperties * vtkMRMLFileIOHandler::GetOptionDefaults ( )

Default values of options that the application specifies (for example, from user settings). These values are used instead of the defaults of the reader or writer. Never null.

◆ GetOptionsDescription()

virtual void vtkMRMLFileIOHandler::GetOptionsDescription ( vtkMRMLIOOptionsDescription * description)
virtual

Options of the reader or writer (properties that the user may set). See https://slicer.readthedocs.io/en/latest/developer_guide/mrml_overview.html#reader-and-writer-options Describe the options. The default implementation describes no options. Properties (context and current values) and defaults are already set in the description.

Reimplemented in vtkMRMLNodeWriter, vtkSlicerAnnotationsReader, vtkSlicerModelsReader, vtkSlicerSceneReader, vtkSlicerScriptedFileReaderBridge, vtkSlicerScriptedFileWriterBridge, vtkSlicerSegmentationsNodeWriter, vtkSlicerSegmentationsReader, and vtkSlicerVolumesReader.

◆ GetOptionsDescriptionJSON()

std::string vtkMRMLFileIOHandler::GetOptionsDescriptionJSON ( vtkMRMLIOProperties * properties)

Get the description of options as JSON (see vtkMRMLIOOptionsDescription). Returns an empty string if the reader or writer has no options.

◆ GetOptionValues()

void vtkMRMLFileIOHandler::GetOptionValues ( vtkMRMLIOProperties * properties,
vtkMRMLIOProperties * values )

Get the values of all options for the specified context (default values, overridden by values in properties). It can be used for getting option values without displaying a user interface.

◆ GetScene()

vtkMRMLScene * vtkMRMLFileIOHandler::GetScene ( ) const

◆ GetUserMessages()

vtkMRMLMessageCollection * vtkMRMLFileIOHandler::GetUserMessages ( ) const

Messages the user should see about the last read or write (a vtkMRMLMessageCollection, as the readers of Slicer use). Never null.

◆ IsA()

◆ IsTypeOf()

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

◆ IsWriter()

virtual bool vtkMRMLFileIOHandler::IsWriter ( ) const
inlinevirtual

Whether this writes rather than reads.

Reimplemented in vtkMRMLFileWriter.

Definition at line 80 of file vtkMRMLFileIOHandler.h.

◆ LongestMatchingExtension()

static std::string vtkMRMLFileIOHandler::LongestMatchingExtension ( const std::string & filePath,
const std::vector< std::string > & extensions )
static

The lower-case extension of a file name, taking the compound extensions of Slicer into account (".seg.nrrd" rather than ".nrrd"), against a list of known extensions.

◆ MatchesExtension()

virtual bool vtkMRMLFileIOHandler::MatchesExtension ( const std::string & filePath) const
virtual

Whether the file name ends in one of the extensions. A handler with no extension of its own matches nothing here; it has to say what it can do in CanLoadFileConfidence instead.

◆ NameFilterToWildcards()

static std::vector< std::string > vtkMRMLFileIOHandler::NameFilterToWildcards ( const std::string & nameFilter)
static

Get the list of wildcard patterns from a name filter. For example: "Image (*.jpg *.png)" -> "*.jpg", "*.png". A name filter without brackets is returned as is if it is a valid wildcard ("*.jpg").

◆ New()

static vtkMRMLFileIOHandler * vtkMRMLFileIOHandler::New ( )
static

◆ PrintSelf()

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

◆ SafeDownCast()

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

◆ SetDescription()

virtual void vtkMRMLFileIOHandler::SetDescription ( std::string )
virtual

◆ SetFileIOManager()

void vtkMRMLFileIOHandler::SetFileIOManager ( vtkMRMLFileIOManager * manager)

◆ SetFileType()

virtual void vtkMRMLFileIOHandler::SetFileType ( std::string )
virtual

◆ SetNameFilters()

void vtkMRMLFileIOHandler::SetNameFilters ( const std::vector< std::string > & filters)

The name filters, as Slicer writes them: "Mimics project (*.mcs *.mcs.gz)".

◆ SetScene()

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

Where the nodes go, and where messages for the user are collected.

◆ WildcardMatch()

static bool vtkMRMLFileIOHandler::WildcardMatch ( const std::string & pattern,
const std::string & text )
static

Case-insensitive wildcard matching of the whole text. Supported wildcards: '*', '?', and character sets ("[abc]", "[!abc]").

Member Data Documentation

◆ Description

std::string vtkMRMLFileIOHandler::Description
protected

Definition at line 142 of file vtkMRMLFileIOHandler.h.

◆ Extensions

std::vector<std::string> vtkMRMLFileIOHandler::Extensions
protected

Definition at line 144 of file vtkMRMLFileIOHandler.h.

◆ FileIOManager

vtkWeakPointer<vtkMRMLFileIOManager> vtkMRMLFileIOHandler::FileIOManager
protected

Definition at line 146 of file vtkMRMLFileIOHandler.h.

◆ FileType

std::string vtkMRMLFileIOHandler::FileType
protected

Definition at line 141 of file vtkMRMLFileIOHandler.h.

◆ NameFilters

std::vector<std::string> vtkMRMLFileIOHandler::NameFilters
protected

Definition at line 143 of file vtkMRMLFileIOHandler.h.

◆ OptionDefaults

vtkNew<vtkMRMLIOProperties> vtkMRMLFileIOHandler::OptionDefaults
protected

Definition at line 147 of file vtkMRMLFileIOHandler.h.

◆ Scene

vtkWeakPointer<vtkMRMLScene> vtkMRMLFileIOHandler::Scene
protected

Definition at line 145 of file vtkMRMLFileIOHandler.h.

◆ UserMessages

vtkNew<vtkMRMLMessageCollection> vtkMRMLFileIOHandler::UserMessages
protected

Definition at line 148 of file vtkMRMLFileIOHandler.h.


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