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