ITK  5.4.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 
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  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 *);
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:
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
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
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::ScalarTypeCallbackType
const char *(*)(void *) ScalarTypeCallbackType
Definition: itkVTKImageImport.h:92
itk::VTKImageImport::UpdateDataCallbackType
void(*)(void *) UpdateDataCallbackType
Definition: itkVTKImageImport.h:95
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::OriginCallbackType
double *(*)(void *) OriginCallbackType
Definition: itkVTKImageImport.h:90
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
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::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
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::SetOriginCallback
void SetOriginCallback(FloatOriginCallbackType f)
Definition: itkVTKImageImport.h:138
itk::VTKImageImport::FloatSpacingCallbackType
float *(*)(void *) FloatSpacingCallbackType
Definition: itkVTKImageImport.h:101
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::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
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::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293