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*);
00094
00096 typedef float* (*FloatSpacingCallbackType)(void*);
00097 typedef float* (*FloatOriginCallbackType)(void*);
00098
00100 itkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
00101 itkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
00102
00104 itkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
00105 itkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
00106
00108 itkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
00109 itkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
00110
00112 itkSetMacro(SpacingCallback, SpacingCallbackType);
00113 itkGetMacro(SpacingCallback, SpacingCallbackType);
00114 itkSetMacro(FloatSpacingCallback, FloatSpacingCallbackType);
00115 itkGetMacro(FloatSpacingCallback, FloatSpacingCallbackType);
00116 void SetSpacingCallback(FloatSpacingCallbackType f)
00117 { this->SetFloatSpacingCallback(f); }
00118
00120 itkSetMacro(OriginCallback, OriginCallbackType);
00121 itkGetMacro(OriginCallback, OriginCallbackType);
00122 itkSetMacro(FloatOriginCallback, FloatOriginCallbackType);
00123 itkGetMacro(FloatOriginCallback, FloatOriginCallbackType);
00124 void SetOriginCallback(FloatOriginCallbackType f)
00125 { this->SetFloatOriginCallback(f); }
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 FloatSpacingCallbackType m_FloatSpacingCallback;
00175 OriginCallbackType m_OriginCallback;
00176 FloatOriginCallbackType m_FloatOriginCallback;
00177 ScalarTypeCallbackType m_ScalarTypeCallback;
00178 NumberOfComponentsCallbackType m_NumberOfComponentsCallback;
00179 PropagateUpdateExtentCallbackType m_PropagateUpdateExtentCallback;
00180 UpdateDataCallbackType m_UpdateDataCallback;
00181 DataExtentCallbackType m_DataExtentCallback;
00182 BufferPointerCallbackType m_BufferPointerCallback;
00183
00184 std::string m_ScalarTypeName;
00185 };
00186
00187 }
00188
00189 #ifndef ITK_MANUAL_INSTANTIATION
00190 #include "itkVTKImageImport.txx"
00191 #endif
00192
00193 #endif // __itkVTKImageImport_h