ITK
4.4.0
Insight Segmentation and Registration Toolkit
|
#include <itkDOMReader.h>
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:
Definition at line 65 of file itkDOMReader.h.
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 Self > | ConstPointer |
typedef SmartPointer< Self > | Pointer |
typedef Object | Self |
typedef LightObject | Superclass |
Public Types inherited from itk::LightObject | |
typedef SmartPointer< const Self > | ConstPointer |
typedef SmartPointer< Self > | Pointer |
typedef LightObject | Self |
Public Member Functions | |
virtual const char * | GetFileName () const |
virtual LoggerType * | GetLogger () const |
virtual const char * | GetNameOfClass () const |
OutputType * | GetOutput () |
const OutputType * | GetOutput () 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 |
Command * | GetCommand (unsigned long tag) |
bool | GetDebug () const |
MetaDataDictionary & | GetMetaDataDictionary (void) |
const MetaDataDictionary & | GetMetaDataDictionary (void) const |
virtual ModifiedTimeType | GetMTime () const |
virtual const TimeStamp & | GetTimeStamp () 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 &) | |
void | operator= (const Self &) |
virtual void | SetIntermediateDOM (DOMNodeType *_arg) |
virtual DOMNodeType * | GetModifiableIntermediateDOM () |
virtual const DOMNodeType * | GetIntermediateDOM () const |
Private Attributes | |
std::string | m_FileName |
DOMNodePointer | m_IntermediateDOM |
LoggerPointer | m_Logger |
OutputType * | m_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) |
Protected Types inherited from itk::LightObject | |
typedef int | InternalReferenceCountType |
Protected Attributes inherited from itk::LightObject | |
InternalReferenceCountType | m_ReferenceCount |
SimpleFastMutexLock | m_ReferenceCountLock |
typedef DOMNodeType::Pointer itk::DOMReader< TOutput >::DOMNodePointer |
Definition at line 77 of file itkDOMReader.h.
typedef DOMNode itk::DOMReader< TOutput >::DOMNodeType |
Definition at line 76 of file itkDOMReader.h.
typedef LoggerType::Pointer itk::DOMReader< TOutput >::LoggerPointer |
Definition at line 80 of file itkDOMReader.h.
typedef Logger itk::DOMReader< TOutput >::LoggerType |
Definition at line 79 of file itkDOMReader.h.
typedef TOutput itk::DOMReader< TOutput >::OutputType |
Definition at line 72 of file itkDOMReader.h.
typedef DOMReader itk::DOMReader< TOutput >::Self |
Standard class typedefs.
Definition at line 70 of file itkDOMReader.h.
|
protected |
|
private |
|
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.
|
virtual |
Get the input XML filename.
|
privatevirtual |
Get/Set the intermediate DOM object.
|
virtual |
Return the internal logger so that users can change the output format or add/remove logging destinations.
|
privatevirtual |
Get/Set the intermediate DOM object.
|
virtual |
Standard part of all itk objects.
Reimplemented from itk::Object.
OutputType* itk::DOMReader< TOutput >::GetOutput | ( | ) |
Get the output object for full access.
const OutputType* itk::DOMReader< TOutput >::GetOutput | ( | ) | const |
Get the output object for read-only access.
|
private |
|
virtual |
Set the input XML filename.
|
privatevirtual |
Get/Set the intermediate DOM object.
|
virtual |
The output object will be created automatically, but the user can appoint a user object as the output by calling this function.
void itk::DOMReader< TOutput >::Update | ( | const DOMNodeType * | inputdom, |
const void * | userdata = 0 |
||
) |
|
virtual |
Function called by end-users to generate the output object from the input XML file.
|
private |
Variable to hold the input XML file name.
Definition at line 136 of file itkDOMReader.h.
|
private |
Variable to hold the intermediate DOM object.
Definition at line 149 of file itkDOMReader.h.
|
mutableprivate |
Variable to log various messages during the reading process.
Definition at line 152 of file itkDOMReader.h.
|
private |
Variable to hold the output object, created internally or supplied by the user.
Definition at line 143 of file itkDOMReader.h.
|
private |
Variable to hold the output object if it is a smart object.
Definition at line 146 of file itkDOMReader.h.