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
00074 itkStaticConstMacro(OutputImageDimension, unsigned int,
00075 TOutputImage::ImageDimension);
00076
00124 OutputImageType * GetOutput(void);
00125 OutputImageType * GetOutput(unsigned int idx);
00127
00163 virtual void GraftOutput(DataObject *output);
00164
00171 virtual void GraftNthOutput(unsigned int idx, DataObject *output);
00172
00186 virtual DataObjectPointer MakeOutput(unsigned int idx);
00187
00188 protected:
00189 ImageSource();
00190 virtual ~ImageSource() {}
00191
00207 virtual void GenerateData();
00208
00231 virtual
00232 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00233 int threadId ) ITK_NO_RETURN;
00234
00235
00241 virtual void AllocateOutputs();
00242
00253 virtual void BeforeThreadedGenerateData() {};
00254
00265 virtual void AfterThreadedGenerateData() {};
00266
00272 virtual
00273 int SplitRequestedRegion(int i, int num, OutputImageRegionType& splitRegion);
00274
00278 static ITK_THREAD_RETURN_TYPE ThreaderCallback( void *arg );
00279
00281 struct ThreadStruct
00282 {
00283 Pointer Filter;
00284 };
00285
00286 private:
00287 ImageSource(const Self&);
00288 void operator=(const Self&);
00289
00290 };
00291
00292 }
00293
00294
00295 #define ITK_TEMPLATE_ImageSource(_, EXPORT, x, y) namespace itk { \
00296 _(1(class EXPORT ImageSource< ITK_TEMPLATE_1 x >)) \
00297 namespace Templates { typedef ImageSource< ITK_TEMPLATE_1 x > ImageSource##y; } \
00298 }
00299
00300 #if ITK_TEMPLATE_EXPLICIT
00301 # include "Templates/itkImageSource+-.h"
00302 #endif
00303
00304 #if ITK_TEMPLATE_TXX
00305 # include "itkImageSource.txx"
00306 #endif
00307
00308 #endif
00309