ITK  6.0.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 void
69 SetMetaIOVersion(unsigned int ver);
70 unsigned int
71 GetMetaIOVersion(void) const;
75 itkSetStringMacro(FileName);
76
78 itkGetStringMacro(FileName);
79
83 {
84 return m_SpatialObject;
85 }
86
90 GroupPointer
92 {
93 if (m_Group == nullptr)
94 {
95 if (m_SpatialObject->GetTypeName() == "GroupSpatialObject")
96 {
97 m_Group = static_cast<GroupType *>(m_SpatialObject.GetPointer());
98 }
99 else
100 {
101 m_Group = GroupType::New();
102 m_Group->AddChild(m_SpatialObject);
103 }
104 }
105 return m_Group;
106 }
110 const MetaEvent *
112 {
113 return m_MetaToSpatialConverter->GetEvent();
114 }
115
116 void
118 {
119 m_MetaToSpatialConverter->SetEvent(event);
120 }
121
123 void
124 RegisterMetaConverter(const char * metaTypeName,
125 const char * spatialObjectTypeName,
126 MetaConverterBaseType * converter);
127
128protected:
129 std::string m_FileName{};
130
132 ~SpatialObjectReader() override = default;
133
134private:
135 GroupPointer m_Group{};
136
137 SpatialObjectPointer m_SpatialObject{};
138
139 typename MetaSceneConverterType::Pointer m_MetaToSpatialConverter{};
140};
141} // namespace itk
142
143#ifndef ITK_MANUAL_INSTANTIATION
144# include "itkSpatialObjectReader.hxx"
145#endif
146
147#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
void SetMetaIOVersion(unsigned int ver)
SpatialObjectPointer GetOutput()
void SetEvent(MetaEvent *event)
unsigned int GetMetaIOVersion(void) const
~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....