]> Creatis software - clitk.git/blob - itk/clitkInvertVFFilter.h
Change itkSimpleFastMutexLock to std::mutex
[clitk.git] / itk / clitkInvertVFFilter.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 __clitkInvertVFFilter_h
19 #define __clitkInvertVFFilter_h
20 #include "clitkImageCommon.h"
21
22 #include "itkImageToImageFilter.h"
23 #include "itkImage.h"
24 #include "itkImageRegionIterator.h"
25 #include "itkImageRegionIteratorWithIndex.h"
26 #include "itkNumericTraits.h"
27
28 namespace clitk
29 {
30   
31   template <class InputImageType, class OutputImageType>  
32   class ITK_EXPORT InvertVFFilter : public itk::ImageToImageFilter<InputImageType, OutputImageType>
33   
34   {
35   public:
36     typedef InvertVFFilter     Self;
37     typedef itk::ImageToImageFilter<InputImageType, OutputImageType>     Superclass;
38     typedef itk::SmartPointer<Self>            Pointer;
39     typedef itk::SmartPointer<const Self>      ConstPointer;
40    
41     /** Method for creation through the object factory. */
42     itkNewMacro(Self);  
43
44     /** Run-time type information (and related methods) */
45     itkTypeMacro( InvertVFFilter, ImageToImageFilter );
46   
47     /** Determine the image dimension. */
48     itkStaticConstMacro(ImageDimension, unsigned int,
49                         InputImageType::ImageDimension );
50     
51     //Some other typedefs
52     typedef double CoordRepType;
53     typedef itk::Image<double, ImageDimension> WeightsImageType;
54 #if ITK_VERSION_MAJOR <= 4
55     typedef itk::Image<itk::SimpleFastMutexLock, ImageDimension> MutexImageType;
56 #endif
57
58     /** Point type */
59     typedef itk::Point<CoordRepType,itkGetStaticConstMacro(ImageDimension)> PointType;
60
61     /** Inherit some types from the superclass. */
62     typedef typename OutputImageType::IndexType        IndexType;
63     typedef typename OutputImageType::SizeType         SizeType;
64     typedef typename OutputImageType::PixelType        PixelType;
65     typedef typename OutputImageType::SpacingType      SpacingType;
66
67     //Set Methods(inline)
68     itkSetMacro( Verbose, bool);
69     itkSetMacro( EdgePaddingValue, PixelType );
70 #if ITK_VERSION_MAJOR <= 4
71     void SetNumberOfThreads(unsigned int r ) ITK_OVERRIDE
72 #else
73     void SetNumberOfWorkUnits(unsigned int r ) ITK_OVERRIDE
74 #endif
75     {
76       m_NumberOfThreadsIsGiven=true;
77 #if ITK_VERSION_MAJOR <= 4
78       m_NumberOfThreads=r;
79 #else
80       m_NumberOfWorkUnits=r;
81 #endif
82     }
83     itkSetMacro(ThreadSafe, bool);
84     itkSetMacro(OutputSpacing, SpacingType);
85     itkSetMacro(OutputSize, SizeType);
86
87   
88   protected:
89     InvertVFFilter();
90     ~InvertVFFilter() {};
91     void GenerateData( ) ITK_OVERRIDE;
92     
93     bool m_Verbose;
94     bool m_NumberOfThreadsIsGiven;
95     SpacingType m_OutputSpacing;
96     SizeType m_OutputSize;
97 #if ITK_VERSION_MAJOR <= 4
98     unsigned int m_NumberOfThreads;
99 #else
100     unsigned int m_NumberOfWorkUnits;
101 #endif
102     PixelType m_EdgePaddingValue;
103     bool m_ThreadSafe;
104   };
105
106
107 } // end namespace clitk
108 #ifndef ITK_MANUAL_INSTANTIATION
109 #include "clitkInvertVFFilter.txx"
110 #endif
111
112 #endif // #define __clitkInvertVFFilter_h