NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkMatrixBasedSimulReconRegnMetric.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef itkMatrixBasedSimulReconRegnMetric_h
16 #define itkMatrixBasedSimulReconRegnMetric_h
17 
18 #include <itkConceptChecking.h>
19 #include <itkSingleValuedCostFunction.h>
20 
21 #include <itkForwardAndBackwardProjectionMatrix.h>
22 #include <itkEulerAffineTransformMatrixAndItsVariations.h>
23 
24 
25 namespace itk
26 {
27 
36 template <class IntensityType = double>
37 class ITK_EXPORT MatrixBasedSimulReconRegnMetric : public SingleValuedCostFunction
38 {
39 public:
40 
43  typedef SingleValuedCostFunction Superclass;
44  typedef SmartPointer<Self> Pointer;
45  typedef SmartPointer<const Self> ConstPointer;
46 
48  itkNewMacro(Self);
49 
51  itkTypeMacro(MatrixBasedSimulReconRegnMetric, SingleValuedCostFunction);
52 
54  typedef vnl_vector<double> VectorType;
55  typedef vnl_matrix<double> FullMatrixType;
56  typedef vnl_sparse_matrix<double> SparseMatrixType;
57 
60 
69 
74 
79 
81 
83  typedef typename SingleValuedCostFunction::ParametersType ParametersType;
84  typedef typename SingleValuedCostFunction::MeasureType MeasureType;
85  typedef typename SingleValuedCostFunction::DerivativeType DerivativeType;
86 
88  void SetInputVolume( InputVolumePointer inVolume ) { m_inVolume = inVolume; }
89 
91  void SetParameterNumber( const unsigned int &paraNumber ) { m_paraNumber = paraNumber; }
92 
94  void SetInputVolumeVector( VectorType &inVolumeVector ) { m_EstimatedVolumeVector = inVolumeVector; }
95 
97  void SetInputTwoProjectionVectors( VectorType &inProjectionOne, VectorType &inProjectionTwo )
98  { m_inProjOne = inProjectionOne; m_inProjTwo = inProjectionTwo; }
99 
101  void SetInputTempProjections( InputProjectionPointer tempProjection ) { m_inProjTemp = tempProjection; }
102 
104  void SetEulerTransform( EulerAffineTransformPointer inEuler ) { m_EulerAffineTransform = inEuler; }
105 
107  void SetParameterVector( VectorType &paraVector ) { m_TransformationParameterVector = paraVector; }
108 
110  void SetEulerTransformFDMLambda( double &lambdaVal ) { m_lambdaVal = lambdaVal; }
111  void SetEulerTransformFDMDifference( double &diffFDMVal ) { m_FDMDiff = diffFDMVal; }
112  void SetEulerTransformFDMDifferenceEpsilon( double &epsilonVal ) { m_epsilonVal = epsilonVal; }
113 
114 
116  void SetTotalVoxel( const unsigned long int &totalSize3D ) { m_totalSize3D = totalSize3D; }
117 
119  void SetTotalPixel( const unsigned long int &totalSize2D ) { m_totalSize2D = totalSize2D; }
120 
122  void SetTotalProjectionNumber( const unsigned int &projNumber ) { m_ProjectionNumber = projNumber; }
123 
125  void SetTotalProjectionSize( InputProjectionSizeType &projSize ) { m_InProjectionSize = projSize; }
126 
127 
129  void SetProjectionGeometry( ProjectionGeometryType::Pointer pGeometry ) { m_Geometry = pGeometry; }
130 
132  void SetInputVolumeSize(InputVolumeSizeType &inVolumeSize) {m_InVolumeSize = inVolumeSize;};
133  void SetInputVolumeSpacing(InputVolumeSpacingType &inVolumeSpacing) {m_InVolumeSpacing = inVolumeSpacing;};
134  void SetInputVolumeOrigin(InputVolumePointType &inVolumeOrigin) {m_InVolumeOrigin = inVolumeOrigin;};
135 
137  unsigned int GetNumberOfParameters(void) const;
138 
139 #if 0
140  const InputVolumeType *GetReconstructedVolume(void) {
142  return m_FwdAndBackProjDiffFilter->GetPointerToInputVolume();
143  }
144 
147  void SetParametersAddress( const ParametersType & parameters ) const;
150  void SetDerivativesAddress( const DerivativeType & derivatives ) const;
151 
153  void SetParameters( const ParametersType & parameters ) const;
154 
157  void SetIterativeReconEstimateFile( std::string filename ) {
158  fileOutputCurrentEstimate = filename;
159  }
160 
163  void SetIterativeReconEstimateSuffix( std::string suffix ) {
164  suffixOutputCurrentEstimate = suffix;
165  }
166 #endif
167 
170  virtual void GetValueAndDerivative( const ParametersType & parameters,
171  MeasureType & value,
172  DerivativeType & derivative ) const;
173 
180  virtual MeasureType GetValue( const ParametersType & parameters ) const;
181 
188  virtual void GetDerivative( const ParametersType & parameters,
189  DerivativeType & derivative ) const;
190 
191 
192 protected:
193 
194  MatrixBasedSimulReconRegnMetric();
196 
197  void PrintSelf(std::ostream& os, Indent indent) const;
198 
199 #if 0
200 
202  std::string fileOutputCurrentEstimate;
205  std::string suffixOutputCurrentEstimate;
206 #endif
207 
211  VectorType m_inProjOne, m_inProjTwo;
212 
213  MatrixProjectorPointerType m_MatrixProjector;
214  AffineTransformerPointer m_AffineTransformer;
215  EulerAffineTransformPointer m_EulerAffineTransform;
216 
217  InputVolumePointer m_inVolume;
218  InputProjectionPointer m_inProjTemp;
219 
220  unsigned int m_paraNumber;
221  unsigned long int m_totalSize3D;
222  unsigned long int m_totalSize2D;
223  unsigned int m_ProjectionNumber;
224  double m_lambdaVal;
225  double m_FDMDiff;
226  double m_epsilonVal;
227 
228  InputVolumeSizeType m_InVolumeSize;
229  InputVolumeSpacingType m_InVolumeSpacing;
230  InputVolumePointType m_InVolumeOrigin;
231 
232  InputProjectionSizeType m_InProjectionSize;
233 
235 
236 
237 private:
238  MatrixBasedSimulReconRegnMetric(const Self&); //purposely not implemented
239  void operator=(const Self&); //purposely not implemented
240 
241 };
242 
243 } // end namespace itk
244 
245 #ifndef ITK_MANUAL_INSTANTIATION
246 #include "itkMatrixBasedSimulReconRegnMetric.txx"
247 #endif
248 
249 #endif
void SetTotalProjectionNumber(const unsigned int &projNumber)
Set the total number of the pixels of the projection.
Definition: itkMatrixBasedSimulReconRegnMetric.h:122
InputImageType::PointType InputImagePointType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:62
SmartPointer< Self > Pointer
Definition: itkMatrixBasedSimulReconRegnMetric.h:44
InputVolumeSpacingType m_InVolumeSpacing
Definition: itkMatrixBasedSimulReconRegnMetric.h:229
MatrixProjectorType::InputImageSpacingType InputVolumeSpacingType
Definition: itkMatrixBasedSimulReconRegnMetric.h:66
SingleValuedCostFunction::ParametersType ParametersType
Definition: itkMatrixBasedSimulReconRegnMetric.h:83
OutputImageType::SizeType OutputImageSizeType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:70
Class to apply the affine transformation matrix to a 3D image.
Definition: Projection/itkEulerAffineTransformMatrixAndItsVariations.h:34
itk::ForwardAndBackwardProjectionMatrix< double, double > MatrixProjectorType
Definition: itkMatrixBasedSimulReconRegnMetric.h:58
void SetInputVolume(InputVolumePointer inVolume)
Set the 3D reconstruction estimate input volume.
Definition: itkMatrixBasedSimulReconRegnMetric.h:88
ProjectionGeometryType::Pointer m_Geometry
Definition: itkMatrixBasedSimulReconRegnMetric.h:234
SmartPointer< Self > Pointer
Definition: itkProjectionGeometry.h:36
MatrixProjectorType::Pointer MatrixProjectorPointerType
Definition: itkMatrixBasedSimulReconRegnMetric.h:59
unsigned int m_paraNumber
Definition: itkMatrixBasedSimulReconRegnMetric.h:220
AffineTransformerType::EulerAffineTransformType EulerAffineTransformType
Definition: itkMatrixBasedSimulReconRegnMetric.h:76
void SetInputTempProjections(InputProjectionPointer tempProjection)
Set the temporary projection image.
Definition: itkMatrixBasedSimulReconRegnMetric.h:101
MatrixProjectorType::InputImageRegionType InputVolumeRegionType
Definition: itkMatrixBasedSimulReconRegnMetric.h:64
Class to apply the affine transformation matrix to a 3D image.
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:37
Definition: niftkITKAffineResampleImage.cxx:74
void SetParameterVector(VectorType &paraVector)
Set the transformation parameters as a vector form.
Definition: itkMatrixBasedSimulReconRegnMetric.h:107
MatrixProjectorType::InputImageType InputVolumeType
Definition: itkMatrixBasedSimulReconRegnMetric.h:61
SingleValuedCostFunction::MeasureType MeasureType
Definition: itkMatrixBasedSimulReconRegnMetric.h:84
Class to compute the difference between a reconstruction estimate and the target set of 2D projection...
Definition: itkMatrixBasedSimulReconRegnMetric.h:37
vnl_matrix< double > FullMatrixType
Definition: itkMatrixBasedSimulReconRegnMetric.h:55
unsigned int m_ProjectionNumber
Definition: itkMatrixBasedSimulReconRegnMetric.h:223
void SetEulerTransform(EulerAffineTransformPointer inEuler)
Set the transformation parameters.
Definition: itkMatrixBasedSimulReconRegnMetric.h:104
InputVolumePointType m_InVolumeOrigin
Definition: itkMatrixBasedSimulReconRegnMetric.h:230
InputVolumeSizeType m_InVolumeSize
Definition: itkMatrixBasedSimulReconRegnMetric.h:228
MatrixProjectorType::InputImageIndexType InputVolumeIndexType
Definition: itkMatrixBasedSimulReconRegnMetric.h:68
unsigned long int m_totalSize3D
Definition: itkMatrixBasedSimulReconRegnMetric.h:221
Euler Affine transform.
Definition: itkEulerAffineTransform.h:38
void SetInputTwoProjectionVectors(VectorType &inProjectionOne, VectorType &inProjectionTwo)
Set the input projection images.
Definition: itkMatrixBasedSimulReconRegnMetric.h:97
Abstract class to calculate the geometry of a CT or tomo machine.
Definition: itkProjectionGeometry.h:29
MatrixProjectorType::InputImageConstPointer InputVolumeConstPointer
Definition: itkMatrixBasedSimulReconRegnMetric.h:63
GLsizei const GLfloat * value
Definition: glew.h:1833
InputImageType::IndexType InputImageIndexType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:63
MatrixProjectorType::InputImageSizeType InputVolumeSizeType
Definition: itkMatrixBasedSimulReconRegnMetric.h:65
InputImageType::Pointer InputImagePointer
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:56
vnl_sparse_matrix< double > SparseMatrixType
Definition: itkMatrixBasedSimulReconRegnMetric.h:56
void SetTotalVoxel(const unsigned long int &totalSize3D)
Set the total number of the voxels of the volume.
Definition: itkMatrixBasedSimulReconRegnMetric.h:116
VectorType m_inProjTwo
Definition: itkMatrixBasedSimulReconRegnMetric.h:211
unsigned long int m_totalSize2D
Definition: itkMatrixBasedSimulReconRegnMetric.h:222
VectorType m_EstimatedVolumeVector
Vectors of the image.
Definition: itkMatrixBasedSimulReconRegnMetric.h:209
virtual ~MatrixBasedSimulReconRegnMetric()
Definition: itkMatrixBasedSimulReconRegnMetric.h:195
SmartPointer< const Self > ConstPointer
Definition: itkMatrixBasedSimulReconRegnMetric.h:45
InputImageType::SpacingType InputImageSpacingType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:61
MatrixProjectorType::OutputImagePointer InputProjectionPointer
Definition: itkMatrixBasedSimulReconRegnMetric.h:71
EulerAffineTransformType::Pointer EulerAffineTransformPointer
Definition: itkMatrixBasedSimulReconRegnMetric.h:78
vnl_vector< double > VectorType
Definition: itkMatrixBasedSimulReconRegnMetric.h:51
InputProjectionPointer m_inProjTemp
Definition: itkMatrixBasedSimulReconRegnMetric.h:218
double m_FDMDiff
Definition: itkMatrixBasedSimulReconRegnMetric.h:225
void SetInputVolumeSize(InputVolumeSizeType &inVolumeSize)
Set the size, resolution and origin of the input volume.
Definition: itkMatrixBasedSimulReconRegnMetric.h:132
void SetTotalPixel(const unsigned long int &totalSize2D)
Set the total number of the pixels of the projection.
Definition: itkMatrixBasedSimulReconRegnMetric.h:119
itk::ProjectionGeometry< double > ProjectionGeometryType
Definition: itkMatrixBasedSimulReconRegnMetric.h:80
MatrixProjectorType::InputImagePointType InputVolumePointType
Definition: itkMatrixBasedSimulReconRegnMetric.h:67
void SetInputVolumeSpacing(InputVolumeSpacingType &inVolumeSpacing)
Definition: itkMatrixBasedSimulReconRegnMetric.h:133
InputVolumePointer m_inVolume
Definition: itkMatrixBasedSimulReconRegnMetric.h:217
itk::EulerAffineTransformMatrixAndItsVariations< double > AffineTransformerType
Definition: itkMatrixBasedSimulReconRegnMetric.h:75
MatrixProjectorType::InputImagePointer InputVolumePointer
Definition: itkMatrixBasedSimulReconRegnMetric.h:62
void SetParameterNumber(const unsigned int &paraNumber)
Set the number of the transformation parameters.
Definition: itkMatrixBasedSimulReconRegnMetric.h:91
MatrixBasedSimulReconRegnMetric Self
Definition: itkMatrixBasedSimulReconRegnMetric.h:42
AffineTransformerType::Pointer AffineTransformerPointer
Definition: itkMatrixBasedSimulReconRegnMetric.h:77
SingleValuedCostFunction Superclass
Definition: itkMatrixBasedSimulReconRegnMetric.h:43
InputImageType::RegionType InputImageRegionType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:58
OutputImageType::ConstPointer OutputImageConstPointer
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:67
MatrixProjectorPointerType m_MatrixProjector
Definition: itkMatrixBasedSimulReconRegnMetric.h:213
double m_lambdaVal
Definition: itkMatrixBasedSimulReconRegnMetric.h:224
InputImageType::ConstPointer InputImageConstPointer
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:57
MatrixProjectorType::OutputImageSizeType InputProjectionSizeType
Definition: itkMatrixBasedSimulReconRegnMetric.h:73
void SetInputVolumeVector(VectorType &inVolumeVector)
Set the 3D reconstruction estimate input volume as a vector form.
Definition: itkMatrixBasedSimulReconRegnMetric.h:94
InputProjectionSizeType m_InProjectionSize
Definition: itkMatrixBasedSimulReconRegnMetric.h:232
void SetEulerTransformFDMDifferenceEpsilon(double &epsilonVal)
Definition: itkMatrixBasedSimulReconRegnMetric.h:112
OutputImageType::Pointer OutputImagePointer
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:66
Simultaneous itk::Image and itk::Array (and hence vnl_vector) class.
void SetEulerTransformFDMLambda(double &lambdaVal)
Set the Finite Difference Method (FDM) lambda value, difference value, and epsilon value...
Definition: itkMatrixBasedSimulReconRegnMetric.h:110
SingleValuedCostFunction::DerivativeType DerivativeType
Definition: itkMatrixBasedSimulReconRegnMetric.h:85
MatrixProjectorType::OutputImageConstPointer InputProjectionConstPointer
Definition: itkMatrixBasedSimulReconRegnMetric.h:72
EulerAffineTransformPointer m_EulerAffineTransform
Definition: itkMatrixBasedSimulReconRegnMetric.h:215
InputImageType::SizeType InputImageSizeType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:60
double m_epsilonVal
Definition: itkMatrixBasedSimulReconRegnMetric.h:226
VectorType m_TransformationParameterVector
Definition: itkMatrixBasedSimulReconRegnMetric.h:210
SmartPointer< Self > Pointer
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:43
void SetProjectionGeometry(ProjectionGeometryType::Pointer pGeometry)
Set the projection geometry.
Definition: itkMatrixBasedSimulReconRegnMetric.h:129
SmartPointer< Self > Pointer
Definition: Projection/itkEulerAffineTransformMatrixAndItsVariations.h:40
MatrixProjectorType::OutputImageType InputProjectionType
Definition: itkMatrixBasedSimulReconRegnMetric.h:70
void SetEulerTransformFDMDifference(double &diffFDMVal)
Definition: itkMatrixBasedSimulReconRegnMetric.h:111
SmartPointer< Self > Pointer
Definition: itkEulerAffineTransform.h:49
GLsizei const GLcharARB ** string
Definition: glew.h:5194
void SetInputVolumeOrigin(InputVolumePointType &inVolumeOrigin)
Definition: itkMatrixBasedSimulReconRegnMetric.h:134
AffineTransformerPointer m_AffineTransformer
Definition: itkMatrixBasedSimulReconRegnMetric.h:214
void SetTotalProjectionSize(InputProjectionSizeType &projSize)
Set the total number of the pixels of the projection.
Definition: itkMatrixBasedSimulReconRegnMetric.h:125