ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkSpatialObjectDuplicator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 {
31 template< typename TInputSpatialObject >
32 class ITK_TEMPLATE_EXPORT SpatialObjectDuplicator:public Object
33 {
34 public:
35  ITK_DISALLOW_COPY_AND_ASSIGN(SpatialObjectDuplicator);
36 
39  using Superclass = Object;
42 
43  itkNewMacro(Self);
44 
46  itkTypeMacro(SpatialObjectDuplicator, Object);
47 
49  using SpatialObjectType = TInputSpatialObject;
50  using SpatialObjectPointer = typename TInputSpatialObject::Pointer;
51  using SpatialObjectConstPointer = typename TInputSpatialObject::ConstPointer;
52 
53  static constexpr unsigned int ObjectDimension = SpatialObjectType::ObjectDimension;
54 
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 * GetOutput () const { return this->m_DuplicateSpatialObject.GetPointer(); }
73  virtual SpatialObjectType * GetOutput() { return this->m_DuplicateSpatialObject.GetPointer(); }
75 
76 #if !defined(ITK_LEGACY_REMOVE)
77  // This interface was exposed in ITKv4 when the itkGetModifiableObjectMacro was used
78  virtual SpatialObjectType * GetModifiedOutput() { return this->m_DuplicateSpatialObject.GetPointer(); }
79 #endif
80 
81 
83  void Update();
84 
85 protected:
86  SpatialObjectDuplicator();
87  ~SpatialObjectDuplicator() override = default;
88  void PrintSelf(std::ostream & os, Indent indent) const override;
89 
91  void CopyObject(const InternalSpatialObjectType *source,
92  InternalSpatialObjectType *destination);
93 
94 private:
98 };
99 } // end namespace itk
100 
101 #ifndef ITK_MANUAL_INSTANTIATION
102 #include "itkSpatialObjectDuplicator.hxx"
103 #endif
104 
105 #endif /* itkSpatialObjectDuplicator_h */
Light weight base class for most itk classes.
SpatialObjectPointer m_DuplicateSpatialObject
virtual const SpatialObjectType * GetOutput() const
typename TInputSpatialObject::ConstPointer SpatialObjectConstPointer
typename TInputSpatialObject::Pointer SpatialObjectPointer
Implementation of the composite pattern.
unsigned long ModifiedTimeType
Definition: itkIntTypes.h:104
virtual SpatialObjectType * GetOutput()
Base class for most ITK classes.
Definition: itkObject.h:60