00001 /* 00002 // 00003 // Copyright 1997-2009 Torsten Rohlfing 00004 // 00005 // Copyright 2004-2010 SRI International 00006 // 00007 // This file is part of the Computational Morphometry Toolkit. 00008 // 00009 // http://www.nitrc.org/projects/cmtk/ 00010 // 00011 // The Computational Morphometry Toolkit is free software: you can 00012 // redistribute it and/or modify it under the terms of the GNU General Public 00013 // License as published by the Free Software Foundation, either version 3 of 00014 // the License, or (at your option) any later version. 00015 // 00016 // The Computational Morphometry Toolkit is distributed in the hope that it 00017 // will be useful, but WITHOUT ANY WARRANTY; without even the implied 00018 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU General Public License along 00022 // with the Computational Morphometry Toolkit. If not, see 00023 // <http://www.gnu.org/licenses/>. 00024 // 00025 // $Revision: 2398 $ 00026 // 00027 // $LastChangedDate: 2010-10-05 14:54:37 -0700 (Tue, 05 Oct 2010) $ 00028 // 00029 // $LastChangedBy: torstenrohlfing $ 00030 // 00031 */ 00032 00033 #ifndef __cmtkInverseInterpolationVolumeReconstructionBase_h_included_ 00034 #define __cmtkInverseInterpolationVolumeReconstructionBase_h_included_ 00035 00036 #include <cmtkconfig.h> 00037 00038 #include <Recon/cmtkVolumeInjectionReconstruction.h> 00039 00040 #include <Registration/cmtkAffineRegistration.h> 00041 00042 #include <Base/cmtkAffineXform.h> 00043 #include <Base/cmtkUniformVolume.h> 00044 00045 #include "Numerics/ap.h" 00046 #include "Numerics/lbfgsb.h" 00047 00048 #include <vector> 00049 00050 namespace 00051 cmtk 00052 { 00053 00056 00065 class InverseInterpolationVolumeReconstructionBase : 00067 public VolumeInjectionReconstruction 00068 { 00069 public: 00071 typedef InverseInterpolationVolumeReconstructionBase Self; 00072 00074 typedef VolumeInjectionReconstruction Superclass; 00075 00082 InverseInterpolationVolumeReconstructionBase( const UniformVolume* originalImage, const int numberOfPasses, const int interleaveAxis ); 00083 00086 InverseInterpolationVolumeReconstructionBase( const UniformVolume* reconstructionGrid, std::vector<UniformVolume::SmartPtr>& images ); 00087 00089 virtual ~InverseInterpolationVolumeReconstructionBase() {} 00090 00099 double ComputeApproximationError(); 00100 00102 UniformVolume::SmartPtr& GetLowestMaxErrorImage() 00103 { 00104 return this->m_LowestMaxErrorImage; 00105 } 00106 00108 void SetUseRegionalIntensityTruncation( const bool flag = true ) 00109 { 00110 this->m_RegionalIntensityTruncation = flag; 00111 } 00112 00114 void SetUseFourthOrderError( const bool flag = true ) 00115 { 00116 this->m_FourthOrderError = flag; 00117 } 00118 00120 void SetConstraintWeightLNorm( const double weight ) 00121 { 00122 this->m_ConstraintWeightLNorm = weight; 00123 } 00124 00126 void Optimize( const int numberOfIterations ); 00127 00129 double GetMeanSquaredError() const 00130 { 00131 return this->m_MeanSquaredError; 00132 } 00133 00135 double GetMaximumError() const 00136 { 00137 return this->m_MaximumError; 00138 } 00139 00140 protected: 00142 bool m_RegionalIntensityTruncation; 00143 00145 UniformVolume::SmartPtr m_LowestMaxErrorImage; 00146 00148 double m_LowestMaxError; 00149 00151 std::vector<UniformVolume::SmartPtr> m_InterpolatedPassImages; 00152 00154 std::vector<UniformVolume::SmartPtr> m_DifferencePassImages; 00155 00159 bool m_FourthOrderError; 00160 00164 double m_ConstraintWeightLNorm; 00165 00167 double m_MeanSquaredError; 00168 00170 double m_MaximumError; 00171 00173 ap::FunctionAndGradient* m_FunctionAndGradient; 00174 }; 00175 00177 00178 } // namespace cmtk 00179 00180 #endif // #ifndef __cmtkInverseInterpolationVolumeReconstructionBase_h_included_ 00181