ITK  5.3.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  * 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 {
56 template <typename TOutputImage>
57 class ITK_TEMPLATE_EXPORT VTKImageImport : public ImageSource<TOutputImage>
58 {
59 public:
60  ITK_DISALLOW_COPY_AND_MOVE(VTKImageImport);
61 
66 
68  itkNewMacro(Self);
69 
71  itkTypeMacro(VTKImageImport, ImageSource);
72 
74  using OutputImageType = TOutputImage;
75  using OutputImagePointer = typename OutputImageType::Pointer;
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 *);
99 
101  using FloatSpacingCallbackType = float * (*)(void *);
102  using FloatOriginCallbackType = float * (*)(void *);
104 
106  itkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
107  itkGetConstMacro(UpdateInformationCallback, UpdateInformationCallbackType);
109 
111  itkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
112  itkGetConstMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
114 
116  itkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
117  itkGetConstMacro(WholeExtentCallback, WholeExtentCallbackType);
119 
121  itkSetMacro(SpacingCallback, SpacingCallbackType);
122  itkGetConstMacro(SpacingCallback, SpacingCallbackType);
123  itkSetMacro(FloatSpacingCallback, FloatSpacingCallbackType);
124  itkGetConstMacro(FloatSpacingCallback, FloatSpacingCallbackType);
125  void
127  {
128  this->SetFloatSpacingCallback(f);
129  }
131 
133  itkSetMacro(OriginCallback, OriginCallbackType);
134  itkGetConstMacro(OriginCallback, OriginCallbackType);
135  itkSetMacro(FloatOriginCallback, FloatOriginCallbackType);
136  itkGetConstMacro(FloatOriginCallback, FloatOriginCallbackType);
137  void
139  {
140  this->SetFloatOriginCallback(f);
141  }
143 
145  itkSetMacro(DirectionCallback, DirectionCallbackType);
146  itkGetConstMacro(DirectionCallback, DirectionCallbackType);
148 
150  itkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
151  itkGetConstMacro(ScalarTypeCallback, ScalarTypeCallbackType);
153 
155  itkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
156  itkGetConstMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
158 
160  itkSetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
161  itkGetConstMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
163 
165  itkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
166  itkGetConstMacro(UpdateDataCallback, UpdateDataCallbackType);
168 
170  itkSetMacro(DataExtentCallback, DataExtentCallbackType);
171  itkGetConstMacro(DataExtentCallback, DataExtentCallbackType);
173 
175  itkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
176  itkGetConstMacro(BufferPointerCallback, BufferPointerCallbackType);
178 
180  itkSetMacro2(CallbackUserData, void *);
181  itkGetConstMacro(CallbackUserData, void *);
183 
184 protected:
185  VTKImageImport();
186  ~VTKImageImport() override = default;
187  void
188  PrintSelf(std::ostream & os, Indent indent) const override;
189 
190  void
191  PropagateRequestedRegion(DataObject *) override;
192 
193  void
194  UpdateOutputInformation() override;
195 
196  void
197  GenerateData() override;
198 
199  void
200  GenerateOutputInformation() override;
201 
202 private:
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
itk::VTKImageImport::m_BufferPointerCallback
BufferPointerCallbackType m_BufferPointerCallback
Definition: itkVTKImageImport.h:217
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itkImageSource.h
itk::VTKImageImport::SetSpacingCallback
void SetSpacingCallback(FloatSpacingCallbackType f)
Definition: itkVTKImageImport.h:126
itk::VTKImageImport::NumberOfComponentsCallbackType
int(*)(void *) NumberOfComponentsCallbackType
Definition: itkVTKImageImport.h:93
itk::VTKImageImport::m_PipelineModifiedCallback
PipelineModifiedCallbackType m_PipelineModifiedCallback
Definition: itkVTKImageImport.h:205
itk::VTKImageImport::ScalarTypeCallbackType
const char *(*)(void *) ScalarTypeCallbackType
Definition: itkVTKImageImport.h:92
itk::VTKImageImport::UpdateDataCallbackType
void(*)(void *) UpdateDataCallbackType
Definition: itkVTKImageImport.h:95
itk::VTKImageImport::m_FloatOriginCallback
FloatOriginCallbackType m_FloatOriginCallback
Definition: itkVTKImageImport.h:210
itk::VTKImageImport::OutputRegionType
typename OutputImageType::RegionType OutputRegionType
Definition: itkVTKImageImport.h:79
itk::VTKImageImport::OutputIndexType
typename OutputImageType::IndexType OutputIndexType
Definition: itkVTKImageImport.h:78
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::VTKImageImport::m_ScalarTypeName
std::string m_ScalarTypeName
Definition: itkVTKImageImport.h:219
itk::VTKImageImport::OriginCallbackType
double *(*)(void *) OriginCallbackType
Definition: itkVTKImageImport.h:90
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::VTKImageImport::m_DirectionCallback
DirectionCallbackType m_DirectionCallback
Definition: itkVTKImageImport.h:211
itk::VTKImageImport::m_FloatSpacingCallback
FloatSpacingCallbackType m_FloatSpacingCallback
Definition: itkVTKImageImport.h:208
itk::VTKImageImport::OutputPixelType
typename OutputImageType::PixelType OutputPixelType
Definition: itkVTKImageImport.h:76
itk::VTKImageImport::SpacingCallbackType
double *(*)(void *) SpacingCallbackType
Definition: itkVTKImageImport.h:89
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::VTKImageImport::m_UpdateDataCallback
UpdateDataCallbackType m_UpdateDataCallback
Definition: itkVTKImageImport.h:215
itk::VTKImageImport::m_UpdateInformationCallback
UpdateInformationCallbackType m_UpdateInformationCallback
Definition: itkVTKImageImport.h:204
itk::VTKImageImport::PropagateUpdateExtentCallbackType
void(*)(void *, int *) PropagateUpdateExtentCallbackType
Definition: itkVTKImageImport.h:94
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::VTKImageImport
Connect the end of an VTK pipeline to an ITK image pipeline.
Definition: itkVTKImageImport.h:57
itk::VTKImageImport::BufferPointerCallbackType
void *(*)(void *) BufferPointerCallbackType
Definition: itkVTKImageImport.h:97
itk::VTKImageImport::m_CallbackUserData
void * m_CallbackUserData
Definition: itkVTKImageImport.h:203
itkImportImageContainer.h
itk::VTKImageImport::OutputSizeType
typename OutputImageType::SizeType OutputSizeType
Definition: itkVTKImageImport.h:77
itk::VTKImageImport::DataExtentCallbackType
int *(*)(void *) DataExtentCallbackType
Definition: itkVTKImageImport.h:96
itkSetMacro2
#define itkSetMacro2(name, type)
Definition: itkVTKImageImport.h:24
itk::VTKImageImport::m_NumberOfComponentsCallback
NumberOfComponentsCallbackType m_NumberOfComponentsCallback
Definition: itkVTKImageImport.h:213
itk::VTKImageImport::m_WholeExtentCallback
WholeExtentCallbackType m_WholeExtentCallback
Definition: itkVTKImageImport.h:206
itk::VTKImageImport::SetOriginCallback
void SetOriginCallback(FloatOriginCallbackType f)
Definition: itkVTKImageImport.h:138
itk::VTKImageImport::FloatSpacingCallbackType
float *(*)(void *) FloatSpacingCallbackType
Definition: itkVTKImageImport.h:101
itk::VTKImageImport::m_PropagateUpdateExtentCallback
PropagateUpdateExtentCallbackType m_PropagateUpdateExtentCallback
Definition: itkVTKImageImport.h:214
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::VTKImageImport::PipelineModifiedCallbackType
int(*)(void *) PipelineModifiedCallbackType
Definition: itkVTKImageImport.h:87
itk::VTKImageImport::m_ScalarTypeCallback
ScalarTypeCallbackType m_ScalarTypeCallback
Definition: itkVTKImageImport.h:212
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::VTKImageImport::m_SpacingCallback
SpacingCallbackType m_SpacingCallback
Definition: itkVTKImageImport.h:207
itk::VTKImageImport::m_DataExtentCallback
DataExtentCallbackType m_DataExtentCallback
Definition: itkVTKImageImport.h:216
itk::VTKImageImport::UpdateInformationCallbackType
void(*)(void *) UpdateInformationCallbackType
Definition: itkVTKImageImport.h:86
itk::VTKImageImport::FloatOriginCallbackType
float *(*)(void *) FloatOriginCallbackType
Definition: itkVTKImageImport.h:102
itk::VTKImageImport::DirectionCallbackType
double *(*)(void *) DirectionCallbackType
Definition: itkVTKImageImport.h:91
itk::VTKImageImport::WholeExtentCallbackType
int *(*)(void *) WholeExtentCallbackType
Definition: itkVTKImageImport.h:88
itk::VTKImageImport::m_OriginCallback
OriginCallbackType m_OriginCallback
Definition: itkVTKImageImport.h:209
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293