NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkImageMatrixFormReconstructionMetric.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 itkImageMatrixFormReconstructionMetric_h
16 #define itkImageMatrixFormReconstructionMetric_h
17 
18 #include <itkConceptChecking.h>
19 #include <itkSingleValuedCostFunction.h>
20 
21 #include <itkForwardAndBackwardProjectionMatrix.h>
22 
23 
24 
25 namespace itk
26 {
27 
36 template <class IntensityType = double>
37 class ITK_EXPORT ImageMatrixFormReconstructionMetric : 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(ImageMatrixFormReconstructionMetric, SingleValuedCostFunction);
52 
54  typedef vnl_vector<double> VectorType;
55  typedef vnl_sparse_matrix<double> SparseMatrixType;
56 
59 
68 
73 
75 
77  typedef typename SingleValuedCostFunction::ParametersType ParametersType;
78  typedef typename SingleValuedCostFunction::MeasureType MeasureType;
79  typedef typename SingleValuedCostFunction::DerivativeType DerivativeType;
80 
82  void SetInputVolume( InputVolumePointer inVolume ) { m_inVolume = inVolume; }
83 
85  void SetInputVolumeVector( VectorType &inVolumeVector ) { m_EstimatedVolumeVector = inVolumeVector; }
86 
88  void SetInputProjectionVector( VectorType &inProjection ) { m_inProj = inProjection; }
89 
91  void SetInputTempProjections( InputProjectionPointer tempProjection ) { m_inProjTemp = tempProjection; }
92 
94  void SetTotalVoxel( const unsigned long int &totalSize3D ) { m_totalSize3D = totalSize3D; }
95 
97  void SetTotalPixel( const unsigned long int &totalSize2D ) { m_totalSize2D = totalSize2D; }
98 
100  void SetTotalProjectionNumber( const unsigned int &projNumber ) { m_ProjectionNumber = projNumber; }
101 
103  void SetTotalProjectionSize( InputProjectionSizeType &projSize ) { m_InProjectionSize = projSize; }
104 
105 
107  void SetProjectionGeometry( ProjectionGeometryType::Pointer pGeometry ) { m_Geometry = pGeometry; }
108 
110  void SetInputVolumeSize(InputVolumeSizeType &inVolumeSize) {m_InVolumeSize = inVolumeSize;};
111  void SetInputVolumeSpacing(InputVolumeSpacingType &inVolumeSpacing) {m_InVolumeSpacing = inVolumeSpacing;};
112  void SetInputVolumeOrigin(InputVolumePointType &inVolumeOrigin) {m_InVolumeOrigin = inVolumeOrigin;};
113 
115  unsigned int GetNumberOfParameters(void) const;
116 
117 #if 0
118  const InputVolumeType *GetReconstructedVolume(void) {
120  return m_FwdAndBackProjDiffFilter->GetPointerToInputVolume();
121  }
122 
125  void SetParametersAddress( const ParametersType & parameters ) const;
128  void SetDerivativesAddress( const DerivativeType & derivatives ) const;
129 
131  void SetParameters( const ParametersType & parameters ) const;
132 
135  void SetIterativeReconEstimateFile( std::string filename ) {
136  fileOutputCurrentEstimate = filename;
137  }
138 
141  void SetIterativeReconEstimateSuffix( std::string suffix ) {
142  suffixOutputCurrentEstimate = suffix;
143  }
144 #endif
145 
148  virtual void GetValueAndDerivative( const ParametersType & parameters,
149  MeasureType & value,
150  DerivativeType & derivative ) const;
151 
158  virtual MeasureType GetValue( const ParametersType & parameters ) const;
159 
166  virtual void GetDerivative( const ParametersType & parameters,
167  DerivativeType & derivative ) const;
168 
169 
170 protected:
171 
172  ImageMatrixFormReconstructionMetric();
174 
175  void PrintSelf(std::ostream& os, Indent indent) const;
176 
177 #if 0
178 
180  std::string fileOutputCurrentEstimate;
183  std::string suffixOutputCurrentEstimate;
184 #endif
185 
188  VectorType m_inProj;
189 
190  MatrixProjectorPointerType m_MatrixProjector;
191 
192  InputVolumePointer m_inVolume;
193  InputProjectionPointer m_inProjTemp;
194 
195  unsigned long int m_totalSize3D;
196  unsigned long int m_totalSize2D;
197  unsigned int m_ProjectionNumber;
198 
199  InputVolumeSizeType m_InVolumeSize;
200  InputVolumeSpacingType m_InVolumeSpacing;
201  InputVolumePointType m_InVolumeOrigin;
202 
203  InputProjectionSizeType m_InProjectionSize;
204 
206 
207 
208 private:
209  ImageMatrixFormReconstructionMetric(const Self&); //purposely not implemented
210  void operator=(const Self&); //purposely not implemented
211 
212 };
213 
214 } // end namespace itk
215 
216 #ifndef ITK_MANUAL_INSTANTIATION
217 #include "itkImageMatrixFormReconstructionMetric.txx"
218 #endif
219 
220 #endif
void SetInputVolumeSpacing(InputVolumeSpacingType &inVolumeSpacing)
Definition: itkImageMatrixFormReconstructionMetric.h:111
void SetInputVolumeSize(InputVolumeSizeType &inVolumeSize)
Set the size, resolution and origin of the input volume.
Definition: itkImageMatrixFormReconstructionMetric.h:110
InputImageType::PointType InputImagePointType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:62
void SetTotalProjectionNumber(const unsigned int &projNumber)
Set the total number of the pixels of the projection.
Definition: itkImageMatrixFormReconstructionMetric.h:100
MatrixProjectorType::InputImageConstPointer InputVolumeConstPointer
Definition: itkImageMatrixFormReconstructionMetric.h:62
OutputImageType::SizeType OutputImageSizeType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:70
MatrixProjectorType::OutputImagePointer InputProjectionPointer
Definition: itkImageMatrixFormReconstructionMetric.h:70
SmartPointer< Self > Pointer
Definition: itkProjectionGeometry.h:36
MatrixProjectorType::InputImagePointType InputVolumePointType
Definition: itkImageMatrixFormReconstructionMetric.h:66
SingleValuedCostFunction Superclass
Definition: itkImageMatrixFormReconstructionMetric.h:43
MatrixProjectorType::InputImageType InputVolumeType
Definition: itkImageMatrixFormReconstructionMetric.h:60
MatrixProjectorType::InputImageRegionType InputVolumeRegionType
Definition: itkImageMatrixFormReconstructionMetric.h:63
InputVolumeSpacingType m_InVolumeSpacing
Definition: itkImageMatrixFormReconstructionMetric.h:200
ImageMatrixFormReconstructionMetric Self
Definition: itkImageMatrixFormReconstructionMetric.h:42
SmartPointer< Self > Pointer
Definition: itkImageMatrixFormReconstructionMetric.h:44
void SetInputTempProjections(InputProjectionPointer tempProjection)
Set the temporary projection image.
Definition: itkImageMatrixFormReconstructionMetric.h:91
void SetInputVolume(InputVolumePointer inVolume)
Set the 3D reconstruction estimate input volume.
Definition: itkImageMatrixFormReconstructionMetric.h:82
void SetProjectionGeometry(ProjectionGeometryType::Pointer pGeometry)
Set the projection geometry.
Definition: itkImageMatrixFormReconstructionMetric.h:107
Class to apply the affine transformation matrix to a 3D image.
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:37
MatrixProjectorPointerType m_MatrixProjector
Definition: itkImageMatrixFormReconstructionMetric.h:190
InputVolumePointer m_inVolume
Definition: itkImageMatrixFormReconstructionMetric.h:192
Class to compute the difference between a reconstruction estimate and the target set of 2D projection...
Definition: itkImageMatrixFormReconstructionMetric.h:37
Definition: niftkITKAffineResampleImage.cxx:74
void SetInputVolumeVector(VectorType &inVolumeVector)
Set the 3D reconstruction estimate input volume as a vector form.
Definition: itkImageMatrixFormReconstructionMetric.h:85
void SetTotalPixel(const unsigned long int &totalSize2D)
Set the total number of the pixels of the projection.
Definition: itkImageMatrixFormReconstructionMetric.h:97
ProjectionGeometryType::Pointer m_Geometry
Definition: itkImageMatrixFormReconstructionMetric.h:205
vnl_vector< double > VectorType
Definition: itkImageMatrixFormReconstructionMetric.h:51
Abstract class to calculate the geometry of a CT or tomo machine.
Definition: itkProjectionGeometry.h:29
GLsizei const GLfloat * value
Definition: glew.h:1833
MatrixProjectorType::Pointer MatrixProjectorPointerType
Definition: itkImageMatrixFormReconstructionMetric.h:58
InputImageType::IndexType InputImageIndexType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:63
InputImageType::Pointer InputImagePointer
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:56
VectorType m_EstimatedVolumeVector
Vectors of the image.
Definition: itkImageMatrixFormReconstructionMetric.h:187
unsigned long int m_totalSize2D
Definition: itkImageMatrixFormReconstructionMetric.h:196
MatrixProjectorType::InputImageSpacingType InputVolumeSpacingType
Definition: itkImageMatrixFormReconstructionMetric.h:65
SingleValuedCostFunction::ParametersType ParametersType
Definition: itkImageMatrixFormReconstructionMetric.h:77
InputImageType::SpacingType InputImageSpacingType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:61
void SetTotalVoxel(const unsigned long int &totalSize3D)
Set the total number of the voxels of the volume.
Definition: itkImageMatrixFormReconstructionMetric.h:94
SingleValuedCostFunction::MeasureType MeasureType
Definition: itkImageMatrixFormReconstructionMetric.h:78
InputVolumeSizeType m_InVolumeSize
Definition: itkImageMatrixFormReconstructionMetric.h:199
VectorType m_inProj
Definition: itkImageMatrixFormReconstructionMetric.h:188
SmartPointer< const Self > ConstPointer
Definition: itkImageMatrixFormReconstructionMetric.h:45
void SetInputVolumeOrigin(InputVolumePointType &inVolumeOrigin)
Definition: itkImageMatrixFormReconstructionMetric.h:112
InputProjectionPointer m_inProjTemp
Definition: itkImageMatrixFormReconstructionMetric.h:193
itk::ProjectionGeometry< double > ProjectionGeometryType
Definition: itkImageMatrixFormReconstructionMetric.h:74
itk::ForwardAndBackwardProjectionMatrix< double, double > MatrixProjectorType
Definition: itkImageMatrixFormReconstructionMetric.h:57
InputImageType::RegionType InputImageRegionType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:58
OutputImageType::ConstPointer OutputImageConstPointer
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:67
void SetInputProjectionVector(VectorType &inProjection)
Set the input projection images.
Definition: itkImageMatrixFormReconstructionMetric.h:88
InputProjectionSizeType m_InProjectionSize
Definition: itkImageMatrixFormReconstructionMetric.h:203
InputImageType::ConstPointer InputImageConstPointer
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:57
InputVolumePointType m_InVolumeOrigin
Definition: itkImageMatrixFormReconstructionMetric.h:201
OutputImageType::Pointer OutputImagePointer
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:66
Simultaneous itk::Image and itk::Array (and hence vnl_vector) class.
InputImageType::SizeType InputImageSizeType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:60
vnl_sparse_matrix< double > SparseMatrixType
Definition: itkImageMatrixFormReconstructionMetric.h:55
MatrixProjectorType::OutputImageSizeType InputProjectionSizeType
Definition: itkImageMatrixFormReconstructionMetric.h:72
MatrixProjectorType::InputImagePointer InputVolumePointer
Definition: itkImageMatrixFormReconstructionMetric.h:61
void SetTotalProjectionSize(InputProjectionSizeType &projSize)
Set the total number of the pixels of the projection.
Definition: itkImageMatrixFormReconstructionMetric.h:103
MatrixProjectorType::InputImageIndexType InputVolumeIndexType
Definition: itkImageMatrixFormReconstructionMetric.h:67
SmartPointer< Self > Pointer
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:43
unsigned long int m_totalSize3D
Definition: itkImageMatrixFormReconstructionMetric.h:195
MatrixProjectorType::InputImageSizeType InputVolumeSizeType
Definition: itkImageMatrixFormReconstructionMetric.h:64
GLsizei const GLcharARB ** string
Definition: glew.h:5194
SingleValuedCostFunction::DerivativeType DerivativeType
Definition: itkImageMatrixFormReconstructionMetric.h:79
MatrixProjectorType::OutputImageConstPointer InputProjectionConstPointer
Definition: itkImageMatrixFormReconstructionMetric.h:71
MatrixProjectorType::OutputImageType InputProjectionType
Definition: itkImageMatrixFormReconstructionMetric.h:69
virtual ~ImageMatrixFormReconstructionMetric()
Definition: itkImageMatrixFormReconstructionMetric.h:173
unsigned int m_ProjectionNumber
Definition: itkImageMatrixFormReconstructionMetric.h:197