]> Creatis software - clitk.git/blob - itk/clitkSliceBySliceRelativePositionFilter.h
01f9cd9c833578d802af33e96ba39d0c6cfa43f7
[clitk.git] / itk / clitkSliceBySliceRelativePositionFilter.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://oncora1.lyon.fnclcc.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
19 #ifndef CLITKSLICEBYSLICERELATIVEPOSITIONFILTER_H
20 #define CLITKSLICEBYSLICERELATIVEPOSITIONFILTER_H
21
22 // clitk
23 #include "clitkFilterBase.h"
24
25 namespace clitk {
26   
27   //--------------------------------------------------------------------
28   /*
29     Perform Relative Position filtering in a slice by slice manner. 
30   */
31   //--------------------------------------------------------------------
32   
33   template <class ImageType>
34   class ITK_EXPORT SliceBySliceRelativePositionFilter:
35     public clitk::FilterBase, 
36     public itk::ImageToImageFilter<ImageType, ImageType> 
37   {
38
39   public:
40     /** Standard class typedefs. */
41     typedef itk::ImageToImageFilter<ImageType, ImageType> Superclass;
42     typedef SliceBySliceRelativePositionFilter              Self;
43     typedef itk::SmartPointer<Self>                         Pointer;
44     typedef itk::SmartPointer<const Self>                   ConstPointer;
45        
46     /** Method for creation through the object factory. */
47     itkNewMacro(Self);
48     
49     /** Run-time type information (and related methods). */
50     itkTypeMacro(SliceBySliceRelativePositionFilter, ImageToImageFilter);
51     FILTERBASE_INIT;
52
53     /** Some convenient typedefs. */
54     typedef typename ImageType::ConstPointer ImageConstPointer;
55     typedef typename ImageType::Pointer      ImagePointer;
56     typedef typename ImageType::RegionType   RegionType; 
57     typedef typename ImageType::PixelType    PixelType;
58     typedef typename ImageType::SpacingType  SpacingType;
59     typedef typename ImageType::SizeType     SizeType;
60     
61     /** ImageDimension constants */
62     itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
63     typedef itk::Image<float, ImageDimension> FloatImageType;
64
65     /** Input : initial image and object */
66     void SetInput(const ImageType * image);
67     void SetInputObject(const ImageType * image);
68     
69     // Options
70     itkGetConstMacro(Direction, int);
71     itkSetMacro(Direction, int);
72     itkGetConstMacro(ObjectBackgroundValue, PixelType);
73     itkSetMacro(ObjectBackgroundValue, PixelType);
74
75   protected:
76     SliceBySliceRelativePositionFilter();
77     virtual ~SliceBySliceRelativePositionFilter() {}
78     
79     int m_Direction;
80     PixelType m_ObjectBackgroundValue;
81
82     virtual void GenerateOutputInformation();
83     virtual void GenerateInputRequestedRegion();
84     virtual void GenerateData();
85
86     ImagePointer input;
87     ImagePointer object;
88     ImagePointer m_working_input;
89     ImagePointer m_working_object;
90
91   private:
92     SliceBySliceRelativePositionFilter(const Self&); //purposely not implemented
93     void operator=(const Self&); //purposely not implemented
94     
95   }; // end class
96   //--------------------------------------------------------------------
97
98 } // end namespace clitk
99 //--------------------------------------------------------------------
100
101 #ifndef ITK_MANUAL_INSTANTIATION
102 #include "clitkSliceBySliceRelativePositionFilter.txx"
103 #endif
104
105 #endif