ITK  5.0.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | 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 >:

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

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)
 
void Update (const DOMNodeType *inputdom, const void *userdata=nullptr)
 
virtual void Update ()
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
 
unsigned long AddObserver (const EventObject &event, Command *) 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 noexceptoverride
 
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
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
 itkCloneMacro (Self)
 
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 ()
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
virtual void SetTimeStamp (const TimeStamp &time)
 
 ~Object () override
 
- 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 ()
 

Private Member Functions

virtual void SetIntermediateDOM (DOMNodeType *_arg)
 
virtual DOMNodeTypeGetModifiableIntermediateDOM ()
 
virtual const DOMNodeTypeGetIntermediateDOM () const
 

Private Attributes

std::string m_FileName
 
DOMNodePointer m_IntermediateDOM
 
LoggerPointer m_Logger
 
OutputTypem_Output
 
LightObject::Pointer m_OutputHolder
 

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

Member Typedef Documentation

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

Definition at line 79 of file itkDOMReader.h.

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

Definition at line 78 of file itkDOMReader.h.

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

Definition at line 82 of file itkDOMReader.h.

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

Definition at line 81 of file itkDOMReader.h.

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

Definition at line 76 of file itkDOMReader.h.

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

Standard class type aliases.

Definition at line 72 of file itkDOMReader.h.

Constructor & Destructor Documentation

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

Member Function Documentation

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.

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

Get the input XML filename.

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

Get/Set the intermediate DOM object.

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.

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

Get/Set the intermediate DOM object.

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

Standard part of all itk objects.

Reimplemented from itk::Object.

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

Get the output object for full access.

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

Get the output object for read-only access.

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

Set the input XML filename.

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

Get/Set the intermediate DOM object.

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.

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.

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.

Member Data Documentation

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

Variable to hold the input XML file name.

Definition at line 135 of file itkDOMReader.h.

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

Variable to hold the intermediate DOM object.

Definition at line 148 of file itkDOMReader.h.

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

Variable to log various messages during the reading process.

Definition at line 151 of file itkDOMReader.h.

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 142 of file itkDOMReader.h.

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 145 of file itkDOMReader.h.


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