ITK  6.0.0
Insight Toolkit
itkVTKImageImport.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 itkVTKImageImport_h
19#define itkVTKImageImport_h
20
21#include "itkImageSource.h"
23
24#define itkSetMacro2(name, type) \
25 virtual void Set##name(type _arg) \
26 { \
27 itkDebugMacro("setting " #name " to " << _arg); \
28 if (this->m_##name != _arg) \
29 { \
30 this->m_##name = _arg; \
31 this->Modified(); \
32 } \
33 }
34
35namespace itk
36{
56template <typename TOutputImage>
57class ITK_TEMPLATE_EXPORT VTKImageImport : public ImageSource<TOutputImage>
58{
59public:
60 ITK_DISALLOW_COPY_AND_MOVE(VTKImageImport);
61
66
68 itkNewMacro(Self);
69
71 itkOverrideGetNameOfClassMacro(VTKImageImport);
72
74 using OutputImageType = TOutputImage;
76 using OutputPixelType = typename OutputImageType::PixelType;
80
82 static constexpr unsigned int OutputImageDimension = OutputImageType::ImageDimension;
83
86 using UpdateInformationCallbackType = void (*)(void *);
87 using PipelineModifiedCallbackType = int (*)(void *);
88 using WholeExtentCallbackType = int * (*)(void *);
89 using SpacingCallbackType = double * (*)(void *);
90 using OriginCallbackType = double * (*)(void *);
91 using DirectionCallbackType = double * (*)(void *);
92 using ScalarTypeCallbackType = const char * (*)(void *);
93 using NumberOfComponentsCallbackType = int (*)(void *);
94 using PropagateUpdateExtentCallbackType = void (*)(void *, int *);
95 using UpdateDataCallbackType = void (*)(void *);
96 using DataExtentCallbackType = int * (*)(void *);
97 using BufferPointerCallbackType = void * (*)(void *);
101 using FloatSpacingCallbackType = float * (*)(void *);
102 using FloatOriginCallbackType = float * (*)(void *);
106 itkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
107 itkGetConstMacro(UpdateInformationCallback, UpdateInformationCallbackType);
111 itkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
112 itkGetConstMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
116 itkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
117 itkGetConstMacro(WholeExtentCallback, WholeExtentCallbackType);
121 itkSetMacro(SpacingCallback, SpacingCallbackType);
122 itkGetConstMacro(SpacingCallback, SpacingCallbackType);
123 itkSetMacro(FloatSpacingCallback, FloatSpacingCallbackType);
124 itkGetConstMacro(FloatSpacingCallback, FloatSpacingCallbackType);
125 void
127 {
128 this->SetFloatSpacingCallback(f);
129 }
133 itkSetMacro(OriginCallback, OriginCallbackType);
134 itkGetConstMacro(OriginCallback, OriginCallbackType);
135 itkSetMacro(FloatOriginCallback, FloatOriginCallbackType);
136 itkGetConstMacro(FloatOriginCallback, FloatOriginCallbackType);
137 void
139 {
140 this->SetFloatOriginCallback(f);
141 }
145 itkSetMacro(DirectionCallback, DirectionCallbackType);
146 itkGetConstMacro(DirectionCallback, DirectionCallbackType);
150 itkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
151 itkGetConstMacro(ScalarTypeCallback, ScalarTypeCallbackType);
155 itkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
156 itkGetConstMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
160 itkSetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
161 itkGetConstMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
165 itkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
166 itkGetConstMacro(UpdateDataCallback, UpdateDataCallbackType);
170 itkSetMacro(DataExtentCallback, DataExtentCallbackType);
171 itkGetConstMacro(DataExtentCallback, DataExtentCallbackType);
175 itkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
176 itkGetConstMacro(BufferPointerCallback, BufferPointerCallbackType);
180 itkSetMacro2(CallbackUserData, void *);
181 itkGetConstMacro(CallbackUserData, void *);
184protected:
186 ~VTKImageImport() override = default;
187 void
188 PrintSelf(std::ostream & os, Indent indent) const override;
189
190 void
192
193 void
195
196 void
197 GenerateData() override;
198
199 void
201
202private:
203 void * m_CallbackUserData{ nullptr };
204 UpdateInformationCallbackType m_UpdateInformationCallback{ nullptr };
205 PipelineModifiedCallbackType m_PipelineModifiedCallback{ nullptr };
206 WholeExtentCallbackType m_WholeExtentCallback{ nullptr };
207 SpacingCallbackType m_SpacingCallback{ nullptr };
208 FloatSpacingCallbackType m_FloatSpacingCallback{ nullptr };
209 OriginCallbackType m_OriginCallback{ nullptr };
210 FloatOriginCallbackType m_FloatOriginCallback{ nullptr };
211 DirectionCallbackType m_DirectionCallback{ nullptr };
212 ScalarTypeCallbackType m_ScalarTypeCallback{ nullptr };
213 NumberOfComponentsCallbackType m_NumberOfComponentsCallback{ nullptr };
214 PropagateUpdateExtentCallbackType m_PropagateUpdateExtentCallback{ nullptr };
215 UpdateDataCallbackType m_UpdateDataCallback{ nullptr };
216 DataExtentCallbackType m_DataExtentCallback{ nullptr };
217 BufferPointerCallbackType m_BufferPointerCallback{ nullptr };
218
219 std::string m_ScalarTypeName{};
220};
221} // namespace itk
222
223#ifndef ITK_MANUAL_INSTANTIATION
224# include "itkVTKImageImport.hxx"
225#endif
226
227#endif // itkVTKImageImport_h
Base class for all data objects in ITK.
Base class for all process objects that output image data.
TOutputImage OutputImageType
typename OutputImageType::Pointer OutputImagePointer
Control indentation during Print() invocation.
Definition: itkIndent.h:50
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Connect the end of an VTK pipeline to an ITK image pipeline.
void GenerateOutputInformation() override
void(*)(void *) UpdateDataCallbackType
void *(*)(void *) BufferPointerCallbackType
void SetOriginCallback(FloatOriginCallbackType f)
float *(*)(void *) FloatSpacingCallbackType
~VTKImageImport() override=default
typename OutputImageType::IndexType OutputIndexType
void PropagateRequestedRegion(DataObject *) override
void PrintSelf(std::ostream &os, Indent indent) const override
void(*)(void *, int *) PropagateUpdateExtentCallbackType
const char *(*)(void *) ScalarTypeCallbackType
double *(*)(void *) SpacingCallbackType
int(*)(void *) PipelineModifiedCallbackType
void GenerateData() override
typename OutputImageType::SizeType OutputSizeType
double *(*)(void *) OriginCallbackType
double *(*)(void *) DirectionCallbackType
typename OutputImageType::RegionType OutputRegionType
typename OutputImageType::PixelType OutputPixelType
int(*)(void *) NumberOfComponentsCallbackType
void UpdateOutputInformation() override
Update the information describing the output data.
itkSetMacro2(CallbackUserData, void *)
float *(*)(void *) FloatOriginCallbackType
int *(*)(void *) DataExtentCallbackType
void(*)(void *) UpdateInformationCallbackType
int *(*)(void *) WholeExtentCallbackType
void SetSpacingCallback(FloatSpacingCallbackType f)
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....