ITK
6.0.0
Insight 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 demonstrates how to use a DOM-based reader that is derived from this class:
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 LoggerType * | GetLogger () const |
const char * | GetNameOfClass () const override |
OutputType * | GetOutput () |
const OutputType * | GetOutput () 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 *cmd) 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 |
Command * | GetCommand (unsigned long tag) |
bool | GetDebug () const |
MetaDataDictionary & | GetMetaDataDictionary () |
const MetaDataDictionary & | GetMetaDataDictionary () 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 |
void | Register () const override |
void | RemoveAllObservers () |
void | RemoveObserver (unsigned long tag) const |
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 () | |
bool | PrintObservers (std::ostream &os, Indent indent) const |
void | PrintSelf (std::ostream &os, Indent indent) const override |
virtual void | SetTimeStamp (const TimeStamp &timeStamp) |
~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 DOMNodeType * | GetModifiableIntermediateDOM () |
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 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 {} |
using itk::DOMReader< TOutput >::DOMNodePointer = typename DOMNodeType::Pointer |
Definition at line 79 of file itkDOMReader.h.
using itk::DOMReader< TOutput >::DOMNodeType = DOMNode |
Definition at line 78 of file itkDOMReader.h.
using itk::DOMReader< TOutput >::LoggerPointer = typename LoggerType::Pointer |
Definition at line 82 of file itkDOMReader.h.
using itk::DOMReader< TOutput >::LoggerType = Logger |
Definition at line 81 of file itkDOMReader.h.
using itk::DOMReader< TOutput >::OutputType = TOutput |
Definition at line 76 of file itkDOMReader.h.
using itk::DOMReader< TOutput >::Self = DOMReader |
Standard class type aliases.
Definition at line 72 of file itkDOMReader.h.
|
protected |
|
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.
|
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.
|
overridevirtual |
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.
|
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.
|
virtual |
Function called by end-users to generate the output object from the input XML file.
void itk::DOMReader< TOutput >::Update | ( | const DOMNodeType * | inputdom, |
const void * | userdata = nullptr |
||
) |
|
private |
Variable to hold the input XML file name.
Definition at line 145 of file itkDOMReader.h.
|
private |
Variable to hold the intermediate DOM object.
Definition at line 154 of file itkDOMReader.h.
|
mutableprivate |
Variable to log various messages during the reading process.
Definition at line 157 of file itkDOMReader.h.
|
private |
Variable to hold the output object, created internally or supplied by the user.
Definition at line 148 of file itkDOMReader.h.
|
private |
Variable to hold the output object if it is a smart object.
Definition at line 151 of file itkDOMReader.h.