vtk-dicom  0.8.17
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages
vtkDICOMToRAS.h
1 /*=========================================================================
2 
3  Program: DICOM for VTK
4 
5  Copyright (c) 2012-2024 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 =========================================================================*/
27 #ifndef vtkDICOMToRAS_h
28 #define vtkDICOMToRAS_h
29 
30 #include "vtkThreadedImageAlgorithm.h"
31 #include "vtkDICOMModule.h" // For export macro
32 #include "vtkDICOMConfig.h" // For configuration details
33 
34 // Declare VTK classes within VTK's optional namespace
35 #if defined(VTK_ABI_NAMESPACE_BEGIN)
36 VTK_ABI_NAMESPACE_BEGIN
37 #endif
38 
39 class vtkMatrix4x4;
40 
41 #if defined(VTK_ABI_NAMESPACE_BEGIN)
42 VTK_ABI_NAMESPACE_END
43 #endif
44 
45 //----------------------------------------------------------------------------
46 class VTKDICOM_EXPORT vtkDICOMToRAS : public vtkThreadedImageAlgorithm
47 {
48 public:
50  static vtkDICOMToRAS *New();
52 
54  void PrintSelf(ostream& os, vtkIndent indent) VTK_DICOM_OVERRIDE;
55 
57  void SetRASToDICOM(int v);
59  void RASToDICOMOn() { this->SetRASToDICOM(1); }
60  void RASToDICOMOff() { this->SetRASToDICOM(0); }
61  int GetRASToDICOM() { return this->RASToDICOM; }
63 
65 
71  void SetPatientMatrix(vtkMatrix4x4 *matrix);
72  vtkMatrix4x4 *GetPatientMatrix() { return this->PatientMatrix; }
74 
76 
82  vtkMatrix4x4 *GetRASMatrix() { return this->RASMatrix; }
83  void SetRASMatrix(vtkMatrix4x4 *matrix);
85 
87 
93  void UpdateMatrix();
95 
97 
108  void RASMatrixHasPositionOn() { this->SetRASMatrixHasPosition(1); }
109  void RASMatrixHasPositionOff() { this->SetRASMatrixHasPosition(0); }
110  int GetRASMatrixHasPosition() { return this->RASMatrixHasPosition; }
112 
114 
123  void AllowColumnReorderingOn() { this->SetAllowColumnReordering(1); }
124  void AllowColumnReorderingOff() { this->SetAllowColumnReordering(0); }
125  int GetAllowColumnReordering() { return this->AllowColumnReordering; }
127 
129 
138  void AllowRowReorderingOn() { this->SetAllowRowReordering(1); }
139  void AllowRowReorderingOff() { this->SetAllowRowReordering(0); }
140  int GetAllowRowReordering() { return this->AllowRowReordering; }
142 
143 protected:
144  vtkDICOMToRAS();
145  ~vtkDICOMToRAS() VTK_DICOM_OVERRIDE;
146 
148  void CheckNeedToReorder();
149 
151 
155  void ComputeMatrix(int extent[6], double spacing[3], double origin[3]);
156 
157  int RequestInformation(
158  vtkInformation* request, vtkInformationVector** inputVector,
159  vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
160 
161  int RequestUpdateExtent(
162  vtkInformation* request, vtkInformationVector** inputVector,
163  vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
164 
165  int RequestData(
166  vtkInformation* request, vtkInformationVector** inputVector,
167  vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
168 
169  void ThreadedRequestData(
170  vtkInformation *request, vtkInformationVector **inputVector,
171  vtkInformationVector *outputVector, vtkImageData ***inData,
172  vtkImageData **outData, int ext[6], int id) VTK_DICOM_OVERRIDE;
173 
174  vtkMatrix4x4 *PatientMatrix;
175  vtkMatrix4x4 *RASMatrix;
176 
177  int RASToDICOM;
178  int AllowColumnReordering;
179  int AllowRowReordering;
180  int RASMatrixHasPosition;
181  int ReorderColumns;
182  int ReorderRows;
183  double Matrix[16];
184 
185 private:
186 #ifdef VTK_DICOM_DELETE
187  vtkDICOMToRAS(const vtkDICOMToRAS&) VTK_DICOM_DELETE;
188  void operator=(const vtkDICOMToRAS&) VTK_DICOM_DELETE;
189 #else
190  vtkDICOMToRAS(const vtkDICOMToRAS&) = delete;
191  void operator=(const vtkDICOMToRAS&) = delete;
192 #endif
193 };
194 
195 #endif // vtkDICOMToRAS_h
Convert DICOM orientation to RAS orientation.
Definition: vtkDICOMToRAS.h:47
void UpdateMatrix()
Update the matrix without updating the output data.
void SetAllowColumnReordering(int v)
Allow the columns of the image to be reordered.
vtkMatrix4x4 * GetRASMatrix()
Get a matrix that places the image in RAS coordinates.
Definition: vtkDICOMToRAS.h:82
void SetAllowRowReordering(int v)
Allow the rows of the image to be reordered.
void SetRASMatrixHasPosition(int v)
Set whether the RAS matrix should have a non-zero final column.
void SetPatientMatrix(vtkMatrix4x4 *matrix)
Set a matrix that places the image in DICOM patient coords.
void PrintSelf(ostream &os, vtkIndent indent) VTK_DICOM_OVERRIDE
Print information about this object.
static vtkDICOMToRAS * New()
Static method for construction.
Generic filter that has one input..
Definition: vtkThreadedImageAlgorithm.h:38