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>
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
00070 typedef TOutputImage OutputImageType;
00071 typedef typename OutputImageType::Pointer OutputImagePointer;
00072 typedef typename OutputImageType::PixelType OutputPixelType;
00073 typedef typename OutputImageType::SizeType OutputSizeType;
00074 typedef typename OutputImageType::IndexType OutputIndexType;
00075 typedef typename OutputImageType::RegionType OutputRegionType;
00076
00078 itkStaticConstMacro(OutputImageDimension, unsigned int,
00079 OutputImageType::ImageDimension);
00080
00083 typedef void (*UpdateInformationCallbackType)(void*);
00084 typedef int (*PipelineModifiedCallbackType)(void*);
00085 typedef int* (*WholeExtentCallbackType)(void*);
00086 typedef float* (*SpacingCallbackType)(void*);
00087 typedef float* (*OriginCallbackType)(void*);
00088 typedef const char* (*ScalarTypeCallbackType)(void*);
00089 typedef int (*NumberOfComponentsCallbackType)(void*);
00090 typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
00091 typedef void (*UpdateDataCallbackType)(void*);
00092 typedef int* (*DataExtentCallbackType)(void*);
00093 typedef void* (*BufferPointerCallbackType)(void*);
00094
00096 itkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
00097 itkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
00098
00100 itkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
00101 itkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
00102
00104 itkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
00105 itkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
00106
00108 itkSetMacro(SpacingCallback, SpacingCallbackType);
00109 itkGetMacro(SpacingCallback, SpacingCallbackType);
00110
00112 itkSetMacro(OriginCallback, OriginCallbackType);
00113 itkGetMacro(OriginCallback, OriginCallbackType);
00114
00116 itkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
00117 itkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
00118
00120 itkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
00121 itkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
00122
00124 itkSetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
00125 itkGetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
00126
00128 itkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
00129 itkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
00130
00132 itkSetMacro(DataExtentCallback, DataExtentCallbackType);
00133 itkGetMacro(DataExtentCallback, DataExtentCallbackType);
00134
00136 itkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
00137 itkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
00138
00140 itkSetMacro2(CallbackUserData, void*);
00141 itkGetMacro(CallbackUserData, void*);
00142
00143 protected:
00144 VTKImageImport();
00145 ~VTKImageImport() {}
00146 void PrintSelf(std::ostream& os, Indent indent) const;
00147
00148 virtual void PropagateRequestedRegion(DataObject*);
00149 virtual void UpdateOutputInformation();
00150 virtual void GenerateData();
00151 virtual void GenerateOutputInformation();
00152
00153 private:
00154 VTKImageImport(const Self&);
00155 void operator= (const Self&);
00156
00157 void* m_CallbackUserData;
00158 UpdateInformationCallbackType m_UpdateInformationCallback;
00159 PipelineModifiedCallbackType m_PipelineModifiedCallback;
00160 WholeExtentCallbackType m_WholeExtentCallback;
00161 SpacingCallbackType m_SpacingCallback;
00162 OriginCallbackType m_OriginCallback;
00163 ScalarTypeCallbackType m_ScalarTypeCallback;
00164 NumberOfComponentsCallbackType m_NumberOfComponentsCallback;
00165 PropagateUpdateExtentCallbackType m_PropagateUpdateExtentCallback;
00166 UpdateDataCallbackType m_UpdateDataCallback;
00167 DataExtentCallbackType m_DataExtentCallback;
00168 BufferPointerCallbackType m_BufferPointerCallback;
00169
00170 std::string m_ScalarTypeName;
00171 };
00172
00173 }
00174
00175 #ifndef ITK_MANUAL_INSTANTIATION
00176 #include "itkVTKImageImport.txx"
00177 #endif
00178
00179 #endif // __itkVTKImageImport_h