Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef __cmtkInverseInterpolationVolumeReconstruction_h_included_
00034 #define __cmtkInverseInterpolationVolumeReconstruction_h_included_
00035
00036 #include <cmtkconfig.h>
00037
00038 #include <Recon/cmtkInverseInterpolationVolumeReconstructionBase.h>
00039
00040 #include <Base/cmtkAffineXform.h>
00041 #include <Base/cmtkUniformVolume.h>
00042
00043 #include <Registration/cmtkAffineRegistration.h>
00044
00045 #include <System/cmtkProgress.h>
00046
00047 #include "Numerics/ap.h"
00048
00049 #include <vector>
00050
00051 namespace
00052 cmtk
00053 {
00054
00057
00061 template<class TInterpolator>
00062 class InverseInterpolationVolumeReconstruction :
00064 public InverseInterpolationVolumeReconstructionBase
00065 {
00066 public:
00068 typedef InverseInterpolationVolumeReconstruction<TInterpolator> Self;
00069
00071 typedef InverseInterpolationVolumeReconstructionBase Superclass;
00072
00079 InverseInterpolationVolumeReconstruction( const UniformVolume* originalImage, const int numberOfPasses, const int interleaveAxis )
00080 : InverseInterpolationVolumeReconstructionBase( originalImage, numberOfPasses, interleaveAxis )
00081 {
00082 this->m_FunctionAndGradient = new typename Self::FunctionAndGradient( this );
00083 }
00084
00087 InverseInterpolationVolumeReconstruction( const UniformVolume* reconstructionGrid, std::vector<UniformVolume::SmartPtr>& images )
00088 : InverseInterpolationVolumeReconstructionBase( reconstructionGrid, images )
00089 {
00090 this->m_FunctionAndGradient = new typename Self::FunctionAndGradient( this );
00091 }
00092
00094 virtual ~InverseInterpolationVolumeReconstruction()
00095 {
00096 delete this->m_FunctionAndGradient;
00097 }
00098
00099 private:
00101 void Interpolation( const ap::real_1d_array& reconstructedPixelArray );
00102
00104 void ComputeErrorGradientImage( ap::real_1d_array& g );
00105
00107 void GetPassImageDependentPixelRegion
00108 ( int* region, const UniformVolume* correctedImage, const int* currentCorrectedGridPoint,
00109 const UniformVolume* passImage, const AffineXform* transformationToPassImage, const DataGrid::IndexType& passImageDims );
00110
00112 class FunctionAndGradient :
00114 public ap::FunctionAndGradient
00115 {
00116 public:
00118 typedef InverseInterpolationVolumeReconstruction<TInterpolator> FunctionType;
00119
00121 FunctionAndGradient( FunctionType* function )
00122 {
00123 this->m_Function = function;
00124 }
00125
00127 virtual void Evaluate( const ap::real_1d_array& x, ap::real_value_type& f, ap::real_1d_array& g );
00128
00130 virtual void NextIteration( const int iteration )
00131 {
00132 Progress::SetProgress( iteration );
00133 }
00134
00135 private:
00137 FunctionType* m_Function;
00138 };
00139
00141 friend class Self::FunctionAndGradient;
00142 };
00143
00145
00146 }
00147
00148 #include "cmtkInverseInterpolationVolumeReconstruction.txx"
00149
00150 #endif // #ifndef __cmtkInverseInterpolationVolumeReconstruction_h_included_
00151