vtk-dicom  0.8.14
vtkDICOMCTRectifier.h
1 /*=========================================================================
2 
3  Program: DICOM for VTK
4 
5  Copyright (c) 2012-2022 David Gobbi
6  All rights reserved.
7  See Copyright.txt or http://dgobbi.github.io/bsd3.txt for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
23 #ifndef vtkDICOMCTRectifier_h
24 #define vtkDICOMCTRectifier_h
25 
26 #include "vtkDICOMAlgorithm.h"
27 #include "vtkDICOMModule.h" // For export macro
28 
29 // Declare VTK classes within VTK's optional namespace
30 #if defined(VTK_ABI_NAMESPACE_BEGIN)
31 VTK_ABI_NAMESPACE_BEGIN
32 #endif
33 
34 class vtkMatrix4x4;
35 
36 #if defined(VTK_ABI_NAMESPACE_BEGIN)
37 VTK_ABI_NAMESPACE_END
38 #endif
39 
40 //----------------------------------------------------------------------------
41 class VTKDICOM_EXPORT vtkDICOMCTRectifier : public vtkDICOMAlgorithm
42 {
43 public:
47 
49  void PrintSelf(ostream& os, vtkIndent indent) VTK_DICOM_OVERRIDE;
50 
52  enum
54  {
55  Nearest,
56  Linear,
57  Cubic,
58  WindowedSinc
59  };
61 
63 
69  void SetReverse(int v);
70  void ReverseOn() { this->SetReverse(1); }
71  void ReverseOff() { this->SetReverse(0); }
72  int GetReverse() { return this->Reverse; }
74 
76 
81  void SetVolumeMatrix(vtkMatrix4x4 *matrix);
82  vtkMatrix4x4 *GetVolumeMatrix() { return this->VolumeMatrix; }
84 
86 
92  void SetInterpolationMode(int t);
93  void SetInterpolationModeToNearest() {
94  this->SetInterpolationMode(Nearest); }
95  void SetInterpolationModeToLinear() {
96  this->SetInterpolationMode(Linear); }
97  void SetInterpolationModeToCubic() {
98  this->SetInterpolationMode(Cubic); }
99  void SetInterpolationModeToWindowedSinc() {
100  this->SetInterpolationMode(WindowedSinc); }
101  int GetInterpolationMode() { return this->InterpolationMode; }
103 
105 
110  vtkMatrix4x4 *GetRectifiedMatrix() { return this->RectifiedMatrix; }
112 
114 
118  void UpdateMatrix();
120 
122 
128  static double GetGantryDetectorTilt(vtkMatrix4x4 *volumeMatrix);
130 
131 protected:
133  ~vtkDICOMCTRectifier() VTK_DICOM_OVERRIDE;
134 
136 
140  void ComputeMatrix(
141  const double matrix[16], const int extent[6], double spacing[3],
142  double origin[3]);
143 
144  int RequestInformation(
145  vtkInformation* request, vtkInformationVector** inputVector,
146  vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
147 
148  int RequestUpdateExtent(
149  vtkInformation* request, vtkInformationVector** inputVector,
150  vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
151 
152  int RequestData(
153  vtkInformation* request, vtkInformationVector** inputVector,
154  vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
155 
156  void ThreadedRequestData(
157  vtkInformation *request, vtkInformationVector **inputVector,
158  vtkInformationVector *outputVector, vtkImageData ***inData,
159  vtkImageData **outData, int ext[6], int id) VTK_DICOM_OVERRIDE;
160 
161  vtkMatrix4x4 *VolumeMatrix;
162  vtkMatrix4x4 *RectifiedMatrix;
163  vtkMatrix4x4 *Matrix;
164  int Reverse;
165  int InterpolationMode;
166 
167 private:
168 #ifdef VTK_DICOM_DELETE
169  vtkDICOMCTRectifier(const vtkDICOMCTRectifier&) VTK_DICOM_DELETE;
170  void operator=(const vtkDICOMCTRectifier&) VTK_DICOM_DELETE;
171 #else
172  vtkDICOMCTRectifier(const vtkDICOMCTRectifier&) = delete;
173  void operator=(const vtkDICOMCTRectifier&) = delete;
174 #endif
175 };
176 
177 #endif // vtkDICOMCTRectifier_h
Superclass for DICOM image filters.
Definition: vtkDICOMAlgorithm.h:49
Prepare a CT for 3D processing.
Definition: vtkDICOMCTRectifier.h:42
void SetReverse(int v)
Reverse the default operation.
void PrintSelf(ostream &os, vtkIndent indent) VTK_DICOM_OVERRIDE
Print information about this object.
void SetVolumeMatrix(vtkMatrix4x4 *matrix)
Set the matrix that describes the CT volume geometry.
static vtkDICOMCTRectifier * New()
Static method for construction.
vtkMatrix4x4 * GetRectifiedMatrix()
Get the matrix that describes the rectified geometry.
Definition: vtkDICOMCTRectifier.h:110
static double GetGantryDetectorTilt(vtkMatrix4x4 *volumeMatrix)
A static method to measure the tilt from a matrix.
void SetInterpolationMode(int t)
Set the interpolation method for resampling the data.
void UpdateMatrix()
Update the RectifiedMatrix without updating the output data.