itkVTKImageImport.h
Go to the documentation of this file.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
00055 template <typename TOutputImage>
00056 class ITK_EXPORT VTKImageImport: public ImageSource<TOutputImage>
00057 {
00058 public:
00060 typedef VTKImageImport Self;
00061 typedef ImageSource<TOutputImage> Superclass;
00062 typedef SmartPointer<Self> Pointer;
00063
00065 itkNewMacro(Self);
00066
00068 itkTypeMacro(VTKImageImport, ImageSource);
00069
00071 typedef TOutputImage OutputImageType;
00072 typedef typename OutputImageType::Pointer OutputImagePointer;
00073 typedef typename OutputImageType::PixelType OutputPixelType;
00074 typedef typename OutputImageType::SizeType OutputSizeType;
00075 typedef typename OutputImageType::IndexType OutputIndexType;
00076 typedef typename OutputImageType::RegionType OutputRegionType;
00077
00079 itkStaticConstMacro(OutputImageDimension, unsigned int,
00080 OutputImageType::ImageDimension);
00081
00084 typedef void (*UpdateInformationCallbackType)(void*);
00085 typedef int (*PipelineModifiedCallbackType)(void*);
00086 typedef int* (*WholeExtentCallbackType)(void*);
00087 typedef double* (*SpacingCallbackType)(void*);
00088 typedef double* (*OriginCallbackType)(void*);
00089 typedef const char* (*ScalarTypeCallbackType)(void*);
00090 typedef int (*NumberOfComponentsCallbackType)(void*);
00091 typedef void (*PropagateUpdateExtentCallbackType)(void*, int*);
00092 typedef void (*UpdateDataCallbackType)(void*);
00093 typedef int* (*DataExtentCallbackType)(void*);
00094 typedef void* (*BufferPointerCallbackType)(void*);
00096
00098 typedef float* (*FloatSpacingCallbackType)(void*);
00099 typedef float* (*FloatOriginCallbackType)(void*);
00101
00103 itkSetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
00104 itkGetMacro(UpdateInformationCallback, UpdateInformationCallbackType);
00106
00108 itkSetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
00109 itkGetMacro(PipelineModifiedCallback, PipelineModifiedCallbackType);
00111
00113 itkSetMacro(WholeExtentCallback, WholeExtentCallbackType);
00114 itkGetMacro(WholeExtentCallback, WholeExtentCallbackType);
00116
00118 itkSetMacro(SpacingCallback, SpacingCallbackType);
00119 itkGetMacro(SpacingCallback, SpacingCallbackType);
00120 itkSetMacro(FloatSpacingCallback, FloatSpacingCallbackType);
00121 itkGetMacro(FloatSpacingCallback, FloatSpacingCallbackType);
00122 void SetSpacingCallback(FloatSpacingCallbackType f)
00123 { this->SetFloatSpacingCallback(f); }
00125
00127 itkSetMacro(OriginCallback, OriginCallbackType);
00128 itkGetMacro(OriginCallback, OriginCallbackType);
00129 itkSetMacro(FloatOriginCallback, FloatOriginCallbackType);
00130 itkGetMacro(FloatOriginCallback, FloatOriginCallbackType);
00131 void SetOriginCallback(FloatOriginCallbackType f)
00132 { this->SetFloatOriginCallback(f); }
00134
00136 itkSetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
00137 itkGetMacro(ScalarTypeCallback, ScalarTypeCallbackType);
00139
00141 itkSetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
00142 itkGetMacro(NumberOfComponentsCallback, NumberOfComponentsCallbackType);
00144
00146 itkSetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
00147 itkGetMacro(PropagateUpdateExtentCallback,PropagateUpdateExtentCallbackType);
00149
00151 itkSetMacro(UpdateDataCallback, UpdateDataCallbackType);
00152 itkGetMacro(UpdateDataCallback, UpdateDataCallbackType);
00154
00156 itkSetMacro(DataExtentCallback, DataExtentCallbackType);
00157 itkGetMacro(DataExtentCallback, DataExtentCallbackType);
00159
00161 itkSetMacro(BufferPointerCallback, BufferPointerCallbackType);
00162 itkGetMacro(BufferPointerCallback, BufferPointerCallbackType);
00164
00166 itkSetMacro2(CallbackUserData, void*);
00167 itkGetMacro(CallbackUserData, void*);
00169
00170 protected:
00171 VTKImageImport();
00172 ~VTKImageImport() {}
00173 void PrintSelf(std::ostream& os, Indent indent) const;
00174
00175 virtual void PropagateRequestedRegion(DataObject*);
00176 virtual void UpdateOutputInformation();
00177 virtual void GenerateData();
00178 virtual void GenerateOutputInformation();
00179
00180 private:
00181 VTKImageImport(const Self&);
00182 void operator= (const Self&);
00183
00184 void* m_CallbackUserData;
00185 UpdateInformationCallbackType m_UpdateInformationCallback;
00186 PipelineModifiedCallbackType m_PipelineModifiedCallback;
00187 WholeExtentCallbackType m_WholeExtentCallback;
00188 SpacingCallbackType m_SpacingCallback;
00189 FloatSpacingCallbackType m_FloatSpacingCallback;
00190 OriginCallbackType m_OriginCallback;
00191 FloatOriginCallbackType m_FloatOriginCallback;
00192 ScalarTypeCallbackType m_ScalarTypeCallback;
00193 NumberOfComponentsCallbackType m_NumberOfComponentsCallback;
00194 PropagateUpdateExtentCallbackType m_PropagateUpdateExtentCallback;
00195 UpdateDataCallbackType m_UpdateDataCallback;
00196 DataExtentCallbackType m_DataExtentCallback;
00197 BufferPointerCallbackType m_BufferPointerCallback;
00198
00199 std::string m_ScalarTypeName;
00200 };
00201
00202 }
00203
00204 #ifndef ITK_MANUAL_INSTANTIATION
00205 #include "itkVTKImageImport.txx"
00206 #endif
00207
00208 #endif // __itkVTKImageImport_h
00209