00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkVTKImageImport_h
00018 #define __itkVTKImageImport_h
00019
00020 #include "itkImageSource.h"
00021 #include "itkImage.h"
00022 #include "itkImportImageContainer.h"
00023
00024 #define itkSetMacro2(name,type) \
00025 virtual void Set##name (type _arg) \
00026 { \
00027 itkDebugMacro("setting " #name " to " << _arg); \
00028 if (this->m_##name != _arg) \
00029 { \
00030 this->m_##name = _arg; \
00031 this->Modified(); \
00032 } \
00033 }
00034
00035 namespace itk
00036 {
00037
00054 template <typename TOutputImage, typename TVTKRealType=float>
00055 class ITK_EXPORT VTKImageImport: public ImageSource<TOutputImage>
00056 {
00057 public:
00059 typedef VTKImageImport Self;
00060 typedef ImageSource<TOutputImage> Superclass;
00061 typedef SmartPointer<Self> Pointer;
00062
00064 itkNewMacro(Self);
00065
00067 itkTypeMacro(VTKImageImport, ImageSource);
00068
00071 typedef TVTKRealType vtkRealType;
00072
00074 typedef TOutputImage OutputImageType;
00075 typedef typename OutputImageType::Pointer OutputImagePointer;
00076 typedef typename OutputImageType::PixelType OutputPixelType;
00077 typedef typename OutputImageType::SizeType OutputSizeType;
00078 typedef typename OutputImageType::IndexType OutputIndexType;
00079 typedef typename OutputImageType::RegionType OutputRegionType;
00080
00083 typedef vtkRealType VTKSpacingType;
00084 typedef vtkRealType VTKOriginType;
00085
00086
00087
00088
00090 itkStaticConstMacro(OutputImageDimension, unsigned int,
00091 OutputImageType::ImageDimension);
00092
00095 typedef void (*UpdateInformationCallbackType)(void*);
00096 typedef int (*PipelineModifiedCallbackType)(void*);
00097 typedef int* (*WholeExtentCallbackType)(void*);
00098 typedef VTKSpacingType * (*SpacingCallbackType)(void*);
00099 typedef VTKOriginType * (*OriginCallbackType)(void*);
00100 typedef const char* (*ScalarTypeCallbackType)(void*);
00101 typedef int (*NumberOfComponentsCallbackType)(void*);
00102 typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
00103 typedef void (*UpdateDataCallbackType)(void*);
00104 typedef int* (*DataExtentCallbackType)(void*);
00105 typedef void* (*BufferPointerCallbackType)(void*);
00106
00108 itkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
00109 itkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
00110
00112 itkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
00113 itkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
00114
00116 itkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
00117 itkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
00118
00120 itkSetMacro(SpacingCallback, SpacingCallbackType);
00121 itkGetMacro(SpacingCallback, SpacingCallbackType);
00122
00124 itkSetMacro(OriginCallback, OriginCallbackType);
00125 itkGetMacro(OriginCallback, OriginCallbackType);
00126
00128 itkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
00129 itkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
00130
00132 itkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
00133 itkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
00134
00136 itkSetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
00137 itkGetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
00138
00140 itkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
00141 itkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
00142
00144 itkSetMacro(DataExtentCallback, DataExtentCallbackType);
00145 itkGetMacro(DataExtentCallback, DataExtentCallbackType);
00146
00148 itkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
00149 itkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
00150
00152 itkSetMacro2(CallbackUserData, void*);
00153 itkGetMacro(CallbackUserData, void*);
00154
00155 protected:
00156 VTKImageImport();
00157 ~VTKImageImport() {}
00158 void PrintSelf(std::ostream& os, Indent indent) const;
00159
00160 virtual void PropagateRequestedRegion(DataObject*);
00161 virtual void UpdateOutputInformation();
00162 virtual void GenerateData();
00163 virtual void GenerateOutputInformation();
00164
00165 private:
00166 VTKImageImport(const Self&);
00167 void operator= (const Self&);
00168
00169 void* m_CallbackUserData;
00170 UpdateInformationCallbackType m_UpdateInformationCallback;
00171 PipelineModifiedCallbackType m_PipelineModifiedCallback;
00172 WholeExtentCallbackType m_WholeExtentCallback;
00173 SpacingCallbackType m_SpacingCallback;
00174 OriginCallbackType m_OriginCallback;
00175 ScalarTypeCallbackType m_ScalarTypeCallback;
00176 NumberOfComponentsCallbackType m_NumberOfComponentsCallback;
00177 PropagateUpdateExtentCallbackType m_PropagateUpdateExtentCallback;
00178 UpdateDataCallbackType m_UpdateDataCallback;
00179 DataExtentCallbackType m_DataExtentCallback;
00180 BufferPointerCallbackType m_BufferPointerCallback;
00181
00182 std::string m_ScalarTypeName;
00183 };
00184
00185 }
00186
00187 #ifndef ITK_MANUAL_INSTANTIATION
00188 #include "itkVTKImageImport.txx"
00189 #endif
00190
00191 #endif // __itkVTKImageImport_h