ITK  6.0.0
Insight Toolkit
itkDOMWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * https://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 
19 #ifndef itkDOMWriter_h
20 #define itkDOMWriter_h
21 
22 #include "itkDOMNodeXMLWriter.h"
23 #include "itkObject.h"
24 #include "itkLogger.h"
25 
26 namespace itk
27 {
28 
66 template <typename TInput>
67 class ITK_TEMPLATE_EXPORT DOMWriter : public Object
68 {
69 public:
70  ITK_DISALLOW_COPY_AND_MOVE(DOMWriter);
74  using Self = DOMWriter;
75 
76  itkOverrideGetNameOfClassMacro(DOMWriter);
77 
78  using InputType = TInput;
79 
82 
83  using LoggerType = Logger;
85 
87  itkSetStringMacro(FileName);
88 
90  itkGetStringMacro(FileName);
91 
93  virtual void
94  SetInput(const InputType * input);
95 
97  const InputType *
98  GetInput() const;
99 
104  itkGetConstMacro(Logger, LoggerType *);
105 
111  void
112  Update(DOMNodeType * outputdom, const void * userdata = nullptr);
113 
117  virtual void
118  Update();
119 
120 protected:
121  DOMWriter();
122 
130  virtual void
131  GenerateData(DOMNodeType * outputdom, const void * userdata) const = 0;
132 
133 private:
135  itkSetObjectMacro(IntermediateDOM, DOMNodeType);
136  itkGetModifiableObjectMacro(IntermediateDOM, DOMNodeType);
140  std::string m_FileName{};
141 
143  const InputType * m_Input{};
144 
146  typename LightObject::ConstPointer m_InputHolder{};
147 
149  DOMNodePointer m_IntermediateDOM{};
150 
152  mutable LoggerPointer m_Logger{};
153 };
154 
155 } // namespace itk
156 
157 #ifndef ITK_MANUAL_INSTANTIATION
158 # include "itkDOMWriter.hxx"
159 #endif
160 
161 #endif // itkDOMWriter_h
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::Logger
Used for logging information during a run.
Definition: itkLogger.h:36
itk::DOMWriter
Class to write an ITK object to an XML file or a DOM object, using the DOM APIs.
Definition: itkDOMWriter.h:67
itk::SmartPointer< const Self >
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkDOMNodeXMLWriter.h
itk::DOMWriter::LoggerPointer
typename LoggerType::Pointer LoggerPointer
Definition: itkDOMWriter.h:84
itk::DOMWriter::DOMNodePointer
typename DOMNodeType::Pointer DOMNodePointer
Definition: itkDOMWriter.h:81
itk::DOMNode
Class to represent a node in a Document Object Model (DOM) tree structure.
Definition: itkDOMNode.h:53
itkObject.h
itk::DOMWriter::InputType
TInput InputType
Definition: itkDOMWriter.h:78
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
itkLogger.h