ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkSpatialObjectToPointSetFilter.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 itkSpatialObjectToPointSetFilter_h
19 #define itkSpatialObjectToPointSetFilter_h
20 
21 #include "itkPointSet.h"
22 #include "itkDataObject.h"
23 #include "itkMeshSource.h"
25 
26 namespace itk
27 {
34 template< typename TPointBasedSpatialObject, typename TOutputPointSet >
35 class ITK_TEMPLATE_EXPORT SpatialObjectToPointSetFilter
36 : public MeshSource< TOutputPointSet >
37 {
38 public:
39  ITK_DISALLOW_COPY_AND_ASSIGN(SpatialObjectToPointSetFilter);
40 
46 
47  using OutputPointSetType = TOutputPointSet;
48  using OutputPointSetPointer = typename OutputPointSetType::Pointer;
49 
52 
54 
56  itkNewMacro(Self);
57 
60 
62  using PointBasedSpatialObjectType = TPointBasedSpatialObject;
64  = typename PointBasedSpatialObjectType::Pointer;
66  = typename PointBasedSpatialObjectType::ConstPointer;
67  using ChildrenListType = typename TPointBasedSpatialObject::ChildrenListType;
68 
70  static constexpr unsigned int ObjectDimension
71  = PointBasedSpatialObjectType::ObjectDimension;
72 
75 
76  using SpatialObjectType
78 
80  using Superclass::SetInput;
81 
82  void SetInput(const SpatialObjectType *object);
83 
84  void SetInput(const DataObjectIdentifierType & key,
85  const SpatialObjectType *object);
86 
88  const SpatialObjectType * GetInput();
89  const SpatialObjectType * GetInput(unsigned int idx);
91 
96  itkSetMacro(ChildrenDepth, unsigned int);
97  itkGetConstMacro(ChildrenDepth, unsigned int);
99 
100  /* Set the sampling factor of the object. The resulting pointset will have a
101  * size inversely proportional to the sampling factor.*/
102  itkSetMacro(SamplingFactor, unsigned int);
103  itkGetConstMacro(SamplingFactor, unsigned int);
104 
105 protected:
107  ~SpatialObjectToPointSetFilter() override = default;
108 
109  void GenerateOutputInformation() override {} // do nothing
110  void GenerateData() override;
111 
112  void PrintSelf(std::ostream & os, Indent indent) const override;
113 
114 private:
115  unsigned int m_ChildrenDepth{ 0 };
116  unsigned int m_SamplingFactor{ 1 };
117 };
118 } // end namespace itk
119 
120 #ifndef ITK_MANUAL_INSTANTIATION
121 #include "itkSpatialObjectToPointSetFilter.hxx"
122 #endif
123 
124 #endif
DataObject::DataObjectIdentifierType DataObjectIdentifierType
Light weight base class for most itk classes.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
typename OutputPointSetType::Pointer OutputPointSetPointer
Base class for filters that take a SpatialObject as input and produce a PointSet as output...
Base class for all process objects that output mesh data.
Definition: itkMeshSource.h:49
Implementation of the composite pattern.
typename PointBasedSpatialObjectType::Pointer PointBasedSpatialObjectPointer
typename PointBasedSpatialObjectType::ConstPointer PointBasedSpatialObjectConstPointer
Point used for spatial objets.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename TPointBasedSpatialObject::ChildrenListType ChildrenListType
SmartPointer< Self > Pointer
std::string DataObjectIdentifierType