00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __itkImageSource_h
00021 #define __itkImageSource_h
00022
00023 #include "itkProcessObject.h"
00024 #include "itkImage.h"
00025
00026 namespace itk
00027 {
00028
00051 template <class TOutputImage>
00052 class ITK_EXPORT ImageSource : public ProcessObject
00053 {
00054 public:
00056 typedef ImageSource Self;
00057 typedef ProcessObject Superclass;
00058 typedef SmartPointer<Self> Pointer;
00059 typedef SmartPointer<const Self> ConstPointer;
00060
00062 typedef DataObject::Pointer DataObjectPointer;
00063
00065 itkTypeMacro(ImageSource,ProcessObject);
00066
00068 typedef TOutputImage OutputImageType;
00069 typedef typename OutputImageType::Pointer OutputImagePointer;
00070 typedef typename OutputImageType::RegionType OutputImageRegionType;
00071 typedef typename OutputImageType::PixelType OutputImagePixelType;
00072
00113 OutputImageType * GetOutput(void);
00114 OutputImageType * GetOutput(unsigned int idx);
00116
00152 virtual void GraftOutput(DataObject *output);
00153
00160 virtual void GraftNthOutput(unsigned int idx, DataObject *output);
00161
00175 virtual DataObjectPointer MakeOutput(unsigned int idx);
00176
00177 protected:
00178 ImageSource();
00179 virtual ~ImageSource() {}
00180
00196 virtual void GenerateData();
00197
00220 virtual
00221 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00222 int threadId );
00223
00224
00230 virtual void AllocateOutputs();
00231
00242 virtual void BeforeThreadedGenerateData() {};
00243
00254 virtual void AfterThreadedGenerateData() {};
00255
00261 virtual
00262 int SplitRequestedRegion(int i, int num, OutputImageRegionType& splitRegion);
00263
00267 static ITK_THREAD_RETURN_TYPE ThreaderCallback( void *arg );
00268
00270 struct ThreadStruct
00271 {
00272 Pointer Filter;
00273 };
00274
00275 private:
00276 ImageSource(const Self&);
00277 void operator=(const Self&);
00278
00279 };
00280
00281 }
00282
00283
00284 #define ITK_TEMPLATE_ImageSource(_, EXPORT, x, y) namespace itk { \
00285 _(1(class EXPORT ImageSource< ITK_TEMPLATE_1 x >)) \
00286 namespace Templates { typedef ImageSource< ITK_TEMPLATE_1 x > ImageSource##y; } \
00287 }
00288
00289 #if ITK_TEMPLATE_EXPLICIT
00290 # include "Templates/itkImageSource+-.h"
00291 #endif
00292
00293 #if ITK_TEMPLATE_TXX
00294 # include "itkImageSource.txx"
00295 #endif
00296
00297 #endif
00298
00299