Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkRayCastInterpolateImageFunction.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkRayCastInterpolateImageFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:28:37 $ 00007 Version: $Revision: 1.4 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef _itkRayCastInterpolateImageFunction_h 00018 #define _itkRayCastInterpolateImageFunction_h 00019 00020 #include "itkInterpolateImageFunction.h" 00021 #include "itkTransform.h" 00022 #include "itkVector.h" 00023 00024 namespace itk 00025 { 00026 00038 template <class TInputImage, class TCoordRep = float> 00039 class ITK_EXPORT RayCastInterpolateImageFunction : 00040 public InterpolateImageFunction<TInputImage,TCoordRep> 00041 { 00042 public: 00044 typedef RayCastInterpolateImageFunction Self; 00045 typedef InterpolateImageFunction<TInputImage,TCoordRep> Superclass; 00046 typedef SmartPointer<Self> Pointer; 00047 typedef SmartPointer<const Self> ConstPointer; 00048 00050 itkStaticConstMacro(InputImageDimension, unsigned int, 00051 TInputImage::ImageDimension); 00052 00057 typedef Transform<TCoordRep,3,3> TransformType; 00058 00059 typedef typename TransformType::Pointer TransformPointer; 00060 typedef typename TransformType::InputPointType InputPointType; 00061 typedef typename TransformType::OutputPointType OutputPointType; 00062 typedef typename TransformType::ParametersType TransformParametersType; 00063 typedef typename TransformType::JacobianType TransformJacobianType; 00064 00065 typedef typename Superclass::InputPixelType PixelType; 00066 00067 typedef typename TInputImage::SizeType SizeType; 00068 00069 typedef itk::Vector<double, 3> DirectionType; 00070 00072 typedef InterpolateImageFunction<TInputImage,TCoordRep> InterpolatorType; 00073 00074 typedef typename InterpolatorType::Pointer InterpolatorPointer; 00075 00076 00078 itkTypeMacro(RayCastInterpolateImageFunction, InterpolateImageFunction); 00079 00081 itkNewMacro(Self); 00082 00084 typedef typename Superclass::OutputType OutputType; 00085 00087 typedef typename Superclass::InputImageType InputImageType; 00088 00090 typedef typename Superclass::RealType RealType; 00091 00093 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension); 00094 00096 typedef typename Superclass::PointType PointType; 00097 00099 typedef typename Superclass::IndexType IndexType; 00100 00102 typedef typename Superclass::ContinuousIndexType ContinuousIndexType; 00103 00104 00105 00116 virtual OutputType Evaluate( const PointType& point ) const; 00117 00129 virtual OutputType EvaluateAtContinuousIndex( 00130 const ContinuousIndexType & index ) const {return 0; }; 00131 00132 00134 itkSetObjectMacro( Transform, TransformType ); 00136 itkGetObjectMacro( Transform, TransformType ); 00137 00139 itkSetObjectMacro( Interpolator, InterpolatorType ); 00141 itkGetObjectMacro( Interpolator, InterpolatorType ); 00142 00144 itkSetMacro( FocalPoint, InputPointType ); 00146 itkGetMacro( FocalPoint, InputPointType ); 00147 00149 itkSetMacro( Threshold, double ); 00151 itkGetMacro( Threshold, double ); 00152 00156 inline bool IsInsideBuffer( const PointType & point ) const 00157 { 00158 return true; 00159 } 00160 00169 bool SetRay(OutputPointType RayPosn, DirectionType RayDirn) const; 00170 00171 00185 bool Integrate(double &integral) const { 00186 return IntegrateAboveThreshold(integral, 0); 00187 }; 00188 00189 00204 bool IntegrateAboveThreshold(double &integral, double threshold) const; 00205 00212 void IncrementIntensities(double increment=1) const; 00213 00214 00224 bool NextPoint(void) const; 00225 00227 void Reset(void) const; 00228 00238 void GetCurrentCoord3D(double &x, double &y, double &z) const; 00239 00247 void GetCurrentVoxelCoord3D(double &x, double &y, double &z) const; 00248 00250 double GetCurrentIntensity(void) const; 00251 00266 double GetCurrentDensity(double threshold=0.) const; 00267 00269 void GetCurrentVoxels(PixelType &voxel1, PixelType &voxel2, 00270 PixelType &voxel3, PixelType &voxel4) const; 00271 00273 int GetNumberOfVoxels(void) const {return m_NumVoxelPlanesTraversed;}; 00274 00276 double GetRayPointSpacing(void) const { 00277 const double *spacing=m_Image->GetSpacing(); 00278 00279 if (m_ValidRay) 00280 return sqrt( m_VoxelIncrement[0]*spacing[0]*m_VoxelIncrement[0]*spacing[0] 00281 + m_VoxelIncrement[1]*spacing[1]*m_VoxelIncrement[1]*spacing[1] 00282 + m_VoxelIncrement[2]*spacing[2]*m_VoxelIncrement[2]*spacing[2] ); 00283 else 00284 return 0.; 00285 }; 00286 00293 void SetBoundingBox(double position[3], double size[3]) const; 00294 00295 00296 protected: 00297 00299 RayCastInterpolateImageFunction(); 00300 00302 ~RayCastInterpolateImageFunction(){}; 00303 00305 void PrintSelf(std::ostream& os, Indent indent) const; 00306 00307 00313 typedef enum { 00314 UNDEFINED_DIRECTION=0, 00315 TRANSVERSE_IN_X, 00316 TRANSVERSE_IN_Y, 00317 TRANSVERSE_IN_Z, 00318 LAST_DIRECTION 00319 } TraversalDirection; 00320 00321 00323 TransformPointer m_Transform; 00324 00326 InputPointType m_FocalPoint; 00327 00329 double m_Threshold; 00330 00332 mutable bool m_ValidRay; 00333 00342 mutable double m_RayVoxelStartPosition[3]; 00343 00352 mutable double m_RayVoxelEndPosition[3]; 00353 00354 00363 mutable double m_Position3Dvox[3]; 00364 00366 mutable double m_VoxelIncrement[3]; 00367 00369 mutable TraversalDirection m_TraversalDirection; 00370 00372 mutable int m_TotalRayVoxelPlanes; 00373 00375 mutable int m_NumVoxelPlanesTraversed; 00376 00378 mutable const PixelType *m_RayIntersectionVoxels[4]; 00379 00384 mutable int m_RayIntersectionVoxelIndex[3]; 00385 00386 00388 mutable int m_NumberOfVoxelsInX; 00390 mutable int m_NumberOfVoxelsInY; 00392 mutable int m_NumberOfVoxelsInZ; 00393 00395 mutable double m_VoxelDimensionInX; 00397 mutable double m_VoxelDimensionInY; 00399 mutable double m_VoxelDimensionInZ; 00400 00402 mutable double m_RayStartCoordInMM[3]; 00404 mutable double m_RayEndCoordInMM[3]; 00405 00406 00410 mutable double m_BoundingPlane[6][4]; 00412 mutable double m_BoundingCorner[8][3]; 00413 00415 mutable double m_CurrentRayPositionInMM[3]; 00416 00418 mutable double m_RayDirectionInMM[3]; 00419 00421 InterpolatorPointer m_Interpolator; 00422 00423 00425 void EndPointsInVoxels(void) const; 00426 00431 void CalcDirnVector(void) const; 00432 00439 bool AdjustRayLength(void) const; 00440 00445 void InitialiseVoxelPointers(void) const; 00446 00448 void IncrementVoxelPointers(void) const; 00449 00451 void Initialise(void) const; 00452 00454 void RecordVolumeDimensions(void) const; 00455 00457 void DefineCorners(void) const; 00458 00470 void CalcPlanesAndCorners(void) const; 00471 00481 bool CalcRayIntercepts(void) const; 00482 00483 00484 private: 00485 RayCastInterpolateImageFunction( const Self& ); //purposely not implemented 00486 void operator=( const Self& ); //purposely not implemented 00487 00489 void ZeroState() const; 00490 00491 00492 }; 00493 00494 } // namespace itk 00495 00496 #ifndef ITK_MANUAL_INSTANTIATION 00497 #include "itkRayCastInterpolateImageFunction.txx" 00498 #endif 00499 00500 #endif

Generated at Sat Mar 31 02:27:39 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000