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 double* (*SpacingCallbackType)(void*);
00087 typedef double* (*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*);
00095
00097 typedef float* (*FloatSpacingCallbackType)(void*);
00098 typedef float* (*FloatOriginCallbackType)(void*);
00100
00102 itkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
00103 itkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
00105
00107 itkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
00108 itkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
00110
00112 itkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
00113 itkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
00115
00117 itkSetMacro(SpacingCallback, SpacingCallbackType);
00118 itkGetMacro(SpacingCallback, SpacingCallbackType);
00119 itkSetMacro(FloatSpacingCallback, FloatSpacingCallbackType);
00120 itkGetMacro(FloatSpacingCallback, FloatSpacingCallbackType);
00121 void SetSpacingCallback(FloatSpacingCallbackType f)
00122 { this->SetFloatSpacingCallback(f); }
00124
00126 itkSetMacro(OriginCallback, OriginCallbackType);
00127 itkGetMacro(OriginCallback, OriginCallbackType);
00128 itkSetMacro(FloatOriginCallback, FloatOriginCallbackType);
00129 itkGetMacro(FloatOriginCallback, FloatOriginCallbackType);
00130 void SetOriginCallback(FloatOriginCallbackType f)
00131 { this->SetFloatOriginCallback(f); }
00133
00135 itkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
00136 itkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
00138
00140 itkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
00141 itkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
00143
00145 itkSetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
00146 itkGetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
00148
00150 itkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
00151 itkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
00153
00155 itkSetMacro(DataExtentCallback, DataExtentCallbackType);
00156 itkGetMacro(DataExtentCallback, DataExtentCallbackType);
00158
00160 itkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
00161 itkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
00163
00165 itkSetMacro2(CallbackUserData, void*);
00166 itkGetMacro(CallbackUserData, void*);
00168
00169 protected:
00170 VTKImageImport();
00171 ~VTKImageImport() {}
00172 void PrintSelf(std::ostream& os, Indent indent) const;
00173
00174 virtual void PropagateRequestedRegion(DataObject*);
00175 virtual void UpdateOutputInformation();
00176 virtual void GenerateData();
00177 virtual void GenerateOutputInformation();
00178
00179 private:
00180 VTKImageImport(const Self&);
00181 void operator= (const Self&);
00182
00183 void* m_CallbackUserData;
00184 UpdateInformationCallbackType m_UpdateInformationCallback;
00185 PipelineModifiedCallbackType m_PipelineModifiedCallback;
00186 WholeExtentCallbackType m_WholeExtentCallback;
00187 SpacingCallbackType m_SpacingCallback;
00188 FloatSpacingCallbackType m_FloatSpacingCallback;
00189 OriginCallbackType m_OriginCallback;
00190 FloatOriginCallbackType m_FloatOriginCallback;
00191 ScalarTypeCallbackType m_ScalarTypeCallback;
00192 NumberOfComponentsCallbackType m_NumberOfComponentsCallback;
00193 PropagateUpdateExtentCallbackType m_PropagateUpdateExtentCallback;
00194 UpdateDataCallbackType m_UpdateDataCallback;
00195 DataExtentCallbackType m_DataExtentCallback;
00196 BufferPointerCallbackType m_BufferPointerCallback;
00197
00198 std::string m_ScalarTypeName;
00199 };
00200
00201 }
00202
00203 #ifndef ITK_MANUAL_INSTANTIATION
00204 #include "itkVTKImageImport.txx"
00205 #endif
00206
00207 #endif // __itkVTKImageImport_h
00208