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

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

Inheritance diagram for vtkMRMLFileWriter:
Collaboration diagram for vtkMRMLFileWriter:

Public Types

typedef vtkMRMLFileIOHandler Superclass
 
- Public Types inherited from vtkMRMLFileIOHandler
typedef vtkObject Superclass
 

Public Member Functions

void AddNodeClassName (const std::string &className)
 
void AddWrittenNodeID (const std::string &nodeID)
 
virtual bool CanWriteObject (vtkObject *object)
 
virtual double CanWriteObjectConfidence (vtkObject *object)
 
void ClearWrittenNodeIDs ()
 
virtual const char * GetClassName ()
 
virtual double GetConfidenceForMatchingClass ()
 What a writer that only knows its node class answers for a node of that class.
 
virtual std::vector< std::string > GetNameFiltersForObject (vtkObject *object)
 
std::string GetNodeClassName () const
 
const std::vector< std::string > & GetNodeClassNames () const
 
const std::vector< std::string > & GetWrittenNodeIDs () const
 The nodes the last Write wrote, by node ID.
 
virtual int IsA (const char *type)
 
bool IsWriter () const override
 Whether this writes rather than reads.
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
virtual void SetConfidenceForMatchingClass (double)
 
void SetNodeClassName (const std::string &className)
 
void SetNodeClassNames (const std::vector< std::string > &classNames)
 The classes of nodes this writer is for.
 
void SetWrittenNodeIDs (const std::vector< std::string > &nodeIDs)
 
virtual bool Write (vtkMRMLIOProperties *properties)
 
- 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 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 vtkMRMLFileWriter * New ()
 
static vtkMRMLFileWriter * 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

 vtkMRMLFileWriter ()
 
 ~vtkMRMLFileWriter () override
 
- Protected Member Functions inherited from vtkMRMLFileIOHandler
 vtkMRMLFileIOHandler ()
 
 ~vtkMRMLFileIOHandler () override
 

Protected Attributes

double ConfidenceForMatchingClass { 0.5 }
 
std::vector< std::string > NodeClassNames
 
std::vector< std::string > WrittenNodeIDs
 
- 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
 

Detailed Description

Base class of file writers, which write a node (or the scene) to file. Subclasses override Write() and, if checking the node class is not enough to decide if the object can be written, CanWriteObjectConfidence().

See https://slicer.readthedocs.io/en/latest/developer_guide/mrml_overview.html#the-writer

Definition at line 30 of file vtkMRMLFileWriter.h.

Member Typedef Documentation

◆ Superclass

Constructor & Destructor Documentation

◆ vtkMRMLFileWriter()

vtkMRMLFileWriter::vtkMRMLFileWriter ( )
protected

◆ ~vtkMRMLFileWriter()

vtkMRMLFileWriter::~vtkMRMLFileWriter ( )
overrideprotected

Member Function Documentation

◆ AddNodeClassName()

void vtkMRMLFileWriter::AddNodeClassName ( const std::string & className)

◆ AddWrittenNodeID()

void vtkMRMLFileWriter::AddWrittenNodeID ( const std::string & nodeID)

◆ CanWriteObject()

virtual bool vtkMRMLFileWriter::CanWriteObject ( vtkObject * object)
virtual

Return true if the object is handled by the writer. By default it returns true if the object is an instance of any of the node class names.

Reimplemented in vtkMRMLNodeWriter, vtkSlicerSceneWriter, and vtkSlicerScriptedFileWriterBridge.

◆ CanWriteObjectConfidence()

virtual double vtkMRMLFileWriter::CanWriteObjectConfidence ( vtkObject * object)
virtual

Returns a positive number (>0) if the writer can write the object to file. The higher the returned value is the more confident the writer it is the most suitable class to write the object. By default, the method calls CanWriteObject and if it returns true then it returns ConfidenceForMatchingClass (0.5 by default).

Reimplemented in vtkSlicerScriptedFileWriterBridge.

◆ ClearWrittenNodeIDs()

void vtkMRMLFileWriter::ClearWrittenNodeIDs ( )

◆ GetClassName()

virtual const char * vtkMRMLFileWriter::GetClassName ( )
virtual

◆ GetConfidenceForMatchingClass()

virtual double vtkMRMLFileWriter::GetConfidenceForMatchingClass ( )
virtual

What a writer that only knows its node class answers for a node of that class.

◆ GetNameFiltersForObject()

virtual std::vector< std::string > vtkMRMLFileWriter::GetNameFiltersForObject ( vtkObject * object)
virtual

Get the list of name filters supported for writing a particular object. Example: "Image (*.jpg *.png *.tiff)", "Model (.vtk)". By default, it returns the name filters of the writer (see SetNameFilters()).

Reimplemented in vtkMRMLNodeWriter, vtkSlicerMarkupsWriter, and vtkSlicerScriptedFileWriterBridge.

◆ GetNodeClassName()

std::string vtkMRMLFileWriter::GetNodeClassName ( ) const

The class of node this writer is for ("vtkMRMLTextNode"). Setting it replaces all node class names with this single class name. Empty for a writer that decides for itself in CanWriteObjectConfidence.

◆ GetNodeClassNames()

const std::vector< std::string > & vtkMRMLFileWriter::GetNodeClassNames ( ) const
inline

Definition at line 74 of file vtkMRMLFileWriter.h.

◆ GetWrittenNodeIDs()

const std::vector< std::string > & vtkMRMLFileWriter::GetWrittenNodeIDs ( ) const

The nodes the last Write wrote, by node ID.

◆ IsA()

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

◆ IsTypeOf()

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

◆ IsWriter()

bool vtkMRMLFileWriter::IsWriter ( ) const
inlineoverridevirtual

Whether this writes rather than reads.

Reimplemented from vtkMRMLFileIOHandler.

Definition at line 37 of file vtkMRMLFileWriter.h.

◆ New()

static vtkMRMLFileWriter * vtkMRMLFileWriter::New ( )
static

◆ PrintSelf()

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

◆ SafeDownCast()

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

◆ SetConfidenceForMatchingClass()

virtual void vtkMRMLFileWriter::SetConfidenceForMatchingClass ( double )
virtual

◆ SetNodeClassName()

void vtkMRMLFileWriter::SetNodeClassName ( const std::string & className)

◆ SetNodeClassNames()

void vtkMRMLFileWriter::SetNodeClassNames ( const std::vector< std::string > & classNames)

The classes of nodes this writer is for.

◆ SetWrittenNodeIDs()

void vtkMRMLFileWriter::SetWrittenNodeIDs ( const std::vector< std::string > & nodeIDs)

◆ Write()

virtual bool vtkMRMLFileWriter::Write ( vtkMRMLIOProperties * properties)
virtual

Write the node named by the "nodeID" property to the file named by "fileName". What it wrote is then in GetWrittenNodeIDs. The base class writes nothing: a writer whose work is done elsewhere is called through its owner.

Reimplemented in vtkMRMLNodeWriter, vtkSlicerMarkupsWriter, vtkSlicerSceneWriter, vtkSlicerScriptedFileWriterBridge, and vtkSlicerSegmentationsNodeWriter.

Member Data Documentation

◆ ConfidenceForMatchingClass

double vtkMRMLFileWriter::ConfidenceForMatchingClass { 0.5 }
protected

Definition at line 86 of file vtkMRMLFileWriter.h.

◆ NodeClassNames

std::vector<std::string> vtkMRMLFileWriter::NodeClassNames
protected

Definition at line 85 of file vtkMRMLFileWriter.h.

◆ WrittenNodeIDs

std::vector<std::string> vtkMRMLFileWriter::WrittenNodeIDs
protected

Definition at line 87 of file vtkMRMLFileWriter.h.


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