00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkImageSource.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:12 $ 00007 Version: $Revision: 1.47 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 Portions of this code are covered under the VTK copyright. 00013 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details. 00014 00015 This software is distributed WITHOUT ANY WARRANTY; without even 00016 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00017 PURPOSE. See the above copyright notices for more information. 00018 00019 =========================================================================*/ 00020 #ifndef __itkImageSource_h 00021 #define __itkImageSource_h 00022 00023 #include "itkProcessObject.h" 00024 00025 namespace itk 00026 { 00027 00039 template <class TOutputImage> 00040 class ITK_EXPORT ImageSource : public ProcessObject 00041 { 00042 public: 00044 typedef ImageSource Self; 00045 typedef ProcessObject Superclass; 00046 typedef SmartPointer<Self> Pointer; 00047 typedef SmartPointer<const Self> ConstPointer; 00048 00050 typedef DataObject::Pointer DataObjectPointer; 00051 00053 itkTypeMacro(ImageSource,ProcessObject); 00054 00056 typedef TOutputImage OutputImageType; 00057 typedef typename OutputImageType::Pointer OutputImagePointer; 00058 typedef typename OutputImageType::RegionType OutputImageRegionType; 00059 typedef typename OutputImageType::PixelType OutputImagePixelType; 00060 00101 OutputImageType * GetOutput(void); 00102 OutputImageType * GetOutput(unsigned int idx); 00103 00139 virtual void GraftOutput(OutputImageType *output); 00140 00147 virtual void GraftNthOutput(unsigned int idx, OutputImageType *output); 00148 00162 virtual DataObjectPointer MakeOutput(unsigned int idx); 00163 00164 protected: 00165 ImageSource(); 00166 virtual ~ImageSource() {} 00167 00183 virtual void GenerateData(); 00184 00207 virtual 00208 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, 00209 int threadId ); 00210 00211 00217 virtual void PrepareOutputs() {}; 00218 00224 virtual void AllocateOutputs(); 00225 00236 virtual void BeforeThreadedGenerateData() {}; 00237 00248 virtual void AfterThreadedGenerateData() {}; 00249 00255 virtual 00256 int SplitRequestedRegion(int i, int num, OutputImageRegionType& splitRegion); 00257 00261 static ITK_THREAD_RETURN_TYPE ThreaderCallback( void *arg ); 00262 00264 struct ThreadStruct 00265 { 00266 Pointer Filter; 00267 }; 00268 00269 private: 00270 ImageSource(const Self&); //purposely not implemented 00271 void operator=(const Self&); //purposely not implemented 00272 00273 }; 00274 00275 } // end namespace itk 00276 00277 #ifndef ITK_MANUAL_INSTANTIATION 00278 #include "itkImageSource.txx" 00279 #endif 00280 00281 #endif 00282