]> Creatis software - clitk.git/blob - itk/itkRayCastInterpolateImageFunctionWithOrigin.h
removed headers
[clitk.git] / itk / itkRayCastInterpolateImageFunctionWithOrigin.h
1 #ifndef __itkRayCastInterpolateImageFunctionWithOrigin_h
2 #define __itkRayCastInterpolateImageFunctionWithOrigin_h
3 #include "itkInterpolateImageFunction.h"
4 #include "itkTransform.h"
5 #include "itkVector.h"
6
7 namespace itk
8 {
9
10 /** \class RayCastInterpolateImageFunctionWithOrigin
11  * \brief Projective interpolation of an image at specified positions.
12  *
13  * RayCastInterpolateImageFunctionWithOrigin casts rays through a 3-dimensional
14  * image and uses bilinear interpolation to integrate each plane of
15  * voxels traversed.
16  * 
17  * \warning This interpolator works for 3-dimensional images only.
18  *
19  * \ingroup ImageFunctions
20  */
21 template <class TInputImage, class TCoordRep = float>
22 class ITK_EXPORT RayCastInterpolateImageFunctionWithOrigin : 
23     public InterpolateImageFunction<TInputImage,TCoordRep> 
24 {
25 public:
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;
31
32   /** Constants for the image dimensions */
33   itkStaticConstMacro(InputImageDimension, unsigned int,
34                       TInputImage::ImageDimension);
35
36   /** 
37    * Type of the Transform Base class 
38    * The fixed image should be a 3D image
39    */
40   typedef Transform<TCoordRep,3,3> TransformType;
41
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;
47
48   typedef typename Superclass::InputPixelType        PixelType;
49
50   typedef typename TInputImage::SizeType             SizeType;
51
52   typedef Vector<TCoordRep, 3>                       DirectionType;
53
54   /**  Type of the Interpolator Base class */
55   typedef InterpolateImageFunction<TInputImage,TCoordRep> InterpolatorType;
56
57   typedef typename InterpolatorType::Pointer         InterpolatorPointer;
58
59   
60   /** Run-time type information (and related methods). */
61   itkTypeMacro(RayCastInterpolateImageFunctionWithOrigin, InterpolateImageFunction);
62
63   /** Method for creation through the object factory. */
64   itkNewMacro(Self);  
65
66   /** OutputType typedef support. */
67   typedef typename Superclass::OutputType OutputType;
68
69   /** InputImageType typedef support. */
70   typedef typename Superclass::InputImageType InputImageType;
71
72   /** RealType typedef support. */
73   typedef typename Superclass::RealType RealType;
74
75   /** Dimension underlying input image. */
76   itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
77
78   /** Point typedef support. */
79   typedef typename Superclass::PointType PointType;
80
81   /** Index typedef support. */
82   typedef typename Superclass::IndexType IndexType;
83
84   /** ContinuousIndex typedef support. */
85   typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
86
87   /** \brief
88    * Interpolate the image at a point position.
89    *
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.
93    *
94    * ImageFunction::IsInsideBuffer() can be used to check bounds before
95    * calling the method. 
96    */
97   virtual OutputType Evaluate( const PointType& point ) const;
98
99   /** Interpolate the image at a continuous index position
100    *
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.
104    *
105    * Subclasses must override this method.
106    *
107    * ImageFunction::IsInsideBuffer() can be used to check bounds before
108    * calling the method. 
109    */
110   virtual OutputType EvaluateAtContinuousIndex( 
111     const ContinuousIndexType &index ) const;
112
113
114   /** Connect the Transform. */
115   itkSetObjectMacro( Transform, TransformType );
116   /** Get a pointer to the Transform.  */
117   itkGetObjectMacro( Transform, TransformType );
118  
119   /** Connect the Interpolator. */
120   itkSetObjectMacro( Interpolator, InterpolatorType );
121   /** Get a pointer to the Interpolator.  */
122   itkGetObjectMacro( Interpolator, InterpolatorType );
123
124   /** Connect the Interpolator. */
125   itkSetMacro( FocalPoint, InputPointType );
126   /** Get a pointer to the Interpolator.  */
127   itkGetMacro( FocalPoint, InputPointType );
128
129   /** Connect the Transform. */
130   itkSetMacro( Threshold, double );
131   /** Get a pointer to the Transform.  */
132   itkGetMacro( Threshold, double );
133  
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
138     { 
139     return true;
140     }
141   bool IsInsideBuffer( const ContinuousIndexType &  ) const
142     {
143     return true;
144     }
145   bool IsInsideBuffer( const IndexType &  ) const
146     { 
147     return true;
148     }
149
150 protected:
151
152   /// Constructor
153   RayCastInterpolateImageFunctionWithOrigin();
154
155   /// Destructor
156   ~RayCastInterpolateImageFunctionWithOrigin(){};
157
158   /// Print the object
159   void PrintSelf(std::ostream& os, Indent indent) const;
160   
161   /// Transformation used to calculate the new focal point position
162   TransformPointer m_Transform;
163
164   /// The focal point or position of the ray source
165   InputPointType m_FocalPoint;
166
167   /// The threshold above which voxels along the ray path are integrated.
168   double m_Threshold;
169
170   /// Pointer to the interpolator
171   InterpolatorPointer m_Interpolator;
172
173
174 private:
175   RayCastInterpolateImageFunctionWithOrigin( const Self& ); //purposely not implemented
176   void operator=( const Self& ); //purposely not implemented
177
178
179 };
180
181 } // namespace itk
182
183 #ifndef ITK_MANUAL_INSTANTIATION
184 #include "itkRayCastInterpolateImageFunctionWithOrigin.txx"
185 #endif
186
187 #endif