]> Creatis software - clitk.git/blob - itk/clitkForwardWarpImageFilter.h
Debug vvMainWinsow.ui
[clitk.git] / itk / clitkForwardWarpImageFilter.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://www.centreleonberard.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18 #ifndef __clitkForwardWarpImageFilter_h
19 #define __clitkForwardWarpImageFilter_h
20 #include "clitkImageCommon.h"
21
22 //itk include
23 #include "itkImageToImageFilter.h"
24 #include "itkImage.h"
25 #include "itkImageRegionIterator.h"
26 #include "itkImageRegionIteratorWithIndex.h"
27 #include "itkNumericTraits.h"
28 #include "itkSimpleFastMutexLock.h"
29
30 namespace clitk
31 {
32   
33   template <  class InputImageType,  class OutputImageType,  class DeformationFieldType  >  
34   class ForwardWarpImageFilter : public itk::ImageToImageFilter<InputImageType, OutputImageType>
35   
36   {
37   public:
38     typedef ForwardWarpImageFilter     Self;
39     typedef itk::ImageToImageFilter<InputImageType,OutputImageType>     Superclass;
40     typedef itk::SmartPointer<Self>            Pointer;
41     typedef itk::SmartPointer<const Self>      ConstPointer;
42
43    
44     /** Method for creation through the object factory. */
45     itkNewMacro(Self);  
46   
47     /** Determine the image dimension. */
48     itkStaticConstMacro(ImageDimension, unsigned int,
49                         InputImageType::ImageDimension );
50     itkStaticConstMacro(InputImageDimension, unsigned int,
51                         OutputImageType::ImageDimension );
52     itkStaticConstMacro(DeformationFieldDimension, unsigned int,
53                         DeformationFieldType::ImageDimension );
54
55
56     //Some other typedefs
57     typedef double CoordRepType;
58     typedef itk::Image<double, ImageDimension> WeightsImageType;
59     typedef itk::Image<itk::SimpleFastMutexLock, ImageDimension> MutexImageType;
60
61     /** Point type */
62     typedef itk::Point<CoordRepType,itkGetStaticConstMacro(ImageDimension)> PointType;
63
64     /** Inherit some types from the superclass. */
65     typedef typename OutputImageType::IndexType        IndexType;
66     typedef typename OutputImageType::SizeType         SizeType;
67     typedef typename OutputImageType::PixelType        PixelType;
68     typedef typename OutputImageType::SpacingType      SpacingType;
69     
70     //Set & Get Methods (inline)
71     itkSetMacro( Verbose, bool);
72     itkSetMacro( EdgePaddingValue, PixelType );
73     itkSetMacro( DeformationField, typename DeformationFieldType::Pointer);
74     void SetNumberOfThreads(unsigned int r )
75     {
76       m_NumberOfThreadsIsGiven=true;
77       m_NumberOfThreads=r;
78     }
79     itkSetMacro(ThreadSafe, bool);
80  
81   
82     //ITK concept checking, why not?  
83 #ifdef ITK_USE_CONCEPT_CHECKING
84     /** Begin concept checking */
85     itkConceptMacro(SameDimensionCheck1,
86                     (itk::Concept::SameDimension<ImageDimension, InputImageDimension>));
87     itkConceptMacro(SameDimensionCheck2,
88                     (itk::Concept::SameDimension<ImageDimension, DeformationFieldDimension>));
89     itkConceptMacro(InputHasNumericTraitsCheck,
90                     (itk::Concept::HasNumericTraits<typename InputImageType::PixelType>));
91     itkConceptMacro(DeformationFieldHasNumericTraitsCheck,
92                     (itk::Concept::HasNumericTraits<typename DeformationFieldType::PixelType::ValueType>));
93     /** End concept checking */
94 #endif
95
96   protected:
97     ForwardWarpImageFilter();
98     ~ForwardWarpImageFilter() {};
99     void GenerateData( );
100
101   
102   private:
103     bool m_Verbose;
104     bool m_NumberOfThreadsIsGiven;
105     unsigned int m_NumberOfThreads;
106     PixelType m_EdgePaddingValue;
107     typename DeformationFieldType::Pointer m_DeformationField;
108     bool m_ThreadSafe;
109  
110   };
111
112
113
114
115
116 } // end namespace clitk
117 #ifndef ITK_MANUAL_INSTANTIATION
118 #include "clitkForwardWarpImageFilter.txx"
119 #endif
120
121 #endif // #define __clitkForwardWarpImageFilter_h