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
00040 template <class TOutputImage>
00041 class ITK_EXPORT ImageSource : public ProcessObject
00042 {
00043 public:
00045 typedef ImageSource Self;
00046 typedef ProcessObject Superclass;
00047 typedef SmartPointer<Self> Pointer;
00048 typedef SmartPointer<const Self> ConstPointer;
00049
00051 typedef DataObject::Pointer DataObjectPointer;
00052
00054 itkTypeMacro(ImageSource,ProcessObject);
00055
00057 typedef TOutputImage OutputImageType;
00058 typedef typename OutputImageType::Pointer OutputImagePointer;
00059 typedef typename OutputImageType::RegionType OutputImageRegionType;
00060 typedef typename OutputImageType::PixelType OutputImagePixelType;
00061
00102 OutputImageType * GetOutput(void);
00103 OutputImageType * GetOutput(unsigned int idx);
00104
00140 virtual void GraftOutput(OutputImageType *output);
00141
00148 virtual void GraftNthOutput(unsigned int idx, OutputImageType *output);
00149
00163 virtual DataObjectPointer MakeOutput(unsigned int idx);
00164
00165 protected:
00166 ImageSource();
00167 virtual ~ImageSource() {}
00168
00184 virtual void GenerateData();
00185
00208 virtual
00209 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00210 int threadId );
00211
00212
00218 virtual void PrepareOutputs() {};
00219
00225 virtual void AllocateOutputs();
00226
00237 virtual void BeforeThreadedGenerateData() {};
00238
00249 virtual void AfterThreadedGenerateData() {};
00250
00256 virtual
00257 int SplitRequestedRegion(int i, int num, OutputImageRegionType& splitRegion);
00258
00262 static ITK_THREAD_RETURN_TYPE ThreaderCallback( void *arg );
00263
00265 struct ThreadStruct
00266 {
00267 Pointer Filter;
00268 };
00269
00270 private:
00271 ImageSource(const Self&);
00272 void operator=(const Self&);
00273
00274 };
00275 #ifdef ITK_EXPLICIT_INSTANTIATION
00276 extern template class ImageSource<Image<float ,2> >;
00277 extern template class ImageSource<Image<double ,2> >;
00278 extern template class ImageSource<Image<unsigned char ,2> >;
00279 extern template class ImageSource<Image<unsigned short,2> >;
00280 extern template class ImageSource<Image<unsigned int ,2> >;
00281 extern template class ImageSource<Image<signed char ,2> >;
00282 extern template class ImageSource<Image<signed short ,2> >;
00283 extern template class ImageSource<Image<signed int ,2> >;
00284 extern template class ImageSource<Image<float ,3> >;
00285 extern template class ImageSource<Image<double ,3> >;
00286 extern template class ImageSource<Image<unsigned char ,3> >;
00287 extern template class ImageSource<Image<unsigned short,3> >;
00288 extern template class ImageSource<Image<unsigned int ,3> >;
00289 extern template class ImageSource<Image<signed char ,3> >;
00290 extern template class ImageSource<Image<signed short ,3> >;
00291 extern template class ImageSource<Image<signed int ,3> >;
00292 #endif
00293
00294 }
00295
00296 #ifndef ITK_MANUAL_INSTANTIATION
00297 #include "itkImageSource.txx"
00298 #endif
00299
00300 #endif
00301