]> Creatis software - clitk.git/blob - itk/clitkForwardWarpImageFilter.h
Initial revision
[clitk.git] / itk / clitkForwardWarpImageFilter.h
1 #ifndef __clitkForwardWarpImageFilter_h
2 #define __clitkForwardWarpImageFilter_h
3
4 //clitk include
5 #include "clitkIOCommon.h"
6
7 //itk include
8 #include "itkImageToImageFilter.h"
9 #include "itkImage.h"
10 #include "itkImageRegionIterator.h"
11 #include "itkImageRegionIteratorWithIndex.h"
12 #include "itkNumericTraits.h"
13 #include "itkSimpleFastMutexLock.h"
14
15 namespace clitk
16 {
17   
18   template <  class InputImageType,  class OutputImageType,  class DeformationFieldType  >  
19   class ForwardWarpImageFilter : public itk::ImageToImageFilter<InputImageType, OutputImageType>
20   
21   {
22   public:
23     typedef ForwardWarpImageFilter     Self;
24     typedef itk::ImageToImageFilter<InputImageType,OutputImageType>     Superclass;
25     typedef itk::SmartPointer<Self>            Pointer;
26     typedef itk::SmartPointer<const Self>      ConstPointer;
27
28    
29     /** Method for creation through the object factory. */
30     itkNewMacro(Self);  
31   
32     /** Determine the image dimension. */
33     itkStaticConstMacro(ImageDimension, unsigned int,
34                         InputImageType::ImageDimension );
35     itkStaticConstMacro(InputImageDimension, unsigned int,
36                         OutputImageType::ImageDimension );
37     itkStaticConstMacro(DeformationFieldDimension, unsigned int,
38                         DeformationFieldType::ImageDimension );
39
40
41     //Some other typedefs
42     typedef double CoordRepType;
43     typedef itk::Image<double, ImageDimension> WeightsImageType;
44     typedef itk::Image<itk::SimpleFastMutexLock, ImageDimension> MutexImageType;
45
46     /** Point type */
47     typedef itk::Point<CoordRepType,itkGetStaticConstMacro(ImageDimension)> PointType;
48
49     /** Inherit some types from the superclass. */
50     typedef typename OutputImageType::IndexType        IndexType;
51     typedef typename OutputImageType::SizeType         SizeType;
52     typedef typename OutputImageType::PixelType        PixelType;
53     typedef typename OutputImageType::SpacingType      SpacingType;
54     
55     //Set & Get Methods (inline)
56     itkSetMacro( Verbose, bool);
57     itkSetMacro( EdgePaddingValue, PixelType );
58     itkSetMacro( DeformationField, typename DeformationFieldType::Pointer);
59     void SetNumberOfThreads(unsigned int r )
60     {
61       m_NumberOfThreadsIsGiven=true;
62       m_NumberOfThreads=r;
63     }
64     itkSetMacro(ThreadSafe, bool);
65  
66   
67     //ITK concept checking, why not?  
68 #ifdef ITK_USE_CONCEPT_CHECKING
69     /** Begin concept checking */
70     itkConceptMacro(SameDimensionCheck1,
71                     (itk::Concept::SameDimension<ImageDimension, InputImageDimension>));
72     itkConceptMacro(SameDimensionCheck2,
73                     (itk::Concept::SameDimension<ImageDimension, DeformationFieldDimension>));
74     itkConceptMacro(InputHasNumericTraitsCheck,
75                     (itk::Concept::HasNumericTraits<typename InputImageType::PixelType>));
76     itkConceptMacro(DeformationFieldHasNumericTraitsCheck,
77                     (itk::Concept::HasNumericTraits<typename DeformationFieldType::PixelType::ValueType>));
78     /** End concept checking */
79 #endif
80
81   protected:
82     ForwardWarpImageFilter();
83     ~ForwardWarpImageFilter() {};
84     void GenerateData( );
85
86   
87   private:
88     bool m_Verbose;
89     bool m_NumberOfThreadsIsGiven;
90     unsigned int m_NumberOfThreads;
91     PixelType m_EdgePaddingValue;
92     typename DeformationFieldType::Pointer m_DeformationField;
93     bool m_ThreadSafe;
94  
95   };
96
97
98
99
100
101 } // end namespace clitk
102 #ifndef ITK_MANUAL_INSTANTIATION
103 #include "clitkForwardWarpImageFilter.txx"
104 #endif
105
106 #endif // #define __clitkForwardWarpImageFilter_h