ITK  4.4.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_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;
74  typedef typename OutputImageType::SizeType OutputSizeType;
75  typedef typename OutputImageType::IndexType OutputIndexType;
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;
174 
175  virtual void PropagateRequestedRegion(DataObject *);
176 
177  virtual void UpdateOutputInformation();
178 
179  virtual void GenerateData();
180 
181  virtual void GenerateOutputInformation();
182 
183 private:
184  VTKImageImport(const Self &); //purposely not implemented
185  void operator=(const Self &); //purposely not implemented
186 
188  UpdateInformationCallbackType m_UpdateInformationCallback;
189  PipelineModifiedCallbackType m_PipelineModifiedCallback;
190  WholeExtentCallbackType m_WholeExtentCallback;
191  SpacingCallbackType m_SpacingCallback;
192  FloatSpacingCallbackType m_FloatSpacingCallback;
193  OriginCallbackType m_OriginCallback;
194  FloatOriginCallbackType m_FloatOriginCallback;
195  ScalarTypeCallbackType m_ScalarTypeCallback;
196  NumberOfComponentsCallbackType m_NumberOfComponentsCallback;
197  PropagateUpdateExtentCallbackType m_PropagateUpdateExtentCallback;
198  UpdateDataCallbackType m_UpdateDataCallback;
199  DataExtentCallbackType m_DataExtentCallback;
200  BufferPointerCallbackType m_BufferPointerCallback;
201 
202  std::string m_ScalarTypeName;
203 };
204 } // namespace itk
205 
206 #ifndef ITK_MANUAL_INSTANTIATION
207 #include "itkVTKImageImport.hxx"
208 #endif
209 
210 #endif // __itkVTKImageImport_h
211