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

Python bridge for vtkMRMLFileWriter. More...

#include <Base/Logic/vtkSlicerScriptedFileWriterBridge.h>

Inheritance diagram for vtkSlicerScriptedFileWriterBridge:
Collaboration diagram for vtkSlicerScriptedFileWriterBridge:

Public Types

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

Public Member Functions

bool CanWriteObject (vtkObject *object) override
 
double CanWriteObjectConfidence (vtkObject *object) override
 
virtual const char * GetClassName ()
 
std::vector< std::string > GetNameFiltersForObject (vtkObject *object) override
 
void GetOptionsDescription (vtkMRMLIOOptionsDescription *description) override
 
vtkWeakReference * GetWeakReference ()
 
virtual int IsA (const char *type)
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
bool Write (vtkMRMLIOProperties *properties) override
 
- Public Member Functions inherited from vtkMRMLFileWriter
void AddNodeClassName (const std::string &className)
 
void AddWrittenNodeID (const std::string &nodeID)
 
void ClearWrittenNodeIDs ()
 
virtual double GetConfidenceForMatchingClass ()
 What a writer that only knows its node class answers for a node of that class.
 
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.
 
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)
 
- 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 ()
 
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 vtkSlicerScriptedFileWriterBridge * New ()
 
static vtkSlicerScriptedFileWriterBridge * SafeDownCast (vtkObject *o)
 
- Static Public Member Functions inherited from vtkMRMLFileWriter
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

void UnRegisterInternal (vtkObjectBase *o, vtkTypeBool check) override
 
 vtkSlicerScriptedFileWriterBridge ()
 
 ~vtkSlicerScriptedFileWriterBridge () override
 
- Protected Member Functions inherited from vtkMRMLFileWriter
 vtkMRMLFileWriter ()
 
 ~vtkMRMLFileWriter () override
 
- Protected Member Functions inherited from vtkMRMLFileIOHandler
 vtkMRMLFileIOHandler ()
 
 ~vtkMRMLFileIOHandler () override
 

Additional Inherited Members

- Protected Attributes inherited from vtkMRMLFileWriter
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

Python bridge for vtkMRMLFileWriter.

File writers are implemented in Python by subclassing slicer.vtkSlicerScriptedFileWriter (defined in slicer.ScriptedFileIO), which is a Python subclass of this class. This class calls the methods that are overridden in Python and uses the vtkMRMLFileWriter implementation of the other methods.

See https://slicer.readthedocs.io/en/latest/developer_guide/mrml_overview.html#readers-and-writers-implemented-in-python

See also
vtkSlicerScriptedFileReaderBridge

Definition at line 47 of file vtkSlicerScriptedFileWriterBridge.h.

Member Typedef Documentation

◆ Superclass

Constructor & Destructor Documentation

◆ vtkSlicerScriptedFileWriterBridge()

vtkSlicerScriptedFileWriterBridge::vtkSlicerScriptedFileWriterBridge ( )
protected

◆ ~vtkSlicerScriptedFileWriterBridge()

vtkSlicerScriptedFileWriterBridge::~vtkSlicerScriptedFileWriterBridge ( )
overrideprotected

Member Function Documentation

◆ CanWriteObject()

bool vtkSlicerScriptedFileWriterBridge::CanWriteObject ( vtkObject * object)
overridevirtual

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

◆ CanWriteObjectConfidence()

double vtkSlicerScriptedFileWriterBridge::CanWriteObjectConfidence ( vtkObject * object)
overridevirtual

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

◆ GetClassName()

virtual const char * vtkSlicerScriptedFileWriterBridge::GetClassName ( )
virtual

Reimplemented from vtkMRMLFileWriter.

◆ GetNameFiltersForObject()

std::vector< std::string > vtkSlicerScriptedFileWriterBridge::GetNameFiltersForObject ( vtkObject * object)
overridevirtual

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

◆ GetOptionsDescription()

void vtkSlicerScriptedFileWriterBridge::GetOptionsDescription ( vtkMRMLIOOptionsDescription * description)
overridevirtual

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

◆ GetWeakReference()

vtkWeakReference * vtkSlicerScriptedFileWriterBridge::GetWeakReference ( )

Weak reference to this object. It is cleared when the object starts to be deleted (before DeleteEvent observers are called), therefore it can be used for referring to this object from Python without preventing the deletion of the object, even in DeleteEvent observers.

◆ IsA()

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

Reimplemented from vtkMRMLFileWriter.

◆ IsTypeOf()

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

◆ New()

static vtkSlicerScriptedFileWriterBridge * vtkSlicerScriptedFileWriterBridge::New ( )
static

◆ PrintSelf()

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

◆ SafeDownCast()

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

◆ UnRegisterInternal()

void vtkSlicerScriptedFileWriterBridge::UnRegisterInternal ( vtkObjectBase * o,
vtkTypeBool check )
overrideprotected

Clear the weak reference (see GetWeakReference) when the last reference is released, before DeleteEvent observers are invoked.

◆ Write()

bool vtkSlicerScriptedFileWriterBridge::Write ( vtkMRMLIOProperties * properties)
overridevirtual

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


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