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 __itkImageTransformer_h 00029 #define __itkImageTransformer_h 00030 00031 #include "itkProcessObject.h" 00032 #include "itkImage.h" 00033 00034 namespace itk 00035 { 00058 template< class TInputImage > 00059 class ITK_EXPORT ImageTransformer:public ProcessObject 00060 { 00061 public: 00063 typedef ImageTransformer Self; 00064 typedef ProcessObject Superclass; 00065 typedef SmartPointer< Self > Pointer; 00066 typedef SmartPointer< const Self > ConstPointer; 00067 00069 typedef DataObject::Pointer DataObjectPointer; 00070 00072 itkTypeMacro(ImageTransformer, ProcessObject); 00073 00075 typedef TInputImage InputImageType; 00076 typedef typename InputImageType::Pointer InputImagePointer; 00077 typedef typename InputImageType::RegionType InputImageRegionType; 00078 typedef typename InputImageType::PixelType InputImagePixelType; 00079 00081 itkStaticConstMacro(InputImageDimension, unsigned int, 00082 TInputImage::ImageDimension); 00083 00085 using Superclass::SetInput; 00086 virtual void SetInput(const InputImageType *image); 00087 virtual void SetInput(unsigned int, const TInputImage *image); 00088 const InputImageType * GetInput(void) const; 00089 InputImageType * GetInput(void); 00090 const InputImageType * GetInput(unsigned int idx) const; 00092 00112 virtual void PushBackInput(const InputImageType *image); 00113 virtual void PopBackInput(); 00114 virtual void PushFrontInput(const InputImageType *image); 00115 virtual void PopFrontInput(); 00117 00118 protected: 00119 ImageTransformer(); 00120 virtual ~ImageTransformer() {} 00121 00135 virtual void GenerateInputRequestedRegion(); 00136 00152 virtual void GenerateData(); 00153 00176 virtual 00177 void ThreadedGenerateData(const InputImageRegionType & inputRegionForThread, 00178 ThreadIdType threadId); 00179 00185 virtual void AllocateOutputs(); 00186 00197 virtual void BeforeThreadedGenerateData() {} 00198 00209 virtual void AfterThreadedGenerateData() {} 00210 00216 virtual 00217 unsigned int SplitRequestedRegion(unsigned int i, unsigned int num, InputImageRegionType & splitRegion); 00218 00222 static ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg); 00223 00233 void PushBackInput(const DataObject *input) 00234 { Superclass::PushBackInput(input); } 00235 void PushFrontInput(const DataObject *input) 00236 { Superclass::PushFrontInput(input); } 00238 00241 struct ThreadStruct { 00242 Pointer Filter; 00243 }; 00244 private: 00245 ImageTransformer(const Self &); //purposely not implemented 00246 void operator=(const Self &); //purposely not implemented 00247 }; 00248 } // end namespace itk 00250 00251 // Define instantiation macro for this template. 00252 #define ITK_TEMPLATE_ImageTransformer(_, EXPORT, TypeX, TypeY) \ 00253 namespace itk \ 00254 { \ 00255 _( 1 ( class EXPORT ImageTransformer< ITK_TEMPLATE_1 TypeX > ) ) \ 00256 namespace Templates \ 00257 { \ 00258 typedef ImageTransformer< ITK_TEMPLATE_1 TypeX > ImageTransformer##TypeY; \ 00259 } \ 00260 } 00261 00262 #if ITK_TEMPLATE_EXPLICIT 00263 #include "Templates/itkImageTransformer+-.h" 00264 #endif 00265 00266 #if ITK_TEMPLATE_TXX 00267 #include "itkImageTransformer.hxx" 00268 #endif 00269 00270 #endif 00271