ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 /*========================================================================= 00019 * 00020 * Portions of this file are subject to the VTK Toolkit Version 3 copyright. 00021 * 00022 * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00023 * 00024 * For complete copyright, license and disclaimer of warranty information 00025 * please refer to the NOTICE file at the top of the ITK source tree. 00026 * 00027 *=========================================================================*/ 00028 #ifndef __itkImageSource_h 00029 #define __itkImageSource_h 00030 00031 #include "itkProcessObject.h" 00032 #include "itkImage.h" 00033 00034 namespace itk 00035 { 00063 template< class TOutputImage > 00064 class ITK_EXPORT ImageSource:public ProcessObject 00065 { 00066 public: 00068 typedef ImageSource Self; 00069 typedef ProcessObject Superclass; 00070 typedef SmartPointer< Self > Pointer; 00071 typedef SmartPointer< const Self > ConstPointer; 00072 00074 typedef DataObject::Pointer DataObjectPointer; 00075 00076 typedef Superclass::DataObjectIdentifierType DataObjectIdentifierType; 00077 typedef Superclass::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; 00078 00080 itkTypeMacro(ImageSource, ProcessObject); 00081 00083 typedef TOutputImage OutputImageType; 00084 typedef typename OutputImageType::Pointer OutputImagePointer; 00085 typedef typename OutputImageType::RegionType OutputImageRegionType; 00086 typedef typename OutputImageType::PixelType OutputImagePixelType; 00087 00089 itkStaticConstMacro(OutputImageDimension, unsigned int, 00090 TOutputImage::ImageDimension); 00091 00139 OutputImageType * GetOutput(void); 00140 const OutputImageType * GetOutput(void) const; 00142 00143 OutputImageType * GetOutput(unsigned int idx); 00144 00180 virtual void GraftOutput(DataObject *output); 00181 00187 virtual void GraftOutput(const DataObjectIdentifierType & key, DataObject *output); 00188 00195 virtual void GraftNthOutput(unsigned int idx, DataObject *output); 00196 00210 using Superclass::MakeOutput; 00211 virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); 00213 00214 protected: 00215 ImageSource(); 00216 virtual ~ImageSource() {} 00217 00233 virtual void GenerateData(); 00234 00257 virtual 00258 void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, 00259 ThreadIdType threadId); 00260 00266 virtual void AllocateOutputs(); 00267 00278 virtual void BeforeThreadedGenerateData() {} 00279 00290 virtual void AfterThreadedGenerateData() {} 00291 00297 virtual 00298 unsigned int SplitRequestedRegion(unsigned int i, unsigned int num, OutputImageRegionType & splitRegion); 00299 00303 static ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg); 00304 00307 struct ThreadStruct { 00308 Pointer Filter; 00309 }; 00310 private: 00311 ImageSource(const Self &); //purposely not implemented 00312 void operator=(const Self &); //purposely not implemented 00313 }; 00314 } // end namespace itk 00316 00317 // Define instantiation macro for this template. 00318 #define ITK_TEMPLATE_ImageSource(_, EXPORT, TypeX, TypeY) \ 00319 namespace itk \ 00320 { \ 00321 _( 1 ( class EXPORT ImageSource< ITK_TEMPLATE_1 TypeX > ) ) \ 00322 namespace Templates \ 00323 { \ 00324 typedef ImageSource< ITK_TEMPLATE_1 TypeX > ImageSource##TypeY; \ 00325 } \ 00326 } 00327 00328 #if ITK_TEMPLATE_EXPLICIT 00329 #include "Templates/itkImageSource+-.h" 00330 #endif 00331 00332 #if ITK_TEMPLATE_TXX 00333 #include "itkImageSource.hxx" 00334 #endif 00335 00336 #endif 00337