ITK  5.3.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  * 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 itkSpatialObjectReader_h
19 #define itkSpatialObjectReader_h
20 
21 #include "itkMetaSceneConverter.h"
22 #include "itkMetaConverterBase.h"
23 #include "itkSpatialObject.h"
24 #include "itkGroupSpatialObject.h"
25 #include "itkProcessObject.h"
26 
27 namespace itk
28 {
33 template <unsigned int NDimensions = 3,
34  typename PixelType = unsigned char,
35  typename TMeshTraits = DefaultStaticMeshTraits<PixelType, NDimensions, NDimensions>>
36 class ITK_TEMPLATE_EXPORT SpatialObjectReader : public Object
37 {
38 public:
39  ITK_DISALLOW_COPY_AND_MOVE(SpatialObjectReader);
40 
47  using GroupPointer = typename GroupType::Pointer;
48 
54 
56  itkNewMacro(Self);
57 
59  using Superclass = Object;
60  itkTypeMacro(SpatialObjectReader, Object);
62 
64  void
65  Update();
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  }
101 
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 
121 protected:
122  std::string m_FileName;
123 
125  ~SpatialObjectReader() override = default;
126 
127 private:
129 
131 
133 };
134 } // namespace itk
135 
136 #ifndef ITK_MANUAL_INSTANTIATION
137 # include "itkSpatialObjectReader.hxx"
138 #endif
139 
140 #endif // itkSpatialObjectReader_h
itk::SpatialObjectReader::GroupPointer
typename GroupType::Pointer GroupPointer
Definition: itkSpatialObjectReader.h:47
itk::SpatialObjectReader::m_MetaToSpatialConverter
MetaSceneConverterType::Pointer m_MetaToSpatialConverter
Definition: itkSpatialObjectReader.h:132
itk::SpatialObjectReader::SetEvent
void SetEvent(MetaEvent *event)
Definition: itkSpatialObjectReader.h:110
itkSpatialObject.h
itk::SpatialObjectReader::m_SpatialObject
SpatialObjectPointer m_SpatialObject
Definition: itkSpatialObjectReader.h:130
itk::SmartPointer< Self >
itk::SpatialObjectReader
Definition: itkSpatialObjectReader.h:36
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itkGroupSpatialObject.h
itk::SpatialObjectReader::GetOutput
SpatialObjectPointer GetOutput()
Definition: itkSpatialObjectReader.h:75
itk::SpatialObjectReader::GetEvent
const MetaEvent * GetEvent()
Definition: itkSpatialObjectReader.h:104
itkProcessObject.h
itkMetaSceneConverter.h
itk::MetaEvent
Event abstract class.
Definition: itkMetaEvent.h:40
itk::SpatialObject
Implementation of the composite pattern.
Definition: itkSpatialObject.h:57
itk::SpatialObjectReader::m_FileName
std::string m_FileName
Definition: itkSpatialObjectReader.h:122
itk::MetaConverterBase< NDimensions >
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::SpatialObjectReader::SpatialObjectPointer
typename SpatialObjectType::Pointer SpatialObjectPointer
Definition: itkSpatialObjectReader.h:45
itk::SpatialObjectReader::GetGroup
GroupPointer GetGroup()
Definition: itkSpatialObjectReader.h:84
itk::SpatialObjectReader::m_Group
GroupPointer m_Group
Definition: itkSpatialObjectReader.h:128
itk::GroupSpatialObject
Representation of a group based on the spatial object classes.
Definition: itkGroupSpatialObject.h:39
itk::MetaSceneConverter
Converts between MetaObject and SpaitalObject group.
Definition: itkMetaSceneConverter.h:48
itkMetaConverterBase.h