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://oncora1.lyon.fnclcc.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 __clitkRayCastInterpolateImageFunctionWithOrigin_h
19 #define __clitkRayCastInterpolateImageFunctionWithOrigin_h
20 #include "clitkBSplineDeformableTransform.h"
22 #include "itkInterpolateImageFunction.h"
23 #include "itkTransform.h"
24 #include "itkVector.h"
30 template <class TInputImage, class TCoordRep = float>
31 class ITK_EXPORT RayCastInterpolateImageFunctionWithOrigin :
32 public itk::InterpolateImageFunction<TInputImage,TCoordRep>
35 /** Standard class typedefs. */
36 typedef RayCastInterpolateImageFunctionWithOrigin Self;
37 typedef itk::InterpolateImageFunction<TInputImage,TCoordRep> Superclass;
38 typedef itk::SmartPointer<Self> Pointer;
39 typedef itk::SmartPointer<const Self> ConstPointer;
41 /** Constants for the image dimensions */
42 itkStaticConstMacro(InputImageDimension, unsigned int,
43 TInputImage::ImageDimension);
46 * Type of the Transform Base class
47 * The fixed image should be a 3D image
49 typedef itk::Transform<TCoordRep,3,3> TransformType;
51 typedef typename TransformType::Pointer TransformPointer;
52 typedef typename TransformType::InputPointType InputPointType;
53 typedef typename TransformType::OutputPointType OutputPointType;
54 typedef typename TransformType::ParametersType TransformParametersType;
55 typedef typename TransformType::JacobianType TransformJacobianType;
57 typedef typename Superclass::InputPixelType PixelType;
59 typedef typename TInputImage::SizeType SizeType;
61 typedef itk::Vector<TCoordRep, 3> DirectionType;
63 /** Type of the Interpolator Base class */
64 typedef itk::InterpolateImageFunction<TInputImage,TCoordRep> InterpolatorType;
66 typedef typename InterpolatorType::Pointer InterpolatorPointer;
68 //JV Type of the Interpolator for the transform
69 typedef itk::InterpolateImageFunction<TInputImage,TCoordRep> DeformableTransformInterpolatorType;
70 typedef typename DeformableTransformInterpolatorType::Pointer DeformableTransformInterpolatorPointer;
73 /** Run-time type information (and related methods). */
74 itkTypeMacro(RayCastInterpolateImageFunctionWithOrigin, InterpolateImageFunction);
76 /** Method for creation through the object factory. */
79 /** OutputType typedef support. */
80 typedef typename Superclass::OutputType OutputType;
82 /** InputImageType typedef support. */
83 typedef typename Superclass::InputImageType InputImageType;
85 /** RealType typedef support. */
86 typedef typename Superclass::RealType RealType;
88 /** Dimension underlying input image. */
89 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
91 /** Point typedef support. */
92 typedef typename Superclass::PointType PointType;
94 /** Index typedef support. */
95 typedef typename Superclass::IndexType IndexType;
97 /** ContinuousIndex typedef support. */
98 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
101 * Interpolate the image at a point position.
103 * Returns the interpolated image intensity at a
104 * specified point position. No bounds checking is done.
105 * The point is assume to lie within the image buffer.
107 * ImageFunction::IsInsideBuffer() can be used to check bounds before
108 * calling the method.
110 virtual OutputType Evaluate( const PointType& point ) const;
112 /** Interpolate the image at a continuous index position
114 * Returns the interpolated image intensity at a
115 * specified index position. No bounds checking is done.
116 * The point is assume to lie within the image buffer.
118 * Subclasses must override this method.
120 * ImageFunction::IsInsideBuffer() can be used to check bounds before
121 * calling the method.
123 virtual OutputType EvaluateAtContinuousIndex(
124 const ContinuousIndexType &index ) const;
127 /** Connect the Transform. */
128 itkSetObjectMacro( Transform, TransformType );
129 /** Get a pointer to the Transform. */
130 itkGetObjectMacro( Transform, TransformType );
132 /** Connect the Interpolator. */
133 itkSetObjectMacro( Interpolator, InterpolatorType );
134 /** Get a pointer to the Interpolator. */
135 itkGetObjectMacro( Interpolator, InterpolatorType );
137 /** Connect the focalPoint. */
138 itkSetMacro( FocalPoint, InputPointType );
139 /** Get a pointer to the focalpoint. */
140 itkGetMacro( FocalPoint, InputPointType );
142 /** Connect the threshold. */
143 itkSetMacro( Threshold, double );
144 /** Get a pointer to the threshhold. */
145 itkGetMacro( Threshold, double );
147 /** Check if a point is inside the image buffer.
148 * \warning For efficiency, no validity checking of
149 * the input image pointer is done. */
150 inline bool IsInsideBuffer( const PointType & ) const
154 bool IsInsideBuffer( const ContinuousIndexType & ) const
158 bool IsInsideBuffer( const IndexType & ) const
163 //JV transform is deformable
164 itkSetMacro( TransformIsDeformable, bool );
165 itkGetMacro( TransformIsDeformable, bool );
167 //JV interpolator for deformable transform
168 itkSetObjectMacro( DeformableTransformInterpolator, DeformableTransformInterpolatorType );
169 itkGetObjectMacro( DeformableTransformInterpolator, DeformableTransformInterpolatorType );
174 RayCastInterpolateImageFunctionWithOrigin();
177 ~RayCastInterpolateImageFunctionWithOrigin(){};
180 void PrintSelf(std::ostream& os, itk::Indent indent) const;
182 /// Transformation used to calculate the new focal point position
183 TransformPointer m_Transform;
185 /// The focal point or position of the ray source
186 InputPointType m_FocalPoint;
188 /// The threshold above which voxels along the ray path are integrated.
191 /// Pointer to the interpolator
192 InterpolatorPointer m_Interpolator;
194 //JV Pointer to the deformable transform interpolator
195 DeformableTransformInterpolatorPointer m_DeformableTransformInterpolator;
198 //JV Transform is deformable: fetch interpolated value at transformed intersect
199 bool m_TransformIsDeformable;
203 RayCastInterpolateImageFunctionWithOrigin( const Self& ); //purposely not implemented
204 void operator=( const Self& ); //purposely not implemented
211 #ifndef ITK_MANUAL_INSTANTIATION
212 #include "clitkRayCastInterpolateImageFunctionWithOrigin.txx"