1 #ifndef __itkRayCastInterpolateImageFunctionWithOrigin_h
2 #define __itkRayCastInterpolateImageFunctionWithOrigin_h
3 #include "itkInterpolateImageFunction.h"
4 #include "itkTransform.h"
10 /** \class RayCastInterpolateImageFunctionWithOrigin
11 * \brief Projective interpolation of an image at specified positions.
13 * RayCastInterpolateImageFunctionWithOrigin casts rays through a 3-dimensional
14 * image and uses bilinear interpolation to integrate each plane of
17 * \warning This interpolator works for 3-dimensional images only.
19 * \ingroup ImageFunctions
21 template <class TInputImage, class TCoordRep = float>
22 class ITK_EXPORT RayCastInterpolateImageFunctionWithOrigin :
23 public InterpolateImageFunction<TInputImage,TCoordRep>
26 /** Standard class typedefs. */
27 typedef RayCastInterpolateImageFunctionWithOrigin Self;
28 typedef InterpolateImageFunction<TInputImage,TCoordRep> Superclass;
29 typedef SmartPointer<Self> Pointer;
30 typedef SmartPointer<const Self> ConstPointer;
32 /** Constants for the image dimensions */
33 itkStaticConstMacro(InputImageDimension, unsigned int,
34 TInputImage::ImageDimension);
37 * Type of the Transform Base class
38 * The fixed image should be a 3D image
40 typedef Transform<TCoordRep,3,3> TransformType;
42 typedef typename TransformType::Pointer TransformPointer;
43 typedef typename TransformType::InputPointType InputPointType;
44 typedef typename TransformType::OutputPointType OutputPointType;
45 typedef typename TransformType::ParametersType TransformParametersType;
46 typedef typename TransformType::JacobianType TransformJacobianType;
48 typedef typename Superclass::InputPixelType PixelType;
50 typedef typename TInputImage::SizeType SizeType;
52 typedef Vector<TCoordRep, 3> DirectionType;
54 /** Type of the Interpolator Base class */
55 typedef InterpolateImageFunction<TInputImage,TCoordRep> InterpolatorType;
57 typedef typename InterpolatorType::Pointer InterpolatorPointer;
60 /** Run-time type information (and related methods). */
61 itkTypeMacro(RayCastInterpolateImageFunctionWithOrigin, InterpolateImageFunction);
63 /** Method for creation through the object factory. */
66 /** OutputType typedef support. */
67 typedef typename Superclass::OutputType OutputType;
69 /** InputImageType typedef support. */
70 typedef typename Superclass::InputImageType InputImageType;
72 /** RealType typedef support. */
73 typedef typename Superclass::RealType RealType;
75 /** Dimension underlying input image. */
76 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
78 /** Point typedef support. */
79 typedef typename Superclass::PointType PointType;
81 /** Index typedef support. */
82 typedef typename Superclass::IndexType IndexType;
84 /** ContinuousIndex typedef support. */
85 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
88 * Interpolate the image at a point position.
90 * Returns the interpolated image intensity at a
91 * specified point position. No bounds checking is done.
92 * The point is assume to lie within the image buffer.
94 * ImageFunction::IsInsideBuffer() can be used to check bounds before
97 virtual OutputType Evaluate( const PointType& point ) const;
99 /** Interpolate the image at a continuous index position
101 * Returns the interpolated image intensity at a
102 * specified index position. No bounds checking is done.
103 * The point is assume to lie within the image buffer.
105 * Subclasses must override this method.
107 * ImageFunction::IsInsideBuffer() can be used to check bounds before
108 * calling the method.
110 virtual OutputType EvaluateAtContinuousIndex(
111 const ContinuousIndexType &index ) const;
114 /** Connect the Transform. */
115 itkSetObjectMacro( Transform, TransformType );
116 /** Get a pointer to the Transform. */
117 itkGetObjectMacro( Transform, TransformType );
119 /** Connect the Interpolator. */
120 itkSetObjectMacro( Interpolator, InterpolatorType );
121 /** Get a pointer to the Interpolator. */
122 itkGetObjectMacro( Interpolator, InterpolatorType );
124 /** Connect the Interpolator. */
125 itkSetMacro( FocalPoint, InputPointType );
126 /** Get a pointer to the Interpolator. */
127 itkGetMacro( FocalPoint, InputPointType );
129 /** Connect the Transform. */
130 itkSetMacro( Threshold, double );
131 /** Get a pointer to the Transform. */
132 itkGetMacro( Threshold, double );
134 /** Check if a point is inside the image buffer.
135 * \warning For efficiency, no validity checking of
136 * the input image pointer is done. */
137 inline bool IsInsideBuffer( const PointType & ) const
141 bool IsInsideBuffer( const ContinuousIndexType & ) const
145 bool IsInsideBuffer( const IndexType & ) const
153 RayCastInterpolateImageFunctionWithOrigin();
156 ~RayCastInterpolateImageFunctionWithOrigin(){};
159 void PrintSelf(std::ostream& os, Indent indent) const;
161 /// Transformation used to calculate the new focal point position
162 TransformPointer m_Transform;
164 /// The focal point or position of the ray source
165 InputPointType m_FocalPoint;
167 /// The threshold above which voxels along the ray path are integrated.
170 /// Pointer to the interpolator
171 InterpolatorPointer m_Interpolator;
175 RayCastInterpolateImageFunctionWithOrigin( const Self& ); //purposely not implemented
176 void operator=( const Self& ); //purposely not implemented
183 #ifndef ITK_MANUAL_INSTANTIATION
184 #include "itkRayCastInterpolateImageFunctionWithOrigin.txx"