ITK  4.2.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
itk::DOMReader< TOutput > Class Template Reference

#include <itkDOMReader.h>

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

List of all members.

Public Types

typedef DOMNodeType::Pointer DOMNodePointer
typedef DOMNode DOMNodeType
typedef LoggerType::Pointer LoggerPointer
typedef Logger LoggerType
typedef TOutput OutputType
typedef DOMReader Self
- Public Types inherited from itk::Object
typedef SmartPointer< const SelfConstPointer
typedef SmartPointer< SelfPointer
typedef LightObject Superclass
- Public Types inherited from itk::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=0)
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
virtual LightObject::Pointer CreateAnother () const
virtual void DebugOff () const
virtual void DebugOn () const
CommandGetCommand (unsigned long tag)
bool GetDebug () const
MetaDataDictionaryGetMetaDataDictionary (void)
const MetaDataDictionaryGetMetaDataDictionary (void) const
virtual unsigned long 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
virtual void Register () const
void RemoveAllObservers ()
void RemoveObserver (unsigned long tag)
void SetDebug (bool debugFlag) const
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
virtual void SetReferenceCount (int)
virtual void UnRegister () 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
virtual void PrintSelf (std::ostream &os, Indent indent) const
virtual void SetTimeStamp (const TimeStamp &time)
virtual ~Object ()
- 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

 DOMReader (const Self &)
virtual DOMNodeTypeGetIntermediateDOM ()
void operator= (const Self &)
virtual void SetIntermediateDOM (DOMNodeType *_arg)

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

Detailed Description

template<class 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.


Member Typedef Documentation

template<class TOutput >
typedef DOMNodeType::Pointer itk::DOMReader< TOutput >::DOMNodePointer

Definition at line 77 of file itkDOMReader.h.

template<class TOutput >
typedef DOMNode itk::DOMReader< TOutput >::DOMNodeType

Definition at line 76 of file itkDOMReader.h.

template<class TOutput >
typedef LoggerType::Pointer itk::DOMReader< TOutput >::LoggerPointer

Definition at line 80 of file itkDOMReader.h.

template<class TOutput >
typedef Logger itk::DOMReader< TOutput >::LoggerType

Definition at line 79 of file itkDOMReader.h.

template<class TOutput >
typedef TOutput itk::DOMReader< TOutput >::OutputType

Definition at line 72 of file itkDOMReader.h.

template<class TOutput >
typedef DOMReader itk::DOMReader< TOutput >::Self

Standard class typedefs.

Reimplemented from itk::Object.

Definition at line 70 of file itkDOMReader.h.


Constructor & Destructor Documentation

template<class TOutput >
itk::DOMReader< TOutput >::DOMReader ( )
protected
template<class TOutput >
itk::DOMReader< TOutput >::DOMReader ( const Self )
private

Member Function Documentation

template<class 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<class TOutput >
virtual const char* itk::DOMReader< TOutput >::GetFileName ( ) const
virtual

Get the input XML filename.

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

Get the intermediate DOM object.

template<class 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<class TOutput >
virtual const char* itk::DOMReader< TOutput >::GetNameOfClass ( ) const
virtual

Standard part of all itk objects.

Reimplemented from itk::Object.

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

Get the output object for full access.

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

Get the output object for read-only access.

template<class TOutput >
void itk::DOMReader< TOutput >::operator= ( const Self )
private

Mutex lock to protect modification to the reference count

Reimplemented from itk::Object.

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

Set the input XML filename.

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

Set the intermediate DOM object.

template<class 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<class TOutput >
void itk::DOMReader< TOutput >::Update ( const DOMNodeType inputdom,
const void *  userdata = 0 
)

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<class 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<class TOutput >
std::string itk::DOMReader< TOutput >::m_FileName
private

Variable to hold the input XML file name.

Definition at line 138 of file itkDOMReader.h.

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

Variable to hold the intermediate DOM object.

Definition at line 150 of file itkDOMReader.h.

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

Variable to log various messages during the reading process.

Definition at line 153 of file itkDOMReader.h.

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

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

Definition at line 144 of file itkDOMReader.h.

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

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

Definition at line 147 of file itkDOMReader.h.


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