ITK  4.13.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:
63 
65  itkNewMacro(Self);
66 
68  itkTypeMacro(VTKImageImport, ImageSource);
69 
71  typedef TOutputImage OutputImageType;
72  typedef typename OutputImageType::Pointer OutputImagePointer;
73  typedef typename OutputImageType::PixelType OutputPixelType;
76  typedef typename OutputImageType::RegionType OutputRegionType;
77 
79  itkStaticConstMacro(OutputImageDimension, unsigned int,
80  OutputImageType::ImageDimension);
81 
84  typedef void ( * UpdateInformationCallbackType )(void *);
85  typedef int ( * PipelineModifiedCallbackType )(void *);
86  typedef int * ( * WholeExtentCallbackType )(void *);
87  typedef double * ( * SpacingCallbackType )(void *);
88  typedef double * ( * OriginCallbackType )(void *);
89  typedef const char * ( *ScalarTypeCallbackType )(void *);
90  typedef int ( * NumberOfComponentsCallbackType )(void *);
91  typedef void ( * PropagateUpdateExtentCallbackType )(void *, int *);
92  typedef void ( * UpdateDataCallbackType )(void *);
93  typedef int * ( * DataExtentCallbackType )(void *);
94  typedef void * ( * BufferPointerCallbackType )(void *);
96 
98  typedef float * ( *FloatSpacingCallbackType )(void *);
99  typedef float * ( *FloatOriginCallbackType )(void *);
101 
103  itkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
104  itkGetConstMacro(UpdateInformationCallback, UpdateInformationCallbackType);
106 
108  itkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
109  itkGetConstMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
111 
113  itkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
114  itkGetConstMacro(WholeExtentCallback, WholeExtentCallbackType);
116 
118  itkSetMacro(SpacingCallback, SpacingCallbackType);
119  itkGetConstMacro(SpacingCallback, SpacingCallbackType);
120  itkSetMacro(FloatSpacingCallback, FloatSpacingCallbackType);
121  itkGetConstMacro(FloatSpacingCallback, FloatSpacingCallbackType);
122  void SetSpacingCallback(FloatSpacingCallbackType f)
123  { this->SetFloatSpacingCallback(f); }
125 
127  itkSetMacro(OriginCallback, OriginCallbackType);
128  itkGetConstMacro(OriginCallback, OriginCallbackType);
129  itkSetMacro(FloatOriginCallback, FloatOriginCallbackType);
130  itkGetConstMacro(FloatOriginCallback, FloatOriginCallbackType);
131  void SetOriginCallback(FloatOriginCallbackType f)
132  { this->SetFloatOriginCallback(f); }
134 
136  itkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
137  itkGetConstMacro(ScalarTypeCallback, ScalarTypeCallbackType);
139 
141  itkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
142  itkGetConstMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
144 
146  itkSetMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
147  itkGetConstMacro(PropagateUpdateExtentCallback, PropagateUpdateExtentCallbackType);
149 
151  itkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
152  itkGetConstMacro(UpdateDataCallback, UpdateDataCallbackType);
154 
156  itkSetMacro(DataExtentCallback, DataExtentCallbackType);
157  itkGetConstMacro(DataExtentCallback, DataExtentCallbackType);
159 
161  itkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
162  itkGetConstMacro(BufferPointerCallback, BufferPointerCallbackType);
164 
166  itkSetMacro2(CallbackUserData, void *);
167  itkGetConstMacro(CallbackUserData, void *);
169 
170 protected:
171  VTKImageImport();
173  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
174 
175  virtual void PropagateRequestedRegion(DataObject *) ITK_OVERRIDE;
176 
177  virtual void UpdateOutputInformation() ITK_OVERRIDE;
178 
179  virtual void GenerateData() ITK_OVERRIDE;
180 
181  virtual void GenerateOutputInformation() ITK_OVERRIDE;
182 
183 private:
184  ITK_DISALLOW_COPY_AND_ASSIGN(VTKImageImport);
185 
186  void * m_CallbackUserData;
187  UpdateInformationCallbackType m_UpdateInformationCallback;
188  PipelineModifiedCallbackType m_PipelineModifiedCallback;
189  WholeExtentCallbackType m_WholeExtentCallback;
190  SpacingCallbackType m_SpacingCallback;
191  FloatSpacingCallbackType m_FloatSpacingCallback;
192  OriginCallbackType m_OriginCallback;
193  FloatOriginCallbackType m_FloatOriginCallback;
194  ScalarTypeCallbackType m_ScalarTypeCallback;
195  NumberOfComponentsCallbackType m_NumberOfComponentsCallback;
196  PropagateUpdateExtentCallbackType m_PropagateUpdateExtentCallback;
197  UpdateDataCallbackType m_UpdateDataCallback;
198  DataExtentCallbackType m_DataExtentCallback;
199  BufferPointerCallbackType m_BufferPointerCallback;
200 
201  std::string m_ScalarTypeName;
202 };
203 } // namespace itk
204 
205 #ifndef ITK_MANUAL_INSTANTIATION
206 #include "itkVTKImageImport.hxx"
207 #endif
208 
209 #endif // itkVTKImageImport_h
OutputImageType::Pointer OutputImagePointer
ImageSource< TOutputImage > Superclass
Connect the end of an VTK pipeline to an ITK image pipeline.
Base class for all process objects that output image data.
#define itkSetMacro2(name, type)
void SetOriginCallback(FloatOriginCallbackType f)
OutputImageType::SizeType OutputSizeType
OutputImageType::RegionType OutputRegionType
OutputImageType::PixelType OutputPixelType
TOutputImage OutputImageType
SmartPointer< Self > Pointer
Control indentation during Print() invocation.
Definition: itkIndent.h:49
void SetSpacingCallback(FloatSpacingCallbackType f)
Base class for all data objects in ITK.
OutputImageType::IndexType OutputIndexType