ITK  5.2.0
Insight Toolkit
Public Types | Public Member Functions | Protected Member Functions | List of all members
itk::DOMReader< TOutput > Class Template Referenceabstract

#include <itkDOMReader.h>

+ Inheritance diagram for itk::DOMReader< TOutput >:
+ Collaboration diagram for itk::DOMReader< TOutput >:

Public Types

using DOMNodePointer = typename DOMNodeType::Pointer
 
using DOMNodeType = DOMNode
 
using LoggerPointer = typename LoggerType::Pointer
 
using LoggerType = Logger
 
using OutputType = TOutput
 
using Self = DOMReader
 
- Public Types inherited from itk::Object
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = Object
 
using Superclass = LightObject
 
- Public Types inherited from itk::LightObject
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = LightObject
 

Public Member Functions

virtual const char * GetFileName () const
 
virtual LoggerTypeGetLogger () const
 
virtual const char * GetNameOfClass () const
 
OutputTypeGetOutput ()
 
const OutputTypeGetOutput () const
 
virtual void SetFileName (const char *_arg)
 
virtual void SetOutput (OutputType *output)
 
virtual void Update ()
 
void Update (const DOMNodeType *inputdom, const void *userdata=nullptr)
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
 
unsigned long AddObserver (const EventObject &event, Command *) const
 
unsigned long AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const
 
LightObject::Pointer CreateAnother () const override
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
CommandGetCommand (unsigned long tag)
 
bool GetDebug () const
 
MetaDataDictionaryGetMetaDataDictionary ()
 
const MetaDataDictionaryGetMetaDataDictionary () const
 
virtual ModifiedTimeType GetMTime () const
 
virtual const TimeStampGetTimeStamp () const
 
bool HasObserver (const EventObject &event) const
 
void InvokeEvent (const EventObject &)
 
void InvokeEvent (const EventObject &) const
 
virtual void Modified () const
 
void Register () const override
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag)
 
void SetDebug (bool debugFlag) const
 
void SetReferenceCount (int) override
 
void UnRegister () const noexcept override
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
void SetMetaDataDictionary (MetaDataDictionary &&rrhs)
 
virtual void SetObjectName (std::string _arg)
 
virtual const std::string & GetObjectName () const
 
- Public Member Functions inherited from itk::LightObject
Pointer Clone () const
 
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
void Print (std::ostream &os, Indent indent=0) const
 

Protected Member Functions

 DOMReader ()
 
virtual void GenerateData (const DOMNodeType *inputdom, const void *userdata)=0
 
- Protected Member Functions inherited from itk::Object
 Object ()
 
 ~Object () override
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
virtual void SetTimeStamp (const TimeStamp &timeStamp)
 
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 
 LightObject ()
 
virtual void PrintHeader (std::ostream &os, Indent indent) const
 
virtual void PrintTrailer (std::ostream &os, Indent indent) const
 
virtual ~LightObject ()
 
std::string m_FileName
 
OutputTypem_Output
 
LightObject::Pointer m_OutputHolder
 
DOMNodePointer m_IntermediateDOM
 
LoggerPointer m_Logger
 
virtual void SetIntermediateDOM (DOMNodeType *_arg)
 
virtual DOMNodeTypeGetModifiableIntermediateDOM ()
 
virtual const DOMNodeTypeGetIntermediateDOM () const
 

Additional Inherited Members

- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOff ()
 
static void GlobalWarningDisplayOn ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool val)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 
- Protected Attributes inherited from itk::LightObject
std::atomic< int > m_ReferenceCount
 

Detailed Description

template<typename TOutput>
class itk::DOMReader< TOutput >

Class to read an ITK object from an XML file or a DOM object, using the DOM APIs.

End-users need to derive from this class to implement readers for user objects. In subclasses, users need to provide an implementation for the virtual functions GenerateData(-,-).

This class performs similar functions as the XMLReader - both provide the base for handling object reading from an XML source. The difference is that, readers derived from this class perform object reading using the easy-to-use DOM APIs, while XMLReader-based readers use the more error-prone SAX (Simple API for XML) APIs.

Internally, this class first implicitly creates an intermediate DOM object from the input XML file using the DOMNodeXMLReader, then performs output object generation by pulling information from the DOM object.

Note: Though this class behaves similar to ProcessObject, it is not derived from ProcessObject. This is because many user objects to be read, e.g., registrations, transforms, optimizers, and so on, are not objects of type DataObject, thus this class cannot be connected to an ITK process pipeline.

The following code snippet demonstrates how to use a DOM-based reader that is derived from this class:

itk::MyObjectType::Pointer output_object;
const char* input_xml_file_name = ...
itk::MyObjectDOMReader::Pointer reader = itk::MyObjectDOMReader::New();
reader->SetFileName( input_xml_file_name );
reader->Update();
output_object = reader->GetOutput();
See also
XMLReader
DOMNodeXMLReader
DOMNode

Definition at line 65 of file itkDOMReader.h.

Member Typedef Documentation

◆ DOMNodePointer

template<typename TOutput >
using itk::DOMReader< TOutput >::DOMNodePointer = typename DOMNodeType::Pointer

Definition at line 79 of file itkDOMReader.h.

◆ DOMNodeType

template<typename TOutput >
using itk::DOMReader< TOutput >::DOMNodeType = DOMNode

Definition at line 78 of file itkDOMReader.h.

◆ LoggerPointer

template<typename TOutput >
using itk::DOMReader< TOutput >::LoggerPointer = typename LoggerType::Pointer

Definition at line 82 of file itkDOMReader.h.

◆ LoggerType

template<typename TOutput >
using itk::DOMReader< TOutput >::LoggerType = Logger

Definition at line 81 of file itkDOMReader.h.

◆ OutputType

template<typename TOutput >
using itk::DOMReader< TOutput >::OutputType = TOutput

Definition at line 76 of file itkDOMReader.h.

◆ Self

template<typename TOutput >
using itk::DOMReader< TOutput >::Self = DOMReader

Standard class type aliases.

Definition at line 72 of file itkDOMReader.h.

Constructor & Destructor Documentation

◆ DOMReader()

template<typename TOutput >
itk::DOMReader< TOutput >::DOMReader ( )
protected

Member Function Documentation

◆ GenerateData()

template<typename TOutput >
virtual void itk::DOMReader< TOutput >::GenerateData ( const DOMNodeType inputdom,
const void *  userdata 
)
protectedpure virtual

Function to be implemented in subclasses. It is called automatically when update functions are performed. It should fill the contents of the output object by pulling information from the intermediate DOM object. Some derived readers may accept an incomplete DOM object during the reading process, in those cases the optional argument 'userdata' can be used to provide the missed information.

◆ GetFileName()

template<typename TOutput >
virtual const char* itk::DOMReader< TOutput >::GetFileName ( ) const
virtual

Get the input XML filename.

◆ GetIntermediateDOM()

template<typename TOutput >
virtual const DOMNodeType* itk::DOMReader< TOutput >::GetIntermediateDOM ( ) const
privatevirtual

Variable to hold the input XML file name.

◆ GetLogger()

template<typename TOutput >
virtual LoggerType* itk::DOMReader< TOutput >::GetLogger ( ) const
virtual

Return the internal logger so that users can change the output format or add/remove logging destinations.

◆ GetModifiableIntermediateDOM()

template<typename TOutput >
virtual DOMNodeType* itk::DOMReader< TOutput >::GetModifiableIntermediateDOM ( )
privatevirtual

Variable to hold the input XML file name.

◆ GetNameOfClass()

template<typename TOutput >
virtual const char* itk::DOMReader< TOutput >::GetNameOfClass ( ) const
virtual

Standard part of all itk objects.

Reimplemented from itk::Object.

◆ GetOutput() [1/2]

template<typename TOutput >
OutputType* itk::DOMReader< TOutput >::GetOutput ( )

Get the output object for full access.

◆ GetOutput() [2/2]

template<typename TOutput >
const OutputType* itk::DOMReader< TOutput >::GetOutput ( ) const

Get the output object for read-only access.

◆ SetFileName()

template<typename TOutput >
virtual void itk::DOMReader< TOutput >::SetFileName ( const char *  _arg)
virtual

Set the input XML filename.

◆ SetIntermediateDOM()

template<typename TOutput >
virtual void itk::DOMReader< TOutput >::SetIntermediateDOM ( DOMNodeType _arg)
privatevirtual

Get/Set the intermediate DOM object.

◆ SetOutput()

template<typename TOutput >
virtual void itk::DOMReader< TOutput >::SetOutput ( OutputType output)
virtual

The output object will be created automatically, but the user can appoint a user object as the output by calling this function.

◆ Update() [1/2]

template<typename TOutput >
virtual void itk::DOMReader< TOutput >::Update ( )
virtual

Function called by end-users to generate the output object from the input XML file.

◆ Update() [2/2]

template<typename TOutput >
void itk::DOMReader< TOutput >::Update ( const DOMNodeType inputdom,
const void *  userdata = nullptr 
)

Function called by Update() or end-users to generate the output object from a DOM object. Some derived readers may accept an incomplete DOM object during the reading process, in those cases the optional argument 'userdata' can be used to provide the missed information.

Member Data Documentation

◆ m_FileName

template<typename TOutput >
std::string itk::DOMReader< TOutput >::m_FileName
private

Variable to hold the input XML file name.

Definition at line 141 of file itkDOMReader.h.

◆ m_IntermediateDOM

template<typename TOutput >
DOMNodePointer itk::DOMReader< TOutput >::m_IntermediateDOM
private

Variable to hold the intermediate DOM object.

Definition at line 154 of file itkDOMReader.h.

◆ m_Logger

template<typename TOutput >
LoggerPointer itk::DOMReader< TOutput >::m_Logger
mutableprivate

Variable to log various messages during the reading process.

Definition at line 157 of file itkDOMReader.h.

◆ m_Output

template<typename TOutput >
OutputType* itk::DOMReader< TOutput >::m_Output
private

Variable to hold the output object, created internally or supplied by the user.

Definition at line 148 of file itkDOMReader.h.

◆ m_OutputHolder

template<typename TOutput >
LightObject::Pointer itk::DOMReader< TOutput >::m_OutputHolder
private

Variable to hold the output object if it is a smart object.

Definition at line 151 of file itkDOMReader.h.


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