1 #ifndef __itkBSplineDecompositionImageFilterWithOBD_h
2 #define __itkBSplineDecompositionImageFilterWithOBD_h
6 #include "itkImageLinearIteratorWithIndex.h"
7 #include "vnl/vnl_matrix.h"
9 #include "itkImageToImageFilter.h"
14 template <class TInputImage, class TOutputImage>
15 class ITK_EXPORT BSplineDecompositionImageFilterWithOBD :
16 public ImageToImageFilter<TInputImage,TOutputImage>
19 /** Standard class typedefs. */
20 typedef BSplineDecompositionImageFilterWithOBD Self;
21 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
22 typedef SmartPointer<Self> Pointer;
23 typedef SmartPointer<const Self> ConstPointer;
25 /** Run-time type information (and related methods). */
26 itkTypeMacro(BSplineDecompositionImageFilterWithOBD, itk::ImageToImageFilter);
28 /** New macro for creation of through a Smart Pointer */
31 /** Inherit input and output image types from Superclass. */
32 typedef typename Superclass::InputImageType InputImageType;
33 typedef typename Superclass::InputImagePointer InputImagePointer;
34 typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
35 typedef typename Superclass::OutputImagePointer OutputImagePointer;
38 typedef typename InputImageType::SizeType SizeType;
40 /** Dimension underlying input image. */
41 itkStaticConstMacro(ImageDimension, unsigned int,TInputImage::ImageDimension);
42 itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
44 /** Iterator typedef support */
45 typedef ImageLinearIteratorWithIndex<TOutputImage> OutputLinearIterator;
47 /** Get/Sets the Spline Order, supports 0th - 5th order splines. The default
48 * is a 3rd order spline. */
49 //JV only used to set the current order
50 void SetSplineOrder(unsigned int SplineOrder);
51 //JV Set the order by Dimension
52 void SetSplineOrders(SizeType);
54 itkGetMacro(SplineOrder, int);
56 #ifdef ITK_USE_CONCEPT_CHECKING
57 /** Begin concept checking */
58 itkConceptMacro(DimensionCheck,
59 (Concept::SameDimension<ImageDimension, OutputImageDimension>));
60 itkConceptMacro(InputConvertibleToDoubleCheck,
61 (Concept::Convertible<typename TInputImage::PixelType, double>));
62 itkConceptMacro(OutputConvertibleToDoubleCheck,
63 (Concept::Convertible<typename TOutputImage::PixelType, double>));
64 itkConceptMacro(InputConvertibleToOutputCheck,
65 (Concept::Convertible<typename TInputImage::PixelType,
66 typename TOutputImage::PixelType>));
67 itkConceptMacro(DoubleConvertibleToOutputCheck,
68 (Concept::Convertible<double, typename TOutputImage::PixelType>));
69 /** End concept checking */
73 BSplineDecompositionImageFilterWithOBD();
74 virtual ~BSplineDecompositionImageFilterWithOBD() {};
75 void PrintSelf(std::ostream& os, Indent indent) const;
79 /** This filter requires all of the input image. */
80 void GenerateInputRequestedRegion();
82 /** This filter must produce all of its output at once. */
83 void EnlargeOutputRequestedRegion( DataObject *output );
85 /** These are needed by the smoothing spline routine. */
86 std::vector<double> m_Scratch; // temp storage for processing of Coefficients
87 typename TInputImage::SizeType m_DataLength; // Image size
88 unsigned int m_SplineOrder; // User specified spline order (3rd or cubic is the default)
90 //JV multiple splineOrders
91 SizeType m_SplineOrders; //SplineOrder by dimension
93 double m_SplinePoles[3];// Poles calculated for a given spline order
94 int m_NumberOfPoles; // number of poles
95 double m_Tolerance; // Tolerance used for determining initial causal coefficient
96 unsigned int m_IteratorDirection; // Direction for iterator incrementing
100 BSplineDecompositionImageFilterWithOBD( const Self& ); //purposely not implemented
101 void operator=( const Self& ); //purposely not implemented
103 /** Determines the poles given the Spline Order. */
104 virtual void SetPoles();
106 /** Converts a vector of data to a vector of Spline coefficients. */
107 virtual bool DataToCoefficients1D();
109 /** Converts an N-dimension image of data to an equivalent sized image
110 * of spline coefficients. */
111 void DataToCoefficientsND();
113 /** Determines the first coefficient for the causal filtering of the data. */
114 virtual void SetInitialCausalCoefficient(double z);
116 /** Determines the first coefficient for the anti-causal filtering of the data. */
117 virtual void SetInitialAntiCausalCoefficient(double z);
119 /** Used to initialize the Coefficients image before calculation. */
120 void CopyImageToImage();
122 /** Copies a vector of data from the Coefficients image to the m_Scratch vector. */
123 void CopyCoefficientsToScratch( OutputLinearIterator & );
125 /** Copies a vector of data from m_Scratch to the Coefficients image. */
126 void CopyScratchToCoefficients( OutputLinearIterator & );
132 #ifndef ITK_MANUAL_INSTANTIATION
133 #include "itkBSplineDecompositionImageFilterWithOBD.txx"