ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkBSplineControlPointImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkBSplineControlPointImageFilter_h
19 #define __itkBSplineControlPointImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
24 #include "itkFixedArray.h"
25 #include "itkPointSet.h"
26 #include "itkVariableSizeMatrix.h"
27 #include "itkVector.h"
28 #include "itkVectorContainer.h"
29 
30 #include "vnl/vnl_matrix.h"
31 #include "vnl/vnl_vector.h"
32 
33 namespace itk
34 {
35 
59 template <typename TInputImage, typename TOutputImage = TInputImage>
61  : public ImageToImageFilter<TInputImage, TOutputImage>
62 {
63 public:
68 
70  itkNewMacro(Self);
71 
73  itkStaticConstMacro( ImageDimension, unsigned int,
74  TInputImage::ImageDimension );
75 
76  typedef TInputImage ControlPointLatticeType;
77  typedef TOutputImage OutputImageType;
78 
80  typedef typename OutputImageType::PixelType PixelType;
81  typedef typename OutputImageType::RegionType RegionType;
82  typedef typename OutputImageType::IndexType IndexType;
83  typedef typename OutputImageType::PointType PointType;
84  typedef typename OutputImageType::RegionType OutputImageRegionType;
85 
86  typedef typename OutputImageType::SpacingType SpacingType;
87  typedef typename OutputImageType::PointType OriginType;
88  typedef typename OutputImageType::SizeType SizeType;
89  typedef typename OutputImageType::DirectionType DirectionType;
90 
92  typedef float RealType;
93  typedef Image<RealType,
94  itkGetStaticConstMacro( ImageDimension )> RealImageType;
96 
97  typedef FixedArray<unsigned,
98  itkGetStaticConstMacro( ImageDimension )> ArrayType;
99 
101  typedef PointSet<PixelType,
102  itkGetStaticConstMacro( ImageDimension )> PointSetType;
105  typedef Image<PointDataType,
106  itkGetStaticConstMacro( ImageDimension )> PointDataImageType;
109 
116 
121  void SetSplineOrder( unsigned int );
122 
127  void SetSplineOrder( ArrayType );
128 
132  itkGetConstReferenceMacro( SplineOrder, ArrayType );
133 
150  itkSetMacro( CloseDimension, ArrayType );
151 
155  itkGetConstReferenceMacro( CloseDimension, ArrayType );
156 
160  itkSetMacro( Spacing, SpacingType );
161 
165  itkGetConstMacro( Spacing, SpacingType );
166 
170  itkSetMacro( Origin, OriginType );
171 
175  itkGetConstMacro( Origin, OriginType );
176 
180  itkSetMacro( Size, SizeType );
181 
185  itkGetConstMacro( Size, SizeType );
186 
201  itkSetMacro( Direction, DirectionType );
202 
206  itkGetConstMacro( Direction, DirectionType );
207 
215  typename ControlPointLatticeType::Pointer
217 
218 protected:
221  void PrintSelf( std::ostream& os, Indent indent ) const;
222 
227 
228 private:
229  BSplineControlPointImageFilter( const Self& ); //purposely not implemented
230  void operator=( const Self& ); //purposely not implemented
231 
232 
238 
243  unsigned int SplitRequestedRegion( unsigned int, unsigned int, OutputImageRegionType & );
244 
250  const RealType, const unsigned int );
251 
256 
262 
269 
271 
277 
279 
280  inline typename RealImageType::IndexType
281  NumberToIndex( unsigned int number, typename RealImageType::SizeType size )
282  {
283  typename RealImageType::IndexType k;
284  k[0] = 1;
285 
286  for ( unsigned int i = 1; i < ImageDimension; i++ )
287  {
288  k[i] = size[ImageDimension-i-1]*k[i-1];
289  }
290  typename RealImageType::IndexType index;
291  for ( unsigned int i = 0; i < ImageDimension; i++ )
292  {
293  index[ImageDimension-i-1]
294  = static_cast<unsigned int>( number/k[ImageDimension-i-1] );
295  number %= k[ImageDimension-i-1];
296  }
297  return index;
298  }
299 
300 };
301 
302 } // end namespace itk
303 
304 #ifndef ITK_MANUAL_INSTANTIATION
305 #include "itkBSplineControlPointImageFilter.hxx"
306 #endif
307 
308 #endif
Image< PointDataType, itkGetStaticConstMacro(ImageDimension)> PointDataImageType
CoxDeBoorBSplineKernelFunction< 3 > KernelType
Process a given a B-spline grid of control points.
void ThreadedGenerateData(const OutputImageRegionType &, ThreadIdType)
unsigned int SplitRequestedRegion(unsigned int, unsigned int, OutputImageRegionType &)
KernelType::Pointer m_Kernel[ImageDimension]
void PrintSelf(std::ostream &os, Indent indent) const
Represent the size (bounds) of a n-dimensional image.
Definition: itkSize.h:52
PointSetType::PointDataContainer PointDataContainerType
Image< RealType, itkGetStaticConstMacro(ImageDimension)> RealImageType
Base class for all process objects that output image data.
MeshTraits::PixelType PixelType
Definition: itkPointSet.h:101
Simulate a standard C array with copy semnatics.
Definition: itkFixedArray.h:50
BSpline kernel used for density estimation and nonparameteric regression.
ImageToImageFilter< TInputImage, TOutputImage > Superclass
vnl_matrix< RealType > m_RefinedLatticeCoefficients[ImageDimension]
BSpline kernel used for density estimation and nonparameteric regression.
ControlPointLatticeType::Pointer RefineControlPointLattice(ArrayType)
FixedArray< unsigned, itkGetStaticConstMacro(ImageDimension)> ArrayType
RealImageType::IndexType NumberToIndex(unsigned int number, typename RealImageType::SizeType size)
Superclass::IndexType IndexType
Definition: itkImage.h:122
void CollapsePhiLattice(PointDataImageType *, PointDataImageType *, const RealType, const unsigned int)
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
Definition: itkPointSet.h:84
Base class for filters that take an image as input and produce an image as output.
OutputImageType::RegionType OutputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
MeshTraits::PointDataContainer PointDataContainer
Definition: itkPointSet.h:108
PointSet< PixelType, itkGetStaticConstMacro(ImageDimension)> PointSetType
Templated n-dimensional image class.
Definition: itkImage.h:75
unsigned int ThreadIdType
Definition: itkIntTypes.h:159