ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkGridImageSource.h
Go to the documentation of this file.
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 #ifndef __itkGridImageSource_h
00019 #define __itkGridImageSource_h
00020 
00021 #include "itkGenerateImageSource.h"
00022 #include "itkFixedArray.h"
00023 #include "itkKernelFunctionBase.h"
00024 #include "itkVectorContainer.h"
00025 
00026 #include "vnl/vnl_vector.h"
00027 
00028 namespace itk
00029 {
00056 template< typename TOutputImage >
00057 class ITK_EXPORT GridImageSource
00058    :public GenerateImageSource< TOutputImage >
00059 {
00060 public:
00062   typedef GridImageSource                     Self;
00063   typedef GenerateImageSource< TOutputImage > Superclass;
00064   typedef SmartPointer< Self >                Pointer;
00065   typedef SmartPointer< const Self >          ConstPointer;
00066 
00068   itkTypeMacro(GridImageSource, GenerateImageSource);
00069 
00071   itkNewMacro(Self);
00072 
00073   typedef double RealType;
00074 
00076   itkStaticConstMacro(ImageDimension, unsigned int,
00077                       TOutputImage::ImageDimension);
00078 
00080   typedef TOutputImage                         ImageType;
00081   typedef typename TOutputImage::RegionType    ImageRegionType;
00082   typedef typename TOutputImage::PixelType     PixelType;
00083   typedef typename TOutputImage::SpacingType   SpacingType;
00084   typedef typename TOutputImage::PointType     OriginType;
00085   typedef typename TOutputImage::DirectionType DirectionType;
00086   typedef typename TOutputImage::SizeType      SizeType;
00087 
00088   typedef KernelFunctionBase<double>           KernelFunctionType;
00090   typedef FixedArray< RealType, itkGetStaticConstMacro(ImageDimension) >
00091   ArrayType;
00092   typedef FixedArray< bool, itkGetStaticConstMacro(ImageDimension) >
00093   BoolArrayType;
00094   typedef vnl_vector< RealType >                           PixelArrayType;
00095   typedef VectorContainer< SizeValueType, PixelArrayType > PixelArrayContainerType;
00097 
00099   itkSetObjectMacro(KernelFunction, KernelFunctionType);
00100   itkGetConstReferenceObjectMacro(KernelFunction, KernelFunctionType);
00102 
00103   itkSetMacro(Sigma, ArrayType);
00104   itkGetConstReferenceMacro(Sigma, ArrayType);
00105 
00106   itkSetMacro(GridSpacing, ArrayType);
00107   itkGetConstReferenceMacro(GridSpacing, ArrayType);
00108 
00109   itkSetMacro(GridOffset, ArrayType);
00110   itkGetConstReferenceMacro(GridOffset, ArrayType);
00111 
00112   itkSetMacro(WhichDimensions, BoolArrayType);
00113   itkGetConstReferenceMacro(WhichDimensions, BoolArrayType);
00114 
00115   itkSetMacro(Scale, RealType);
00116   itkGetConstReferenceMacro(Scale, RealType);
00117 protected:
00118   GridImageSource();
00119   // ~GridImageSource(){} default implementation ok
00120   void PrintSelf(std::ostream & os, Indent indent) const;
00121 
00122   virtual void
00123   ThreadedGenerateData(const ImageRegionType &
00124                        outputRegionForThread, ThreadIdType threadId);
00125 
00126   virtual void BeforeThreadedGenerateData();
00127 
00128 private:
00129   GridImageSource(const GridImageSource &); //purposely not implemented
00130   void operator=(const GridImageSource &);  //purposely not implemented
00131 
00135   typename PixelArrayContainerType::Pointer m_PixelArrays;
00136 
00138   typename KernelFunctionType::Pointer m_KernelFunction;
00139 
00142   ArrayType m_Sigma;
00143 
00145   ArrayType m_GridSpacing;
00146 
00148   ArrayType m_GridOffset;
00149 
00151   BoolArrayType m_WhichDimensions;
00152 
00154   RealType m_Scale;
00155 };
00156 } // end namespace itk
00157 
00158 #ifndef ITK_MANUAL_INSTANTIATION
00159 #include "itkGridImageSource.hxx"
00160 #endif
00161 
00162 #endif
00163