ITK  4.6.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 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);
123  { this->SetFloatSpacingCallback(f); }
125 
127  itkSetMacro(OriginCallback, OriginCallbackType);
128  itkGetConstMacro(OriginCallback, OriginCallbackType);
129  itkSetMacro(FloatOriginCallback, FloatOriginCallbackType);
130  itkGetConstMacro(FloatOriginCallback, FloatOriginCallbackType);
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 
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
void PrintSelf(std::ostream &os, Indent indent) const
OutputImageType::Pointer OutputImagePointer
PipelineModifiedCallbackType m_PipelineModifiedCallback
ImageSource< TOutputImage > Superclass
UpdateInformationCallbackType m_UpdateInformationCallback
BufferPointerCallbackType m_BufferPointerCallback
Connect the end of an VTK pipeline to an ITK image pipeline.
void operator=(const Self &)
NumberOfComponentsCallbackType m_NumberOfComponentsCallback
double *(* OriginCallbackType)(void *)
PropagateUpdateExtentCallbackType m_PropagateUpdateExtentCallback
virtual void SetFloatOriginCallback(FloatOriginCallbackType _arg)
virtual void UpdateOutputInformation()
FloatSpacingCallbackType m_FloatSpacingCallback
DataExtentCallbackType m_DataExtentCallback
virtual void GenerateOutputInformation()
Base class for all process objects that output image data.
int(* PipelineModifiedCallbackType)(void *)
std::string m_ScalarTypeName
virtual void PropagateRequestedRegion(DataObject *)
void SetOriginCallback(FloatOriginCallbackType f)
OutputImageType::SizeType OutputSizeType
double *(* SpacingCallbackType)(void *)
int *(* WholeExtentCallbackType)(void *)
const char *(* ScalarTypeCallbackType)(void *)
SpacingCallbackType m_SpacingCallback
float *(* FloatOriginCallbackType)(void *)
OutputImageType::RegionType OutputRegionType
OutputImageType::PixelType OutputPixelType
itkSetMacro2(CallbackUserData, void *)
void(* UpdateInformationCallbackType)(void *)
void(* UpdateDataCallbackType)(void *)
TOutputImage OutputImageType
FloatOriginCallbackType m_FloatOriginCallback
int *(* DataExtentCallbackType)(void *)
int(* NumberOfComponentsCallbackType)(void *)
UpdateDataCallbackType m_UpdateDataCallback
virtual void SetFloatSpacingCallback(FloatSpacingCallbackType _arg)
void *(* BufferPointerCallbackType)(void *)
static const unsigned int OutputImageDimension
SmartPointer< Self > Pointer
Control indentation during Print() invocation.
Definition: itkIndent.h:49
float *(* FloatSpacingCallbackType)(void *)
void(* PropagateUpdateExtentCallbackType)(void *, int *)
WholeExtentCallbackType m_WholeExtentCallback
void SetSpacingCallback(FloatSpacingCallbackType f)
OriginCallbackType m_OriginCallback
virtual void GenerateData()
ScalarTypeCallbackType m_ScalarTypeCallback
Base class for all data objects in ITK.
OutputImageType::IndexType OutputIndexType