ITK  5.4.0
Insight Toolkit
itkSpatialObjectReader.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#ifndef itkSpatialObjectReader_h
19#define itkSpatialObjectReader_h
20
23#include "itkSpatialObject.h"
25#include "itkProcessObject.h"
26
27namespace itk
28{
33template <unsigned int VDimension = 3,
34 typename PixelType = unsigned char,
35 typename TMeshTraits = DefaultStaticMeshTraits<PixelType, VDimension, VDimension>>
36class ITK_TEMPLATE_EXPORT SpatialObjectReader : public Object
37{
38public:
39 ITK_DISALLOW_COPY_AND_MOVE(SpatialObjectReader);
40
48
54
56 itkNewMacro(Self);
57
60 itkOverrideGetNameOfClassMacro(SpatialObjectReader);
64 void
66
68 itkSetStringMacro(FileName);
69
71 itkGetStringMacro(FileName);
72
76 {
77 return m_SpatialObject;
78 }
79
83 GroupPointer
85 {
86 if (m_Group == nullptr)
87 {
88 if (m_SpatialObject->GetTypeName() == "GroupSpatialObject")
89 {
90 m_Group = static_cast<GroupType *>(m_SpatialObject.GetPointer());
91 }
92 else
93 {
94 m_Group = GroupType::New();
95 m_Group->AddChild(m_SpatialObject);
96 }
97 }
98 return m_Group;
99 }
103 const MetaEvent *
105 {
106 return m_MetaToSpatialConverter->GetEvent();
107 }
108
109 void
111 {
112 m_MetaToSpatialConverter->SetEvent(event);
113 }
114
116 void
117 RegisterMetaConverter(const char * metaTypeName,
118 const char * spatialObjectTypeName,
119 MetaConverterBaseType * converter);
120
121protected:
122 std::string m_FileName{};
123
125 ~SpatialObjectReader() override = default;
126
127private:
128 GroupPointer m_Group{};
129
130 SpatialObjectPointer m_SpatialObject{};
131
132 typename MetaSceneConverterType::Pointer m_MetaToSpatialConverter{};
133};
134} // namespace itk
135
136#ifndef ITK_MANUAL_INSTANTIATION
137# include "itkSpatialObjectReader.hxx"
138#endif
139
140#endif // itkSpatialObjectReader_h
Representation of a group based on the spatial object classes.
Light weight base class for most itk classes.
Event abstract class.
Definition: itkMetaEvent.h:42
Converts between MetaObject and SpatialObject group.
Base class for most ITK classes.
Definition: itkObject.h:62
typename GroupType::Pointer GroupPointer
SpatialObjectPointer GetOutput()
void SetEvent(MetaEvent *event)
~SpatialObjectReader() override=default
void RegisterMetaConverter(const char *metaTypeName, const char *spatialObjectTypeName, MetaConverterBaseType *converter)
typename SpatialObjectType::Pointer SpatialObjectPointer
Implementation of the composite pattern.
static Pointer New()
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....