ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 /*========================================================================= 00019 * 00020 * Portions of this file are subject to the VTK Toolkit Version 3 copyright. 00021 * 00022 * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00023 * 00024 * For complete copyright, license and disclaimer of warranty information 00025 * please refer to the NOTICE file at the top of the ITK source tree. 00026 * 00027 *=========================================================================*/ 00028 #ifndef __itkBSplineDecompositionImageFilter_h 00029 #define __itkBSplineDecompositionImageFilter_h 00030 00031 #include <vector> 00032 00033 #include "itkImageLinearIteratorWithIndex.h" 00034 #include "vnl/vnl_matrix.h" 00035 00036 #include "itkImageToImageFilter.h" 00037 00038 namespace itk 00039 { 00072 template< class TInputImage, class TOutputImage > 00073 class ITK_EXPORT BSplineDecompositionImageFilter: 00074 public ImageToImageFilter< TInputImage, TOutputImage > 00075 { 00076 public: 00078 typedef BSplineDecompositionImageFilter Self; 00079 typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass; 00080 typedef SmartPointer< Self > Pointer; 00081 typedef SmartPointer< const Self > ConstPointer; 00082 00084 itkTypeMacro(BSplineDecompositionImageFilter, ImageToImageFilter); 00085 00087 itkNewMacro(Self); 00088 00090 typedef typename Superclass::InputImageType InputImageType; 00091 typedef typename Superclass::InputImagePointer InputImagePointer; 00092 typedef typename Superclass::InputImageConstPointer InputImageConstPointer; 00093 typedef typename Superclass::OutputImagePointer OutputImagePointer; 00094 00095 typedef typename itk::NumericTraits< typename TOutputImage::PixelType >::RealType CoeffType; 00096 00098 itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension); 00099 itkStaticConstMacro(OutputImageDimension, unsigned int, 00100 TOutputImage::ImageDimension); 00102 00104 typedef ImageLinearIteratorWithIndex< TOutputImage > OutputLinearIterator; 00105 00108 void SetSplineOrder(unsigned int SplineOrder); 00109 00110 itkGetConstMacro(SplineOrder, int); 00111 00112 #ifdef ITK_USE_CONCEPT_CHECKING 00113 00114 itkConceptMacro( DimensionCheck, 00115 ( Concept::SameDimension< ImageDimension, OutputImageDimension > ) ); 00116 itkConceptMacro( InputConvertibleToOutputCheck, 00117 ( Concept::Convertible< typename TInputImage::PixelType, 00118 typename TOutputImage::PixelType > ) ); 00119 itkConceptMacro( DoubleConvertibleToOutputCheck, 00120 ( Concept::Convertible< double, typename TOutputImage::PixelType > ) ); 00121 00123 #endif 00124 protected: 00125 BSplineDecompositionImageFilter(); 00126 virtual ~BSplineDecompositionImageFilter() {} 00127 void PrintSelf(std::ostream & os, Indent indent) const; 00129 00130 void GenerateData(); 00131 00133 void GenerateInputRequestedRegion(); 00134 00136 void EnlargeOutputRequestedRegion(DataObject *output); 00137 00139 std::vector< CoeffType > m_Scratch; // temp storage for processing 00140 // of Coefficients 00141 typename TInputImage::SizeType m_DataLength; // Image size 00142 00143 unsigned int m_SplineOrder; // User specified spline order (3rd 00144 // or cubic is the default) 00145 double m_SplinePoles[3]; // Poles calculated for a given 00146 // spline order 00147 int m_NumberOfPoles; // number of poles 00148 00149 double m_Tolerance; // Tolerance used for determining 00150 // initial causal coefficient 00151 unsigned int m_IteratorDirection; // Direction for iterator 00152 // incrementing 00153 private: 00154 BSplineDecompositionImageFilter(const Self &); //purposely not implemented 00155 void operator=(const Self &); //purposely not implemented 00156 00158 virtual void SetPoles(); 00159 00161 virtual bool DataToCoefficients1D(); 00162 00165 void DataToCoefficientsND(); 00166 00168 virtual void SetInitialCausalCoefficient(double z); 00169 00172 virtual void SetInitialAntiCausalCoefficient(double z); 00173 00175 void CopyImageToImage(); 00176 00179 void CopyCoefficientsToScratch(OutputLinearIterator &); 00180 00182 void CopyScratchToCoefficients(OutputLinearIterator &); 00183 }; 00184 } // namespace itk 00185 00186 #ifndef ITK_MANUAL_INSTANTIATION 00187 #include "itkBSplineDecompositionImageFilter.hxx" 00188 #endif 00189 00190 #endif 00191