NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkSimultaneousUnconstrainedMatrixReconRegnMetric.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 itkSimultaneousUnconstrainedMatrixReconRegnMetric_h
16 #define itkSimultaneousUnconstrainedMatrixReconRegnMetric_h
17 
18 #include <itkConceptChecking.h>
19 #include <itkSingleValuedCostFunction.h>
20 
21 #include <itkForwardAndBackwardProjectionMatrix.h>
22 #include <itkEulerAffineTransformMatrixAndItsVariations.h>
23 
24 
25 
26 namespace itk
27 {
28 
37 template <class TScalarType = double, class IntensityType = float>
38 class ITK_EXPORT SimultaneousUnconstrainedMatrixReconRegnMetric : public SingleValuedCostFunction
39 {
40 public:
41 
44  typedef SingleValuedCostFunction Superclass;
45  typedef SmartPointer<Self> Pointer;
46  typedef SmartPointer<const Self> ConstPointer;
47 
49  itkNewMacro(Self);
50 
52  itkTypeMacro(SimultaneousUnconstrainedMatrixReconRegnMetric, SingleValuedCostFunction);
53 
54  // Some convenient typedefs.
55 
58 
67 
72 
75 
77 
79  typedef vnl_sparse_matrix<TScalarType> SparseMatrixType;
80  typedef vnl_matrix<TScalarType> FullMatrixType;
81  typedef vnl_vector<TScalarType> VectorType;
82 
84  typedef typename SingleValuedCostFunction::ParametersType ParametersType;
85  typedef typename SingleValuedCostFunction::MeasureType MeasureType;
86  typedef typename SingleValuedCostFunction::DerivativeType DerivativeType;
87 
88 
90  void SetInputVolume( InputVolumePointer inVolume ) { m_inVolume = inVolume; }
91 
93  void SetInputVolumeVector( VectorType &inVolumeVector ) { m_EstimatedVolumeVector = inVolumeVector; }
94 
96  void SetInputTwoProjectionVectors( VectorType &inProjectionOne, VectorType &inProjectionTwo )
97  { m_inProjOne = inProjectionOne; m_inProjTwo = inProjectionTwo; }
98 
100  void SetInputTempProjections( InputProjectionPointer tempProjection ) { m_inProjTemp = tempProjection; }
101 
103  void SetParameterNumber( const unsigned int &paraNumber ) { m_paraNumber = paraNumber; }
104 
106  void SetParameterVector( VectorType &paraVector ) { m_TransformationParameterVector = paraVector; }
107 
109  void SetTotalVoxel( const unsigned long int &totalSize3D ) { m_totalSize3D = totalSize3D; }
110 
112  void SetTotalPixel( const unsigned long int &totalSize2D ) { m_totalSize2D = totalSize2D; }
113 
115  void SetTotalProjectionNumber( const unsigned int &projNumber ) { m_ProjectionNumber = projNumber; }
116 
118  void SetTotalProjectionSize( InputProjectionSizeType &projSize ) { m_InProjectionSize = projSize; }
119 
121  void SetProjectionGeometry( ProjectionGeometryType::Pointer pGeometry ) { m_Geometry = pGeometry; }
122 
124  void SetInputVolumeSize(InputVolumeSizeType &inVolumeSize) {m_InVolumeSize = inVolumeSize;};
125  void SetInputVolumeSpacing(InputVolumeSpacingType &inVolumeSpacing) {m_InVolumeSpacing = inVolumeSpacing;};
126  void SetInputVolumeOrigin(InputVolumePointType &inVolumeOrigin) {m_InVolumeOrigin = inVolumeOrigin;};
127 
129  unsigned int GetNumberOfParameters(void) const;
130 
132  void Initialise(void);
133 
136  virtual void GetValueAndDerivative( const ParametersType & parameters,
137  MeasureType & value,
138  DerivativeType & derivative ) const;
139 
146  virtual MeasureType GetValue( const ParametersType & parameters ) const;
147 
154  virtual void GetDerivative( const ParametersType & parameters,
155  DerivativeType & derivative ) const;
156 
157 
158 protected:
159 
162 
163  void PrintSelf(std::ostream& os, Indent indent) const;
164 
168  VectorType m_inProjOne, m_inProjTwo;
169 
170  MatrixProjectorPointerType m_MatrixProjector;
172 
173  InputVolumePointer m_inVolume;
174  InputProjectionPointer m_inProjTemp;
175 
176  unsigned int m_paraNumber;
177  unsigned long int m_totalSize3D;
178  unsigned long int m_totalSize2D;
179  unsigned int m_ProjectionNumber;
180 
181  InputVolumeSizeType m_InVolumeSize;
182  InputVolumeSpacingType m_InVolumeSpacing;
183  InputVolumePointType m_InVolumeOrigin;
184 
185  InputProjectionSizeType m_InProjectionSize;
186 
187 
190  // EulerAffineTransformType::ParametersType m_EulerAffineParameters;
191  // double* pEulerAffineParameters;
192 
194 
195 
196 private:
197  SimultaneousUnconstrainedMatrixReconRegnMetric(const Self&); //purposely not implemented
198  void operator=(const Self&); //purposely not implemented
199 
200 };
201 
202 } // end namespace itk
203 
204 #ifndef ITK_MANUAL_INSTANTIATION
205 #include "itkSimultaneousUnconstrainedMatrixReconRegnMetric.txx"
206 #endif
207 
208 #endif
MatrixProjectorPointerType m_MatrixProjector
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:170
MatrixProjectorType::OutputImageType InputProjectionType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:68
InputImageType::PointType InputImagePointType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:62
MatrixProjectorType::InputImageType InputVolumeType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:59
OutputImageType::SizeType OutputImageSizeType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:70
Class to apply the affine transformation matrix to a 3D image.
Definition: Projection/itkEulerAffineTransformMatrixAndItsVariations.h:34
SmartPointer< const Self > ConstPointer
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:46
SmartPointer< Self > Pointer
Definition: itkProjectionGeometry.h:36
MatrixProjectorType::InputImageConstPointer InputVolumeConstPointer
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:61
MatrixProjectorType::OutputImagePointer InputProjectionPointer
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:69
void SetInputTwoProjectionVectors(VectorType &inProjectionOne, VectorType &inProjectionTwo)
Set the input projection images.
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:96
MatrixProjectorType::InputImageSpacingType InputVolumeSpacingType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:64
unsigned long int m_totalSize3D
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:177
vnl_sparse_matrix< TScalarType > SparseMatrixType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:79
MatrixProjectorType::InputImagePointType InputVolumePointType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:65
Class to apply the affine transformation matrix to a 3D image.
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:37
void SetTotalProjectionSize(InputProjectionSizeType &projSize)
Set the total number of the pixels of the projection.
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:118
VectorType m_EstimatedVolumeVector
Vectors of the image and transformation parameters.
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:166
Definition: niftkITKAffineResampleImage.cxx:74
void SetProjectionGeometry(ProjectionGeometryType::Pointer pGeometry)
Set the projection geometry.
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:121
MatrixProjectorType::OutputImageSizeType InputProjectionSizeType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:71
AffineTransformerType::EulerAffineTransformType EulerAffineTransformType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:74
InputProjectionPointer m_inProjTemp
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:174
SmartPointer< Self > Pointer
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:45
void SetInputVolumeVector(VectorType &inVolumeVector)
Set the 3D reconstruction estimate input volume as a vector form.
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:93
VectorType m_TransformationParameterVector
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:167
unsigned int m_ProjectionNumber
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:179
vnl_vector< TScalarType > VectorType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:81
void SetInputTempProjections(InputProjectionPointer tempProjection)
Set the temporary projection image.
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:100
InputVolumePointType m_InVolumeOrigin
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:183
unsigned long int m_totalSize2D
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:178
Euler Affine transform.
Definition: itkEulerAffineTransform.h:38
InputVolumeSpacingType m_InVolumeSpacing
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:182
SingleValuedCostFunction::ParametersType ParametersType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:84
void SetTotalPixel(const unsigned long int &totalSize2D)
Set the total number of the pixels of the projection.
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:112
MatrixProjectorType::InputImageRegionType InputVolumeRegionType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:62
Abstract class to calculate the geometry of a CT or tomo machine.
Definition: itkProjectionGeometry.h:29
SingleValuedCostFunction::MeasureType MeasureType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:85
virtual ~SimultaneousUnconstrainedMatrixReconRegnMetric()
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:161
GLsizei const GLfloat * value
Definition: glew.h:1833
vnl_matrix< TScalarType > FullMatrixType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:80
MatrixProjectorType::InputImageSizeType InputVolumeSizeType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:63
InputImageType::IndexType InputImageIndexType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:63
InputImageType::Pointer InputImagePointer
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:56
void SetParameterNumber(const unsigned int &paraNumber)
Set the number of the transformation parameters.
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:103
MatrixProjectorType::OutputImageConstPointer InputProjectionConstPointer
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:70
unsigned int m_paraNumber
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:176
itk::EulerAffineTransformMatrixAndItsVariations< double > AffineTransformerType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:73
itk::ForwardAndBackwardProjectionMatrix< TScalarType, IntensityType > MatrixProjectorType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:52
InputImageType::SpacingType InputImageSpacingType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:61
MatrixProjectorType::InputImagePointer InputVolumePointer
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:60
void SetTotalProjectionNumber(const unsigned int &projNumber)
Set the total number of the pixels of the projection.
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:115
InputProjectionSizeType m_InProjectionSize
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:185
void SetInputVolume(InputVolumePointer inVolume)
Set the 3D reconstruction estimate input volume.
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:90
InputVolumePointer m_inVolume
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:173
SimultaneousUnconstrainedMatrixReconRegnMetric Self
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:43
AffineTransformerType::Pointer m_AffineTransformer
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:171
InputImageType::RegionType InputImageRegionType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:58
OutputImageType::ConstPointer OutputImageConstPointer
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:67
InputImageType::ConstPointer InputImageConstPointer
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:57
MatrixProjectorType::Pointer MatrixProjectorPointerType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:57
void SetParameterVector(VectorType &paraVector)
Set the transformation parameters as a vector form.
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:106
OutputImageType::Pointer OutputImagePointer
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:66
Simultaneous itk::Image and itk::Array (and hence vnl_vector) class.
itk::ProjectionGeometry< float > ProjectionGeometryType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:76
InputImageType::SizeType InputImageSizeType
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:60
Class to compute the difference between a reconstruction estimate and the target set of 2D projection...
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:38
SingleValuedCostFunction Superclass
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:44
void SetInputVolumeSize(InputVolumeSizeType &inVolumeSize)
Set the size, resolution and origin of the input volume.
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:124
void SetTotalVoxel(const unsigned long int &totalSize3D)
Set the total number of the voxels of the volume.
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:109
SmartPointer< Self > Pointer
Definition: Projection/itkForwardAndBackwardProjectionMatrix.h:43
ProjectionGeometryType::Pointer m_Geometry
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:193
SmartPointer< Self > Pointer
Definition: Projection/itkEulerAffineTransformMatrixAndItsVariations.h:40
SingleValuedCostFunction::DerivativeType DerivativeType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:86
InputVolumeSizeType m_InVolumeSize
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:181
MatrixProjectorType::InputImageIndexType InputVolumeIndexType
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:66
void SetInputVolumeSpacing(InputVolumeSpacingType &inVolumeSpacing)
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:125
VectorType m_inProjTwo
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:168
void SetInputVolumeOrigin(InputVolumePointType &inVolumeOrigin)
Definition: itkSimultaneousUnconstrainedMatrixReconRegnMetric.h:126