1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18 #ifndef __itkRayCastInterpolateImageFunctionWithOrigin_h
19 #define __itkRayCastInterpolateImageFunctionWithOrigin_h
20 #include "itkInterpolateImageFunction.h"
21 #include "itkTransform.h"
22 #include "itkVector.h"
27 /** \class RayCastInterpolateImageFunctionWithOrigin
28 * \brief Projective interpolation of an image at specified positions.
30 * RayCastInterpolateImageFunctionWithOrigin casts rays through a 3-dimensional
31 * image and uses bilinear interpolation to integrate each plane of
34 * \warning This interpolator works for 3-dimensional images only.
36 * \ingroup ImageFunctions
38 template <class TInputImage, class TCoordRep = float>
39 class ITK_EXPORT RayCastInterpolateImageFunctionWithOrigin :
40 public InterpolateImageFunction<TInputImage,TCoordRep>
43 /** Standard class typedefs. */
44 typedef RayCastInterpolateImageFunctionWithOrigin Self;
45 typedef InterpolateImageFunction<TInputImage,TCoordRep> Superclass;
46 typedef SmartPointer<Self> Pointer;
47 typedef SmartPointer<const Self> ConstPointer;
49 /** Constants for the image dimensions */
50 itkStaticConstMacro(InputImageDimension, unsigned int,
51 TInputImage::ImageDimension);
54 * Type of the Transform Base class
55 * The fixed image should be a 3D image
57 typedef Transform<TCoordRep,3,3> TransformType;
59 typedef typename TransformType::Pointer TransformPointer;
60 typedef typename TransformType::InputPointType InputPointType;
61 typedef typename TransformType::OutputPointType OutputPointType;
62 typedef typename TransformType::ParametersType TransformParametersType;
63 typedef typename TransformType::JacobianType TransformJacobianType;
65 typedef typename Superclass::InputPixelType PixelType;
67 typedef typename TInputImage::SizeType SizeType;
69 typedef Vector<TCoordRep, 3> DirectionType;
71 /** Type of the Interpolator Base class */
72 typedef InterpolateImageFunction<TInputImage,TCoordRep> InterpolatorType;
74 typedef typename InterpolatorType::Pointer InterpolatorPointer;
77 /** Run-time type information (and related methods). */
78 itkTypeMacro(RayCastInterpolateImageFunctionWithOrigin, InterpolateImageFunction);
80 /** Method for creation through the object factory. */
83 /** OutputType typedef support. */
84 typedef typename Superclass::OutputType OutputType;
86 /** InputImageType typedef support. */
87 typedef typename Superclass::InputImageType InputImageType;
89 /** RealType typedef support. */
90 typedef typename Superclass::RealType RealType;
92 /** Dimension underlying input image. */
93 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
95 /** Point typedef support. */
96 typedef typename Superclass::PointType PointType;
98 /** Index typedef support. */
99 typedef typename Superclass::IndexType IndexType;
101 /** ContinuousIndex typedef support. */
102 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
105 * Interpolate the image at a point position.
107 * Returns the interpolated image intensity at a
108 * specified point position. No bounds checking is done.
109 * The point is assume to lie within the image buffer.
111 * ImageFunction::IsInsideBuffer() can be used to check bounds before
112 * calling the method.
114 virtual OutputType Evaluate( const PointType& point ) const;
116 /** Interpolate the image at a continuous index position
118 * Returns the interpolated image intensity at a
119 * specified index position. No bounds checking is done.
120 * The point is assume to lie within the image buffer.
122 * Subclasses must override this method.
124 * ImageFunction::IsInsideBuffer() can be used to check bounds before
125 * calling the method.
127 virtual OutputType EvaluateAtContinuousIndex(
128 const ContinuousIndexType &index ) const;
131 /** Connect the Transform. */
132 itkSetObjectMacro( Transform, TransformType );
133 /** Get a pointer to the Transform. */
134 itkGetObjectMacro( Transform, TransformType );
136 /** Connect the Interpolator. */
137 itkSetObjectMacro( Interpolator, InterpolatorType );
138 /** Get a pointer to the Interpolator. */
139 itkGetObjectMacro( Interpolator, InterpolatorType );
141 /** Connect the Interpolator. */
142 itkSetMacro( FocalPoint, InputPointType );
143 /** Get a pointer to the Interpolator. */
144 itkGetMacro( FocalPoint, InputPointType );
146 /** Connect the Transform. */
147 itkSetMacro( Threshold, double );
148 /** Get a pointer to the Transform. */
149 itkGetMacro( Threshold, double );
151 /** Check if a point is inside the image buffer.
152 * \warning For efficiency, no validity checking of
153 * the input image pointer is done. */
154 inline bool IsInsideBuffer( const PointType & ) const
158 bool IsInsideBuffer( const ContinuousIndexType & ) const
162 bool IsInsideBuffer( const IndexType & ) const
170 RayCastInterpolateImageFunctionWithOrigin();
173 ~RayCastInterpolateImageFunctionWithOrigin(){};
176 void PrintSelf(std::ostream& os, Indent indent) const;
178 /// Transformation used to calculate the new focal point position
179 TransformPointer m_Transform;
181 /// The focal point or position of the ray source
182 InputPointType m_FocalPoint;
184 /// The threshold above which voxels along the ray path are integrated.
187 /// Pointer to the interpolator
188 InterpolatorPointer m_Interpolator;
192 RayCastInterpolateImageFunctionWithOrigin( const Self& ); //purposely not implemented
193 void operator=( const Self& ); //purposely not implemented
200 #ifndef ITK_MANUAL_INSTANTIATION
201 #include "itkRayCastInterpolateImageFunctionWithOrigin.txx"