]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Algorithms/CPRFilter.h
Some bugs on CPR solved.
[cpPlugins.git] / lib / cpExtensions / Algorithms / CPRFilter.h
1 // -------------------------------------------------------------------------
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // -------------------------------------------------------------------------
4
5 #ifndef __CPEXTENSIONS__ALGORITHMS__CPRFILTER__H__
6 #define __CPEXTENSIONS__ALGORITHMS__CPRFILTER__H__
7
8 #include <vector>
9
10 #include <itkImageToImageFilter.h>
11 #include <itkInterpolateImageFunction.h>
12 #include <itkJoinSeriesImageFilter.h>
13 #include <itkPolyLineParametricPath.h>
14 #include <cpExtensions/Algorithms/IsoImageSlicer.h>
15
16 namespace cpExtensions
17 {
18   namespace Algorithms
19   {
20     /**
21      */
22     template< class I, class S = float >
23     class CPRFilter
24       : public itk::ImageToImageFilter< I, I >
25     {
26     public:
27       // Standard ITK typedefs.
28       typedef CPRFilter                       Self;
29       typedef itk::ImageToImageFilter< I, I > Superclass;
30       typedef itk::SmartPointer< Self >       Pointer;
31       typedef itk::SmartPointer< const Self > ConstPointer;
32       itkStaticConstMacro( VDimension, unsigned int, I::ImageDimension );
33
34       typedef I TImage;
35       typedef S TScalar;
36
37       typedef itk::InterpolateImageFunction< I, S >            TInterpolator;
38       typedef itk::PolyLineParametricPath< VDimension >        TAxis;
39       typedef cpExtensions::Algorithms::IsoImageSlicer< I, S > TSlicer;
40       typedef typename TSlicer::TSliceImage                    TSlice;
41       typedef itk::JoinSeriesImageFilter< TSlice, I >          TJoin;
42
43     public:
44       itkNewMacro( Self );
45       itkTypeMacro( CPRFilter, itk::ImageToImageFilter );
46
47       itkGetConstMacro( SliceRadius, double );
48       itkGetConstMacro( NumberOfSlices, unsigned int );
49       itkGetObjectMacro( Interpolator, TInterpolator );
50
51       itkSetMacro( SliceRadius, double );
52       itkSetMacro( NumberOfSlices, unsigned int );
53       itkSetObjectMacro( Interpolator, TInterpolator );
54
55     public:
56       const TAxis* GetAxis( ) const;
57       void SetAxis( const TAxis* axis );
58
59     protected:
60       CPRFilter( );
61       virtual ~CPRFilter( );
62
63       virtual void GenerateOutputInformation( );
64       virtual void GenerateData( );
65
66     protected:
67       double m_SliceRadius;
68       unsigned int m_NumberOfSlices;
69
70       typename TInterpolator::Pointer          m_Interpolator;
71       typename TJoin::Pointer                  m_Join;
72       std::vector< typename TSlicer::Pointer > m_Slices;
73     };
74
75   } // ecapseman
76
77 } // ecapseman
78
79 #ifndef ITK_MANUAL_INSTANTIATION
80 #include <cpExtensions/Algorithms/CPRFilter.hxx>
81 #endif // ITK_MANUAL_INSTANTIATION
82
83 #endif // __CPEXTENSIONS__ALGORITHMS__CPRFILTER__H__
84
85 // eof - $RCSfile$