]> Creatis software - clitk.git/blob - itk/clitkSliceBySliceRelativePositionFilter.h
some small corrections
[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 #include "clitkAddRelativePositionConstraintToLabelImageFilter.h"
25
26 namespace clitk {
27   
28   //--------------------------------------------------------------------
29   /*
30     Perform Relative Position filtering in a slice by slice manner. 
31   */
32   //--------------------------------------------------------------------
33   
34   template <class ImageType>
35   class ITK_EXPORT SliceBySliceRelativePositionFilter:
36     public clitk::FilterBase, 
37     public itk::ImageToImageFilter<ImageType, ImageType> 
38   {
39
40   public:
41     /** Standard class typedefs. */
42     typedef itk::ImageToImageFilter<ImageType, ImageType>   Superclass;
43     typedef SliceBySliceRelativePositionFilter              Self;
44     typedef itk::SmartPointer<Self>                         Pointer;
45     typedef itk::SmartPointer<const Self>                   ConstPointer;
46        
47     /** Method for creation through the object factory. */
48     itkNewMacro(Self);
49     
50     /** Run-time type information (and related methods). */
51     itkTypeMacro(SliceBySliceRelativePositionFilter, ImageToImageFilter);
52     FILTERBASE_INIT;
53
54     /** ImageDimension constants */
55     itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
56     typedef itk::Image<float, ImageDimension> FloatImageType;
57
58     /** Some convenient typedefs. */
59     typedef typename ImageType::ConstPointer ImageConstPointer;
60     typedef typename ImageType::Pointer      ImagePointer;
61     typedef typename ImageType::RegionType   RegionType; 
62     typedef typename ImageType::PixelType    PixelType;
63     typedef typename ImageType::SpacingType  SpacingType;
64     typedef typename ImageType::SizeType     SizeType;
65     typedef itk::Image<PixelType, ImageDimension-1> SliceType;
66     typedef clitk::AddRelativePositionConstraintToLabelImageFilter<SliceType> RelPosFilterType;
67     typedef typename RelPosFilterType::OrientationTypeEnumeration OrientationTypeEnumeration;
68     
69     /** Input : initial image and object */
70     void SetInput(const ImageType * image);
71     void SetInputObject(const ImageType * image);
72     
73     // Options
74     itkGetConstMacro(Direction, int);
75     itkSetMacro(Direction, int);
76     itkGetConstMacro(ObjectBackgroundValue, PixelType);
77     itkSetMacro(ObjectBackgroundValue, PixelType);
78
79     itkSetMacro(OrientationType, OrientationTypeEnumeration);
80     itkGetConstMacro(OrientationType, OrientationTypeEnumeration);
81     itkGetConstMacro(ResampleBeforeRelativePositionFilter, bool);
82     itkSetMacro(ResampleBeforeRelativePositionFilter, bool);
83     itkBooleanMacro(ResampleBeforeRelativePositionFilter);
84     itkGetConstMacro(IntermediateSpacing, double);
85     itkSetMacro(IntermediateSpacing, double);
86     itkGetConstMacro(FuzzyThreshold, double);
87     itkSetMacro(FuzzyThreshold, double);
88
89   protected:
90     SliceBySliceRelativePositionFilter();
91     virtual ~SliceBySliceRelativePositionFilter() {}
92     
93     int m_Direction;
94     PixelType m_ObjectBackgroundValue;
95     OrientationTypeEnumeration m_OrientationType;
96     double m_IntermediateSpacing;
97     double m_FuzzyThreshold;
98     bool m_ResampleBeforeRelativePositionFilter;
99
100     virtual void GenerateOutputInformation();
101     virtual void GenerateInputRequestedRegion();
102     virtual void GenerateData();
103
104     ImagePointer input;
105     ImagePointer object;
106     ImagePointer m_working_input;
107     ImagePointer m_working_object;
108
109   private:
110     SliceBySliceRelativePositionFilter(const Self&); //purposely not implemented
111     void operator=(const Self&); //purposely not implemented
112     
113   }; // end class
114   //--------------------------------------------------------------------
115
116 } // end namespace clitk
117 //--------------------------------------------------------------------
118
119 #ifndef ITK_MANUAL_INSTANTIATION
120 #include "clitkSliceBySliceRelativePositionFilter.txx"
121 #endif
122
123 #endif