ITK
4.3.0
Insight Segmentation and Registration Toolkit
|
#include <itkDOMWriter.h>
Class to write an ITK object to an XML file or a DOM object, using the DOM APIs.
End-users need to derive from this class to implement writers for user objects. In subclasses, users need to provide an implementation for the virtual function GenerateData(-,-).
This class performs similar functions as the XMLWriterBase - both provide the base for handling object writing to an XML destination. The difference is that, writers derived from this class perform object writing using the easy-to-use DOM APIs, while XMLWriterBase-based writers directly generate textual XML documents, which is tedious and more error prone.
Internally, this class first generates an intermediate DOM object from the input object, then the DOM object is implicitly written to the output XML file using the DOMNodeXMLWriter.
Note: Though this class behaves similar to ProcessObject, it is not derived from ProcessObject. This is because many user objects to be written, 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 writer that is derived from this class:
Definition at line 66 of file itkDOMWriter.h.
Public Types | |
typedef DOMNodeType::Pointer | DOMNodePointer |
typedef DOMNode | DOMNodeType |
typedef TInput | InputType |
typedef LoggerType::Pointer | LoggerPointer |
typedef Logger | LoggerType |
typedef DOMWriter | 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 |
const InputType * | GetInput () const |
virtual LoggerType * | GetLogger () const |
virtual const char * | GetNameOfClass () const |
virtual void | SetFileName (const char *_arg) |
virtual void | SetInput (const InputType *input) |
void | Update (DOMNodeType *outputdom, 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 | |
DOMWriter () | |
virtual void | GenerateData (DOMNodeType *outputdom, const void *userdata) const =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 | |
DOMWriter (const Self &) | |
virtual DOMNodeType * | GetIntermediateDOM () |
void | operator= (const Self &) |
virtual void | SetIntermediateDOM (DOMNodeType *_arg) |
Private Attributes | |
std::string | m_FileName |
const InputType * | m_Input |
LightObject::ConstPointer | m_InputHolder |
DOMNodePointer | m_IntermediateDOM |
LoggerPointer | m_Logger |
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::DOMWriter< TInput >::DOMNodePointer |
Definition at line 78 of file itkDOMWriter.h.
typedef DOMNode itk::DOMWriter< TInput >::DOMNodeType |
Definition at line 77 of file itkDOMWriter.h.
typedef TInput itk::DOMWriter< TInput >::InputType |
Definition at line 73 of file itkDOMWriter.h.
typedef LoggerType::Pointer itk::DOMWriter< TInput >::LoggerPointer |
Definition at line 81 of file itkDOMWriter.h.
typedef Logger itk::DOMWriter< TInput >::LoggerType |
Definition at line 80 of file itkDOMWriter.h.
typedef DOMWriter itk::DOMWriter< TInput >::Self |
Standard class typedefs.
Definition at line 71 of file itkDOMWriter.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 intermediate DOM object by pulling information from the input object. Some derived writers may accept an incomplete input object during the writing process, in those cases the optional argument 'userdata' can be used to provide the missed information.
|
virtual |
Get the output XML filename.
const InputType* itk::DOMWriter< TInput >::GetInput | ( | ) | const |
Get the input object to be written.
|
privatevirtual |
Get the intermediate DOM object.
|
virtual |
Return the internal logger so that users can change the output format or add/remove logging destinations.
|
virtual |
Standard part of all itk objects.
Reimplemented from itk::Object.
|
private |
|
virtual |
Set the output XML filename.
|
virtual |
Set the input object to be written.
|
privatevirtual |
Set the intermediate DOM object.
void itk::DOMWriter< TInput >::Update | ( | DOMNodeType * | outputdom, |
const void * | userdata = 0 |
||
) |
|
virtual |
Function called by end-users to write the input object to the output XML file.
|
private |
Variable to hold the output XML file name.
Definition at line 133 of file itkDOMWriter.h.
|
private |
Variable to hold the input object.
Definition at line 139 of file itkDOMWriter.h.
|
private |
Variable to hold the input object if it is a smart object.
Definition at line 142 of file itkDOMWriter.h.
|
private |
Variable to hold the intermediate DOM object.
Definition at line 145 of file itkDOMWriter.h.
|
mutableprivate |
Variable to log various messages during the writing process.
Definition at line 148 of file itkDOMWriter.h.