NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkCreateForwardBackwardProjectionMatrix.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 itkCreateForwardBackwardProjectionMatrix_h
16 #define itkCreateForwardBackwardProjectionMatrix_h
17 
18 #include <itkRay.h>
20 #include <itk_hash_map.h>
21 
22 #include <vnl/vnl_math.h>
23 #include <vnl/vnl_vector.h>
24 #include <vnl/vnl_sparse_matrix.h>
25 
26 
27 namespace itk
28 {
29 
34 template <class IntensityType = float>
36  public ImageProjectionBaseClass2D3D<Image< IntensityType, 3>, // Input image
37  Image< IntensityType, 2> > // Output image
38 {
39 public:
42  typedef SmartPointer<Self> Pointer;
43  typedef SmartPointer<const Self> ConstPointer;
46 
48  itkNewMacro(Self);
49 
51  itkTypeMacro(CreateForwardBackwardProjectionMatrix, ProcessObject);
52 
55  typedef typename InputImageType::Pointer InputImagePointer;
56  typedef typename InputImageType::ConstPointer InputImageConstPointer;
60  typedef typename InputImageType::SpacingType InputImageSpacingType;
61 
63  typedef typename OutputImageType::Pointer OutputImagePointer;
66  typedef typename OutputImageType::SpacingType OutputImageSpacingType;
67  typedef typename OutputImageType::PointType OutputImagePointType;
70 
72  typedef vnl_sparse_matrix<double> SparseMatrixType;
73  typedef vnl_vector<double> VectorType;
74 
76  typedef itk::hash_map<int, VectorType> VectorMapType;
77  typedef typename itk::hash_map<int, VectorType>::iterator VectorMapIterator;
78  typedef typename itk::hash_map<int, VectorType>::const_iterator VectorMapConstIterator;
79 
81  itkStaticConstMacro(InputImageDimension, unsigned int, 3);
82  itkStaticConstMacro(OutputImageDimension, unsigned int, 2);
83 
91  virtual void GenerateOutputInformation(void);
92 
100  virtual void GenerateInputRequestedRegion(void);
101  virtual void EnlargeOutputRequestedRegion(DataObject *output);
102 
104  void SetProjectedImageSize(OutputImageSizeType &outImageSize) {m_OutputImageSize = outImageSize;};
106  void SetProjectedImageSpacing(OutputImageSpacingType &outImageSpacing) {
107  m_OutputImageSpacing = outImageSpacing;
108  this->GetOutput()->SetSpacing(m_OutputImageSpacing);
109  };
111  void SetProjectedImageOrigin(OutputImagePointType &outImageOrigin) {
112  m_OutputImageOrigin = outImageOrigin;
113  this->GetOutput()->SetOrigin(m_OutputImageOrigin);
114  };
115 
117  void SetRayIntegrationThreshold(double threshold) {m_Threshold = threshold;}
118 
120  void SetSingleThreadedExecution(void) {m_FlagMultiThreadedExecution = false;}
121 
122 protected:
125  void PrintSelf(std::ostream& os, Indent indent) const;
126 
137  virtual void BeforeThreadedGenerateData(void);
138 
149  virtual void AfterThreadedGenerateData(void);
150 
153  void GenerateData();
154 
165  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
166  ThreadIdType threadId );
167 
169  OutputImageSizeType m_OutputImageSize;
171  OutputImageSpacingType m_OutputImageSpacing;
173  OutputImagePointType m_OutputImageOrigin;
174 
176  double m_Threshold;
177 
180 
186  typedef enum {
187  UNDEFINED_DIRECTION=0,
191  LAST_DIRECTION
192  } TraversalDirection;
193 
195  SparseMatrixType m_sparseForwardProjMatrix;
196 
198  SparseMatrixType m_sparseBackwardProjMatrix;
199 
202  VectorMapType m_outputVectorAllThread;
203 
207 
208 
209 private:
210  CreateForwardBackwardProjectionMatrix(const Self&); //purposely not implemented
211  void operator=(const Self&); //purposely not implemented
212 
213 };
214 
215 } // end namespace itk
216 
217 #ifndef ITK_MANUAL_INSTANTIATION
218 #include "itkCreateForwardBackwardProjectionMatrix.txx"
219 #endif
220 
221 #endif
222 
OutputImageSizeType m_OutputImageSize
The size of the output projected image.
Definition: itkCreateForwardBackwardProjectionMatrix.h:169
InputImageType::SpacingType InputImageSpacingType
Definition: itkCreateForwardBackwardProjectionMatrix.h:60
CreateForwardBackwardProjectionMatrix Self
Definition: itkCreateForwardBackwardProjectionMatrix.h:41
OutputImageType::SpacingType OutputImageSpacingType
Definition: itkCreateForwardBackwardProjectionMatrix.h:66
itk::hash_map< int, VectorType >::const_iterator VectorMapConstIterator
Definition: itkCreateForwardBackwardProjectionMatrix.h:78
itk::hash_map< int, VectorType >::iterator VectorMapIterator
Definition: itkCreateForwardBackwardProjectionMatrix.h:77
ImageType::SizeType SizeType
Definition: niftkMakeLapUSProbeBasicModel.cxx:31
VectorMapType m_outputVectorBackProjAllThread
Definition: itkCreateForwardBackwardProjectionMatrix.h:206
InputImageType::RegionType InputImageRegionType
Definition: itkCreateForwardBackwardProjectionMatrix.h:57
OutputImagePointType m_OutputImageOrigin
The origin of the output projected image.
Definition: itkCreateForwardBackwardProjectionMatrix.h:173
vnl_vector< double > VectorType
Definition: itkCreateForwardBackwardProjectionMatrix.h:73
The base class for 2D-3D forward and back projection.
Definition: itkImageProjectionBaseClass2D3D.h:31
OutputImageType::IndexType OutputImageIndexType
Definition: itkCreateForwardBackwardProjectionMatrix.h:69
void SetRayIntegrationThreshold(double threshold)
Set the ray integration threshold.
Definition: itkCreateForwardBackwardProjectionMatrix.h:117
Definition: niftkITKAffineResampleImage.cxx:74
double m_Threshold
The threshold above which voxels along the ray path are integrated.
Definition: itkCreateForwardBackwardProjectionMatrix.h:176
z
Definition: itkCreateForwardBackwardProjectionMatrix.h:190
ImageType::IndexType IndexType
Definition: niftkMakeLapUSProbeBasicModel.cxx:32
SparseMatrixType m_sparseForwardProjMatrix
Definition: itkCreateForwardBackwardProjectionMatrix.h:195
OutputImageType::PointType OutputImagePointType
Definition: itkCreateForwardBackwardProjectionMatrix.h:67
SmartPointer< const Self > ConstPointer
Definition: itkCreateForwardBackwardProjectionMatrix.h:43
void SetProjectedImageSpacing(OutputImageSpacingType &outImageSpacing)
Set the resolution in mm of the output projected image.
Definition: itkCreateForwardBackwardProjectionMatrix.h:106
VectorType m_outputVectorPerThread
Definition: itkCreateForwardBackwardProjectionMatrix.h:201
OutputImageSpacingType m_OutputImageSpacing
The resolution of the output projected image.
Definition: itkCreateForwardBackwardProjectionMatrix.h:171
bool m_FlagMultiThreadedExecution
Flag to turn multithreading on or off.
Definition: itkCreateForwardBackwardProjectionMatrix.h:179
SmartPointer< Self > Pointer
Definition: itkCreateForwardBackwardProjectionMatrix.h:42
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
void SetProjectedImageSize(OutputImageSizeType &outImageSize)
Set the size in pixels of the output projected image.
Definition: itkCreateForwardBackwardProjectionMatrix.h:104
itk::hash_map< int, VectorType > VectorMapType
Definition: itkCreateForwardBackwardProjectionMatrix.h:76
ImageType::RegionType RegionType
Definition: niftkMakeLapUSProbeBasicModel.cxx:30
OutputImageType::SizeType OutputImageSizeType
Definition: itkCreateForwardBackwardProjectionMatrix.h:65
InputImageType::SizeType InputImageSizeType
Definition: itkCreateForwardBackwardProjectionMatrix.h:59
Image< IntensityType, 2 > OutputImageType
Definition: itkCreateForwardBackwardProjectionMatrix.h:62
InputImageType::PixelType InputImagePixelType
Definition: itkCreateForwardBackwardProjectionMatrix.h:58
Class to project a 3D image into 2D.
Definition: itkCreateForwardBackwardProjectionMatrix.h:35
virtual ~CreateForwardBackwardProjectionMatrix(void)
Definition: itkCreateForwardBackwardProjectionMatrix.h:124
OutputImageType::Pointer OutputImagePointer
Definition: itkCreateForwardBackwardProjectionMatrix.h:63
void SetProjectedImageOrigin(OutputImagePointType &outImageOrigin)
Set the origin of the output projected image.
Definition: itkCreateForwardBackwardProjectionMatrix.h:111
OutputImageType::PixelType OutputImagePixelType
Definition: itkCreateForwardBackwardProjectionMatrix.h:68
void SetSingleThreadedExecution(void)
For debugging purposes, set single threaded execution.
Definition: itkCreateForwardBackwardProjectionMatrix.h:120
x
Definition: itkCreateForwardBackwardProjectionMatrix.h:188
Simultaneous itk::Image and itk::Array (and hence vnl_vector) class.
ImageProjectionBaseClass2D3D< Image< IntensityType, 3 >, Image< IntensityType, 2 > > Superclass
Definition: itkCreateForwardBackwardProjectionMatrix.h:45
InputImageType::Pointer InputImagePointer
Definition: itkCreateForwardBackwardProjectionMatrix.h:55
Image< IntensityType, 3 > InputImageType
Definition: itkCreateForwardBackwardProjectionMatrix.h:51
VectorType m_outputVectorBackProjPerThread
Definition: itkCreateForwardBackwardProjectionMatrix.h:205
vnl_sparse_matrix< double > SparseMatrixType
Definition: itkCreateForwardBackwardProjectionMatrix.h:72
InputImageType::ConstPointer InputImageConstPointer
Definition: itkCreateForwardBackwardProjectionMatrix.h:56
y
Definition: itkCreateForwardBackwardProjectionMatrix.h:189
OutputImageType::RegionType OutputImageRegionType
Definition: itkCreateForwardBackwardProjectionMatrix.h:64
SparseMatrixType m_sparseBackwardProjMatrix
Definition: itkCreateForwardBackwardProjectionMatrix.h:198
VectorMapType m_outputVectorAllThread
Definition: itkCreateForwardBackwardProjectionMatrix.h:202