ITK  5.3.0
Insight Toolkit
itkSpatialObjectDuplicator.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  * http://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 #ifndef itkSpatialObjectDuplicator_h
19 #define itkSpatialObjectDuplicator_h
20 
21 #include "itkObject.h"
22 #include "itkSpatialObject.h"
23 
24 namespace itk
25 {
32 template <typename TInputSpatialObject>
33 class ITK_TEMPLATE_EXPORT SpatialObjectDuplicator : public Object
34 {
35 public:
36  ITK_DISALLOW_COPY_AND_MOVE(SpatialObjectDuplicator);
37 
40  using Superclass = Object;
43 
44  itkNewMacro(Self);
45 
47  itkTypeMacro(SpatialObjectDuplicator, Object);
48 
50  using SpatialObjectType = TInputSpatialObject;
51  using SpatialObjectPointer = typename TInputSpatialObject::Pointer;
52  using SpatialObjectConstPointer = typename TInputSpatialObject::ConstPointer;
53 
54  static constexpr unsigned int ObjectDimension = SpatialObjectType::ObjectDimension;
55 
57 
59  itkSetConstObjectMacro(Input, SpatialObjectType);
60 
68  // NOTE: The m_GeneratedImageSource is only
69  // exposed via the Source generation interface
70  // by the GetOutput() method that mimics
71  // a process object.
72  virtual const SpatialObjectType *
73  GetOutput() const
74  {
75  return this->m_DuplicateSpatialObject.GetPointer();
76  }
77  virtual SpatialObjectType *
79  {
80  return this->m_DuplicateSpatialObject.GetPointer();
81  }
83 
84 #if !defined(ITK_LEGACY_REMOVE)
85  // This interface was exposed in ITKv4 when the itkGetModifiableObjectMacro was used
86  virtual SpatialObjectType *
87  GetModifiedOutput()
88  {
89  return this->m_DuplicateSpatialObject.GetPointer();
90  }
91 #endif
92 
93 
95  void
96  Update();
97 
98 protected:
99  SpatialObjectDuplicator();
100  ~SpatialObjectDuplicator() override = default;
101  void
102  PrintSelf(std::ostream & os, Indent indent) const override;
103 
105  void
106  CopyObject(const InternalSpatialObjectType * source, InternalSpatialObjectType * destination);
107 
108 private:
112 };
113 } // end namespace itk
114 
115 #ifndef ITK_MANUAL_INSTANTIATION
116 # include "itkSpatialObjectDuplicator.hxx"
117 #endif
118 
119 #endif /* itkSpatialObjectDuplicator_h */
itk::ModifiedTimeType
SizeValueType ModifiedTimeType
Definition: itkIntTypes.h:102
itkSpatialObject.h
itk::SpatialObjectDuplicator::SpatialObjectConstPointer
typename TInputSpatialObject::ConstPointer SpatialObjectConstPointer
Definition: itkSpatialObjectDuplicator.h:52
itk::SmartPointer< Self >
itk::SpatialObjectDuplicator::SpatialObjectType
TInputSpatialObject SpatialObjectType
Definition: itkSpatialObjectDuplicator.h:50
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::SpatialObjectDuplicator::m_DuplicateSpatialObject
SpatialObjectPointer m_DuplicateSpatialObject
Definition: itkSpatialObjectDuplicator.h:110
itk::SpatialObject
Implementation of the composite pattern.
Definition: itkSpatialObject.h:57
itk::SpatialObjectDuplicator::m_Input
SpatialObjectConstPointer m_Input
Definition: itkSpatialObjectDuplicator.h:109
itk::SpatialObjectDuplicator::m_InternalSpatialObjectTime
ModifiedTimeType m_InternalSpatialObjectTime
Definition: itkSpatialObjectDuplicator.h:111
itk::SpatialObjectDuplicator::GetOutput
virtual const SpatialObjectType * GetOutput() const
Definition: itkSpatialObjectDuplicator.h:73
itkObject.h
itk::SpatialObjectDuplicator::SpatialObjectPointer
typename TInputSpatialObject::Pointer SpatialObjectPointer
Definition: itkSpatialObjectDuplicator.h:51
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::SpatialObjectDuplicator
Definition: itkSpatialObjectDuplicator.h:33
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::SpatialObjectDuplicator::GetOutput
virtual SpatialObjectType * GetOutput()
Definition: itkSpatialObjectDuplicator.h:78