ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkVTKImageImport.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 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 
35 namespace itk
36 {
55 template< typename TOutputImage >
56 class ITK_TEMPLATE_EXPORT VTKImageImport:public ImageSource< TOutputImage >
57 {
58 public:
59  ITK_DISALLOW_COPY_AND_ASSIGN(VTKImageImport);
60 
65 
67  itkNewMacro(Self);
68 
70  itkTypeMacro(VTKImageImport, ImageSource);
71 
73  using OutputImageType = TOutputImage;
74  using OutputImagePointer = typename OutputImageType::Pointer;
75  using OutputPixelType = typename OutputImageType::PixelType;
79 
81  static constexpr unsigned int OutputImageDimension = OutputImageType::ImageDimension;
82 
85  using UpdateInformationCallbackType = void ( * )(void *);
86  using PipelineModifiedCallbackType = int ( * )(void *);
87  using WholeExtentCallbackType = int * ( * )(void *);
88  using SpacingCallbackType = double * ( * )(void *);
89  using OriginCallbackType = double * ( * )(void *);
90  using ScalarTypeCallbackType = const char * ( * )(void *);
91  using NumberOfComponentsCallbackType = int ( * )(void *);
92  using PropagateUpdateExtentCallbackType = void ( * )(void *, int *);
93  using UpdateDataCallbackType = void ( * )(void *);
94  using DataExtentCallbackType = int * ( * )(void *);
95  using BufferPointerCallbackType = void * ( * )(void *);
97 
99  using FloatSpacingCallbackType = float * ( * )(void *);
100  using FloatOriginCallbackType = float * ( * )(void *);
102 
104  itkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
105  itkGetConstMacro(UpdateInformationCallback, UpdateInformationCallbackType);
107 
109  itkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
110  itkGetConstMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
112 
114  itkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
115  itkGetConstMacro(WholeExtentCallback, WholeExtentCallbackType);
117 
119  itkSetMacro(SpacingCallback, SpacingCallbackType);
120  itkGetConstMacro(SpacingCallback, SpacingCallbackType);
121  itkSetMacro(FloatSpacingCallback, FloatSpacingCallbackType);
122  itkGetConstMacro(FloatSpacingCallback, FloatSpacingCallbackType);
124  { this->SetFloatSpacingCallback(f); }
126 
128  itkSetMacro(OriginCallback, OriginCallbackType);
129  itkGetConstMacro(OriginCallback, OriginCallbackType);
130  itkSetMacro(FloatOriginCallback, FloatOriginCallbackType);
131  itkGetConstMacro(FloatOriginCallback, FloatOriginCallbackType);
133  { this->SetFloatOriginCallback(f); }
135 
137  itkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
138  itkGetConstMacro(ScalarTypeCallback, ScalarTypeCallbackType);
140 
142  itkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
143  itkGetConstMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
145 
147  itkSetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
148  itkGetConstMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
150 
152  itkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
153  itkGetConstMacro(UpdateDataCallback, UpdateDataCallbackType);
155 
157  itkSetMacro(DataExtentCallback, DataExtentCallbackType);
158  itkGetConstMacro(DataExtentCallback, DataExtentCallbackType);
160 
162  itkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
163  itkGetConstMacro(BufferPointerCallback, BufferPointerCallbackType);
165 
167  itkSetMacro2(CallbackUserData, void *);
168  itkGetConstMacro(CallbackUserData, void *);
170 
171 protected:
172  VTKImageImport();
173  ~VTKImageImport() override {}
174  void PrintSelf(std::ostream & os, Indent indent) const override;
175 
176  void PropagateRequestedRegion(DataObject *) override;
177 
178  void UpdateOutputInformation() override;
179 
180  void GenerateData() override;
181 
182  void GenerateOutputInformation() override;
183 
184 private:
199 
200  std::string m_ScalarTypeName;
201 };
202 } // namespace itk
203 
204 #ifndef ITK_MANUAL_INSTANTIATION
205 #include "itkVTKImageImport.hxx"
206 #endif
207 
208 #endif // itkVTKImageImport_h
int(*)(void *) NumberOfComponentsCallbackType
typename OutputImageType::Pointer OutputImagePointer
PipelineModifiedCallbackType m_PipelineModifiedCallback
void(*)(void *) UpdateInformationCallbackType
UpdateInformationCallbackType m_UpdateInformationCallback
typename OutputImageType::IndexType OutputIndexType
BufferPointerCallbackType m_BufferPointerCallback
Connect the end of an VTK pipeline to an ITK image pipeline.
NumberOfComponentsCallbackType m_NumberOfComponentsCallback
PropagateUpdateExtentCallbackType m_PropagateUpdateExtentCallback
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
FloatSpacingCallbackType m_FloatSpacingCallback
DataExtentCallbackType m_DataExtentCallback
const char *(*)(void *) ScalarTypeCallbackType
Base class for all process objects that output image data.
#define itkSetMacro2(name, type)
void *(*)(void *) BufferPointerCallbackType
std::string m_ScalarTypeName
void SetOriginCallback(FloatOriginCallbackType f)
void(*)(void *, int *) PropagateUpdateExtentCallbackType
int *(*)(void *) WholeExtentCallbackType
typename OutputImageType::SizeType OutputSizeType
SpacingCallbackType m_SpacingCallback
TOutputImage OutputImageType
double *(*)(void *) OriginCallbackType
float *(*)(void *) FloatOriginCallbackType
int(*)(void *) PipelineModifiedCallbackType
double *(*)(void *) SpacingCallbackType
FloatOriginCallbackType m_FloatOriginCallback
typename OutputImageType::RegionType OutputRegionType
UpdateDataCallbackType m_UpdateDataCallback
Control indentation during Print() invocation.
Definition: itkIndent.h:49
WholeExtentCallbackType m_WholeExtentCallback
void SetSpacingCallback(FloatSpacingCallbackType f)
OriginCallbackType m_OriginCallback
float *(*)(void *) FloatSpacingCallbackType
ScalarTypeCallbackType m_ScalarTypeCallback
typename OutputImageType::PixelType OutputPixelType
int *(*)(void *) DataExtentCallbackType
void(*)(void *) UpdateDataCallbackType
Base class for all data objects in ITK.