]> Creatis software - clitk.git/blob - itk/clitkVectorBSplineDecompositionImageFilterWithOBD.h
removed headers
[clitk.git] / itk / clitkVectorBSplineDecompositionImageFilterWithOBD.h
1 #ifndef __clitkVectorBSplineDecompositionImageFilterWithOBD_h
2 #define __clitkVectorBSplineDecompositionImageFilterWithOBD_h
3 #include <vector>
4
5 #include "itkImageLinearIteratorWithIndex.h"
6 #include "vnl/vnl_matrix.h"
7
8 #include "itkImageToImageFilter.h"
9
10 namespace clitk
11 {
12
13 template <class TInputImage, class TOutputImage>
14 class ITK_EXPORT VectorBSplineDecompositionImageFilterWithOBD : 
15     public itk::ImageToImageFilter<TInputImage,TOutputImage>
16 {
17 public:
18   /** Standard class typedefs. */
19   typedef VectorBSplineDecompositionImageFilterWithOBD       Self;
20   typedef itk::ImageToImageFilter<TInputImage,TOutputImage>  Superclass;
21   typedef itk::SmartPointer<Self>                    Pointer;
22   typedef itk::SmartPointer<const Self>              ConstPointer;
23
24   /** Run-time type information (and related methods). */
25   itkTypeMacro(VectorBSplineDecompositionImageFilterWithOBD, ImageToImageFilter);
26  
27   /** New macro for creation of through a Smart Pointer */
28   itkNewMacro( Self );
29
30   /** Inherit input and output image types from Superclass. */
31   typedef typename Superclass::InputImageType InputImageType;
32   typedef typename Superclass::InputImagePointer InputImagePointer;
33   typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
34   typedef typename Superclass::OutputImagePointer OutputImagePointer;
35
36   /** Dimension underlying input image. */
37   itkStaticConstMacro(ImageDimension, unsigned int,TInputImage::ImageDimension);
38   itkStaticConstMacro(OutputImageDimension, unsigned int,TOutputImage::ImageDimension);
39
40   //JV add the size 
41   typedef typename InputImageType::SizeType SizeType;
42
43   //JV vector dimension
44   itkStaticConstMacro(VectorDimension, unsigned int,TInputImage::PixelType::Dimension);
45
46   /** Iterator typedef support */
47   typedef itk::ImageLinearIteratorWithIndex<TOutputImage> OutputLinearIterator;
48
49   /** Get/Sets the Spline Order, supports 0th - 5th order splines. The default
50    *  is a 3rd order spline. */
51   void SetSplineOrder(unsigned int SplineOrder);
52   itkGetMacro(SplineOrder, int);
53   //JV  Set the order by Dimension
54   void SetSplineOrders(SizeType);
55
56   //JV modified from the original "double" version
57 #ifdef ITK_USE_CONCEPT_CHECKING
58   /** Begin concept checking */
59   itkConceptMacro(DimensionCheck,
60                   (itk::Concept::SameDimension<ImageDimension, OutputImageDimension>));
61   itkConceptMacro(InputConvertibleToDoubleCheck,
62                   (itk::Concept::Convertible<typename TInputImage::PixelType, itk::Vector<double, VectorDimension> >));
63   itkConceptMacro(OutputConvertibleToDoubleCheck,
64                   (itk::Concept::Convertible<typename TOutputImage::PixelType, itk::Vector<double, VectorDimension> >));
65   itkConceptMacro(InputConvertibleToOutputCheck,
66                   (itk::Concept::Convertible<typename TInputImage::PixelType,
67                            typename TOutputImage::PixelType>));
68   itkConceptMacro(DoubleConvertibleToOutputCheck,
69                   (itk::Concept::Convertible<itk::Vector<double, VectorDimension>, typename TOutputImage::PixelType>));
70   /** End concept checking */
71 #endif
72
73 protected:
74   VectorBSplineDecompositionImageFilterWithOBD();
75   virtual ~VectorBSplineDecompositionImageFilterWithOBD() {};
76   void PrintSelf(std::ostream& os, itk::Indent indent) const;
77
78   void GenerateData( );
79
80   /** This filter requires all of the input image. */
81   void GenerateInputRequestedRegion();
82
83   /** This filter must produce all of its output at once. */
84   void EnlargeOutputRequestedRegion( itk::DataObject *output ); 
85
86   /** These are needed by the smoothing spline routine. */
87   //JV multiple splineOrders
88   SizeType                  m_SplineOrders; //SplineOrder by dimension 
89
90   //JV
91   std::vector< itk::Vector<double, VectorDimension> >       m_Scratch;       // temp storage for processing of Coefficients
92   typename TInputImage::SizeType   m_DataLength;  // Image size
93   unsigned int              m_SplineOrder;   // User specified spline order (3rd or cubic is the default)
94   double                    m_SplinePoles[3];// Poles calculated for a given spline order
95   int                       m_NumberOfPoles; // number of poles
96   double                    m_Tolerance;     // Tolerance used for determining initial causal coefficient
97   unsigned int              m_IteratorDirection; // Direction for iterator incrementing
98
99
100 private:
101   VectorBSplineDecompositionImageFilterWithOBD( const Self& ); //purposely not implemented
102   void operator=( const Self& ); //purposely not implemented
103
104   /** Determines the poles given the Spline Order. */
105   virtual void SetPoles();
106
107   /** Converts a vector of data to a vector of Spline coefficients. */
108   virtual bool DataToCoefficients1D();
109
110   /** Converts an N-dimension image of data to an equivalent sized image
111    *    of spline coefficients. */
112   void DataToCoefficientsND();
113
114   /** Determines the first coefficient for the causal filtering of the data. */
115   virtual void SetInitialCausalCoefficient(double z);
116
117   /** Determines the first coefficient for the anti-causal filtering of the data. */
118   virtual void SetInitialAntiCausalCoefficient(double z);
119
120   /** Used to initialize the Coefficients image before calculation. */
121   void CopyImageToImage();
122
123   /** Copies a vector of data from the Coefficients image to the m_Scratch vector. */
124   void CopyCoefficientsToScratch( OutputLinearIterator & );
125
126   /** Copies a vector of data from m_Scratch to the Coefficients image. */
127   void CopyScratchToCoefficients( OutputLinearIterator & );
128   
129 };
130
131
132 } // namespace clitk
133
134 #ifndef ITK_MANUAL_INSTANTIATION
135 #include "clitkVectorBSplineDecompositionImageFilterWithOBD.txx"
136 #endif
137
138 #endif
139