]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Algorithms/CPRImageFilter.h
yet another refactoring
[cpPlugins.git] / lib / cpExtensions / Algorithms / CPRImageFilter.h
1 #ifndef __cpExtensions__Algorithms__CPRImageFilter__h__
2 #define __cpExtensions__Algorithms__CPRImageFilter__h__
3
4 #include <vector>
5 #include <itkImageToImageFilter.h>
6 #include <itkJoinSeriesImageFilter.h>
7 #include <cpExtensions/Algorithms/IsoImageSlicer.h>
8
9 namespace cpExtensions
10 {
11   namespace Algorithms
12   {
13     /**
14      */
15     template< class _TImage, class _TCurve >
16     class CPRImageFilter
17       : public itk::ImageToImageFilter< _TImage, _TImage >
18     {
19     public:
20       typedef CPRImageFilter                              Self;
21       typedef itk::ImageToImageFilter< _TImage, _TImage > Superclass;
22       typedef itk::SmartPointer< Self >                   Pointer;
23       typedef itk::SmartPointer< const Self >             ConstPointer;
24
25       typedef _TImage TImage;
26       typedef _TCurve TCurve;
27       typedef typename TCurve::TScalar TScalar;
28
29       typedef IsoImageSlicer< TImage, TScalar >      TSlicer;
30       typedef typename TSlicer::TInterpolateFunction TInterpolateFunction;
31       typedef typename TSlicer::TSliceImage          TSliceImage;
32
33       typedef itk::JoinSeriesImageFilter< TSliceImage, TImage > TJoinFilter;
34
35     public:
36       itkNewMacro( Self );
37       itkTypeMacro( CPRImageFilter, itk::ImageToImageFilter );
38
39       itkGetConstMacro( SliceRadius, double );
40       itkGetObjectMacro( Interpolator, TInterpolateFunction );
41
42       itkSetMacro( SliceRadius, double );
43       itkSetObjectMacro( Interpolator, TInterpolateFunction );
44
45     public:
46       _TCurve* GetCurve( );
47       const _TCurve* GetCurve( ) const;
48       void SetCurve( _TCurve* curve );
49
50     protected:
51       CPRImageFilter( );
52       virtual ~CPRImageFilter( );
53
54       virtual void GenerateOutputInformation( ) cpExtensions_OVERRIDE;
55       virtual void GenerateInputRequestedRegion( ) cpExtensions_OVERRIDE;
56       virtual void GenerateData( ) cpExtensions_OVERRIDE;
57
58     protected:
59       double m_SliceRadius;
60       typename TInterpolateFunction::Pointer m_Interpolator;
61
62       std::vector< typename TSlicer::Pointer > m_Slicers;
63       typename TJoinFilter::Pointer            m_Join;
64     };
65
66   } // ecapseman
67
68 } // ecapseman
69
70 #ifndef ITK_MANUAL_INSTANTIATION
71 #  include <cpExtensions/Algorithms/CPRImageFilter.hxx>
72 #endif // ITK_MANUAL_INSTANTIATION
73
74 #endif // __cpExtensions__Algorithms__CPRImageFilter__h__
75
76 // eof - $RCSfile$